summaryrefslogtreecommitdiff
path: root/driver/als_opt3001.c
Commit message (Collapse)AuthorAgeFilesLines
* type: Rename vector_3_t to intv3_t.Yilun Lin2018-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Naming of many vector types and matrix types are not clear enough. For example, we have: vector_3_t, which is a vector of three int. vec3_t, which is a vector of three float. size4_t, which is a vector of four size_t. mat33_t, which is a 3x3 matrix of float. matrix_3x3_t, which is a 3x3 matrix of fixed point. Besides, we have types like int8_t, uint16_t types. To clearly distinguished types, the CL propose to, For vector types, naming should be `$type + 'v' + $num + '_t'`: vector_3_t becomes intv3_t vec3_t becomes floatv3_t vector 4 of uint16_t becomes uint16v4_t (which doesn't exist yet) For matrix types, naming should be `mat$N$N_` + $type + '_t', where $N is the matrix size: matrix_3x3_t becomes mat33_fp_t # fp: fixed point mat33_t becomes mat33_float_t TEST=make buildall -j BUG=b:114662791 Change-Id: I865aa3ecbab6cb97f8585a081a679adf00febe1d Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1215442 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* driver: OPT3001: Re-order application of scale.Aseda Aboagye2018-03-141-3/+6
| | | | | | | | | | | | | | | | | This commit simply reorders the application of scale in order to preserve the sensor precision. BUG=b:72985601 BRANCH=stabilize-meowth-10444.B TEST=Flash meowth; Set scale to 1000; Verify that more significant digits are present compared to before. Change-Id: Ibf46e574fccdde50ceb5f8174f9b4a29e60bfbfe Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/955967 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* OPT3001: Support MOTIONSENSE_CMD_SENSOR_[OFFSET|RANGE] for calibration.Marco Chen2017-11-261-32/+30
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* motion: Add opt3001 as a motion sensorGwendal Grignou2017-02-161-1/+210
| | | | | | | | | | | | | | | | | | Use the motion sensor to manage ALS as well. The current interface (via memmap) is preserved, but we can also access the sensor via cros ec sensor stack and send the ALS information to ARC++. BUG=chrome-os-partner:59423 BRANCH=reef CQ-DEPEND=CL:424217 TEST=Check the sensor is working via ACPI sensor and cros ec sensor. Check ARC++ sees the sensors. Change-Id: Iaf608370454ad582691b72b471ea87b511863a78 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424323 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* i2c: Add i2ctest console commandVijay Hiremath2016-09-231-0/+12
| | | | | | | | | | | | | | | | | | Added i2ctest console command to test the reliability of the I2C. By reading/writing to the known registers this tests provides the number of successful read and writes. BUG=chrome-os-partner:57487 TEST=Enabled the i2ctest config on Reef and tested the i2c read/writes. BRANCH=none Change-Id: I9e27ff96f2b85422933bc590d112a083990e2dfb Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/290427 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* ALS: OPT3001: Return appropriate error valueVijay Hiremath2016-09-211-7/+7
| | | | | | | | | | | | | | | | | | | Return appropriate error value for I2C errors and data verification errors. BUG=chrome-os-partner:57512 BRANCH=none TEST=Manually tested on Reef, ALS data changes when surrounding brightness is changed. Change-Id: I17b5bd10da5fa5cc82fdff10337ae893146c70ee Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/386397 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* ALS: Disable the ALS task if all the ALS inits failVijay Hiremath2015-10-021-22/+7
| | | | | | | | | | | | | | | BUG=none TEST=Manually tested on Kunimitsu & Strago. Removed the ALS sensor from DUT, using "taskinfo" console command observed that the ALS task is not running. BRANCH=none Change-Id: I96cb720bd8d70033d433cdc2cd9cea9b56a3b389 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/301753 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* opt3001: Change resume hook priorityDuncan Laurie2015-09-101-1/+1
| | | | | | | | | | | | | | | If the power rail to the ambient light sensor is only enabled at HOOK_CHIPSET_RESUME (as on glados) then the ALS init should not attempt to execute until after that happens. BUG=chrome-os-partner:43493 BRANCH=none TEST=enable ALS on glados and successfully build and use it Change-Id: I4e8841bdf6d3970a30f58431aca771c87c7e15ba Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/298157 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Driver: OPT3001: Add TI OPT3001 light sensor driverVijay Hiremath2015-07-211-0/+104
BUG=none BRANCH=none TEST=Added OPT3001 config to test the sensor in Kunimitsu. Able to read the als data from "als" console command. Varied the light intensity and the als reading are changing. Driver fits into the existing ALS framework. Change-Id: Idb2e6f9f50b6d0d6c8f64c11336efd3f2c76d498 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/286782 Reviewed-by: Shawn N <shawnn@chromium.org>