summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
...
* raa489000 : control ALERT_B when wake from hibernationYongBeum.Ha2021-04-161-0/+11
| | | | | | | | | | | | | | | | When 'Enable ADC' on Control3 is cleared, EN_DIS_MCU_LDO_IN_BAT on Control8 and EN_DIS_GP_COMP_IN_BAT on Control4 must be cleared to set ALERT_B. BUG=b:185434129 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I6f77c0cfb727a66128ef95115a02d2fd49a04ad9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2830654 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* mp2964: Add PMIC driverCaveh Jalali2021-04-163-0/+177
| | | | | | | | | | | | | | | | | This adds a driver for the mp2964 IMVP9.1 PMIC. This driver enables programming control registers within the PMIC. BRANCH=none BUG=b:185424011 TEST=buildall passes. functional testing was done with the follow-on patch. Change-Id: I9b2d89007b5f6933ceeb9a1bcd3bbefb819888a3 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2827950 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* bq25710: Sort registers in numerical orderCaveh Jalali2021-04-162-14/+14
| | | | | | | | | | | | | | | | This sorts the register reporting in the charger_dump command to be numeric order. The original order was probably motivated by the bq25710 datasheet which lists registers out of order. The bq25720 datasheet lists registers in numeric order which makes cross referencing easier. BRANCH=none BUG=b:185190976 TEST=buildall passes Change-Id: I79eca2d1926bd87d77d710e812fc6d18e4b4d2e8 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2819587 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* zed: update touchpad parameterTing Shen2021-04-151-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update touchpad parameter for zed. There's no integer solution for CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y (calculation appended below), this CL also modified the runtime check in elan tp driver to allow rounding errors. Math details: Given dpi_y = 800, LOGICAL_MAX_Y = 1811, we want to find an integer PHYSICAL_MAX_Y such that dpi == 254 * LOGICAL_MAX_Y / PHYSICAL_MAX_Y. The closest solution is 1) PHYSICAL_MAX_Y = 574, 254 * LOGICAL_MAX_Y / PHYSICAL_MAX_Y = 801.3832 != dpi_y, or 2) PHYSICAL_MAX_Y = 575, 254 * LOGICAL_MAX_Y / PHYSICAL_MAX_Y = 799.9895 != dpi_y Both cannot pass our runtime verification. BUG=None TEST=No "TP mismatch" in ec console BRANCH=trogdor Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I9d0c54d029bb2f9e78114341a6246857b41937b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2825473 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* raa489000 : clear 'Enable ADC' bit on port 1YongBeum.Ha2021-04-151-9/+10
| | | | | | | | | | | | | | 9mW is reduced on S0iX power consumption by clearing 'Enable ADC' bit. BUG=b:178356507 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I585ce87bf778f8386edfe8ccaaf1aa53f0374eff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801175 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* sm5803: Add hysteresis control for TINTDevin Lu2021-04-142-7/+26
| | | | | | | | | | | | | | | | To prevent sm5803 is triggering INT2 continually when temperature near to 330 K. This patch adds hysteresis control for TINT. BUG=b:185209738 BRANCH=firmware-dedede-13606.B-master TEST=i2c analyzer to see INT2 is not trigger continually. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ib83fbc3c84a872bc393084a0c651e14b35efbdcf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2825077 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* ISL923x: Add the conversion of the written valueMike Lee2021-04-141-2/+2
| | | | | | | | | | | | | | | Use "AC_CURRENT_TO_REG(CUR)" "CURRENT_TO_REG(CUR)" to convert the written value in set_ac_prochot and set_dc_prochot. BUG=None BRANCH=dedede TEST=make BOARD=sasukette successfully,and local build test ok Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Change-Id: I429a3de95d42eec6b55961c286c2eaa7a0328b94 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2781501 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* bq25720: Add new register for dumpingCaveh Jalali2021-04-132-0/+2
| | | | | | | | | | | | | | | This adds the BQ25720_REG_CHARGE_OPTION_4 register to the list of registers dumped by the charger_dump command. This register does not exist on the bq25710. BRANCH=none BUG=b:185190976 TEST=buildall passes Change-Id: I475007951cc1dd770ccca7c3704c2d5d3f6de04e Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2819585 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* bq25710: Remove duplicate register declarationCaveh Jalali2021-04-132-2/+0
| | | | | | | | | | | | | | This removes a duplicate declaration of BQ25710_REG_PROCHOT_OPTION_1 and listing the register twice when dumping chip registers. BRANCH=none BUG=b:185190976 TEST=buildall passes Change-Id: I8cef74af8914509226b0345b076feb7cdeaf84c5 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785268 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* bq25710: Fix ADCVSYSVBAT register numberCaveh Jalali2021-04-131-1/+1
| | | | | | | | | | | | | | | This corrects the ADCVSYSVBAT register number definition. This register is only referenced when dumping chip registers, so this change has no operational impact. BRANCH=none BUG=b:185190976 TEST=buildall passes Change-Id: I6a17fecd0791f941e8670e0f284d51ba241069db Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2819586 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* Export even more symbols from ps8xxxSimon Glass2021-04-131-9/+0
| | | | | | | | | | | | | | | | | It turns out we need more symbols for some boards, such as when the board_get_ps8xxx_product_id() function is implemented. Export some more things. BUG=b:183296099 BRANCH=none TEST=make BOARD=lazor -j30 Build lazor on zephyr Change-Id: Iccef72582f6033a1a34abe28a636ebe254f1bd5a Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822390 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* bq25720: Extend ADC conversion timeoutCaveh Jalali2021-04-132-3/+14
| | | | | | | | | | | | | | | | | | | | This extends the ADC conversion timeout to 2x 25ms. The bq25720 spec is 25ms whereas the bq25710 spec is 10 ms. So, increase the timeout. Also, to keep the math simple, time out after 200% of the expected time instead of 160%. Hopefully, this fixes the "Could not read VBUS ADC! Error: 4" messages (and root cause) in the EC console. BRANCH=none BUG=b:185004089 TEST=no timeouts observed during a 48 hour run, previously timeouts would happen within a few hours. Change-Id: Iaed0c000577d71eb7d1d136dd81f598b9087ee80 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2819584 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* guybrush: Fix ANX7451 driverRob Barnes2021-04-122-26/+23
| | | | | | | | | | | | | | | | | | Correct i2c address of ANX7451 on guybrush. Do not attempt to read or write mux in Z1 since mux is not powered. The only required init step is to disable ultra low power. So init can be removed if ultra low power is always set inside set. Prevent disabling both DP and USB at the same time since this causes mux to fail. BUG=b:184907521, b:184908498 TEST=Display port works on Guybrush B2 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Icdcc2df6034680844635c8b8675402d0825f34a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2816306 Reviewed-by: Diana Z <dzigterman@chromium.org>
* pi3usb3x532 : check vendor idYongBeum.Ha2021-04-092-0/+17
| | | | | | | | | | | | | Add read function to get vendor id BUG=b:182596801 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Ie6afdfc630d52b53936b7fa1024f73d24ff0cfaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809777 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ps8743 : get chip IDYongBeum.Ha2021-04-092-0/+23
| | | | | | | | | | | | | Add read function to get chip id BUG=b:182596801 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Icf33030a7f013a85fe27e8c8c54b8e4494a01817 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801176 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* guybrush: Dynamically configure C1 muxRob Barnes2021-04-091-0/+2
| | | | | | | | | | | | | | | | | Two C1 muxes are currently supported for guybrush. Configure the correct C1 mux at runtime based on fw_config. Move board_c1_ps8818_mux_set to guybrush board.c since it's board specific tuning. BUG=b:184548806 TEST=Build and run on guybrush B2 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I6ff809a9cbd1ddc2a408d2ce84f75d6723b7844f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809259 Reviewed-by: Diana Z <dzigterman@chromium.org>
* isl9241: Toggle learning mode when fully chargedDevin Lu2021-04-091-0/+25
| | | | | | | | | | | | | | | | In low-power states, the ISL9241 may become stuck in CCM, consuming excess power. Toggle learning mode to enter DCM and save power. This is a workaround recommended by Renasas. BUG=b:183771327 BRANCH=firmware-volteer-13672.B-main TEST=Verifed charger doesn't stuck in CCM mode. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I70bf088b9214fd4b3cee137da561ba84e854106a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789811 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* AMD FP6 Mux: Correct ready bitDiana Z2021-04-092-1/+3
| | | | | | | | | | | | | | Ready will actually be indicated by bit 6 in the status return. BRANCH=None BUG=b:184680878 TEST=on guybrush, confirm we see C1 mux as "ready" and try to set appropriate state Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic522add422f06acddaf88a445398727a0e5be482 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2811940 Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
* guybrush: Add header for ANX7491 retimerRob Barnes2021-04-081-0/+17
| | | | | | | | | | | | | | | Adding a header to hold register values for ANX7491. ANX7491 should work without configuration. More registers can be added as needed for tuning. BUG=b:184592168 TEST=Build BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: If529bfdedff6b151147c8ef02840621b093be672 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809881 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Revert "RAA489000: Clear debug accessory state on init"Diana Z2021-04-071-15/+0
| | | | | | | | | | | | | | | | This reverts commit 756dc91b0a57aa6d557ee4cb486972d8a7b8106a. There will now be a general debug detach on entry to Unattached.SNK/SRC every boot and so this should no longer be necessary. BRANCH=None BUG=b:177870522 TEST=on galith, ensure that refresh+power resets with servo_v4 sink plugged in results in a successful connection with the servo_v4 Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I991ca7fbb5d51d2d8fc07d3a8d8e885e43e94b44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2792691 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* RAA489000: Check battery level in debug detachDiana Z2021-04-071-0/+5
| | | | | | | | | | | | | | | Since our debug detach routine requires setting our CC's to open, we may end up losing Vbus. Protect ourselves by checking the battery level prior to allowing this to be set. BRANCH=None BUG=b:183619502 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I45acb7bce2f9a312c2f35ec74dc4563a947ee059 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2792689 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Revert "fpsensor: Support building firmware that works for both sensors"Tom Hughes2021-04-0710-145/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac08c9d1dbc9f587df3ee6b15d58c0203f7e356e. Reason for revert: Breaks public build Original change's description: > fpsensor: Support building firmware that works for both sensors > > This is a refactoring to allow building FPMCU firmware that works for > one FPC sensor and one ELAN sensor. > > 1. When both drivers implement our common functions, e.g. fp_sensor_init(), > rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). > 2. There are a few functions implemented not in FPC driver but in FPC > private library, e.g. fp_sensor_finger_status(). I kept this as-is for > FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() > 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c > because the sensor type GPIO always says FPC. > > BRANCH=none > BUG=b:175158241 > TEST=make run-fpsensor; make run-fpsensor_status; > make run-fpsensor_crypto > TEST=make -j BOARD=dartmonkey > TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; > make -j BOARD=bloonchipper > Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) > TEST=run device tests with http://crrev/c/2750547 and > http://crrev/i/3654297 on Dragonclaw, all pass > > Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 > Signed-off-by: Yicheng Li <yichengli@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> > Commit-Queue: Tom Hughes <tomhughes@chromium.org> Bug: b:175158241, b:184616069 Change-Id: I2a02a6eefc316e7e13aa188f1ae16672dce2babd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809521 Auto-Submit: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* SM5803: Add interrupt processing function to headerDiana Z2021-04-061-0/+3
| | | | | | | | | | | | | | | Expose the function for interrupt processing for use by other tasks, such as the PD_INT task if the charger chip is sharing an IRQ line with the TCPC. BRANCH=None BUG=b:182534117,b:183679237 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic147fc282ecd5954c95e0c71e230c27b8c91186b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2803461 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* bq25720: Add VSYS_TH2 tuning supportCaveh Jalali2021-04-062-0/+26
| | | | | | | | | | | | | | | | | | This adds support for tuning the bq25720 VSYS_TH2 threshold so that a custom threshold voltage can be specified. The default 3.2v for 1S batteries and 5.9v for 2S (or more) batteries may need to be adjusted to improve system stability. When VSYS droops to this threshold, PROCHOT is asserted to reduce system power demand. BRANCH=none BUG=b:183474163 TEST=with rest of patch stack, booted brya to the OS without a battery Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I7f52a369371eb93860b14ad8438b790af231c450 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798979 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* PCHG: Support firmware updateDaisuke Nojiri2021-04-051-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds EC_CMD_PCHG_UPDATE, which allows the host to update firmware of ctn730 via I2C. An updater (e.g. ectool) is expected to issue EC_PCHG_UPDATE_CMD_OPEN, multiple EC_PCHG_UPDATE_CMD_WRITEs, then EC_PCHG_UPDATE_CLOSE. Each sub-command completion is notified to the host via EC_MKBP_EVENT_PCHG. An updater is supposed to wait for the previous sub-command to complete before proceeding to the next. Example: localhost ~ # ectool pchg 0 State: DOWNLOAD (6) FW Version: 0x104 localhost ~ # ectool pchg 0 update 0x207000 0x105 /path/to/image.bin Update file /path/to/image.bin (85632 bytes) is opened. Writing firmware (port=0 ver=0x105 addr=0x207000 bsize=128): ********************************************************************** FW update session closed (CRC32=0x7bd5c66f). localhost ~ # ectool pchg 0 reset Reset port 0 complete localhost ~ # ectool pchg 0 State: ENABLED (2) FW Version: 0x105 BUG=b:182600604, b:173235954 BRANCH=trogdor TEST=ectool pchg 0 update 0x201200 0x105 /tmp/user_ee_X0.1_V1.5.bin TEST=ectool pchg 0 reset Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I9c62f1714dd69428ab5870c443cb4eb77881a6c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757099
* fpsensor: Support building firmware that works for both sensorsYicheng Li2021-04-0210-71/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring to allow building FPMCU firmware that works for one FPC sensor and one ELAN sensor. 1. When both drivers implement our common functions, e.g. fp_sensor_init(), rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). 2. There are a few functions implemented not in FPC driver but in FPC private library, e.g. fp_sensor_finger_status(). I kept this as-is for FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c because the sensor type GPIO always says FPC. BRANCH=none BUG=b:175158241 TEST=make run-fpsensor; make run-fpsensor_status; make run-fpsensor_crypto TEST=make -j BOARD=dartmonkey TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; make -j BOARD=bloonchipper Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) TEST=run device tests with http://crrev/c/2750547 and http://crrev/i/3654297 on Dragonclaw, all pass Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* usb_mux: ps8822: Add support to adjust rx DP EQ settingScott Collyer2021-04-022-10/+67
| | | | | | | | | | | | | | | | | | | | | | This CL modifies the PS8822 usb_mux driver to support multiple pages (there is a page 0, 1, and 2 for this chip). The usb_mux driver only needs access to page 0, but page 1 access is needed for DP EQ settings. In addition this CL adds a new driver function to allow setting of the DP Rx equalization gain value. BUG=b:178656398 BRANCH=None TEST=tested on quiche and verified the register is programmed when DP mode is active. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I65cb2fc2c982b01537eb60c0b9da30f4363419aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686918 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* bq25720: Add Vmin Active Protection registerCaveh Jalali2021-04-012-0/+6
| | | | | | | | | | | | | | | | This adds the definition for the bq25720 (not present on bq25710) Vmin Active Protection Register (0x37). We don't actually use this register at this point - it's only added to the register dump list. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: If46c4a3169c0b5411179a67ad2c0532d1ddd50a4 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780839 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* ppc/syv682x: support C versionEric Yilun Lin2021-04-012-11/+50
| | | | | | | | | | | | | | | | | | | | | | C version won't block I2C accessing to CONTROL4(to on/off Vconn) reg when smart discahrge enabled. This allows us to re-enable the smart discahrge on boards using SYV682C. This CL support the feature by adding: 1. CONFIG_USBC_PPC_SYV682C 2. CONFIG_USBC_PPC_SYV682X_SMART_DISCHARGE also, hayato uses different SYV682 versions across revisions, add a overridable function syv682x_board_is_syv682c() for handling board revision issue. BUG=b:160548079 b:176876036 TEST=Hayato meets tVconnOff, and tVbusDischarge BRANCH=asurada Change-Id: I89b57b8c20907249d5d97140289fb0570bd58b46 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2738506 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* SYV682x: Fix Source OCP for SYV682B revisionEric Herrmann2021-03-312-14/+19
| | | | | | | | | | | | | | | | | | | | Force the EC to wait at least 15ms before checking to see if the alerts are cleared. This will fix source OCP for the SYV682B, which added a 10ms HW deglitch to the source OC alert. BUG=b:183761055 TEST=Check that OCP is triggered instead of TSD when the port is overloaded on SYV682B TEST=Check that the SYV682A OCP still works with 100ms deglitch TEST=make buildall BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: I40207fecc034a8e8238f0deaa7beeaf8dab2a2d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787706 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Create a public header for bmi160Hyungwoo Yang2021-03-311-21/+1
| | | | | | | | | | | | | | | | Create a separate public header for bmi160 so we can include it from Zephyr. BUG=b:173507858 BRANCH=none TEST=make BOARD=lazor -j4 Change-Id: Ib35d473b3f4e1a566ef35cd5e203b6acbf93319b Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793047 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* stm32gx: ucpd: BIST mode control and correct nRetryCountScott Collyer2021-03-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | This CL implements the driver method to enable/disable BIST test mode in the ucpd driver. When this mode is enabled, the upcd driver only needs to send GoodCRC messages in response to BIST data messages which are received. This CL also fixes the value of nRetryCount to make it based off the port partner'd USB-PD version. BUG=b:181179550 BRANCH=None TEST=Manual Verified that nRetryCount fix enables TD.PD.LL.E3. Soft Reset Usage to pass. Verfied that adding BIST mode control enables TD.PD.PHY.E1. BIST Test Data to pass. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I251e1c3c235d976d934406cdb22df0c177c6f14b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2667241 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* raa489000: Add raa489000_enable_asgate()Aseda Aboagye2021-03-302-0/+9
| | | | | | | | | | | | | | | | | | | This commit exports a function to allow the ASGATE to be enabled or disabled when the charger IC is in the READY state. This can help to achieve a VBUS level of 0V if the READY state is required/desired. BUG=b:183220414 BRANCH=dedede TEST=With some other patches to use this function, build and flash on madoo, plug in a charger, remove charger, verify that VBUS goes down to less than 200mV and decays to 0. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Icb5316d9c206138e68fa4e55dee5b454182921e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793057 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* common: motion_sense: Prevent on/off body from waking up deviceGwendal Grignou2021-03-291-2/+5
| | | | | | | | | | | | | | | | | | | | Introduce a new flag: BYPASS_FIFO to raise an interrupt to the AP when an event is sent. It is not as strong as WAKEUP, as it does not wake up the AP. BYPASS_FIFO must be set when WAKEUP is set. It is applied to sync sensor as well as gesture/activity sensor. BUG=b:123434029 BRANCH=trogdor TEST=Compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Id5aba71e6d11ef31f7fa2c67ba2e07178d088b1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780834 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org> Tested-by: Ching-Kang Yen <chingkang@chromium.org> Commit-Queue: Ching-Kang Yen <chingkang@chromium.org>
* Revert "touchpad_elan: implement sleep mode"Ting Shen2021-03-291-41/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1e86df339d40526911ebea45530b20c36be47a5d. Reason for revert: b/176137996#comment65 Original change's description: > touchpad_elan: implement sleep mode > > Implement sleep mode to save S3 power. After this patch, the touchpad > enters sleep mode when suspend with lid opened. > > Also did some refactor but the logic doesn't change > > BUG=b:176137996 > TEST=tested following scenarios: > 1) suspend when lid open > 2) lid close > 3) hammer reboot > verify that power/sleep state are configured correctly > BRANCH=trogdor > > Signed-off-by: Ting Shen <phoenixshen@google.com> > Change-Id: I0742460ef5d3ec34c6bf16ee4a02a87966069087 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2752530 > Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> > Commit-Queue: Ting Shen <phoenixshen@chromium.org> > Tested-by: Ting Shen <phoenixshen@chromium.org> Bug: b:176137996 Change-Id: I0be526ee74b127b7a3ef901b885d825f2356d0c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789781 Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* Revert "ps8815: delete CONFIG_USB_PD_TCPM_PS8815_FORCE_DID"Zhuohao Lee2021-03-251-0/+45
| | | | | | | | | | | | | | | | | This reverts commit e2761c8be4571adcfc425a9187290872ffa9d02d. In order to support the old TCPC chip which bcd revision is smaller than 0x7, we need to bring back the CONFIG_USB_PD_TCPM_PS8815_FORCE_DID and force the TCPC firmware be updated in the factory line. BUG=b:177251013, b:159289062, b:182018599, b:178978970 BRANCH=firmware-volteer-13672.B TEST=the old TCPC chip can update its firmware. Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Change-Id: I66d12aee569137cc7823a186e3251ca8b187e767 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2784327 Reviewed-by: Keith Short <keithshort@chromium.org>
* touchpad_elan: implement sleep modeTing Shen2021-03-251-24/+41
| | | | | | | | | | | | | | | | | | | | | | Implement sleep mode to save S3 power. After this patch, the touchpad enters sleep mode when suspend with lid opened. Also did some refactor but the logic doesn't change BUG=b:176137996 TEST=tested following scenarios: 1) suspend when lid open 2) lid close 3) hammer reboot verify that power/sleep state are configured correctly BRANCH=trogdor Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I0742460ef5d3ec34c6bf16ee4a02a87966069087 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2752530 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* bq25710: Update legacy system_is_in_rw checkCaveh Jalali2021-03-251-1/+1
| | | | | | | | | | | | | | | | This replaces the legacy use of system_is_in_rw() with system_jumped_late() which handles the case where EFS2 causes a very early sysjump to EC-RW. BRANCH=none BUG=b:183475660,b:183165732 TEST=forced EC-RW hash match so EFS2 would jump to EC-RW. verified brya can boot AP using EC-RW. Change-Id: I57b63fe47712d36c614c1fe051bd5bcb9d0d7ff6 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785266 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ctn730: Print firmware versionDaisuke Nojiri2021-03-241-0/+1
| | | | | | | | | | | | | | | | | | This patch makes ctn730 driver print the firmware version. EC_CMD_PCHG is updated to version 1 and returns firmware version of a charger chip. Version 0 of EC_CMD_PCHG is deprecated. BUG=b:182600604, b:173235954, b:183151376 BRANCH=Trogdor TEST=Verify firmware version is printed on EC console. TEST=ectool pchg 0 (for version 1) TEST=cat /sys/class/power_supply/PCHG0/* (for version 0) "ERR kernel: [ 33.394847] cros-ec-pchg cros-ec-pchg.13.auto: Unable to get port.0 status (err:-524)" Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ib7bb9a7225fe914bc6c8d600d0f4766dbf75ace8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757098
* tusb1064: Add full list of possible I2C device addressesScott Collyer2021-03-241-1/+24
| | | | | | | | | | | | | | | | | | The TUSB1064 has 16 possible I2C device addresses. This CL adds this full list to the tusb1064.h file. In addition, the TUSB1064 device address was updated to match the new macro. BUG=b:168621142 BRANCH=servo TEST=make -j buildall Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I1ee836ef0a88adab1af63901c2ec0be7cef7b232 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267630 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: DT: support TCS3400Hyungwoo Yang2021-03-241-0/+20
| | | | | | | | | | | | | | | | | | This change is to support TCS3400 via DT. The change includes, using DT, - creating TCS3400 driver specific data - creating motion sensor entry for TCS3400 - creating the TCS3400 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I09cb7d69baa95c8450c7f5cc0149038aa23f3bc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778822 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support BMI260Hyungwoo Yang2021-03-241-0/+20
| | | | | | | | | | | | | | | | | | This change is to support BMI260 via DT. The change includes, using DT, - creating BMI260 driver specific data - creating motion sensor entry for BMI260 - creating the BMI260 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Id5c64df4d2f14a50709ac15855567a67671b8515 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778821 Reviewed-by: Simon Glass <sjg@chromium.org>
* isl923x: change control1_mutex to use K_MUTEX_DEFINEJack Rosenthal2021-03-231-2/+1
| | | | | | | | | | | | | | Convert control1_mutex to use K_MUTEX_DEFINE(), removing the requirement for runtime initialization on Zephyr. BUG=b:177677037 BRANCH=none TEST=zmake testall && make buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I4aa0cba73e4283d6050ddbe46bda542788bcab0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782238 Reviewed-by: Simon Glass <sjg@chromium.org>
* isl9241: change control1_mutex to use K_MUTEX_DEFINEJack Rosenthal2021-03-231-4/+1
| | | | | | | | | | | | | | Convert control1_mutex to use K_MUTEX_DEFINE(), removing the requirement for runtime initialization on Zephyr. BUG=b:177677037 BRANCH=none TEST=zmake testall && make buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I7a24cc23855dc6884ed891ebee7e337821524d9a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782237 Reviewed-by: Simon Glass <sjg@chromium.org>
* Create a public header for isl923xSimon Glass2021-03-232-41/+5
| | | | | | | | | | | | | | | | Add a separate public header for this chip so we can include it from Zephyr. Update the charger file to use that header, so it builds on Zephyr. BUG=b:183296099 BRANCH=none TEST=make BOARD=lazor -j4 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I54506ef17ecda2683f1c1a933f1978df458e08ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774916 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* charger: Update BQ25720 configsCaveh Jalali2021-03-221-0/+1
| | | | | | | | | | | | | | | | | This updates how we select between the BQ25720 and BQ25710 charger chips. The BQ25720 charger chip can now be enabled without enabling the BQ25710 charger chip. Both chips are still supported by the same driver and the choice of BQ25720 vs. BQ25710 remains a compile time configuration. BRANCH=none BUG=b:180980490 TEST=buildall passes Change-Id: If632af0b68d8cf73e5c2436a05b1641e4467d8f8 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774701 Reviewed-by: Keith Short <keithshort@chromium.org>
* Coachz: Change stylus detection interval from 100 to 500 mshanwenchao2021-03-221-1/+1
| | | | | | | | | | | | | | | | | | EE confirmed detection interval from 100 to 500 ms, power consumption reduce to 11 mW from 26 mW. But the pen detection time becomes longer. BRANCH=trogdor BUG=b:181359593 TEST=check the stylus detection Signed-off-by: hanwenchao <hanwenchao@huaqin.corp-partner.google.com> Change-Id: I9c2f9f6def4ccf18bc06f1f628cda73be051f91c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721321 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: ln9310: move ln9310.h header to include/Jack Rosenthal2021-03-202-189/+1
| | | | | | | | | | | | | | | Move driver/ln9310.h to include/driver/ln9310.h so this header can be readily included from Zephyr builds. BUG=b:183054226 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I47c1d8dc8af90c690639ef1621cc66a9946ba40b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776220 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* driver: ln9310: use CC_I2C for loggingJack Rosenthal2021-03-201-3/+3
| | | | | | | | | | | | | | | | | | CC_CHIPSET is only available if the chipset task is enabled, but the ln9310 has no other dependencies on power sequencing. Bringup may require this driver to be enabled before power sequencing. It makes more sense to log to the I2C channel, since we communicate with this chip on I2C. BUG=b:183054226 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3b040c88613be6075a834c6758b79965ab88fd76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776219 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* ctn730: Make reset pulse 15 usecDaisuke Nojiri2021-03-181-1/+6
| | | | | | | | | | | | | | | | | | | This patch changes the reset pulse from 1 msec to 15 usec. The datasheet says the minimum reset pulse length is 10 usec. This is better not to be a sleep especially if it's long (e.g. ~1 ms) since the PCHG state machine may try to access the I2C bus, which is held low by ctn730 during reset. BUG=b:173235954 BRANCH=trogdor TEST=Stylus connect, disconnect, charge events are triggered as expected. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ibe611b32bd0f88ad875b24c38bbea577d8d4ec10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2770505 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>