summaryrefslogtreecommitdiff
path: root/driver/als_si114x.h
Commit message (Collapse)AuthorAgeFilesLines
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver/als_si114x.h: Format with clang-formatJack Rosenthal2022-06-281-63/+62
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ie11107953516757d886154380c45499b0e707987 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729904 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* driver: si114x: Clean up register listNicolas Boichat2020-12-301-191/+45
| | | | | | | | | | | | | | | Used the datasheet to reconstruct the register table, took it as an opportunity to align the names with datasheet and clean up a bit the order of the registers/commands/parameters. BRANCH=none BUG=b:172225780 TEST=CQ Change-Id: I0b79b5ca6db439b104704b0e817d8f94fab687a8 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603076 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-201-1/+1
| | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-261-1/+1
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* sensor: Adjust max_frequency based on EC performanceGwendal Grignou2018-12-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | Put in max_frequency a value that the sensor AND the EC support. BRANCH=none BUG=b:118205424,b:118851581,chromium:615059 TEST=Compile. Check all max sensors frequencies have been altered with: for i in $(grep -rh max_frequency board | cut -d '=' -f 2 | sort | \ uniq | grep FREQ | sed 's/FREQ.*//') ; do echo -n $i ; git show | grep -q $i || break; echo check done Check on nocturne accel max frequency is still correct. Change-Id: I848396d9f150a2e94d430a8feeafc1087a6bf2c3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1352063 Commit-Ready: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Jesse Schettler <jschettler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* driver: sensor: tune MAX_FREQGwendal Grignou2017-07-131-2/+2
| | | | | | | | | | | | | | | | | | | | Reduce maximum frequency of BMM150 compass to 80Hz, 800Hz is a typo. Reduce SI1141 maximum frequency to 50Hz: 100Hz is too high when polling mode is used. Fix up of CL:482703 BRANCH=eve, glados BUG=chromium:615059 TEST=On eve, check CTS test android.hardware.cts.SensorBatchingTests#testMagneticField_fastest_flush passes. Observed that dumpsys sensorservice returns compass maxRate at 80Hz instead of 200Hz. Change-Id: If4e688ab59aa53c402d34714b6bb33ccd4a4ab96 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/570482 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cleanup: motion_sense: Remove driver data structure externsShawn Nematbakhsh2017-06-151-1/+0
| | | | | | | | | | | | | | | Driver data structs are now accessed through the drv_data pointer. BUG=chromium:733352 BRANCH=None TEST=`make buildall -j` Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I8fedb425708a08ae6900ade6f17967fe2bc75ebf Reviewed-on: https://chromium-review.googlesource.com/537217 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: sensors: add extra sensor attributesNick Vaccaro2017-05-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | Adds min_frequency and max_frequency to struct motion_sensor_t. New attributes min_frequency and max_frequency are now returned in ectool's MOTIONSENSE_CMD_INFO response. Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3. Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's header file. BRANCH=none BUG=chromium:615059 TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin, make buildall -j passes. Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/482703 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: Add polling mode support to Si114x ALS sensorScott2017-02-201-0/+3
| | | | | | | | | | | | | | | | | | | | | Eve P1 is missing the ALS_INT_L signal and so needs to poll the Si114x. This CL adds a new config option CONFIG_ALS_SI114X_POLLING that when defined uses a deferred callback to trigger the motion sensor event that reads sensor registers. The deferred callback uses a 8 msec delay which is ~2x longer than the time required by the sensor to complete the measurement. BUG=chrome-os-partner:61470 BRANCH=none TEST=On Eve verify that light sensor measurments are present with the 'accelinfo on 1000' command. Change-Id: I212bebf2ceacbac87ccb0734cc4990dbc349b028 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/440377 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver: si114x: Unlock the device if stuckGwendal Grignou2015-12-011-0/+3
| | | | | | | | | | | | | | | | | | | It is possible for the ALS state machine and the chip to not agree: The EC thinks the device is busy making a measurement, while the chip is waiting for the IRQ status register to be written. It is not clear how it happened, an IRQ must have been lost. Reinitiliazed the chip is stuck for 10s. BRANCH=smaug BUG=chrome-os-partner:45627 TEST=With an extra patch that force the IRQ handler to not do anything every 100th, check the device recovers. Use andro sensor to monitor light/proximity outputs. Change-Id: I80d50bf92af127f85f82dc5c0ae318d4cfe06812 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/313668
* device: si114x: Address overflow conditionGwendal Grignou2015-12-011-0/+1
| | | | | | | | | | | | | | | | | If proximity overflow (daylight), we would still assume the data was valid and consider there is an object very very close. That would prevent the light to be measured. (cl/312982) Leave the value as max range for the HAL to handle. BRANCH=smaug BUG=b:25573958 TEST=Check in daylight that light is still measured Change-Id: I684e6f4a9aecd3fd6b338a9939f7ede26752ecb8 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/314921 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* driver: si114x: Do not read light when proximty is lowGwendal Grignou2015-11-181-0/+4
| | | | | | | | | | | | | | | | | | If the proximity sensor indicates there is an object very close (<= 5cm), ignore light sensor readings. Otherwise, when someone put their finger on the sensor, the light sensor would most likely report dark condition and the screen brightness will be lowered unexpectedly. BUG=b:25573958 BRANCH=smaug TEST=check light report does not change when proximity sensor reports < 5cm, using androsensor apps. Change-Id: I16db40766a71a7925e28372ebb54ae43f60a4989 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/312982
* driver: si114x: Fail init of proximity sensor if light sensor fails.Gwendal Grignou2015-10-281-0/+1
| | | | | | | | | | | | | | | | If init of the light sensor fails (for instance, the chip is not present on the i2c bus), we need to fail the init of the proximity sensor. Otherwise, the EC will report an unexistent sensor to the AP. BRANCH=smaug BUG=chrome-os-partner:46638 TEST=check the proximity sensor is not reported if sensor is disconnected from the main board. Change-Id: Ie6b1d74eaac4d6c38d52641626966b5d3ce63bd3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/308560 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* driver: si114x: Convert unit to distanceGwendal Grignou2015-09-011-0/+1
| | | | | | | | | | | | | | Instead of returning the amount of light returned, convert the data into distance (cm). It can be adjust via range. BRANCH=smaug BUG=chrome-os-partner:42526 TEST=check the data is usable by HAL. Change-Id: I97510246ce054af4e61325d7e295ca09cc536457 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/296472 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* driver: si114x: Add ALS/Proxy sensor SI114xGwendal Grignou2015-08-221-0/+245
Add the Silicon Image sensors, add it to the motion_sense module to be used with the FIFO. BRANCH=smaug TEST=Check light and proxy on Smaug: Check Light value in Lux are reasonable. Check Proxy is detecting object, but value are in opposite of distance. BUG=chrome-os-partner:32829 Change-Id: I11419a0f0613f0fae9323f99deedf5a1e6c6e29c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291335 Reviewed-by: Sheng-liang Song <ssl@chromium.org>