summaryrefslogtreecommitdiff
path: root/driver/ln9310.c
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-051-573/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* driver: ln9310: check return codesYuval Peress2021-09-131-93/+82
| | | | | | | | | | | | | | | | | | | Allow better code coverage by checking return codes in various internal static functions. BRANCH=none BUG=b:184856083 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I28afe0538ed9ac98d4ecb9c499d218cd11cbc1ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158736 Commit-Queue: Yuval Peress <peress@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* driver: ln9310: include status in error codeYuval Peress2021-09-021-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I7963baa87d6edbd208fb8bad5c80866f26527748 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3138385 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: ln9310: Update init function signature to return statusYuval Peress2021-09-011-7/+8
| | | | | | | | | | | | | | | Return the status of the init function. This will be used in testing to verify that initialization was correct. BRANCH=none BUG=b:184856083 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I578b32b24b3ee59abf646307fb9670d2db74fe3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133624 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* driver: ln9310: fix typoYuval Peress2021-08-311-1/+1
| | | | | | | | | | | | | | | | | | There's a bug in the chip_revision calculation. Also, add a missing include which causes a warning during build. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Id636f4abcfffc0158d879d4b9333c7cb3ac1ee21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133800 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Yuval Peress <peress@chromium.org> Auto-Submit: Yuval Peress <peress@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* ln9310: check software workaround is in place for every power-upJohn Crossley2021-05-071-0/+26
| | | | | | | | | | | | | | | | | | | | | | Current software sets some registers only during initial powering of LN9310 (when battery is plugged in). If LN9310 was reset for any reason and then a system power on was attempted (power button press), then LN9310 would attempt a startup without the workaround (bad idea). This change adds a check before every LN9310 enable/disable event and re-initializes LN9310 if a reset has occurred . BRANCH=Trogdor BUG=b:185308433 TEST=Should not break the current boot flow, i.e. power-up and power-down (using long-press of the power button) should function Change-Id: I98c08f50bfd48e09776033eac64658f6e27fb58f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2876869 Reviewed-by: John Crossley <crossley@lionsemi.corp-partner.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: John Crossley <crossley@lionsemi.corp-partner.google.com> Tested-by: John Crossley <crossley@lionsemi.corp-partner.google.com>
* ln9310: Stronger workaround to prevent SCOUT overvoltage at startupJohn Crossley2021-05-061-23/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This improved workaround (compared to the previous 2520279) moves the CFLY precharge step out of the ln9310's internal startup sequence and implements it using I2C commands sent by the EC just before the I2C command that triggers the ln9310 startup. The workaround additionally modifies the ln9310's internal startup sequence to use the precharged CFLY capacitors as decoupling of an internal node during the startup sequence which should help prevent an OV glitch from appearing on the LN9310 output even if the internal level shifter on SW1 glitches and pulls up on the C1PA/B nodes. BRANCH=Trogdor BUG=b:185308433 TEST=Should not break the current boot flow, i.e. power-up and power-down (using long-press of the power button) should function similar to before this change. Testing the efficacy at preventing the SCOUT overvoltage glitch must be done with LN9310 parts screened out at wafer test that have a higher likelihood of exhibiting the glitch at the SCOUT output. With these parts, startup should be observed with a scope probe monitoring LN9310 SCOUT for overvoltagee. Change-Id: I216991f950196225cabbbfdaa2333f1650f7f4fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2837531 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: John Crossley <crossley@lionsemi.corp-partner.google.com> Commit-Queue: John Crossley <crossley@lionsemi.corp-partner.google.com>
* driver: ln9310: move ln9310.h header to include/Jack Rosenthal2021-03-201-1/+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>
* ln9310: set min. freq above audible rangeJohn Crossley2021-02-231-0/+5
| | | | | | | | | | | | | | | | | Set the minimum switching frequency to 25 kHz to avoid the audible frequency band. BRANCH=Trogdor BUG=b:180886790 TEST=In IDLE mode check that LN9310 switching freq. stays above the audible frequency range. Change-Id: Ia609fd002e34b6bc684385ceb8405fe84a447ae7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633442 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* ln9310: Update register to reduce hibernate currentJohn Crossley2021-01-121-4/+45
| | | | | | | | | | | | | | | | | Change initialization value of these three registers to reduce hibernate mode current: INFET_CP_PD_BIAS_CFG=0x0, INGATE_PD_EN=0x0, INFET_AUTO_MODE=0x1 BRANCH=Trogdor BUG=b:176858036 TEST=In hibernate mode check that LN9310 VIN current drops from 1.6 mA (w/ previous firmware) to ~105 uA. Change-Id: I9041a912cd68fdf75a7bd2d40d88e17e1dc893c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622758 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com>
* ln9310: Startup sequence update.Sean Hou2020-11-301-0/+53
| | | | | | | | | | | | | | | Update Startup sequence to fully address SC_OUT over voltage issue. BRANCH=master BUG=170591575 TEST=Build successfully. Change-Id: I31cbd839a7943ee19c19601bf178db6911f3dffd Signed-off-by: Sean Hou <seanhou@lionsemi.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2520279 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com>
* ln9310: Mitigate the load overvolt riskAlexandru M Stan2020-10-171-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to mitigate the risk of overvolting something that uses very low power, we want to make sure our switching frequency is not too slow. Also, we are choosing to use VIN for VDR in case EXT_5V is not available when the chip is trying to startup. TODO: This patch might have some power efficiency implications on lower current loads, but until we figure out a more ideal fix this is a good temporary mitigation. BRANCH=master BUG=b:170591575 TEST=make BOARD=lazor EXTRA_CFLAGS=-DBOARD_REV=4 TEST=With a non ideal switchcap, and no load (eg: on limozeen keep qsip pmic off), touch with a finger the BST1A capacitor (eg C67) After this patch nothing bad will happen, without this patch the QSIP might get overvolted and permanently killed. Signed-off-by: Alexandru M Stan <amstan@chromium.org> Signed-off-by: Sean Hou <seanhou@lionsemi.com> Change-Id: Ie230eb8fe87db35854b727585a667cbfdb30e46c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2477473 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* ln9310: Fix the register of LN9310_REG_LB_CTRLWai-Hong Tam2020-09-241-4/+20
| | | | | | | | | | | | | The existing code sets it to a wrong register, LN9310_REG_SYS_CTRL. Correct it. Also override the LN9310_REG_SYS_CTRL to 0. BRANCH=None BUG=b:163867792, b:169127324 TEST=Verified the power-on sequence worked. Change-Id: Idb96e5510eb47b7f652d9ea38be5a5a7eb84e88f Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2425454
* ln9310: Clear STANDBY_EN bit on initWai-Hong Tam2020-09-241-0/+6
| | | | | | | | | | | | | | | Leaving STANDBY_EN on blocks the power on sequence. Clear the bit explicitly. BRANCH=None BUG=b:163867792, b:169127324 TEST=Built the image correctly. Change-Id: Iadfcb3a7eb58f076704392f1dd7762400ed1ab58 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2424806 Reviewed-by: Sean Hou <seanhou@lionsemi.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* ln9310: OPERATION_MODE update method.Sean Hou2020-09-081-0/+17
| | | | | | | | | | | | | | | | | Use SELF_SYNC instead of MANUAL_UPDATE method to cross OPERATION_MODE register, which is a multi-bit i2c register, from i2c clock domain to local ref_clk domain BRANCH=None BUG=None TEST=Built successfully. Change-Id: Ibc4d1b6ae12a323a3b7c345247ab92e4acc762dc Signed-off-by: Sean Hou <seanhou@lionsemi.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393090 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* ln9310: Move battery cell type to board customizationWai-Hong Tam2020-09-041-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | Checking the input voltage to make the decision of 2S battery or 3S battery is not reliable. The 3S battery with very low charge might be under 10V that we initialized the switchcap to 2:1 mode. When the battery was then charged up to 12V, VOUT would go to 6 V which would be a problem. This change moves the decision to board customization. It checks the SKU ID. It can be extended to other ways, like checking the battery manufacturer and device names. To prevent any damage when attaching a 3S battery to a 2S-SKU board, add a check before configuring the switchcap to 2:1 mode. BRANCH=None BUG=b:163867792, b:151393598 TEST=Built successfully. Change-Id: I3f69132bc00b13ec39b229e98a34a5f7f75008f1 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2391210 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* driver: Add LN9310 switchcap driverWai-Hong Tam2020-09-021-0/+187
Add LN9310 2:1 and 3:1 switchcap driver. It will be used in Trogdor projects. BRANCH=None BUG=b:163867792 TEST=Defined the CONFIG and built correctly. Change-Id: I14b55c7cd3be06e3811cc58a182b1694e6ad57ff Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2386481 Reviewed-by: Stephen Boyd <swboyd@chromium.org>