diff options
author | Marco Chen <marcochen@chromium.org> | 2017-11-16 14:12:43 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-26 05:21:39 -0800 |
commit | a2e2be193a46826fa6af7fbaab0e567e248e40b4 (patch) | |
tree | 45081aa3e8896b9cbd1764fbf7ca831b31c499d0 /driver/als_opt3001.h | |
parent | f326fb05b564b0975a9870b2831f9372539202db (diff) | |
download | chrome-ec-a2e2be193a46826fa6af7fbaab0e567e248e40b4.tar.gz |
OPT3001: Support MOTIONSENSE_CMD_SENSOR_[OFFSET|RANGE] for calibration.
1. The original driver of OPT3001
a. didn't support to process the command of offset.
b. implemented command of range to setter/getter of Range Number Field
of chip.
But reffering to cros_ec_light_prox.c from linux kernel side, these two
commands are actually leveraged for in_illuminance_calib[bias|scale]
and these calibration factors should be applied into raw lux value read
from the chip.
2. Move ALS in Poppy / Soraka boards from ALS_TASK to MOTIONSENSE_TASK.
3. Mofify parameters of ALS in Reef board in order to adapt changes
here.
BUG=b:69236269
BRANCH=none
TEST=Manually test on the DUT.
Change-Id: Ic3b593feb3e4bc6da0bada6b5d614975f0cf2280
Signed-off-by: Marco Chen <marcochen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/774341
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver/als_opt3001.h')
-rw-r--r-- | driver/als_opt3001.h | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/driver/als_opt3001.h b/driver/als_opt3001.h index 9850dfe723..eeb05f3a10 100644 --- a/driver/als_opt3001.h +++ b/driver/als_opt3001.h @@ -44,30 +44,15 @@ enum opt3001_mode { int opt3001_init(void); int opt3001_read_lux(int *lux, int af); #else -/* OPT3001 Full-Scale Range */ -enum opt3001_range { - OPT3001_RANGE_40P95_LUX, - OPT3001_RANGE_81P90_LUX, - OPT3001_RANGE_163P80_LUX, - OPT3001_RANGE_327P60_LUX, - OPT3001_RANGE_655P20_LUX, - OPT3001_RANGE_1310P40_LUX, - OPT3001_RANGE_2620P80_LUX, - OPT3001_RANGE_5241P60_LUX, - OPT3001_RANGE_10483P20_LUX, - OPT3001_RANGE_20966P40_LUX, - OPT3001_RANGE_41932P80_LUX, - OPT3001_RANGE_83865P60_LUX, - OPT3001_RANGE_AUTOMATIC_FULL_SCALE, -}; - #define OPT3001_GET_DATA(_s) ((struct opt3001_drv_data_t *)(_s)->drv_data) struct opt3001_drv_data_t { - enum opt3001_range range; int rate; int last_value; - int attenuation; + /* the coef is scale.uscale */ + int16_t scale; + uint16_t uscale; + int16_t offset; }; extern const struct accelgyro_drv opt3001_drv; |