Commit Graph

12 Commits

Author SHA1 Message Date
Aaron Durbin
97a4fd2751 power_button: expose raw signal assertion
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>
2014-08-21 08:02:00 +00:00
Randall Spangler
dd702e8447 baytrail: Workaround for stuck boot process
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>
2014-04-30 10:00:02 +00:00
Randall Spangler
45bc5c1a21 Split out power button code from switch.c
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>
2013-04-25 17:03:18 -07:00
Randall Spangler
a21ea56e76 Rename power_button module to switch
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
2012-10-30 14:50:03 -07:00
Randall Spangler
c795ea69ff Clean up power button module
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>
2012-10-30 12:00:45 -07:00
Randall Spangler
2223179cbc Move looking at write protect GPIO to button/switches module
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
2012-07-18 15:51:36 -07:00
Randall Spangler
7b155fb8ac Refactor boot key detection
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>
2012-06-26 17:01:52 -07:00
Randall Spangler
4568bc7dbd Release keyboard recovery button on next power-on
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>
2012-06-04 17:07:15 -07:00
Randall Spangler
990c8b39e1 Disable touchscreen when lid is closed and in S3
(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
2012-05-21 16:30:12 -07:00
Randall Spangler
5907675a47 Add AC state change hook
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
2012-05-17 09:30:38 -07:00
Randall Spangler
f4e772708b Added HOOK_INIT for driver module inits
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
2012-04-19 13:08:58 -07:00
Randall Spangler
39f86d2fad Split power button code into its own file
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
2012-01-10 14:14:59 -08:00