summaryrefslogtreecommitdiff
path: root/driver/accelgyro_lsm6dsm.h
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: add initial shim for lsm6dsm sensoramber.chen2022-09-191-0/+17
| | | | | | | | | | | | | | | | | Add initial shim for the lsm6dsm accel/gryo sensor BUG=none BRANCH=none TEST=zmake build pujjo Signed-off-by: amber.chen <amber.chen@lcfc.corp-partner.google.com> Change-Id: Ib1ab863bedd2575dfafcbfc1c49c54afe46a7c2c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3865215 Reviewed-by: Andrew McRae <amcrae@google.com> Commit-Queue: Andrew McRae <amcrae@google.com> Code-Coverage: Andrew McRae <amcrae@google.com> Tested-by: Andrew McRae <amcrae@google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* 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/accelgyro_lsm6dsm.h: Format with clang-formatJack Rosenthal2022-06-281-140/+136
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I8d675c8c07b6bc3e170b213b15f7c6527dc58bc0 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729896 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* COIL: update lsm6dsm driverRicardo Quesada2022-02-071-3/+3
| | | | | | | | | | | | | | | | This CL updates the lsm6dm driver according to the COIL guidelines. BRANCH=None BUG=b:163885307 TEST=compare_build.sh -b redrix matches Signed-off-by: Ricardo Quesada <ricardoq@google.com> Change-Id: Ia354094d9cb5a5430bf2732f612ba0bb5e871b8b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3441675 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Ricardo Quesada <ricardoq@chromium.org> Tested-by: Ricardo Quesada <ricardoq@chromium.org> Auto-Submit: Ricardo Quesada <ricardoq@chromium.org>
* driver: lsm6dsm: remove load_fifo_sensor_state_tGwendal Grignou2021-09-231-12/+0
| | | | | | | | | | | | | | | | Remove load_fifo_sensor_state_t since timestamp spreading is done in common code. Fixes: 4e6d315948 ("common: motion_sense: Spread timestamps in motion sense fifo") BUG=b:172342141 BRANCH=none TEST=buildall Change-Id: If47fdd5dc800e6b75bdea4fcef80cf6874debdaa Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150052 Reviewed-by: Yuval Peress <peress@google.com>
* driver: use IS_ENABLED on more accelerometer driversGwendal Grignou2020-11-061-3/+6
| | | | | | | | | | | BUG=chromium:1140877 BRANCH=none TEST=buildall Change-Id: I3c45918b628d4f0999842922680a948cdd4933a2 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2491267 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
* driver: lsm6dsm: Implement temperature readingYuval Peress2020-01-031-0/+2
| | | | | | | | | | | | | | Implement reading the internal chip temperature BUG=b:138303429,chromium:1023858 TEST=None BRANCH=None Change-Id: Ia077d5d439d5557333aae5325140ab1958da993e Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1922293 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver: lsm6dsm: Allow building without CONFIG_ACCEL_FIFOYuval Peress2019-11-211-11/+28
| | | | | | | | | | | | | | | | This change refactors the lsm6dsm to allow building without the use of the FIFO or sensor interrupts. BUG=None BRANCH=None TEST=make buildall Change-Id: I5b338d81061f25fd1c8209b4555f63ea4d8b2dbc Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1916679 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Auto-Submit: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-201-2/+2
| | | | | | | | | | | | | | | | | | | 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-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* driver: lsm6dsm: sensor event spreadingYuval Peress2019-05-231-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | BUG=b:129159505 BRANCH=None TEST=Ran Android CTS Fixes event out of order errors in CTS. This is fixed by doing the spreading on the ec. A new queue is used (data_queue) and in place of the old call to motion_sense_fifo_add_data we now add the event to the queue and increment the sensor's sample count. At the caller (load_fifo) we then figure out the window (time between the last interrupt and the read) and the period by dividing the window by the number of samples (this is done per sensor). If the period is larger than the odr, then the odr is used (this helps with accuracy). Events are now spread between the known time the first entry was added and the read time. Change-Id: I7094a719c76b4b08a758d053e5dfbdba0a30684b Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1620792 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* driver: lsm6dsm: Fix race condition and sensor labeling issuesEnrico Granata2019-03-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes two issues with the LSM6DSM driver: - it fixes a race condition in load_fifo() which could lead to samples being labeled at the wrong timestamp if the FIFO was cleared, and a new interrupt occurred, between reading the last sample, and pushing it to the motion sense queue - it drops samples even when the ODR is changed to the same final normalized rate, since the sensor is turned off/on regardless of this condition; additionally, it adds one more sample to the number of samples to be discarded, since I was experimentally seeing occasional spurious data in the first sample after a rate change. BUG=b:124085261 TEST=on Meep with magnetometer stuffed, and CL:1470775 enabled, run CTS sensor test cases Change-Id: I9701d90fa4e86488840b776e2c7afe4dd89570e7 Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1509718 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* lsm6ds3: update comment for clarityJett Rink2019-02-151-0/+2
| | | | | | | | | | | | | | Add more comment for who am i registers since the name for st parts and who am i register does not seem to mix well. BRANCH=none BUG=none TEST=none Change-Id: I38256c704a81984b720304d7a7499da93802d577 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1470894 Reviewed-by: Diana Z <dzigterman@chromium.org>
* lsm6ds3: Add LDM6DS3 variant to existing LSM6DSMJett Rink2019-02-131-0/+1
| | | | | | | | | | | | | | | | The lsm6dsX where X is M/L/3 are very similar. The only differences appear to be the who am I register value and fifo size. BRANCH=none BUG=b:122281217 TEST=Arcada with CL stack, can read sensor data via EC console using `accelread 0` command Change-Id: Iaa12d49616c66e574e069b43aba2618722f0dda0 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1446533 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Gwendal Grignou <gwendal@google.com>
* driver: lsm6dsm: Integrate LIS2MDL behind LSM6DSMGwendal Grignou2019-02-081-14/+60
| | | | | | | | | | | | | | | | | | | | | - Cros set_rate and normalize between LIS2MDL and LSM6DSM - Remove unused sensor hub function. - Remove parent field, use macro instead (magnetometer is just after the gyroscope). BUG=b:110143516,b:115587004 BRANCH=none TEST=On meep, check the magnetometer is returning data with shell/python script. Check calibration quick in. Check with AIDA64, compass and sensor app the magnetometer is seen. Change-Id: I2efef99eda095e33b6a0555b1cbc4ac8fdbfab5d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1361992 Reviewed-by: Justin TerAvest <teravest@chromium.org> Trybot-Ready: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org>
* driver: lsm6dsm: Clean register definitionGwendal Grignou2019-02-071-53/+83
| | | | | | | | | | | | | | | | | Remove duplicates and order registers by address. BUG=b:115587004 BRANCH=none TEST=Buildall Change-Id: I31a1c5f18314a67c6ec0de64fa69bd5723c60a05 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1361988 Reviewed-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> Trybot-Ready: Justin TerAvest <teravest@chromium.org>
* driver: lsm6dsm: add reboot at init timeDevin Lu2019-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Without this patch, the pass-through mode will get stuck after sysjump. Force a reboot of the lsm6dsm accelerometer side at init() to allow magnetometer initialization to complete. BUG=b:115587004 BRANCH=octopus TEST=execute "sysjump RW" then make sure magnetometer initial passed and no errors as below: [855.944737 Base Accel: MS Done Init type:0x0 range:2] [855.947773 Base Accel ODR: 13000 - roundup 1 from config 1 [AP 0]] [855.949904 Base Gyro: MS Done Init type:0x1 range:1000] [855.952509 Base Gyro ODR: 0 - roundup 0 from config 0 [AP 0]] sensorhub_check_and_rst: Base Accel type:0x0 WAIR error ret: 1 sensorhub_check_and_rst: Base Accel type:0x0 WAIR error ret: 1 sensorhub_check_and_rst: Base Accel type:0x0 WAIR error ret: 1 [855.993153 Base Mag: 3: init failed: 1] Change-Id: I7870acb674457dfcf247a3fa231e82a7123303bf Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/1389994 Reviewed-by: Justin TerAvest <teravest@chromium.org>
* LSM6: Throw out junk data after ODR changesDiana Z2019-01-191-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | After an ODR change on the LSM6DSx sensor, a certain amount of data will be invalid until the filter for the sensor settles. This change is to throw out datapoints after an ODR change to avoid sending the AP any outright bad values. Currently, we're waiting for clarification from ST about how many data points to throw out and whether the accelerometer and gyroscope ODR changes affect each other. For now, we're being conservative and throwing out 4 samples of any sensors on after an ODR change. BUG=b:122912601 BRANCH=octopus TEST=almost all standard deviation failures gone when running CTS on phaser360, a few very close gyro errors remain Change-Id: Ie00c85e18333ce578152ed3ac616815405e8111d Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1423123 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* LSM6: Follow ODR change procedure from application notesDiana Z2019-01-191-1/+2
| | | | | | | | | | | | | | | | | | There are a few ways the current driver differs from the application notes for the LSM6DS3, notably: - FIFO disable is done before any ODR registers are set - FIFO ODR is set before any FIFO decimations BUG=b:122912601 BRANCH=octopus TEST=used "ectool" to change ODR values on phaser360, ensured "accelinfo on" output looked sane with the exception of points which will be discarded next CL Change-Id: I39fdcc67d0b34382a348dc2442785a847a4bc68d Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1419123 Reviewed-by: Jett Rink <jettrink@chromium.org>
* drvier: lsm6dsm: Populate Gyroscope scale properlyGwendal Grignou2019-01-191-24/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Range of 250/1000/2000 dps is an approximation. The Gyrscope uses a slighly higher range: range | gain(udps/LSB) | actual value(dps) 250 | 8750 | 286.72 500 | 17500 | 573.44 1000 | 35000 | 1146.88 2000 | 70000 | 2293.76 Returns the actual value for a given range. BUG=b:121279721 BRANCH=octopus TEST=Check scale returns the correct value: cd /sys/bus/iio/devices/... for i in 250 500 1000 2000 ; do echo $i > scale ; V=$(cat scale) ; echo -n "$i: " ; echo -n "$V: " ; echo $V | python -c 'import sys for line in sys.stdin: print float(line) * 32768 * 180 / 3.14159' ; done 250: 0.000152331: 285.996835182 500: 0.000305197: 572.998116648 1000: 0.000610395: 1145.99811077 2000: 0.001221325: 2293.00066781 Check CTS Verifier Gyroscope Measurement Test pass. Change-Id: I76c977140321d01702af16f58a3dfb7036673014 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1423597 Reviewed-by: Enrico Granata <egranata@chromium.org>
* LSM6: Correct timestamp reporting and FIFO lengthDiana Z2019-01-171-1/+1
| | | | | | | | | | | | | | | | | | | When an accelerometer sends a sample to the motion_sense task with a timestamp, the timestamp should represent the time of the IRQ which caused the FIFO read. This change caches a timestamp after the accelerometer data is read to use when pushing all data from that read. This also corrects the number of bits in the FIFO length field. BRANCH=octopus BUG=b:120679547 TEST=builds, phaser360 CTS pass rate unaffected Change-Id: I220aa2e8fa23af3f7833999cdfac966e8695c831 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1413670 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* sensor: Adjust max_frequency based on EC performanceGwendal Grignou2018-12-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
* drivers/accelgyro_lsm6dsm: Fix the FIFO_NUM_DEV configurationKarthikeyan Ramasubramanian2018-10-231-0/+2
| | | | | | | | | | | | | | | | | | Adding FIFO_DEV_MAG increases the number of motion sensors in the FIFO data set. In the boards where magnetometer is not present, this causes fifo_enable function to perform an out of bound memory access and lead to a crash. Update the number of motion sensors with FIFO_DEV_MAG only in the boards where magnetometer is present. BRANCH=None TEST=bootup to ChromeOS in grabbiter and meep. BUG=b:118083418 Change-Id: I77ce059cb05b429eff84d69c29081c8042fc2c51 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1293889 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* driver/sensorhub_lsm6dsm: Add sensor hub support in LSM6DSM moduleKarthikeyan Ramasubramanian2018-10-191-0/+37
| | | | | | | | | | | | | | | Add support for sensor hub in LSM6DSM accelerometer module so that external sensors module like magnetometer can be supported. BRANCH=none BUG=b:115587004 TEST=Collect magnetometer readings using ectool motionsense Change-Id: Id0fd4eea56b7106a89d55925ae488af6b0300119 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1257503 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* driver/accelgryo_lsm6dsm: Export accelgyro_config_fifo helper functionKarthikeyan Ramasubramanian2018-10-191-0/+4
| | | | | | | | | | | | | | | | Rename config_fifo function as accelgyro_config_fifo and export it to configure the accelerometer FIFO to support magmetometer data. Also remove a redundant else code by initializing the local variables appropriately. BRANCH=none BUG=b:115587004 TEST=none Change-Id: I6f35245b45941adaafd49cc0e26e1f9307c480c2 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1257502 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* FIXUP: fix lsm6dsm driver specific data type declarationPaul Ma2018-06-221-1/+7
| | | | | | | | | | | | | | | | | | accelgyro_lsm6dsm driver use lsm6dsm_data as its driver specific data type rather than stprivate_data. Wrong data type will lead to random corrupted runtime data. Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> BRANCH=none BUG=b:110013316 TEST=make buildall -j Change-Id: I50e0da293921c2662e97aa6f47c83519609186b5 Reviewed-on: https://chromium-review.googlesource.com/1105797 Commit-Ready: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* driver: lsm6dsm/lsm6dsl: Add FIFO supportMario Tesi2018-04-051-16/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added FIFO support to Acc and Gyro with watermark interrupt management. Watermark is configurable setting macro CONFIG_ACCEL_FIFO_THRES properly (board.h) BUG=b:73546254 BRANCH=master TEST=Pass CTS test cheets_CTS_N.7.1_r15.x86.CtsHardwareTestCases on meowth. TEST=Tested on discovery (target stmems) BOARD with LSM6DSM connected to EC i2c master bus. Using motion sense console commands is possible to: - enable sensor (accelinit 0, accelinit 1 for acc and gyro) - set ODR (accelrate 0 x, accelrate 1 y where x, y are mHz) - show sensor data (accelinfo on <time> where time is in ms) Using this procedure is possible to see Green Led of Discovery Board Blinking each time an interrupt from FIFO arrives. To be sure to generate interrupt is better to use high ODR and low time in accelinfo. Change-Id: Icf95b0e889dc806206b8ca50e74636e6a2441a18 Signed-off-by: Mario Tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/467326 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver: lsm6dsm: Fix ODR rate calculationGwendal Grignou2018-04-021-4/+2
| | | | | | | | | | | | | | rate was wrong, but round up was saving us. BUG=b:73546254 BRANCH=none TEST=Check register is set correctly even when roundup is 0. Change-Id: I4cf11291345ccfaacd1fc9942a3f112b460268c1 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/986917 Tested-by: Gwendal Grignou <gwendal@google.com> Reviewed-by: Gwendal Grignou <gwendal@google.com>
* driver: lsm6dsm: fix unitsGwendal Grignou2018-03-191-17/+2
| | | | | | | | | | | | | | | Units must be reported in according to the range. 2g means 1<<15 should be returned when accel is 2g. Actually accelerometer report units in mg. BUG=b:73546254 BRANCH=master TEST=Check with accelinfo with 2g gain Z ~= 1<<14. Change-Id: I218210ca8305ecbe76a681b535f3d75f3a6bea52 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/924408 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: lsm6dsm/lsm6dsl/lis2dh: Use STM MEMs common functionsGwendal Grignou2018-03-191-28/+14
| | | | | | | | | | | | | | | | | | | LSM6DSM now use STM MEMs common functions already used by LIS2DH12 device. Added st_raw_read_n_noinc function to read i2c data not using auto increment protocol. BUG=b:73546254 BRANCH=master TEST=Tested on discovery BOARD with LSM6DSM sensor connected on I2C master bus interface of target board. Using motion sense console commands is possible to enable, set data rate, set full scale and show data from sensor (acc and gyro). Commons function works properly for LSM6DSM. Change-Id: I7a987306135a85abcfa9c1d3ba596fb70598fadc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/465376
* driver: lsm6dsm/lsm6dsl: Fix LSM6DSM_ODR_TO_NORMALIZE macroGwendal Grignou2017-09-201-6/+6
| | | | | | | | | | | | | | | | | | | | | Using builtin function in macro. Compact macros. BUG=none BRANCH=master TEST=Tested on discovery BOARD with LSM6DSM sensor connected to I2C master interface of target board. Using accelrate motion sense console command is possible to test with different data rate: all supported ODR has been tested for acc and gyro Change-Id: Icb11f90254521715dfb2abb5bac6eb87ce45b92d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Mario Tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/465375 Commit-Ready: mario tesi <mario.tesi@st.com> Tested-by: mario tesi <mario.tesi@st.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* accel: add accel driver for LSM6DSMMario Tesi2016-11-151-0/+180
This add basics for acc and gyro sensor ST lsm6dsm Still need to add interrupt management for embedded functions and FIFO BUG=none BRANCH=master TEST=Tested on discovery BOARD with sensor connected on EC i2c master bus. Added motion sense task on discovery board task list, added gpio info in board configuration file and tested with motion sense console commands. Data for acc/gyro seems ok, can successfully change ODR and full scale range for acc and gyro. Change-Id: Ie50c8c0ee366994ed97f7ff3252633893b813ac2 Signed-off-by: Mario Tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/406947 Commit-Ready: mario tesi <mario.tesi@st.com> Tested-by: mario tesi <mario.tesi@st.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>