summaryrefslogtreecommitdiff
path: root/include/power_button.h
Commit message (Collapse)AuthorAgeFilesLines
* KBL/SKL: Add wait between DSW_PWROK and PWRBTNDaisuke Nojiri2017-06-191-0/+8
| | | | | | | | | | | | | | | | This patch adds wait between DSW_PWROK and PWRBTN assert. It is required to be 95 msec or longer for Kaby Lake and Sky Lake. Refer to the timing diagram for G3 to S0 on Sky Lake or Kaby Lake platform design guide for details. BUG=b:62584658 BRANCH=none TEST=On Fizz, measured time between DSW_PWROK high and PWRBTN assert for 1:AC plug-in, 2:recovery+power press, 3: reboot ec command. Change-Id: I89a14ac9a49e20a332bd662d90be62f8ea23b003 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/534901
* cleanup: Fix signed vs unsigned typingShawn Nematbakhsh2016-02-031-1/+1
| | | | | | | | | | | | | | | | | | - ec_response_thermal_get_threshold.value is unsigned, so it can not be less than zero. - make power_button_wait_for_release() take a signed int, to match its existing usage. BUG=None TEST=`make buildall -j` BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ie5748df3d9904d1e417adc38fee18f8cb3ce9750 Reviewed-on: https://chromium-review.googlesource.com/325840 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* skylake: Use a simulated power button press to force-shutdown the APShawn Nematbakhsh2015-06-041-0/+5
| | | | | | | | | | | | | | | | Holding the power button is currently the best known way to bring the AP back to a state where it is shutdown and not powered. BUG=chrome-os-partner:40826, chrome-os-partner:40677 TEST=Run `apshutdown` on glados, verify that power state machine transitions to G3 after several seconds. Run `powerbtn`, verify that state machine transitions back to S0. BRANCH=None Change-Id: Ia799c5f199127f31bd24907b93946c6289d381f8 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275060 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Power Button: Wait for power button to be stable when waiting for releaseAlexandru M Stan2015-02-101-0/+9
| | | | | | | | | | | | | | | | | | The debounce timer might be too slow to actually update the state of debounced_power_pressed by the time we do power_button_is_pressed in the S3->S5 state transition. Solution is to move the power_button_wait_for_release function here and make sure there are no deferreds active. BUG=chrome-os-partner:35948 TEST=During dev mode screen, press power button, note the device stays off TEST=Print debounced_power_pressed in power_button_is_pressed(void), note it's not 0 when power button is actually pressed BRANCH=veyron Change-Id: I8258e9e5524bd65d6ea9c77ea5649304d2195bf0 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/244590 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* power_button: expose raw signal assertionAaron Durbin2014-08-211-0/+6
| | | | | | | | | | | | | | | It's useful to expose the logic of the power button assertion according to the CONFIG active level at the hardware input. Therefore, provide power_button_signal_asserted(). BUG=chrome-os-partner:31481 BRANCH=None TEST=Benson tested this on ryu since has the button cables. Change-Id: Ica48bfe981550700a067406cb72908e14dbccba9 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213298 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* baytrail: Workaround for stuck boot processRandall Spangler2014-04-301-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, the system will boot to S0 from the point of view of the EC, but PLTRST# will never deassert. Work around this by waiting 50 ms for PLTRST# to deassert. If it doesn't, force the chipset all the way down by deasserting RSMRST#, then pulse the power button to turn it back on. Also add a powerfail debug command to simulate this failure event, so that the recovery process can be tested. Add API to the LPC module to get the state of PLTRST#, and to the power button state machine to force it released when we shut down the chipset and and force another power button pulse as we reset the chipset. BUG=chrome-os-partner:28422 BRANCH=baytrail TEST=1. Boot system. Should boot normally. Shut system down. 2. powerfail 3. Boot system. On the EC console, should see the system come up, go back down through G3S5, then come back up. From the user's point of view, it just boots. 1. Boot system. Should boot normally. (That is, powerfail is not sticky) Change-Id: Ia57f196606f79b9f2fce7d9cd109ab932c3571aa Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/197523 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Split out power button code from switch.cRandall Spangler2013-04-251-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The power button code is platform-independent. This change splits the code out of the LM4 switch.c module so that a subseqent change to STM32 platforms can start using it. BUG=chrome-os-partner:18945 BRANCH=none TEST=manual 1. Power+refresh+esc goes to recovery mode, 2. Press power button at recovery screen turns off. 3. With system off, power button turns system on. 4. Press power button for a second; screen locks. 5. Press power button while typing; blocks keystrokes while it's pressed. 6. Hold power button down for 8 sec; system forced to shutdown. 7. From EC console, with system on: hostevent clear hostevent -> event 0x04 is clear press power button hostevent -> event 0x04 is set 8. From EC console, with system off: powerbtn -> system turns on powerbtn 5000 -> system turns off, just like power button was held for 5 sec Change-Id: If2a9b02514a201e1d03c857d128e2ccab51a16ef Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49217 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename power_button module to switchRandall Spangler2012-10-301-43/+0
| | | | | | | | | | | | | | | Since it handles not just power button, but also lid switch, AC detect, and other switches. No functional changes; just renaming. BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system, power on/off with power button Change-Id: I51628a52293f7207715f5f6bf368a08fe6c3dbce Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36821
* Clean up power button moduleRandall Spangler2012-10-301-8/+14
| | | | | | | | | | | | | No functional changes BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system, power off with power button, power on with power button Change-Id: I25aa5c527b7b9f9db6f5c539cecb37ac4bc197f8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36820 Reviewed-by: Simon Glass <sjg@chromium.org>
* Move looking at write protect GPIO to button/switches moduleRandall Spangler2012-07-181-0/+5
| | | | | | | | | | | | | | | | | | Since that already monitors the WP signal for reporting it as a switch. And if we have that code in two places and the WP signal polarity changes, we'll inevitably forget to change it in the other place... BUG=chrome-os-partner:11150 TEST=manual flashinfo -> WP pin asserted remove WP screw flashinfo -> WP pin deasserted Change-Id: I6091c8bb470c357e02ede8a5b184b2a76b70dc60 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27720
* Refactor boot key detectionRandall Spangler2012-06-261-11/+8
| | | | | | | | | | | | | | | | | | | | | Keyboard scan module now owns the recovery key state on all platforms. And clean up a few comments to linux kernel style BUG=chrome-os-partner:10890 TEST=manual - Power on system. Should boot normally. - Power+Refresh+D. Should turn dev switch on. - Power+Refresh+F. Should turn dev switch off. - Power+Esc. Should reboot system. Power button should power on normally. - Power+Refresh+Esc. Should power on into recovery mode. - Then press power to shut system down. - Power button should power on normally (not back into recovery mode). Change-Id: I4d16e1e8b039efeacbd41e8acec115844bc8457d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/26147 Reviewed-by: Simon Glass <sjg@chromium.org>
* Release keyboard recovery button on next power-onRandall Spangler2012-06-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Keyboard recovery used to persist until the next time the EC was reset. It should release the next time the user turns on the system via the lid or power button. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:10034 TEST=manual 1. power system on normally. not in recovery. 2. press Power+Esc+Refresh. System turns on into recovery. 3. shut system down 4. power system on with lid-open. System boots normally. 5. repeat steps 2-3, then power system on with power button. System boots normally. Change-Id: I455c7191d128614629c50ba27d7ef977e414fe90 Reviewed-on: https://gerrit.chromium.org/gerrit/24409 Commit-Ready: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Disable touchscreen when lid is closed and in S3Randall Spangler2012-05-211-0/+4
| | | | | | | | | | | | | | | | | | | (Touchscreen was already disabled in S5) Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9736 TEST=from console, 'gpioget touchscreen_resetn' in these cases: 1) system is off -> 0 2) system is on with lid open -> 1 3) system is on with lid closed -> 1 4) system is suspended with lid open -> 1 5) system is suspended with lid closed -> 1 6) system is shut back down -> 0 7) suspend system with lid open, THEN close lid -> 0 Change-Id: I5fc80b72ea9dcfbf11f5280d79ae805c2ef1b6df
* Add AC state change hookRandall Spangler2012-05-171-0/+3
| | | | | | | | | | | | | | And start wiring to x86_power so it can detect AC state changes (needed to enable/disable turbo). *YES*, this compiles for BDS/Daisy now... Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9069 TEST=plug/unplug AC power and look for "x86 AC on" / "x86 AC off" in debug log Change-Id: I8399fab9637d6635a1c615f07448fd45b86bc25f
* Added HOOK_INIT for driver module initsRandall Spangler2012-04-191-4/+1
| | | | | | | | | | | | This covers modules which need to initialize before task_start(), but don't particularly care in what order they're initialized. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=if it boots, it works Change-Id: I69829aac8d1c3c14ee04916a794b84bbf03a09eb
* Split power button code into its own fileRandall Spangler2012-01-101-0/+24
Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7499 TEST=press and release power button; should see debug messages Change-Id: I8909ae4643afc98753edb690771618ad43135e3e