diff --git a/driver/als_si114x.c b/driver/als_si114x.c index fb4a19fc6a..482678ca15 100644 --- a/driver/als_si114x.c +++ b/driver/als_si114x.c @@ -498,6 +498,8 @@ static int init(const struct motion_sensor_t *s) data->state = SI114X_IDLE; resol = 7; } else { + if (data->state == SI114X_NOT_READY) + return EC_ERROR_ACCESS_DENIED; resol = 5; } @@ -535,7 +537,7 @@ const struct accelgyro_drv si114x_drv = { }; struct si114x_drv_data_t g_si114x_data = { - .state = SI114X_IDLE, + .state = SI114X_NOT_READY, .type_data = { /* Proximity */ { diff --git a/driver/als_si114x.h b/driver/als_si114x.h index 4d524aea66..2e068eb50c 100644 --- a/driver/als_si114x.h +++ b/driver/als_si114x.h @@ -207,6 +207,7 @@ extern const struct accelgyro_drv si114x_drv; enum si114x_state { + SI114X_NOT_READY, SI114X_IDLE, SI114X_ALS_IN_PROGRESS, SI114X_ALS_IN_PROGRESS_PS_PENDING,