summaryrefslogtreecommitdiff
path: root/power/mt8183.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-639/+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>
* kukui: enable HOST_SLEEP_STATE to smooth suspend trasnsitionEric Yilun Lin2021-06-291-0/+71
| | | | | | | | | | | | | | | | | To smooth the suspend transition to prevent from EC waking up AP during S0->S3. BUG=none TEST=ensure AP notify EC before suspending BRANCH=kukui,icarus Change-Id: I6d4d79be2688c53e0057f5e60a394cfa8974e501 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2987228 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* kukui: do not boot AP if low-battery and no chargerEric Yilun Lin2020-12-221-0/+19
| | | | | | | | | | | | | | | | BUG=b:134101454 TEST=#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 96; at batt 93%, no adapter, powerbtn, stay at G3 at batt 93%, with adapter, powerbtn, boot to S0 at batt 97^, without adapter, powerbtn, boot to S0 BRANCH=kukui Change-Id: Ib0ee742ccd1f04aaa173a34455c1333853e0ce50 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597122 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Kukui: initial a new models kakadu of ec.wen zhang2020-11-021-3/+0
| | | | | | | | | | | | | | | Copy from krane, which is a model from Kukui. Modified for building pass. It will need to be revised later. BUG=b:171763111 BRANCH=master TEST=make -j BOARD=kakadu Change-Id: I87fcf8c8e3bd4fa669e0bcb7fbb9d125a9926cdb Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2501801 Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
* power/mt8183: reset EC if EC has jumped and AP rebootsEric Yilun Lin2020-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | Resets EC if EC has jumped before and we want to boot AP. In the normal flow, EC should stay at RW and reset itself and AP should request EC for bootblock when start booting. On some testing scenario, we might want to boot AP after RO->RW->RO transition, and in such case, AP won't be able to boot due to AP_SYS_RST_ODL been pulled down by the SLG, and SLG latches output until the next EC_RST_ODL. So in such test cases, we should reset the EC. BUG=b:161584167 TEST=boot AP; sysjump RO; apshutdown; powerbtn 1200; ensure AP boots BRANCH=kukui Change-Id: Ia4066f1764b83acf6835f344393dcad8c125d0e3 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2319494 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* kakadu: turn off Vconn boost gpio pin when S5/G3Scott Chao2020-06-091-0/+3
| | | | | | | | | | | | | | It should be ~0V in G3, 5V in S3/S0. And this pin can solve apple HDMI dongle issue. BUG=b:156570690 BRANCH=kukui TEST=make -j BOARD=kakadu TEST=make buildall Signed-off-by: Scott Chao <scott.chao@bitland.corp-partner.google.com> Change-Id: I3bd23a0534d0d63fe22bf26ed3a24b34b73fa142 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2235235 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* hooks: Introduce HOOK_CHIPSET_SHUTDOWN_COMPLETEWai-Hong Tam2020-06-061-0/+3
| | | | | | | | | | | | | | | | | | | A new hook HOOK_CHIPSET_SHUTDOWN_COMPLETE is introduced, which are called from the chipset task, while the system has already shut down and all the suspend rails are already off. It will be used for executing pending EC reboot at the chipset shutdown. The EC reboot should be executed when the chipset is completely off. BRANCH=None BUG=b:156981868 TEST=Built all boards. Change-Id: I12f26957e46a1bb34ef079f127b0bddd133cd4e7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2228395 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* power/mt8183: fix power btn behavior for clamshell devicesTing Shen2020-04-281-0/+4
| | | | | | | | | | | | | BUG=b:154443823 TEST=able to do hard showdown between 8~10 sec BRANCH=kukui Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ia06507c42ce492e83b758d2f70ad2a3f9e91212c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2155826 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* common/system: Unify ec_current_image and system_image_copy_tTom Hughes2020-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "enum ec_current_image" is exposed in ec_commands.h (and used by non-EC code, such as biod). We also have an "enum system_image_copy_t" that is the exact same thing (though has a few more definitions). A followup CL (I714b6bd8c0d7192386404c25a831e38438fa5238) adds the "sysinfo" host command, so we want to be able to expose all the potential image variants. Rather than maintain two enums that can potentially get out of sync, unify the code to use a single enum. We choose to keep the "enum ec_current_image", since external code depends on it. To verify that this change results in no changes to the generated binaries: ./util/compare_build.sh --board all BRANCH=none BUG=b:146447208 TEST=./util/compare_build.sh --board=all Change-Id: I13776bc3fd6e6ad635980476a35571c52b1767ac Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2036599 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* Kodama: delay to boot system until the smart battery is readyxiong.huang2020-02-121-0/+25
| | | | | | | | | | | | | | | | | | | | | | With the adapter to activate the smart battery which is shutdown mode, will enable PMIC during activation and have heavy loading, which will prevent the system from powering on. Delay to boot system until the smart battry is ready. BUG=b:148045048 TEST=1) When battery is cutoff mode or shutdown mode, DUT will 4 second to boot, which activated with the adapter. And the return value of system_get_reset_flags() is 0x02. 2) Power off the DUT with click the UI icon 'Shut down' or long press the power button. And the return value of system_get_reset_flags() is 0x802. Both test 1 and 2 can boot DUT. BRANCH=kukui Change-Id: Icb4ed75dbca13fef4c44e5386b7b957a12970557 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2049929 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* power/mt8183: correct EN_PP1800_S5_L enable timingYilun Lin2019-12-101-0/+31
| | | | | | | | | | | | | | | | The power rail should be turned on at G3S5 rather than S5S3, and should be turned off after stay in G3 for 20ms. TEST=Ensure the power rail is on/off at correct timing BUG=b:144144075 b:145255107 BRANCH=none Change-Id: Ie621ab1ac5332da6718201c44266f41aafcac296 Signed-off-by: Yilun Lin <yllin@chromium.org> Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1928413 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* power/mt8183: Need 1s pwrbtn press to exit off stateYilun Lin2019-11-111-6/+18
| | | | | | | | | | | | | | | | | | To prevent mispressed cases, we decide to increase the power button press boot time to at least 1s. TEST=aps; powerbtn $sec; where $sec is between 0~1000 and see it won't boot TEST=aps; powerbtn $sec; where $sec > 1000 and see it boot TEST=aps; ensures the physical power button press is working as expected. BUG=b:131856041 BRANCH=kukui Change-Id: Ie3099ba9639a729cee77b7d444a459fbef72733d Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1906387 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* jacuzzi: disable PP1800 when chipset offTing Shen2019-10-081-0/+2
| | | | | | | | | | | | | | | | | To improve G3 power consumption, a pin EN_PP1800_S5_L is added in board rev 1 and should be turned on before pmic on, and turned off after pmic off. BUG=b:138180455,b:141592177 TEST=verify jacuzzi rev 1 is bootable with this change BRANCH=master Change-Id: Iacd9b0fab97d775f15faa9b2df491940871bc7ff Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1773031 Reviewed-by: Yilun Lin <yllin@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* include: Move RESET_FLAG_* into ec_commands.h as EC_RESET_FLAG_*You-Cheng Syu2019-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | RESET_FLAGS_* are used when setting/reading the field ec_reset_flags of struct ec_response_uptime_info, which is defined in ec_commands.h. So it might be better to put those macros there. To be consistent with the other macros in the file, add "EC_" prefixes to them. BUG=b:109900671,b:118654976 BRANCH=none TEST=make buildall -j Cq-Depend: chrome-internal:1054910, chrome-internal:1054911, chrome-internal:1045539 Change-Id: If72ec25f1b34d8d46b74479fb4cd09252102aafa Signed-off-by: You-Cheng Syu <youcheng@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1520574 Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Ready: Yu-Ping Wu <yupingso@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* power/mt8183: Re-enable watchdog interrupt after sysjumpNicolas Boichat2019-06-251-1/+2
| | | | | | | | | | | | | | | | | Without this, watchdog reset is not detected properly by the EC after software sync. BRANCH=none BUG=b:132938532 TEST=Boot kukui with SW sync enabled stop daisydog echo 1 > /dev/watchdog Board reboots after ~30 seconds (and does not get stuck) Change-Id: Ia33f5f2b2b610d921ef36874226d23ed09b2f793 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663542 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* power/mt8183: Hold PMIC enable to force S5->G3 transition.Nicolas Boichat2019-06-241-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Asserting VSYSSNS should only be done as a last measure. If the PMIC is configured properly, it will shut down upon holding POWER+HOME key for 8+ seconds. This is shorter than the S5->G3 timeout, so we should never need to assert VSYSSNS. BRANCH=none BUG=b:134912821 TEST=reboot ap-off, immediately powerb, see that AP turns on and stays on. TEST=apshutdown, PMIC shuts off gracefully TEST=In power/common.c, change S5_INACTIVITY_TIMEOUT to 3 seconds, see that state machines forces PMIC off using VSYSSNS. TEST=Boot DUT: mosys eventlog clear; poweroff power on DUT, run dut-control power_state:off Wait 8 seconds for EC to go to G3, power on DUT again mosys eventlog list shows events with correct time stamps: 0 | 2019-06-14 15:44:31 | Log area cleared | 79 1 | 2019-06-14 15:44:38 | System boot | 0 2 | 2019-06-14 15:44:38 | Chrome OS Developer Mode 3 | 2019-06-14 15:45:13 | System boot | 0 4 | 2019-06-14 15:45:13 | Chrome OS Developer Mode Change-Id: I9b73d06e07296e47e15fe87dd87fffac2af04d12 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660073 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* power/mt8183: Stay in S5 for 10 seconds before forcing PMIC shutdownNicolas Boichat2019-06-171-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On forced/emergency shutdown, the EC is only able to force the PMIC off by asserting GPIO_PMIC_FORCE_RESET_ODL, which also loses the RTC state. And it does so immediately after transitioning to S5. This causes issues with FAFT, as the RTC resets to original time. Instead, wait for 10 seconds in S5 before forcing the transition to G3, which is what other platforms do, and only force the reset at that time. BRANCH=none BUG=b:134912821 TEST=apshutdown => System stays in S5 for 10 seconds before force shutdown. TEST=apshutdown => powerb wakes the system in both S5 and G3 TEST=apshutdown; reboot ap-off in S5 still waits 10 seconds to force shutdown to G3. TEST=poweroff in AP console works, directly goes to G3, and powerb wakes the system TEST=Boot DUT: mosys eventlog clear; poweroff power on DUT, run dut-control power_state:off Within 10 seconds, power on DUT again mosys eventlog list shows events with correct time stamps: 0 | 2019-06-14 15:40:10 | Log area cleared | 55 1 | 2019-06-14 15:40:24 | System boot | 0 2 | 2019-06-14 15:40:24 | Chrome OS Developer Mode 3 | 2019-06-14 15:40:58 | System boot | 0 4 | 2019-06-14 15:40:58 | Chrome OS Developer Mode Change-Id: I7495950da58179fc066608d804e263c81b0993aa Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660070 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power/mt8183: Clarify comment about force PMIC shutdownNicolas Boichat2019-06-171-2/+3
| | | | | | | | | | | | | | | | | | It turns out MT6358 cannot be configured to shut down when receiving WATCHDOG input, so the statement in the comment is incorrect. However, it is still correct to say that forcing PMIC shutdown should be rare. And add a note that PMIC RTC state will be lost. BRANCH=none BUG=b:109850749, b:134912821 TEST=none Change-Id: I7c84b012d7095fb94473303c83b4ffecb01ee5da Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1657074 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
* kukui: Runtime configure GPIO settings between rev1 and rev2.Yilun Lin2019-03-071-18/+0
| | | | | | | | | | | | | | | | | | Considering we have more space on flash now, we would like to share one image between two board revisions to ease the development. This CL also removes unused powerrails in P1. TEST=flash image on P1 and P2, and check both boards boots. BUG=b:126315091 BRANCH=None Change-Id: Ifd0242396013e18e7e1cbc29048a5fc508626e5b Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1505214 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* power/mt8183: Do not react to watchdog interrupt if PMIC is offNicolas Boichat2019-02-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | When the PMIC is shut down, the watchdog line will naturally fall as well. From measurements, this takes about 70ms+, so the EC will have enough time to do the power sequencing and mask watchdog interrupts, unless something exceptional happens. The exceptional case is easy to handle anyway, so let's do that. BRANCH=none BUG=b:124474520 TEST=With msleep(10) in power_handle_state and printout in the else branch of chipset_watchdog_interrupt => AP poweroff does not cause a watchdog reset. TEST=stop daisydog; echo > /dev/watchdog => system resets after a few seconds Change-Id: I532b1968abb90bd9e96856020faf16080fe67af3 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1490793 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power/mt8183: Detect AP-initiated PMIC shutdown and stay S5/G3Nicolas Boichat2019-02-271-1/+12
| | | | | | | | | | | | | | | Without this change, EC would go to POWER_S5 state, and immediately go back to S3, which resets the system. BRANCH=none BUG=b:126295807 TEST=poweroff in AP console, systems goes to G3 (without requiring forced PMIC shutdown) and stays there Change-Id: Icbff7eb3962e26a6e2e9cb061f53665b9d94423b Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1490791 Reviewed-by: Yilun Lin <yllin@chromium.org>
* kukui: Add BOARD_REV 2 configs.Yilun Lin2019-01-231-0/+12
| | | | | | | | | | | | | | TEST=BOOTBLOCK=... make BOARD=kukui -j flash_ec; and see AP boots. BUG=b:122993147 BRANCH=None Change-Id: I1f76d87aa152ba3c3d7c8697140c7c4769b55d28 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1420247 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Tony Lin <tonycwlin@google.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* kukui: Remove BOARD_REV 0 GPIO configs.Yilun Lin2019-01-221-4/+0
| | | | | | | | | | | | | | | We don't use P0 boards anymore, so let's remove P0 GPIO configs. TEST=make BOARD=kukui -j BUG=b:122993147 BRANCH=None Change-Id: I1859c4c9b182a0acee6e314e8c06fb34a3973f10 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1420246 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* flapjack: add initial content for the buildYH Lin2018-12-101-1/+1
| | | | | | | | | | | | | | | | | Initial content of flapjack is taken after kukui. It will need to be revised later. BUG=b:120704238 TEST=build_packages --board=flapjack BRANCH=none CQ-DEPEND=CL:1368583,CL:1368475,CL:*727368 Signed-off-by: YH Lin <yueherngl@chromium.org> Change-Id: Id2ccb43af46ef0b498112ecc2b9995227cbb9bc6 Reviewed-on: https://chromium-review.googlesource.com/1369384 Commit-Ready: YH Lin <yueherngl@chromium.org> Tested-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* power/mt8183: Fix power transition from S3 to S0.Yilun Lin2018-11-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AP_IN_S3_L asserted should equal to IN_SUSPEND_ASSERTED rather than IN_SUSPEND_DEASSERTED. BRANCH=None BUG=b:113367227 TEST=See AP booted into kernel; and test in EC console: /* booted */ > powerinfo [22.104134 power state 3 = S0, in 0x0002] > gpioget AP_IN_SLEEP_L 1* AP_IN_SLEEP_L /* shutdown */ > aps > powerinfo [94.526641 power state 0 = G3, in 0x0001] > gpioget AP_IN_SLEEP_L 0* AP_IN_SLEEP_L /* boot again */ > powerb > powerinfo [42.273465 power state 3 = S0, in 0x0002] > gpioget AP_IN_SLEEP_L 1 AP_IN_SLEEP_L Change-Id: I13f32505dd0be82ab30a9b48b296918be688d464 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1322183 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* power/mt8183: Obey ap-off reset flag if PMIC is already upstabilize-11217.BNicolas Boichat2018-11-011-1/+7
| | | | | | | | | | | | | | | | | On startup, we need to start from POWER_S5 if the PMIC is already up. However, if the ap-off reset flag is set, we need to make sure that we transition to G3 (and not to S3->S0). BRANCH=none BUG=b:118090373 TEST=reboot ap-off in S0/G3 works fine (AP does not boot). TEST=AP initiated reboot works fine (AP boots up) TEST=EC initiated reboot without ap-off works fine (AP boots up) Change-Id: I515f8f947bfb6b1ef45f1c2ceb7b9d9e0a324c78 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1309435 Reviewed-by: Yilun Lin <yllin@chromium.org>
* system: Remember if reset was due to AP watchdog triggeringNicolas Boichat2018-10-291-1/+6
| | | | | | | | | | | | | | | | | On MT8183, when EC detects a watchdog reset, EC needs to reboot itself in preparation for the next boot. This means that AP loses the reset cause (as AP system reset is toggled), and, therefore, we need to save the reset reason in the EC. BRANCH=none BUG=b:109900671 TEST=apshutdown, powerb, see that reset reason is: reset-pin TEST=Use test-wd from bug. Reset reason: reset-pin ap-watchdog Change-Id: I2e30306db5727a22de930f00dc30de40b9695bef Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1295890 Reviewed-by: Jett Rink <jettrink@chromium.org>
* power/mt8183: Implement watchdog-initiated resetNicolas Boichat2018-10-251-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | AP watchdog line can fall in either of 2 cases: - AP asserts watchdog while the AP is on: this is a real AP-initiated reset. - EC asserted GPIO_AP_SYS_RST_L, so the AP is in reset and AP watchdog falls as well. This is _not_ a watchdog reset. We mask these cases by disabling the interrupt just before shutting down the AP, and re-enabling it before starting the AP. Also, take the opportunity to move warm reset code out of board file into generic MT8183 power code, as well as code to enable interrupts. BRANCH=none BUG=b:109900671 TEST=apshutdown => EC understand this is an EC-initiated shutdown TEST=Use test-wd from bug, see that EC detects it is a watchdog. Change-Id: I02037e5be0254fef991ae2459be35e4561e0994c Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1293132 Reviewed-by: Jett Rink <jettrink@chromium.org>
* power/mt8183: Pulse PMIC_FORCE_RESET_ODL for 10s to force resetNicolas Boichat2018-10-241-0/+20
| | | | | | | | | | | | | | | | | | On forced shutdown, assert PMIC_FORCE_RESET_ODL for 10 seconds. Sometimes, just a short 5ms pulse is enough to shut down the PMIC, but we have seen boards where it is required to assert force reset for a longer time, else the PMIC would immediately power back up. BRANCH=none BUG=b:117747023 TEST=Boot kukui (current AP FW that has no PMIC code yet), type apshutdown in EC console, see that the PMIC is shut down. Change-Id: Ic1793b6f27cebd25f96e42a9de90268566ec5772 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1278224 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power/mt8183: Reboot EC before trying to boot AP for a second timeNicolas Boichat2018-10-151-3/+10
| | | | | | | | | | | | | | HW will prevent us from asserting AP_SYS_RST_L a second time, so we need to reset the EC. BRANCH=none BUG=b:117244116 TEST=Boot kukui => apshutdown => powerb, see that EC resets itself Change-Id: I55236db05777652c171a71dc3fd15fafd7d87434 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1278223 Reviewed-by: Yilun Lin <yllin@chromium.org>
* mt8183: Hold power button 10s for hard shutdown.Yilun Lin2018-10-041-2/+2
| | | | | | | | | | | | | | | | Hard shutdown rules for tablet is 10 sec. go/crosdebug TEST=press pwr btn for 10s, and see chipset_force_shutdown in console BUG=b:117243957 BRANCH=None Change-Id: I44fed345f71b503a0d502c5566f4fcba54f80fb9 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1260722 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Tony Lin <tonycwlin@google.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* power/mt8183: Keep PMIC_WATCHDOG_L low in S5/S3Nicolas Boichat2018-08-311-2/+3
| | | | | | | | | | | | | | | | Instead of pulsing the watchdog to PMIC, keep it low in S5/G3. This avoids leaking power from EC to PMIC in S5/G3, when the PMIC is off. BRANCH=none BUG=b:113559677 TEST=In G3, pp1800_ec_mw power consumption drops from ~23mW to <1mW. Change-Id: I37bc8e5e6954834e1ae2bc1206919f342273b888 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1195300 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power/mt8183: Fix power sequencingNicolas Boichat2018-08-311-6/+32
| | | | | | | | | | | | | | | | | | | | | | Fix power sequencing: 1. Replace power_has_signals(...) with power_get_signals() & ... to reduce unwanted noise during boot 2. PMIC_FORCE_RESET only takes about 5ms to work. 3. In G3, switch back to S5->G3 if the PMIC happens to be on again. 4. On boot, start from S5 instead of G3 if the PMIC is on. 5. In S5->S3, retry to turn on PMIC if the first attempt fails (this is necessary after a force reset) BRANCH=none BUG=b:109850749 TEST=Cycles of apshutdown, powerbtn; EC reboot TEST=apshutdown, sysjump rw, powerbtn works properly Change-Id: I2e52e267eab9d45d30036f75cfd6b821d3b13638 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1194546 Reviewed-by: Yilun Lin <yllin@chromium.org>
* kukui: Change FORCE_RESET to ODLNicolas Boichat2018-08-291-3/+3
| | | | | | | | | | | | | | Also, FORCE_RESET is open-drain, active-low. Also, set the default to high. BRANCH=none BUG=b:112616655 TEST=boot rev1 to coreboot Change-Id: I33bd4a97831313f7bc5c3f0044c5b44d88932060 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1192722 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power/mt8183: Power sequence from S5, not G3Nicolas Boichat2018-08-241-19/+22
| | | | | | | | | | | | | | | | | | | The previous code was switching on the AP on G3 to S5 transition, this causes problems as there is a 10s timeout in the S5 to G3 transition, so we would not be able to boot the AP from S5. The only difference now between S5 and G3, is the case where the PMIC fails to shut down properly: we only enter G3 if the PMIC shuts down as expected. BRANCH=none BUG=b:109850749 TEST=make BOARD=kukui -j Change-Id: I260146e6d4622a76ad3a53d67fdde43a8669697c Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1181008 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* reset: Log the reason for AP resets.Jonathan Brandmeyer2018-07-261-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provides a new EC host command 'uptime info' which gathers up some information which may be useful for debugging spurious resets on the AP (was the EC reset recently? Why was the EC reset? If the EC reset the AP, why did it do so?, etc.). Provide ectool support for the same. Example results of `ectool uptimeinfo`: ``` localhost ~ # ectool uptimeinfo EC uptime: 475.368 seconds AP resets since EC boot: 2 Most recent AP reset causes: 315.903: reset: console command 363.507: reset: keyboard warm reboot EC reset flags at last EC boot: reset-pin | sysjump ``` BRANCH=none TEST=Perform some `apreset` commands from the EC console and observe their side-effects via the `ectool uptimeinfo` command on the AP side. Test sequences include no-resets through 5 resets, observing that the ring buffer handling was correct. BUG=b:110788201, b:79529789 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: I0bf29d69de471c64f905ee8aa070b15b4f34f2ba Reviewed-on: https://chromium-review.googlesource.com/1139028 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* power/mt8183: Fix PMIC_EN_ODL polarity, watchdog signalNicolas Boichat2018-07-231-2/+2
| | | | | | | | | | | | | | | | Watchdog signal should on high by default (and only pulsed to shut down the PMIC). Also, PMIC_EN_ODL is active-low, fix polarity. BRANCH=none BUG=b:109850749 TEST=make BOARD=kukui -j => Boot to FW Change-Id: I3f69bfd75c02ae958785153593d4494c02f39172 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1146132 Reviewed-by: Yilun Lin <yllin@chromium.org>
* power/mt8183: Remove use of GPIO_PP1800_S0_EN.Yilun Lin2018-06-201-2/+0
| | | | | | | | | | | | | TEST=make BOARD=kukui BUG=None BRANCH=None Change-Id: I09b8efb1215abfc53904a8ceb8273d88ef9fbbb1 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1105804 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* power/mt8183: Power sequencing logic for MT8183Nicolas Boichat2018-06-141-0/+328
MT8183 uses a power sequencing inspired from RK3399, with fewer signals. We only have 1 signal from PMIC (PMIC_PWR_GOOD), active in S0/S3, and 1 signal from AP (AP_IN_S3_L), active in S3/S5. One particularity of this design is that we need to reboot the EC to RO on every single cold boot/reboot. For the forced transition to S5, we assert the WATCHDOG signal to PMIC to shut it down, which should usually work, if the PMIC was configured properly by AP. If not, we also assert power+home key (PMIC_EN_ODL) until the PMIC shuts down for good. BRANCH=none BUG=b:109850749 TEST=make BOARD=kukui -j Change-Id: Ibcde8b937d7f4cecb0f470b9a7e0809fc24efae6 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1092402 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>