summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
* KB800X: Fix build errorstabilize-14324.72.B-mainstabilize-14324.62.B-mainstabilize-14324.41.B-mainstabilize-14324.13.B-mainrelease-R97-14324.B-mainDavid Huang2021-11-041-1/+3
| | | | | | | | | | | | | | Fix the build error for kb800x. BUG=b:197505149 BRANCH=none TEST=make buildall -j success. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I99cfaed0beff8b56532efdd549ac05c9900b1493 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3261448 Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: caveh jalali <caveh@chromium.org>
* driver: bmi3xx: Fix base accelerometer streaming issueLatchia2021-11-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The configuration of sensor has to be saved before writing offsets and it has to be written back. Instead of writing back the saved configurations, there was a call to read back the configs again. This patch has the correct write API call. BRANCH=none BUG=b:200776764 TEST=1. make BOARD=guybrush -j 2. Flash EC binary on the gurbrush proto 2 device 3. In kernel run: ectool motionsense cd /sys/bus/iio/devices/iio\:device2 && cat location echo 0 > in_accel_x_calibbias ectool motionsense # this should work Signed-off-by: Latchiamaran Senram <latchiamaran.senram@bosch.corp-partner.google.com> Change-Id: If8a20f50df8287fb49dec242f6ee9030e8bbe5d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3255475 Tested-by: Chih-Yao Chuang <jasonchuang@google.com> Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
* ec: Implement keyboard backlight get enabledJeremy Bettis2021-11-032-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Prior to crrev/c/1051027, the EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT host cmd returned an enabled flag, which the FAFT test firmware_ECLidSwitch depends on. That test, however, was broken, and wasn't actually running the kb backlight portion of the test on any models, so no one ever noticed that the HC and the kblight ec console commands don't return the enabled status. Add a get_enabled function to the kblight driver struct, and add an implementation for each existing driver. BRANCH=None BUG=b:194908032 TEST=CP'd to leona branch, build EC, flash board kblight 100 ; lidclose ; kblight ; lidopen ; kblight Verified the cmd returned enabled: 1 when lights were on Change-Id: Ia6ab025901869933cf70bb49f3bf2def2987b7b3 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3248888 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* bq25710: Add PSYS sensing configurationCaveh Jalali2021-11-012-0/+58
| | | | | | | | | | | | | | | | | | | | This adds a new config option to enable the PSYS monitoring feature on the BQ25710, BQ25720 chargers. The register definition for configuring PSYS on the BQ25720 is expanded to 2 bits, giving more control to meaure battery and AC separately. We keep it simple and include both when measurement is enabled. BRANCH=none BUG=b:195615830 TEST=with rest of patch series, psys values reported by dump_intel_rapl_consumption look reasonable Change-Id: I0f299c6a24d20ef5bdcda13de74b30ba0c2d5d3c Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3253076 Reviewed-by: Ryan Lin <ryan.lin@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* ANX7451: Correct headerDiana Z2021-11-011-1/+1
| | | | | | | | | | | | | | The timestamp_t and get_time() utilities are defined in timer.h. BRANCH=None BUG=b:195137794 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib53714d30af7e2bf6b97e0b6fdd4acab228dfbde Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3252342 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver/accelgyro_lsm6dsm: Add assertTom Hughes2021-10-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When building metaknight with clang, it warns: driver/accelgyro_lsm6dsm.c:193:5: error: array index 2 is past the end of the array (which contains 2 elements) [-Werror,-Warray-bounds] decimators[FIFO_DEV_MAG]); ^ ~~~~~~~~~~~~ driver/accelgyro_lsm6dsm.c:133:2: note: array 'decimators' declared here uint8_t decimators[FIFO_DEV_NUM] = { 0 }; ^ In the case of metaknight, IS_ENABLED(CONFIG_LSM6DSM_SEC_I2C) should evaluate to false and we will never hit this issue. Adding an ASSERT makes clang happy. BRANCH=none BUG=b:172020503 TEST=CC=clang make BOARD=metaknight Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id81f51fccb256f281dd5de0c52d0c0008e2a6787 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3197754 Reviewed-by: Keith Short <keithshort@chromium.org>
* it83xx_pd.h: fix header dependencyTing Shen2021-10-291-0/+2
| | | | | | | | | | | | | | | | | | it83xx_pd.h uses uint8_t, add the appropriate header for type declaration. BUG=none TEST=make BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Iad30f525297835c6041d8bc95bb2b751c10a09ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3249323 Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* cleanup: charger: Add BQ25710 sense resistor configsDeepti Deshatty2021-10-281-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Defined different sense register configs for BQ25710. All the charger chip driver implementation uses common sense register configs i.e CONFIG_CHARGER_SENSE_RESISTOR and CONFIG_CHARGER_SENSE_RESISTOR_AC. When we enable a charger driver for a platform, it is expected that the platform define these sense register configs. But ADLRVP requires two different charger drivers i.e ISL9241 and BQ25720 to be enabled to support all the variant builds. Hence BQ25710 driver is changed to use different sense register configs so that the configs defined for ISL9241 are not affected. BRANCH=none TEST=make -j buildall has no issues Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: If1e1422246e2e3a5cb628d9a37c23790502b5ca4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3211773 Reviewed-by: Poornima Tom <poornima.tom@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* AMD FP6: Correct array sizeDiana Z2021-10-281-1/+1
| | | | | | | | | | | | | | | The value CONFIG_USB_PD_PORT_MAX_COUNT is the standard one to use for arrays representing PD ports. BRANCH=None BUG=b:195137794 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic7c6aecfa3b44be4b412919a27be996879315bd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3248970 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* SERVO_V4P1: Use IO-Expander driver specific flagsSam Hurst2021-10-272-6/+11
| | | | | | | | | | | | | | | | | | The TCA64XXA driver controls both the tca6416a and tca6424a io-expanders, so the IO-Expander driver specific flags are used to distinguish between the two. BUG=b:203907721 BRANCH=none TEST=ServoV4p1 flags are not clobbered and IO-Expanders are working Signed-off-by: Sam Hurst <shurst@google.org> Change-Id: I89335845f035aa18d39762cda8ede732e99df3ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3239015 Tested-by: Sam Hurst <shurst@google.com> Commit-Queue: caveh jalali <caveh@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* driver/retimer: Avoid converting between enum typesTom Hughes2021-10-251-1/+1
| | | | | | | | | | | | | | | | | | When building with clang, it warns: board/morphius/board.c:337:18: error: implicit conversion from enumeration type 'enum ioex_signal' to different enumeration type 'enum gpio_signal' [-Werror,-Wenum-conversion] .enable_gpio = IOEX_USB_C0_DATA_EN, BRANCH=none BUG=b:172020503 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I8d7d9292701732925f7a34daa7d673a61abaebce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3238251 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* driver/tusb1064 : support for TUSB1044 type-c redriverDeepti Deshatty2021-10-213-1/+52
| | | | | | | | | | | | | | | New config CONFIG_USB_MUX_TUSB1044 introduced to compile existing tusb1064 driver for tusb1044. New api tusb1044_hpd_update() is implemented to update the HPD bit in Gerenal_1 register based on the HPD information received. BRANCH=none TEST=Redriver is enabled on ADL-N and type-c display verified Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: Ia38aae2ff5c8a545272e5f99b3728e8bbbb4e716 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3205431 Reviewed-by: caveh jalali <caveh@chromium.org>
* cleanup: charger: consolidate charger_dump console commandsDeepti Deshatty2021-10-205-59/+20
| | | | | | | | | | | | | | | | | | | | Console command "charger_dump" is defined in multiple charger driver files, hence, build fails when more than one charger chip drivers are enabled for a platform. To avoid this "charger_dump" console command is defined in a common file, and this command handler invokes platform specific charger dump register api. BRANCH=none BUG=none TEST=Verified 'charger dump' command on brya Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: Ic542af90b47880e90073c529f9183abc6a3f5af7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3211760 Commit-Queue: caveh jalali <caveh@chromium.org> Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: Remove redundant check in accelgyro_bmi260.c:config_interruptTristan Honscheid2021-10-201-3/+6
| | | | | | | | | | | | | | | | | | Both `config_interrupt` and its sole caller check that the sensor struct is for an accelerometer. This is redundant and creates an unreachable code path that we cannot unit test. Remove the extra check and add a comment to the function clarifying that it is the caller's responsibility to verify the sensor is an accelerometer. BRANCH=None BUG=b:184856157 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: I7c90fa11a1bf1ad9fbf52c88291115cceaf06687 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3232755 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: Test BMI260 interrupt handlerTristan Honscheid2021-10-191-20/+0
| | | | | | | | | | | | | | | | | Quick test of the interrupt handler in accelgyro_bmi260.c that verifies the event flags get set properly. Also moved the definition of CONFIG_ACCELGYRO_BMI260_INT_EVENT in to the corresponding header file so we can access that value in the test. BRANCH=None BUG=b:184856157 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: Ibf88aee12f661a7883d1fffb6b3a6d53b79289db Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229647 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tree: Files should end with single newlineTom Hughes2021-10-1816-16/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: Test accelgyro_bmi260.c for unsupported operationsTristan Honscheid2021-10-181-3/+11
| | | | | | | | | | | | | | | | | Add a test that covers parts of the code where we validate sensor types. Also made a modification to accelgyro_bmi260.c where I moved the sensor type check up to the top of the func so we fail before trying to set the data rate (which doesn't work for magnetometers). BRANCH=None BUG=b:184856157 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: I170087b8bfdc1212972d00010c90789967a6415b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229076 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* tree: Make all host commands staticTom Hughes2021-10-152-4/+5
| | | | | | | | | | | | | | Almost all of the host commands were already static. This change makes all of them static for consistency. BRANCH=none BUG=b:172020503 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I8330e85e6d64a039f08d7620eed1fe897f436567 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3221786 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* sn5s330: Set RCP threshold to 3 mV for PP1Scott Collyer2021-10-152-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adjusts the RCP (reverse current protection) voltage threshold for PP1 to 3 mV when in ideal diode mode. This change fixes an issue on honeybuns for port C0 when connecting to M1 based host machines and charging at higher VBUS values ( > 15V). BRANCH=quiche BUG=b:199339421 TEST=verfied bit 4 of function set 10 register is clear > ppc 0 dump FUNC_SET1 [50h] = 0x05 FUNC_SET2 [51h] = 0x18 FUNC_SET3 [52h] = 0x68 FUNC_SET4 [53h] = 0xfc FUNC_SET5 [54h] = 0x37 FUNC_SET6 [55h] = 0xc1 FUNC_SET7 [56h] = 0x70 FUNC_SET8 [57h] = 0xbd FUNC_SET9 [58h] = 0x34 FUNC_SET10 [59h] = 0x60 ODM partner verified this change fixed the ~3% devices that were failing and did interop testing with other host machines to verify no regressions. Those results are linked in the buganizer issue. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Id798debc11f8586acc6c9feef104478375ee4fea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3219573 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* zephyr: drivers: ln9310 make software_enable doc more explicitAaron Massey2021-10-111-4/+5
| | | | | | | | | | | | | | | | | | Updates documentation in ln9310_software_enable() to explicitly state it contains an alternative startup sequence that is required by older chip versions in addition to normal startup. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: I976d2f35b1e392bc584cbd7e13ab34421846f679 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200519 Commit-Queue: Aaron Massey <aaronmassey@google.com> Tested-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* driver: bma4xx: Correct implementation for get offsetChen-Tsung Hsieh2021-10-071-1/+1
| | | | | | | | | | | | | | | | | | Before writing the offset to the BMA sensor, if it is less than 0, we will add 256 to it. So after reading the offset, we should subtract 256 from it instead of -256. BRANCH=none BUG=b:201238498, b:192409667 TEST=run 'ectool motionsense offset 2 19 0 0' on Tomato Change-Id: I26e2e714a529347c2cdb6b051c1423b379ad5c0d Signed-off-by: Chen-Tsung Hsieh <chentsung@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3205437 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Commit-Queue: Li-jen Chen <lijen@google.com>
* PS8xxx: Move the delay before Vconn shutdown to PS8xxx driverWai-Hong Tam2021-10-072-10/+15
| | | | | | | | | | | | | | | | | | This workaround is PS8xxx chip specific. Move it from the general TCPCI driver to the PS8xxx driver. BRANCH=Trogdor BUG=b:185202064, b:183586640 TEST=Verified the dock detection: * Insert the dock to the Type-C port and shutdown the device; * Press powerbutton to power on the device; * Use lsusb command, list can not find the dock information; * The dock can be found. Change-Id: I33b4d0649c534735cf20e38831757449dd03ff27 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3209650 Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver/led: Remove unused functionTom Hughes2021-10-051-6/+0
| | | | | | | | | | | | | | | | | Building with clang: driver/led/lm3630a.c:23:19: error: unused function 'lm3630a_read' [-Werror,-Wunused-function] static inline int lm3630a_read(uint8_t reg, int *val) BRANCH=none BUG=b:172020503 TEST=make CC=arm-none-eabi-clang BOARD=aleena Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: If4a26261d41f470c2cb86208e3c1eaada0b2ff3e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3202999 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: emul: ln9310 test fixed chip rev ln9310_power_good()Aaron Massey2021-10-021-1/+7
| | | | | | | | | | | | | | | | | | Add functional modes to emulator & test ln9310_power_good() with 2S & 3S batteries on fixed chip revision. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Cq-Depend: chromium:3179310 Change-Id: I52d19f0115dfc0e792a4b321a95df0deb42b5fa1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3188557 Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* driver/charger: Remove unused functionsTom Hughes2021-10-011-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | When building with clang it warns: driver/charger/isl923x.c:116:34: error: unused function 'raw_read8' [-Werror,-Wunused-function] static inline enum ec_error_list raw_read8(int chgnum, int offset, int *value) driver/charger/isl923x.c:137:34: error: unused function 'raw_update16' [-Werror,-Wunused-function] static inline enum ec_error_list raw_update16(int chgnum, int offset, int mask, raw_update16 is only used in some configurations; remove ifdefs from callers. raw_read8 is not used at all, so it is removed. BRANCH=none BUG=b:172020503 TEST=make CC=arm-none-eabi-clang BOARD=elm -j TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Iaabdc5f4dfe8d6ad8a8ee5d157f284fff1ed676d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3197752 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: als_bh1730: Set last_valueGwendal Grignou2021-10-011-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>
* zephyr: charger: Allow multiple (different) chipsYuval Peress2021-10-012-14/+14
| | | | | | | | | | | | | | | | | There's no real restriction that the same chip needs to be used for charging. Remove 'choice' and allow multiple charging drivers to be set for the same board. This change also requires re-naming the mutex to avoid conflict because of the way Zephyr allocates them. BRANCH=none BUG=b:201602829 TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I522247bc7dbdae6d6c360a37dfbc1031f4058983 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195199 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* driver: Add support for BMI220 sensorMike Lee2021-10-013-19/+68
| | | | | | | | | | | | | | | Based on BMI260 sensor, add support for BMI220 sensor. BUG=b:188373185,b:193945779 BRANCH=dedede,kukui TEST=run factory test on storo360 Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Signed-off-by: Rong Chang <rongchang@chromium.org> Change-Id: Ifa88c7c58203ba405fde757b85570d53a27221a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3077595 Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
* accel: add probing support for kionix driverMichał Barnaś2021-09-301-0/+17
| | | | | | | | | | | | | | | Add function to probe the kx022 chip. BRANCH=main BUG=b:194424288 TEST=kx022 can be added as alternative motion sensor and it should be probed correctly Change-Id: Ib2d5c2b15dedf3a90e3c4ce0bffae9df2d29ac20 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3129963 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: motion: add support for icm426xx driverMichał Barnaś2021-09-302-0/+37
| | | | | | | | | | | | | | | | | Add support for icm426xx accel and gyro sensors. This allows to define these sensors in board's device tree. Add support for runtime probing of this sensor. BRANCH=main BUG=b:194424288 TEST=icm426xx sensor can be defined in zephyr build all dependencies are generated correctly Change-Id: I7a6499cb099c3edca8513b664d4948afea59998c Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3137943 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* driver: Remove unused functionTom Hughes2021-09-291-16/+0
| | | | | | | | | | | | | | | | | | When compiling with clang it warns that the function is unused: driver/accelgyro_lsm6dsm.c:45:29: error: unused function 'get_fifo_type' [-Werror,-Wunused-function] static inline enum dev_fifo get_fifo_type(const struct motion_sensor_t *s) BRANCH=none BUG=b:172020503 TEST=make CC=clang V=1 BOARD=arcada_ish Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibc52e25a2f750e8da8335e7835475db7a5d42670 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3193275 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* SSFC: Framework to support two charger sourcesParth Malkan2021-09-241-14/+21
| | | | | | | | | | | | | | | | | | Many platforms have requirements to support more than one charge source (eg. pirika). It can't be supported by just enabling two different CONFIGS as that can lead to conflicts. Eg.USD_PD_VBUS_DETECT_TCPC vs USB_PD_VBUS_DETECT_DISCHARGE. This change provides a framework that supports two different charger sources in the same build. Please see the CL for relevant logs. BRANCH=None BUG=b:194375840 TEST=make -j buildall Signed-off-by: Parth Malkan <parthmalkan@google.com> Change-Id: I309cc5930233983e615d90a4290fc749abf7aa2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088232 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: drivers: thermistors are device tree nodesAaron Massey2021-09-241-3/+4
| | | | | | | | | | | | | | | | | | | Thermistor drivers now query the device tree for configuration. Thermistor tests have been updated to be parameterized on all thermistors enabled in the device tree. BRANCH=none BUG=b:184374937 TEST= 1) zmake testall 2) make runhosttests Cq-Depend: chromium:3161332 Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: Ic5330cd5c33e79e192428ca857651de9a225856e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133812 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* driver/tcpm/it83xx: turn both cc pins off when disable VconnRuibin Chang2021-09-241-9/+17
| | | | | | | | | | | | | | | | | | | | | If the pd port has previous connection and supplies Vconn, then RO jumping to RW reset the system, we never know which cc is the previous Vconn pin, so we always turn both cc pins off when disable Vconn power switch. BUG=b:199461325 BRANCH=none TEST=on board haboki, RO jump to RW, check Vconn low and pd can nego Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I526af287d3f52ca27c38f342553aac9b3a241d84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3178341 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Commit-Queue: Diana Z <dzigterman@chromium.org>
* driver/tcpm/it8xxx2: turn both cc pins off when disable VconnRuibin Chang2021-09-241-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | If the pd port has previous connection and supplies Vconn, then RO jumping to RW reset the system, we never know which cc is the previous Vconn pin, so we always turn both cc pins off when disable Vconn power switch. This change is leveraged from it83xx (CL:3178341), although Vconn is controlled by ppc on asurada series and asurada series don't happen the bug, but we still need this change for the future that if there is a project control Vconn by GPIO. BUG=none BRANCH=none TEST=make board hayato Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I66e7961d5ba412c18948a433103c17b79e7c5e08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3180703 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* driver: lsm6dsm: remove load_fifo_sensor_state_tGwendal Grignou2021-09-232-38/+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>
* Revert "DP/TBT/USB4: Retimer WA resolved Brya TBT lane bonding issue in AP mode"madhusudanarao amara2021-09-231-20/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit f0985f8a11585f6a704aa94a8354bd5b934619ac. Reason for revert: Issue is resolved after setting the Force BB Retimer GPIO (GPP_E4) to 0. It is a coreboot change. BUG=b:195375738 BRANCH=None TEST=TBT enumerated no lane bonding issue is observed with above coreboot code change with reverted EC WA. Signed-off-by: madhusudanarao amara <madhusudanarao.amara@intel.corp-partner.google.com> Change-Id: I09a8a53aec9ba3757189a091606922bc7a133ba7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3162936 Reviewed-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* driver: bmi3xx: simplify irq handlerGwendal Grignou2021-09-232-261/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove unnecessary structure: - bmi3_fifo_data, bmi3xx_drv_data - put static buffer in local bmi3_fifo_frame - Tighten interrupt routine - Use word to avoid intermediate copy - Trust fifo configuration from fifo_enable. - Process FIFO until interrupt indicates it is empty. - Simplify bmi3_parse_fifo_data - Use loop to avoid code duplication. - Remove intermediate variable. - Use word to process FIFO. - Remove blank lines, use inverted christmas tree convention. - Use constant when appropriate. - Set FIFO watermark to 3 words to catch single acceleromter event when gyroscope is disabled. BUG=b:195264765,b:178398789 BRANCH=none TEST=Run `tast run guybrushlocal hardware.SensorIioserviceHard' in loop. Change-Id: I55da91a557b8c51f707dc29b4867cc715dce2cca Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170618 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Revert "driver: bmi3xx: Set FIFO watermark to 6 words"Gwendal Grignou2021-09-231-1/+1
| | | | | | | | | | | | | | | | | | This reverts commit 5786cdd32f9d8ba7da8b2d9764b06dfeb991f5ff. FIFO is not always 6 words: When the gyroscope is disabled, the FIFO will only contains 3 words. BUG=b:178398789,b:195264765 BRANCH=none TEST=Compile Cq-Depend: chromium:3170618 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I1cc0f6e31bb06a2ea11a815ea1f360766fb5d474 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172267 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com>
* ccgxxf: Add correct I2C address flagsstabilize-14235.B-mainVijay Hiremath2021-09-221-2/+1
| | | | | | | | | | | | | | | | CCGXXF exposes I2C addresses 0x0B for 1st port & 0x1B for second port hence corrected the I2C address flags in header file. BUG=none BRANCH=none TEST=Able to initialize second Type-C port Change-Id: I9dc955d1035b1f488e92a47cdac49bdd6154f4ae Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172253 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* driver: lis2dw12: fix init timeout loop conditionYuval Peress2021-09-211-3/+1
| | | | | | | | | | | | | | | | | | | | The loop condition for the soft reset was incorrect, on a failure to read the soft reset register, the loop would hit the `continue` command which would then test (status & LIS2DW12_SOFT_RESET_MASK) != 0 and leave us at the mercy of the status value left on the stack. BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/projects/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Iebeafe9c57c71713a1df5230e60ac067209ec5b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170538 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver: accel_lis2dw12: use ret in init as the return valueYuval Peress2021-09-211-4/+4
| | | | | | | | | | | | | | | | Use the value in ret during the lis2dw12_init function to differentiate between errors. BRANCH=none BUG=b:200046770 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id31f01e09ff1305a4cd0ab14d56a05172a263760 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3170536 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ps8xxx: Add support for ps8815 A2 with bad FWCaveh Jalali2021-09-211-0/+7
| | | | | | | | | | | | | | | | This adds the low level chip ID of the ps8815 A2 so we can recognize the chip when its main firmware is inoperative. BRANCH=none BUG=b:186189039 TEST=with next patch in series, verified the brya EC reports the correct device ID when the firmware is corrupted. Change-Id: I2696b9c20fdefd8afd02f7394a45f1c4c5636d71 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857796 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Remove mux set from HPD updateDiana Z2021-09-161-7/+0
| | | | | | | | | | | | | | Now that the BB retimer has its own HPD update function, the extra mux set can be removed from the general USB mux code. BRANCH=None BUG=b:195773400 TEST=on voxel, pass tast typec.Mode*.manual Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ica83c2c568799d7686d8cfdbc5b0f446a6ebcb8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163931 Reviewed-by: Keith Short <keithshort@chromium.org>
* BB Retimer: Create HPD update functionDiana Z2021-09-161-0/+32
| | | | | | | | | | | | | | | | The BB retimer may use a simple read/modify/write on its configuration register to set HPD fields, rather than needing to rely on a call to a full mux set later to achieve this. Introduce an API so boards using the BB retimer may move to using this function. BRANCH=None BUG=b:195773400 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iae87c0860350fed32f69e0ea3b6530cd7e5ba111 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163929 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Gate ACK event send on ACK waitingDiana Z2021-09-161-1/+11
| | | | | | | | | | | | | | | | | Currently, the EC doesn't always wait for an ACK from the virtual mux but it will still always send the AP ACK onto the PD task. This means we have some risk of a previous ACK being present in the task events already when we begin a new wait. Remove this risk by only sending the event to the task when there is a task waiting. BRANCH=None BUG=b:186777984 TEST=tast typec.Mode*.manual tests on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I1e4cf96af838c0cbe4ef549337b304679b59d641 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078414 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Add access locksDiana Z2021-09-161-0/+22
| | | | | | | | | | | | | | | Currently, there are three separate tasks which can access the muxes at once (host command, PD, and chipset). As such, locking should help coordinate sets and gets to each port. BRANCH=None BUG=b:172222942 TEST=tast typec.Mode*.manual on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I003a2eee06e4b44241308d8b64da597bd17c8878 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078413 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB MUX: Update mux HPD update interface to use mux_state_tDiana Z2021-09-161-9/+7
| | | | | | | | | | | | | | | | | Since the drivers are now taking a mux_state_t set of flags to update, go ahead and unify the usb_mux API this way as well. It makes the parameters more apparent than the 1/0 inputs, and aligns the stack to use the same parameters. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie943dbdf03818d8497c0e328adf2b9794585d96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095438 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* rt1718s: refactor: move gpio control to driver moduleTing Shen2021-09-142-6/+74
| | | | | | | | | | | | | | | | | | | | This CL moves RT1718S gpio control from board file to common driver codebase, and implements the set flag and get/set level functions. Note that this CL does not fully implement IOEX interface because TCPC has different init process than usual ioexpanders. BUG=none TEST=1) pass faft_pd 2) manually test pd source/sink/frs on port 1 BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: If2a0bca2b13ad4748eea54b4c8004da7dc6fc6a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159643 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* bmi3xx: Fix sensor_num in ec_response_motion_sensor_dataRob Barnes2021-09-141-2/+1
| | | | | | | | | | | | | | | | | | The sensor_num should match the sensor index of the sensor that produced the data. It was incorrectly set to sens_cnt, which is just the offset of the sensors on the bmi3xx. BUG=b:195264765, b:197186738 TEST=Passed the following tests on guybrush: iioservice_simpleclient --channels='accel_x' --frequency=12.5 --device_id=2 --samples=1 run cts -m CtsSensorTestCases -t android.hardware.cts.SensorBatchingTests#testAccelUncalibrated_50hz_batching BRANCH=None Change-Id: Id51ea52a0426fc50a5001437e720eedf41c333ad Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150058 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>