summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* kindred: fix set TCPC_AUX_SWITCH to 0xC on Port 0firmware-hatch-12672.BBoris Mittelberg2023-04-182-30/+25
| | | | | | | | | | | | | | Updating the mux via a callback instead of interrupt BUG=b:183123775 BRANCH=main,firmware-hatch-12672.B TEST=make BOARD=kindred Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: Ic90202937bda5b8c8028b9f9affae021095521b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4158694 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* jinlon: Adjust TEMP_SENSOR_4 thresholds to reduce fan speed in clamshellDevin Lu2023-02-171-15/+15
| | | | | | | | | | | | | | | | [Conflicts] There is no clang-format for firmware branch. BUG=b:261696880 BRANCH=firmware-hatch-12672.B TEST=Thermal team verified thermal policy is expected. Change-Id: Ia376eddaaaf8036aa244011a7cf097e8f883ca7a Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4225587 Tested-by: Devin Lu <devin.lu@quantatw.com> Commit-Queue: Devin Lu <devin.lu@quantatw.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4236857
* dratini: Set TCPC_AUX_SWITCH to 0xC on Port 0 on mux setBoris Mittelberg2023-01-102-0/+23
| | | | | | | | | | | | | | | | | When the screen brightness is changed, DP sends signal on AUX channel. This causes CCD mode to be disconnected. This patch sets the MUX to aux+ <-> sbu2, aux- <-> sbu1 to fix it. BUG=b:183123775 BRANCH=main,firmware-hatch-12672.B TEST=manually verify servod doesn't exit when screen turns off due to the device being idle for 8 minutes on dragonair Change-Id: I2c8761f81252d87d7aca4878023fb4db3d73812a Signed-off-by: Boris Mittelberg <bmbm@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4126661 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* usb_mux: add board_set callbackBoris Mittelberg2023-01-102-0/+13
| | | | | | | | | | | | | | | The callback exists on ToT, it allows to use board-specific callback from usb_mux_set BUG=b:183123775 TEST=manual test on dratini/dragonair Change-Id: I76828f4739f317ae3cb7afa4b7edf16f75031a2e Signed-off-by: Boris Mittelberg <bmbm@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4133689 Reviewed-by: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* Revert "dratini: Set TCPC_AUX_SWITCH to 0xC on Port 0 on CCD enable"Boris Mittelberg2022-12-283-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f7b945264c001e700bebc66c6401ae67e97df74e. Reason for revert: Doesn't work if rddkeepalive is enabled Original change's description: > dratini: Set TCPC_AUX_SWITCH to 0xC on Port 0 on CCD enable > > When the screen brightness is changed, DP sends signal on AUX channel. > This causes CCD mode to be disconnected. > > This patch sets the MUX to aux+ <-> sbu2, aux- <-> sbu1 to fix it. > > Same change as I3dba1bdfd44a921077a2f60dec17119bb0077238 > > BUG=b:183123775 > BRANCH=none > TEST=manually verify servod doesn't exit when screen brightness is changed > > Signed-off-by: Boris Mittelberg <bmbm@google.com> > Change-Id: Iff91a4b4753b42ee42cd5baac36ba8243d966ce0 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785192 > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > (cherry picked from commit 515990a91e4430ff66cae9e532332a0ee33162de) > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829732 > Reviewed-by: Shelley Chen <shchen@chromium.org> > Commit-Queue: Shelley Chen <shchen@chromium.org> > Tested-by: Shelley Chen <shchen@chromium.org> Bug: b:183123775 Change-Id: If5e9dd6492ccf84c80f8c0dd5c80c16ab5bd7a85 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4098872 Commit-Queue: Boris Mittelberg <bmbm@google.com> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Tested-by: Boris Mittelberg <bmbm@google.com>
* jinlon: moving buttons and switches to use MKBPShelley Chen2022-06-151-0/+1
| | | | | | | | | | | | | | | | | | | | | Switching config options to route buttons and switches to using MKBP instead of 8042 driver. This fixes the issue that we were seeing where when the "Treat top-row keys as function keys" config switch was enabled on Jinlon, the volume buttons (on the side of the device, not the keyboard) were behaving like F11/F12 keys. BUG=b:232107647 BRANCH=hatch TEST=enable the "Tread top-row keys as function keys" switch make sure physical volume keys on the side of Jinlon device still work (we see the volume slider appear) Signed-off-by: Shelley Chen <shchen@google.com> Change-Id: I9a6aadc1921ac4a612cc3e7612955afdcc0f03c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3681949 Tested-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* mkbp: Move key simulation to input devicesBoris Mittelberg2022-06-1515-600/+80
| | | | | | | | | | | | | | | | | | | | | | Today some platforms include MKBP_KEYBOARD because they use side buttons, switches or other events that share the same driver with MKBP keyboard. Those platforms don't enable KEYSCAN task. The CL is moving key emulation functionality to MKBP input devices, to make a clear separation between the real keyboard usage and emulation/buttons/switches/etc. All boards that were selecting `CONFIG_KEYBOARD_PROTOCOL_MKBP` without KEYSCAN task are now updated to select `CONFIG_MKBP_INPUT_DEVICES` BUG=b:170966461 BRANCH=main,firmware-dedede-13606.B,firmware-volteer-13672.B-main TEST=None Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: I515140ebf6e175f4b29991329f92266ffca232a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2824044 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700699 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
* mkbp: EC buttons and switches via MKBPBoris Mittelberg2022-06-159-167/+245
| | | | | | | | | | | | | | | | | | Allowing EC buttons and switches to be signaled via MKBP protocol, using CONFIG_MKBP_INPUT_DEVICES. Default behaviour is unchanged. BUG=b:170966461 BRANCH=main,firmware-dedede-13606.B,firmware-volteer-13672.B-main TEST=None Signed-off-by: Boris Mittelberg <bmbm@google.com> Cq-Depend: chromium:2824044 Change-Id: Ib96f98ecb3717a8ee8963be69fb7d7eb72e6d132 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796382 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700698 Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* mkbp: Separate MKBP_INFO host command from the keyboard driverBoris Mittelberg2022-06-154-122/+167
| | | | | | | | | | | | | | | | Detaching protocol-related info command from the keyboard driver. BUG=b:170966461 BRANCH=main,firmware-dedede-13606.B,firmware-volteer-13672.B-main TEST=None Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: I7943f7537bdf003145e9bd909a14f9451d922a5a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796381 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700697 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
* mkbp: Separate FIFO from the keyboard driverBoris Mittelberg2022-06-159-214/+317
| | | | | | | | | | | | | | | | | | Move protocol-related functionality out from the keyboard driver. This change is required to allow passing button events via MKBP on devices with non-MKBP keyboards. It reorganizes the code without changing the logic. BUG=b:170966461 BRANCH=main,firmware-dedede-13606.B,firmware-volteer-13672.B-main TEST=None Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: Ifb5b9d8e605f491313ee1dfe2c9950eb52152aa8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2669355 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700696 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* zephyr: provide a definition of K_MUTEX_DEFINE for CrOS EC OSJack Rosenthal2022-06-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Create a compatible K_MUTEX_DEFINE() for CrOS EC OS. This allows us to use K_MUTEX_DEFINE() in shared code without needing special Zephyr-only guards. K_MUTEX_DEFINE() will allow us to stop much of our usage of k_mutex_init(), which can often be forgotten, leaving mutexes uninitialized. BUG=b:177677037 BRANCH=none TEST=follow up CLs do some conversion to K_MUTEX_DEFINE they compile in both CrOS EC OS and Zephyr OS Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I11a9bcf1648447a7f1cb587bb0ebdf0c62381346 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782231 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700695 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
* Zephyr: add support for shimming the mutex structYuval Peress2022-06-151-2/+14
| | | | | | | | | | | | | | | | | | | | | This changes creates a common mutex_t which can be used in both platform/ec and zephyr code. It also adds an empty #define for k_mutex_init(mutex) such that the zephyr function can be used without affecting platform/ec. BRANCH=none BUG=b:171896666 TEST=Built platform/ec for boards: volteer & eve Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I6a711252732697ab120515d916bf388fdcd9544f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2508414 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3700694 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
* jinlon: Update fan table version for acousticDevin Lu2021-11-021-29/+29
| | | | | | | | | | | | | | | | This patch updates the fan table to improve acoustics while charging. BUG=b:195482344 BRANCH=firmware-hatch-12672.B TEST=On Jinlon. thermal team verified the fan steps worked as expected. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Iab85a39836f347f748a5adc0d04bd3e5392ddcca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3225269 Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> (cherry picked from commit 0470518017abb568fb7ebf13945ec75cfd7663a2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3256725
* driver: als_bh1730: Set last_valueGwendal Grignou2021-10-071-3/+4
| | | | | | | | | | | | | | | | | | |last_value| was never set, so sensor would send same data and never send measurement of 0 lux. BUG=b:201719476 BRANCH=many TEST=compile Fixes: 47a6acca3a41 ("motion: Add bh1730 as a motion sensor") Change-Id: Ib201db8809cd50b717c37e2f717a1b7ea0dcf312 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3198678 Reviewed-by: Cheng-Hao Yang <chenghaoyang@chromium.org> (cherry picked from commit 2e570139cfc803e0740655cc3da768df4dd716d3) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200051
* Clear OWNERS for factory/firmware branchBrian Norris2021-09-117-22/+0
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155186 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* helios: gyro sensor add 2nd source icm40608Michael5 Chen12021-08-243-1/+100
| | | | | | | | | | | | | | | | | | gyro sensor add 2nd source icm-40608 BUG=b:196286603 BRANCH=hatch TEST=make BAORD=helios Using command "watch ectool motionsense lid_angle". Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I06c1ea21b353959f07dd16a3732d23c638d031bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3089086 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> (cherry picked from commit c97daf56d5d5d57594bf61a7a316b6e26c143179) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115808
* kindred: Set TCPC_AUX_SWITCH to 0xC on Port 0 on CCD enableShelley Chen2021-07-143-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | When the screen brightness is changed, DP sends signal on AUX channel. This causes CCD mode to be disconnected. This patch sets the MUX to aux+ <-> sbu2, aux- <-> sbu1 to fix it. Same change as I3dba1bdfd44a921077a2f60dec17119bb0077238 BUG=b:185137814 BRANCH=hatch TEST=manually verify servod doesn't exit when screen turns off due to the device being idle for too long Signed-off-by: Shelley Chen <shchen@google.com> Change-Id: Ie1edef535297c68b7e91e247caaeb7ad00d19392 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2831053 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org> (cherry picked from commit 7d2eebe8c7d4c59df993218cfcba2616f20fc8a4) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3029003 Reviewed-by: Shelley Chen <shchen@chromium.org>
* common: motionsense fifo: Reset the initialized bits after commitYuval Peress2021-07-122-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously once we had one sample from a sensor, we considered the fifo initialized. Meaning we would use our computed next timestamp to spread the timestamps. This was causing issues with some devices that ended up causing the timestamps to run ahead. Reset next_timestamp_initialized back to 0 after each commit. This will allow repeated timestamps but only if a driver stages/commits the same timestamp twice. Staging the same timestamp with only a single commit will still work as before (which is the expected path). BRANCH=none BUG=b:168335284 TEST=make run-motion_sense_fifo Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib7c566f69d7c1e4e898050b67105555dd05376e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2871055 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit bc9660a4b3e8bab1d729cb42e0f27ac968a4f457) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2875114 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
* motion_sense: Fix signed/unsigned comparison in ec_motion_sensor_clamp_* helpersFurquan Shaikh2021-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ec_motion_sensor_clamp_* helpers are performing comparison between signed and unsigned integers leading to non-compliant code. This results in comparison operation converting negative values to unsigned integers. Example: When ec_motion_sensor_clamp_i16() is called with a value of -15000, it returns 32767 instead of -15000 because: * MAX(-15000, INT16_MIN) ==> MAX(-15000, -32768) ==> -15000 * MIN(-15000, INT16_MAX) ==> MIN(-15000, 32767U) ==> This expands to: int32_t temp_a = -15000; uint32_t temp_b = 32767U; << This is my assumption what the compiler would be doing (temp_a < temp_b) ? temp_a : temp_b; In this comparison, temp_a is signed int whereas temp_b is unsigned int. As per C-standard for usual arithmetic conversions, for the comparison operation, both operands are converted to unsigned integer type corresponding to the type of the operand with signed integer type. Thus the comparison operation changes to comparison between: -15000 --> 0xffffc568 32767 --> 0x7fff and hence returns 0x7fff i.e. 32767. This change adds explicit type cast for constant values passed into MIN()/MAX() to ensure that the comparison is compliant to C standard. With this the above comparison in ec_motion_sensor_clamp_i16() correctly returns -15000. BUG=b:167751183,b:189894836 BRANCH=zork TEST=Verified that screen flips when in tablet mode on Morphius. Also, verified using following steps that raw data seen in sysfs consists of positive and negative values: $ cd /sys/bus/iio/devices $ watch -n 0.1 grep . */in_*_raw Signed-off-by: Furquan Shaikh <furquan@google.com> Change-Id: I444c9aeab4ae8a4726600222080fb141084b7a41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393459 Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Furquan Shaikh <furquan@chromium.org> (cherry picked from commit ec743f4b565061208d33dfd36d8fd753197f998c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2932464 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org>
* dratini: Set TCPC_AUX_SWITCH to 0xC on Port 0 on CCD enableBoris Mittelberg2021-04-153-0/+29
| | | | | | | | | | | | | | | | | | | | | | | When the screen brightness is changed, DP sends signal on AUX channel. This causes CCD mode to be disconnected. This patch sets the MUX to aux+ <-> sbu2, aux- <-> sbu1 to fix it. Same change as I3dba1bdfd44a921077a2f60dec17119bb0077238 BUG=b:183123775 BRANCH=none TEST=manually verify servod doesn't exit when screen brightness is changed Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: Iff91a4b4753b42ee42cd5baac36ba8243d966ce0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785192 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 515990a91e4430ff66cae9e532332a0ee33162de) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2829732 Reviewed-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org> Tested-by: Shelley Chen <shchen@chromium.org>
* nightfury : change key debounce timeYongBeum.Ha2021-03-103-0/+10
| | | | | | | | | | | | | | | change key-down debounce time to 30ms BUG=b:181307934 BRANCH=None TEST=make -j BOARD=nightfury Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I07c7f433b7b071ca20f2ab570a251580771092d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2744760 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* driver: tcs3400: Check for device status only onceGwendal Grignou2021-02-261-28/+31
| | | | | | | | | | | | | | | | | | | | | | | | Since ASIEN (interrupt on ALS saturation) and ALS threshold interrupts are disabled, we can only get interrupt on RBGC cycle read. Therefore, when using the interrupt, not need to check if RGB data is ready in post_events(). Only check while in force mode. Remove recheck when accounting for saturation. BUG=b:177860358 BRANCH=kukui,hatch,puff,volteer TEST=compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I7fc419a98828b9b188849e04a15cfefaf9e96c8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572739 Reviewed-by: Nick Vaccaro <nvaccaro@google.com> (cherry picked from commit ba15cc92f2050175b50db3baa84228e49a081a10) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721098 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* motion_sense: use clamp functions in sending 32bit sensor valuesIkjoon Jang2021-02-261-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Apply 32bit clamp functions in sending 32bit sensor values to host. Clamp functions explicitly clamp values into 16bit ec protocol regarding its sensor type. Clamp functions take its sensor type as an argument and clamp 32bit value into 0~65535 for light sensors and -32768 ~ 32767 for all other motion sensors. BUG=b:144002158 TEST=Reading illuminance values in kukui kernel BRANCH=none Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Change-Id: I977114e26f28e7806c11b0a97c9edec7a84ea0dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328951 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit b9ae5ccdec033adefa24b60cd458f8a64789a248) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721097 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* drivers/tcs3400: code cleanups in transferring sensor valuesIkjoon Jang2021-02-261-62/+49
| | | | | | | | | | | | | | | | | | | | | | - bugfix in using memcpy() for unmatched size - use clamp helper functions in tcs3400's transferring 32 bit values into 16bit unsigned packet. - use IS_ENABLED() instead of ifdef/endif macros BUG=b:162396219 TEST=Reading illuminance values from kukui kernel BRANCH=none Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Change-Id: Icc781e0ec6f4eb3465069a697aad8e8e16b9a9a2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328950 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit a51ecba6f0bba4c3f660346a9c7fd5fc22a1d3ec) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721096 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* common: motion_sense: Add helper functions clamping 32bit into ec protocolIkjoon Jang2021-02-261-0/+36
| | | | | | | | | | | | | | | | | | | | This helper functions are for clamping 32bit values into ec motion sensor protocol 16 data representations. BUG=b:162396219 TEST=build BRANCH=none Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Change-Id: I9c2a6e824570abde916de8cf513d1be79e345b56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328949 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit a30ccbaefe30d16ff6327cf4e3e687077b7ef041) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721095 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* ec_commands: add uint16_t alias to motion_sensor_data for light sensorsIkjoon Jang2021-02-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | Current EC protocol defines motion sensor's 3-axis raw data type as i16 but in case of light sensor, this should be u16 to support up to 65535. This patch explicitly declares u16 type in protocol definition BUG=b:162396219 TEST=Build BRANCH=none Change-Id: Ie38c7d72d9a8ab5d83d23edfa3faeb7fccaa0082 Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2328948 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit dc72e1d946422ea3359c35c15f30cd68e1ce9ca4) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721094 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* util/ecst: Make sure that copying back arguments doesn't exceed MAX_ARGSPatrick Georgi2021-02-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Newer gcc than we have in CrOS shows a non-helpful error message: util/ecst.c: In function 'main': util/ecst.c:398:7: error: 'strncpy' output may be truncated copying 100 bytes from a string of length 9999 [-Werror=stringop-truncation] 398 | strncpy(hdr_args[arg_ind++], | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | tmp_hdr_args[tmp_ind], | ~~~~~~~~~~~~~~~~~~~~~~ 400 | ARG_SIZE); | ~~~~~~~~~ In the end it's about gcc not being able to ensure that hdr_args[] doesn't overflow. BUG=none BRANCH=none TEST=gcc 9.3 as shipped with debian sid compiles ecst without error Change-Id: I2c30cdfaac0305ea4e4c19477469bcf497469caa Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2273240 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> (cherry picked from commit 3a838d11ae131526b1524a03789f11300f095c9b) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721093 Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* ectool_keyscan: add missing null terminator to kbd_plain_xlateFabio Baltieri2021-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | strchr relies on the source string to be null terminated. This fixes a compiler warning when building outside of the chroot: util/ectool_keyscan.c: In function ‘cmd_keyscan’: util/ectool_keyscan.c:208:9: error: ‘strchr’ argument missing terminating nul [-Werror=stringop-overflow=] 208 | pos = strchr(kbd_plain_xlate, key); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ BUG=none TEST=build only, warning is gone BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Iafb8249515ffa1a5f7e04a272e54a048eef9a57c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606228 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> (cherry picked from commit 06a82155ef062adaccf3c2469c59ca850f5800c7) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721092 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* kohaku: Set base light sensor information correctlyGwendal Grignou2021-02-132-4/+9
| | | | | | | | | | | | | | | | BH1370 light sensor only support 10Hz frequency. Set parameters properly. Sensor only used on kohaku. BUG=b:172343923 BRANCH=hatch TEST=Check on Kohaku the light parameters are correct. Change-Id: Ibb9b2699e414cf80730d290aba981dcd4898f84f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586069 Reviewed-by: Scott Collyer <scollyer@chromium.org> (cherry picked from commit e2882f20fa28810e735e1a8f0750674e7940eb2d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693917
* kindred: Add detect accel/gyro sensor in HOOK_INITBen Chen2021-02-041-1/+5
| | | | | | | | | | | | | | | | | | | | Add detect accel/gyro sensor in HOOK_INIT for sysjump rw. Use "HOOK_PRIO_INIT_ADC + 2" For sku_id checking. And make sure detect sensor when chipset power on. BUG=b:175918382 BRANCH=hatch TEST=sysjump ro/rw to check motionsense data. Change-Id: Ib5de2225b0534d91bda4127a8a22a23cdbea59ae Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2669748 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> (cherry picked from commit d78e31576248a3f496a3ff92c44c4806111933e4) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2672987 Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* driver: icm426xx: Use calibration unit to set/get offsetGwendal Grignou2021-01-291-24/+15
| | | | | | | | | | | | | | | | EC interface use constant (not range dependent) units to get/set offsets. Use them in icm426xx driver. BUG=b:177292639 BRANCH=hatch,nami,kukui,dedede,grunt,zork,octopus,volteer TEST=compile Change-Id: I6e6b1551464ea389db34646ba5b2bb553d683d7a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2657955 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2659406
* kindred: config motion sensor driver by chip idBen Chen2021-01-293-2/+142
| | | | | | | | | | | | | | | | | | | | config motion sensor icm/kx022/bmi160/bma255 driver by chip id value. BUG=b:175918382 BRANCH=main TEST=Work on DUT with ICM/KX022/BMA255/BMI160, check the motion function is workable. Change-Id: Ie76dc49f2e102c230ddb5675a52639acb22b2da4 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592541 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> (cherry picked from commit 04661a072ecc00ef42112ceb223095808190ff68) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2657898 Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* icm426xx: reset data rate when initDavid Huang2021-01-221-0/+2
| | | | | | | | | | | | | | | | | | | When icm426xx init, reset data rate to enable sensor. BUG=chromium:1160266 BRANCH=main TEST=Check ectool motionsense get data after shutdown and power on. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I0a1042eaf6dbdb132c4bb50975eae3c6f0cfad00 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597131 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2605028 Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
* driver: add icm426xx chip type defineJean-Baptiste Maneyrol2021-01-222-0/+4
| | | | | | | | | | | | | | | | | | | | | Add new enum motionsensor_chip and update ectool motionsense. BUG=chromium:1117541 BRANCH=None TEST=ectool motionsense info Cq-Depend: chromium:2317888 Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Change-Id: I07736d61bdb7332bfdc44c8f7294233e43a6e00d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2374647 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2605027 Tested-by: David Huang <david.huang@quanta.corp-partner.google.com> Auto-Submit: David Huang <david.huang@quanta.corp-partner.google.com> Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Bob Moragues <moragues@chromium.org>
* driver: add ICM-426xx driver supportJean-Baptiste Maneyrol2021-01-227-0/+1729
| | | | | | | | | | | | | | | | | | | | | Add ICM-426xx accel/gyro driver code. BUG=chromium:1117541 BRANCH=None TEST=ectool motionsense fifo_read && tast run hardware.SensorRing Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Change-Id: I83fe48abc6aa9cde86576a777ac4272d90fac597 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317888 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2605026 Tested-by: David Huang <david.huang@quanta.corp-partner.google.com> Auto-Submit: David Huang <david.huang@quanta.corp-partner.google.com> Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: David Huang <david.huang@quanta.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org>
* driver: tcs3400: Report ODR for RGB sensorGwendal Grignou2020-12-111-5/+5
| | | | | | | | | | | | | | | | | | | | To be able to send data to the host, the oversampling ratio must be non-zero. It implies: - the host send a set frequency request for the RGB sensor - the EC use the frequency from the clear sensor to calculate the RGB sensor oversampling ratio BUG=b:172343923 BRANCH=kukui,hatch,volteer TEST=On Volteer, in calibration mode, check we get samples from the RGB sensor. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I70eb62287cae983800cdadaee4cfe00b2f22b734 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570825 Reviewed-by: Nick Vaccaro <nvaccaro@google.com> (cherry picked from commit 4761e94ef6690c47a25351d024705197674720bd) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586070
* driver/opt3100: Set min/max frequency that match the driverGwendal Grignou2020-12-012-5/+8
| | | | | | | | | | | | | | | | Given we set integration time at 800ms, the host must be aware to not set an ODR over 1Hz. BUG=chromium:615059 BRANCH=nocturne TEST=Check new max_frequency is indeed 1Hz on nocturne. Change-Id: I44252073f59e00cdf4d13b4fa6d88448537c168e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991857 Reviewed-by: Nick Vaccaro <nvaccaro@google.com> (cherry picked from commit a8ea3bfdbe928b9bcf2d3756a2fae16fe40132ae) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567037
* driver: bmi: remove unnecessary msleep()Gwendal Grignou2020-10-291-42/+0
| | | | | | | | | | | | | | | | | | | | | 1ms sleep after every write is not necessary. The only place it is is at init time and it is taken care of. Remove unused function. Remove sleep when ODR changes, it causes EC to stall. BUG=b:170155773 BRANCH=hatch, zork TEST=On volteer check hardware.SensorRing passes continuously. Conflicts: driver/accelgyro_bmi260.c: not present. Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2483357 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org> Change-Id: I5fd06c9cd6a79ee6cc7f92c448e18fb71a906184 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2492533 Reviewed-by: Yuval Peress <peress@chromium.org>
* driver: bmi160: Read only the first 2 bytes of the interrupt fieldGwendal Grignou2020-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The remaining 2 are qualifier for single/double tap we are not interested in. They are not reset to 0 even after we process the interrupt, so when gesture is enabled, we are stuck in the interrupt routine for a while. BMI260 does not have this problem as the interrupt register is now explicitly 16 bit. Gesture is currently enabled on eve that does not have the loop on interrupt, so no other branch than ToT is affected. BUG=b:164974014 BRANCH=none TEST=Without, we would be stuck in bmi160 irq_hanlder: (timestamp of int) (interrupt mask) ... [5064.237873 a hw int: 769270447 - 2 0x00C00000] [5064.238989 a hw int: 769270447 - 2 0x00C04000] [5064.241277 a hw int: 769270447 - 2 0x00C00000] [5064.242397 a hw int: 769270447 - 2 0x00C00000] [5064.243527 a hw int: 769270447 - 2 0x00C00000] [5064.244647 a hw int: 769270447 - 2 0x00C00000] [5064.246419 a hw int: 769270447 - 2 0x00C00000] ... / Qualifier -----/ Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2370152 Reviewed-by: Patryk Duda <pdk@semihalf.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patryk Duda <pdk@semihalf.com> (cherry picked from commit bee0b6334399a341e7e242b5e8b12575262c9791) Change-Id: I2c8fd354eddfa412f644555dcdcdb77708a9e3c7 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2492532 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* common: motion_sense_fifo: fix iteration bugYuval Peress2020-10-292-2/+54
| | | | | | | | | | | | | | | | | | Fix potential bug when iterating over FIFO entries for commit. This bug can manifest when non-timestamp/non-data entries are inserted into the FIFO. BUG=b:138303429,chromium:1023858 TEST=Added unit tests BRANCH=None Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2012846 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit e8b5147f37bdb347ba25780bc4b969b37fd6b239) Change-Id: I64855db2141f7ad6aafb3f3a84632a1dabef11f4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2492531
* common/motion_sense: finish change that change ODR in motion taskGwendal Grignou2020-10-291-0/+3
| | | | | | | | | | | | | | | | | | Forgot to change odr_event_required in the console command accelrate. Fixup of crrev.com/c/1470772 BUG=b:111422556,chromium:562245,b:124085261 BRANCH=none TEST=Using accelrate ID ODR 1 change the ODR on sensor ID. Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1992840 Reviewed-by: Yuval Peress <peress@chromium.org> (cherry picked from commit 8e7d2cfac6cc60599c22fe4f072d5744b772fdf5) Change-Id: I62b5d4b120e212ad74c976923270f29176266870 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2492530 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
* driver: bma2x2: Limit max frequency to 125HzGwendal Grignou2020-10-181-2/+8
| | | | | | | | | | | | | | | | | | Given BMA2x2 are polled (to save interrupt pin), limit ODR to 125Hz. Even if we read too early (we can be 3ms early), it prevents tast hardware.SensorRing from failing. Lid accelerometer is usually read at 10/12.5Hz. BUG=b:170155773 BRANCH=octupus,kukui,hatch TEST=hardware.SensorRing passes on volteer Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Ic7e68402afbf1ceacb627ee732dbd609b7cb5d5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2451421 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit befbf85be57f99dccb9b61ec6481726afc27eea5) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2482345
* driver: lis2ds: set up the minimum value for set_rangeInno.Park2020-10-152-0/+3
| | | | | | | | | | | | | | | | | | | Current lis2ds driver is vulnerable to unrestrained input for range setting. The system gets rebooted as setting a range to 0 or negative. This CL set up minimum range in set_range() to filter input 0 or below. BUG=b:170688359 BRANCH=none TEST=run 'ectool motionsense range 0 0' and check if device rebooted Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Change-Id: I24e68635584ecddab415df8d7af0250a62f28d40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2467416 Reviewed-by: Yuval Peress <peress@chromium.org> (cherry picked from commit 95e90b8132568e3872137d8649168816c8ece46a) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2473619 Reviewed-by: Bob Moragues <moragues@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
* nightfury: set compatible device for SKU 2.Jongpil Jung2020-10-091-1/+1
| | | | | | | | | | | | | | | SKU2 is compatible device. If we didn't set compatible device, internal keyboard works in tablet mode. BUG=b:170357684 BRANCH=firmware-hatch-12672.B TEST=DUT will not be resumed from S3 when pressing Keyboard in tablet mode. Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com> Change-Id: I1aeff53460e440016c8d6f27ea4927f1251068fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2463142 Reviewed-by: Bob Moragues <moragues@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
* kindred: modify power button timeoutben.chen2@quanta.corp-partner.google.com2020-08-141-0/+2
| | | | | | | | | | | | | | | | | | | ensure wake up from MURATA battery takes some seconds, to come back out of its disconnect. Setting CONFIG_POWER_BUTTON_INIT_TIMEOUT to 2 second. BUG=b:146914669 BRANCH=hatch TEST=check power on, plug in AC after battery cutoff Change-Id: I55e1f1957ebbe6800cf01e347e9ed29d57ab1280 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1984153 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2355631 Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* Jinlon: Re-scale power LED pulsing duty cycleDevin Lu2020-07-281-2/+3
| | | | | | | | | | | | | | | | | | | To save more battery life for S0ix, this patch re-scale power led pulsing cycle with 1.6s off, 0.4s on. BUG=b:161569874 BRANCH=firmware-hatch-12672.B TEST=Make sure power LED pulsing cycle is 1.6s off, 0.4s on. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ia791d0a85a51bfe02071d6537b8ded408367c4e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2319488 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> (cherry picked from commit 1b4030c9ea2e44ff06e29d69206c048e49ba2170) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321823 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* driver: bmi160: Increase the deadline for gyro calibrationInno.Park2020-06-301-3/+19
| | | | | | | | | | | | | | | | | | | | | Current calibration timeout, 400ms, is not enough for gyro. Accel has done calibration under 100ms, whereas gyro usually takes 300ms ~ 700ms. So we need to increase timeout to 800ms in case of gyro. In addition, temporary set the least range during calibration to perform with full sensitivity. BUG=b:159557101 BRANCH=none TEST=check if gyro calibrated well without an error. 'echo 1 > /sys/bus/iio/devices/iio:device[gyro-index]/calibrate' Change-Id: Ib8c190d2969f6295e70cadd990999dfddf7a1b53 Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256967 Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org> (cherry picked from commit 6c131d859105c3e699cbc4df17e10b3e332ebc93) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2275717
* driver: Add BMI common codeChing-Kang Yen2020-06-2210-976/+1346
| | | | | | | | | | | | | | | | | | | | | Add accelgyro_bmi_common.(c/h) for the code shared among the BMI. BRANCH=None BUG=b:146144827 TEST=make -j4 BOARD=ampton Then, flash the ec.bin into DUT, check sensor data is available on DUT by "ectool motionsense". TEST=make buildall -j Change-Id: Ia56ffb0896943b08640b3d6ca96324ac5e7d93a0 Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130146 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 86be30f5c4220112c6303c176f12096151285515) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256625 Tested-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
* driver: bmi160: Fix rounding error in set_offset() and get_offset()Ching-Kang Yen2020-06-203-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | The original set_offset() and get_offset() codes in the driver/accelgyro_bmi160 use simple divisions to write the data. The more times the set_offset() and get_offset() is used, the data will get closer to 0. Fixing it by replacing simple division to round_divide(), division that round to nearest, in the common/math_util.c. BRANCH=octopus BUG=b:146823505 TEST=Testing on octopus:ampton on branch [firmware-octopus-11297.B]. Checking the data did not rounding to 0. Change-Id: Ide9df9e32fc501e63d6f952cb8254df7662afd23 Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2002998 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 036e9f7b214b763524497550aae0ee94df8fd536) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249639 Reviewed-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Tested-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Commit-Queue: Bob Moragues <moragues@chromium.org>
* driver: lis2mdl: Define LIS2MDL_CAL even when CONFIG_MAG_CALIBRATE is notGwendal Grignou2020-06-202-8/+17
| | | | | | | | | | | | | | | | | | | | | | mag_cal_t holds offset information for the sensor, even when online calibration is not defined. Allow driver to work with online calibration disabled (it could be set from the host). BUG=none BRANCH=none TEST=using nucleo-f072rb_iks01a2, check magnetometer is working with or without CONFIG_MAG_CALIBRATE enabled. Change-Id: I2e259f53c620c593b516a12d6dff47dfbadb26c8 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1993584 Reviewed-by: Yuval Peress <peress@chromium.org> (cherry picked from commit e5320809ae393184f8ff3c120232f42fe714f616) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249644 Reviewed-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Tested-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Commit-Queue: Bob Moragues <moragues@chromium.org>