Commit Graph

245 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
51ea502041 power/rk3399: Support USB wake in host-requested wakeable S3
For boards with POWER_SEQUENCING_VERSION = 2 (and likely future
versions), allow the host to request "wakeable suspend", which will
leave rails enabled to allow wake-on-usb.

BUG=b:63037490
BRANCH=kevin
TEST=With subsequent commit, compile on scarlet w/ power sequencing
version = 2.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>

Change-Id: Iaadd371b1d1509d185c8c8306b72760dcfe9989f
Reviewed-on: https://chromium-review.googlesource.com/572211
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-07-28 15:04:24 -07:00
Aseda Aboagye
61a80d620a CNL: Use SYS_RST_L for warm/cold chipset reset.
The EC cannot control warm vs cold reset of the chipset using the
SYS_RST_L pin; it's just a reset request.  This commit changes the
behaviour of chipset_reset to assert SYS_RST_L regardless if a cold or a
warm reset is requested.

BUG=b:63508740
BRANCH=None
TEST=make -j buildall; Flash a modified image on npcx7_evb, verify that
no panics or asserts are hit.

Change-Id: Idfd6f556bf909c7df4e8bd50a79b60719478cde7
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/585573
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-07-25 20:08:32 -07:00
Jenny TC
43081fded2 S0ix: use both SLP_S0 interrupt and host command for s0ix
EC currently uses a host command from kernel to enter s0ix.
This patch waits for the SLP_S0 interrupt to come after receiving
the host command before entering S0ix.

On the exit path, the SLP_S0 interrupt directly triggers the
exit rather than waiting for the host command.

BRANCH=none
BUG=b:37443151
TEST=check in EC logs for SLP_S0 entry and powerindebug output,
check suspend_stress_test on reef and soraka works fine,
make -j8 buildall runs fine

Change-Id: Ie5507b7a1e723532f07bc0671c2abd364f6224a2
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/513705
Commit-Ready: Jenny Tc <jenny.tc@intel.com>
Tested-by: Jenny Tc <jenny.tc@intel.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-07-24 03:03:47 -07:00
Philip Chen
8b9576749b power/rk3399: Assert SYS_RST_L from S5 to S3
To fix a previous mistake and align the SYS_RST control
for all rk3399 boards.

BUG=b:62640322
BRANCH=none
TEST=build scarlet with 'CHIPSET_POWER_SEQ_VERSION == 2'

Change-Id: Iab91ea713c512afd10f15df38fbdb2dd6c62cb23
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/578306
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-07-20 15:00:36 -07:00
Aseda Aboagye
1082d99ca6 zoombini: Add eSPI VW signals support.
This commit adds support for the virtual wire signals over eSPI.
Additionally, the SLP_S0_L signal is added for the board and some minor
changes are made to some GPIOs.

BUG=None
BRANCH=None
TEST=flash zoombini image on npcx7 EVB with some modifications.  Verify
no panics or asserts are hit.

Change-Id: I6ada270b3e3fc7e24b28a8da6ee9dcde707414fc
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/577054
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-07-19 12:34:33 -07:00
Furquan Shaikh
ef73893a4b skylake: Use SYS_RESET signal to trigger warm and cold reset
RCIN# signal is known to not work properly for performing a warm reset
when the CPU is in a bad state. This results in the common key combo
(Alt-Volup-r) not working to reset the host. Thus, use SYS_RESET
signal instead to trigger both cold and warm chipset reset.

BUG=chromium:721853
BRANCH=None
TEST=make -j buildall

Change-Id: I38663db96767d0aa03cd1aea0fe2a0cc5b771cd2
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/575947
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2017-07-18 21:50:33 -07:00
Philip Chen
94bba42b65 power/rk3399: Fix the new power sequencing to support new board
BUG=b:62640322, b:62269890
BRANCH=none
TEST=build scarlet with POWER_SEQUENCING_VERSION == 2 &&
     CHIP == stm32

Change-Id: I314b21a909324a7d4666569525d9daddd300abdb
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/572338
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-07-17 21:27:15 -07:00
Daisuke Nojiri
921e9b7125 vboot: Jump to RW early
This change makes EC run vboot in the HOOK task. The vboot routine
requires battery and charger info. It waits in a deferred call
loop until the charge manager is initialized.

BUG=b:63586051
BRANCH=none
TEST=Verify the following cases:

A. Hardware reboot (type-c/BJ)
1. Unplug AC in S0 then plug in AC:     BOOT/BOOT
2. Unplug AC in S5 then plug in AC:     S5/S5
3. Unplug AC after A.2 then plug in AC: S5/S5
4. Press PB in S5:                      BOOT/BOOT

B. Software reboot (type-c/BJ)
1. Run EC reboot command in S0:        BOOT/BOOT
2. Run EC reboot command in S5:        BOOT/BOOT
3. Run EC reboot ap-off command in S0: S5/S5
4. Run EC reboot ap-off command in S5: S5/S5
5. Run host reboot command:            BOOT/BOOT
6. Run host shutdown command:          S5/S5

C. Recovery tests
1. Press RB and PB in S0:                        FAIL(*1)/PASS
2. Press RB and PB in S5:                        FAIL(*1)/PASS(*2)
3. Unplug AC in S0 then press RB and plug in AC: PASS/PASS
4. Unplug AC in S5 then press RB and plug in AC: PASS(*2)/PASS(*2)

*1: b:63668669
*2: b:63669512. Requires one more PB press.

Change-Id: I28f37fdad7f83d0d44570b9003e8c6a4b83b832f
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/568699
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-07-14 04:01:45 -07:00
Daisuke Nojiri
4ec4975d90 vboot: Move common code under common/vboot
This patch moves the code which can be shared with other data
verification schemes (e.g. RWSIG) under common/vboot. It also
adds unit tests for it.

BUG=b:38462249
BRANCH=none
TEST=make run-vboot. Verify verification succeeds on Fizz.

Change-Id: Icab4d96dd2c154a12b01c41ebe9b46286b4b590e
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/563463
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-07-13 19:45:57 -07:00
Philip Chen
cab784928d power/rk3399: Add a new power sequencing
This change is for Scarlet rev1.

BUG=b:62640322
BRANCH=none
TEST=
1) build Scarlet with 'CHIPSET_POWER_SEQ_VERSION == 2' successfully
2) build Kevin (CHIPSET_POWER_SEQ_VERSION == 0),
   and verify Kevin still boots

Change-Id: I084a7b51fb1fdd8b6d50aa06189f34054162fc9a
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/568224
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-07-13 00:48:17 -07:00
Aseda Aboagye
7903342436 power: Add Cannonlake chipset support.
BUG=b:63508740
BRANCH=None
TEST=`make -j buildall`

Change-Id: I66e0e229c61c85af8f1f1c263e107e9990399e6a
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/564798
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-07-11 13:13:03 -07:00
Daisuke Nojiri
e42acfe200 vboot: Add vboot for EC by EC
This patch adds vboot for EC by EC (vboot EC) for x86 systems.
When ec is transitioning s5->s3, it checks the power supply is
enough to boot AP or not. If not, it runs other checks and may
finally validate and jump to a RW image.

BUG=b:38462249
BRANCH=none
TEST=Boot Fizz on barrel jack and type-c charger.

Change-Id: I5988b0595976370c5303c45541702ae89d86fc97
Reviewed-on: https://chromium-review.googlesource.com/518254
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-06-28 21:50:51 -07:00
Philip Chen
9e32694d10 power/rk3399: Table-based power sequencing
We need to refactor power/rk3399.c to make it more flexible
to support different power sequences for upcoming follower boards.

BUG=b:62640322
BRANCH=none
TEST=manaully test on scarlet and kevin:
S0->S3->S0 and S0->S3->S5->G3->S5->S3->S0 work.

Change-Id: I70cdcbaba046bfab4fe832eca58f30524e99e6de
Reviewed-on: https://chromium-review.googlesource.com/540783
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-06-22 17:03:59 -07:00
Shawn Nematbakhsh
b0dd82b39c cleanup: Remove big and pit boards
Remove big and pit boards along with several now-obsolete CONFIGs /
source files.

BUG=chromium:735109
TEST=`make buildall -j`
BRANCH=None
CQ-DEPEND=CL:544681

Change-Id: Ieb784bd36157fd1f6240cd19de6e6d12191a8097
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/540667
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-06-22 17:03:52 -07:00
Shawn Nematbakhsh
8a16e6483a task: Wait for HOOK_INIT completion before scheduling tasks
Until HOOK_INIT has completed, do not allow any tasks other than HOOKS
or IDLE to be scheduled. Programmers often make the assumption that
a HOOK_INIT function is guaranteed to be run before task code that depends
on it, so let's make it so.

BUG=chromium:649398
BRANCH=None
TEST=Manual on kevin, compare boot without patch:

...
[0.004 power state 0 = G3, in 0x0008] <-- from chipset task
RTC: 0x00000000 (0.00 s)
[0.004 power state 4 = G3->S5, in 0x0008]
RTC: 0x00000000 (0.00 s)
[0.005 clear MKBP fifo]
[0.006 clear MKBP fifo]
[0.006 KB init state: ... <-- from keyscan task
[0.012 SW 0x05]
[0.155 hash start 0x00020000 0x00019a38]
[0.158 HOOK_INIT DONE!]

... to boot with patch:

...
RTC: 0x58cc614c (1489789260.00 s)
[0.004 clear MKBP fifo]
[0.005 clear MKBP fifo]
[0.010 SW 0x05]
[0.155 hash start 0x00020000 0x000198e0]
[0.157 HOOK_INIT DONE!]
...

Also, verify kevin boots to OS and is generally functional through
sysjump and basic tasks, and verify elm (stm32f0 / cortex-m0) boots.

Change-Id: If56fab05ce9b9650feb93c5cfc2d084aa281e622
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/456628
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-06-19 15:33:10 -07:00
Furquan Shaikh
7651e32a95 power/skylake: Ensure panic data is backed up before PMIC reset
On PMIC reset, VCC power rail goes down thus resulting in loss of
panic data. Thus, provide a chance to the chip to backup panic data if
available.

BUG=b:62076222
BRANCH=None
TEST=make -j buildall

1. > crash divzero
   > panic
   === PROCESS EXCEPTION: 06 ====== xPSR: ffffffff ===
   r0 :         r1 :         r2 :         r3 :
   r4 :00000001 r5 :00000000 r6 :00000000 r7 :00000000
   r8 :00000000 r9 :00000000 r10:00000000 r11:00000000
   r12:         sp :00000000 lr :         pc :
   Divide by 0
   mmfs = 2000000, shcsr = 0, hfsr = 0, dfsr = 0

2. > crash assert
   > panic
   === PROCESS EXCEPTION: 00 ====== xPSR: ffffffff ===
   r0 :         r1 :         r2 :         r3 :
   r4 :dead6663 r5 :000000a4 r6 :00000000 r7 :00000000
   r8 :00000000 r9 :00000000 r10:00000000 r11:00000000
   r12:         sp :00000000 lr :         pc :

   mmfs = 0, shcsr = 0, hfsr = 0, dfsr = 0

3. > crash watchdog
   > panic
   === PROCESS EXCEPTION: 3c ====== xPSR: ffffffff ===
   r0 :         r1 :         r2 :         r3 :
   r4 :dead6664 r5 :0000000a r6 :00000000 r7 :00000000
   r8 :00000000 r9 :00000000 r10:00000000 r11:00000000
   r12:         sp :00000000 lr :         pc :

   mmfs = 0, shcsr = 0, hfsr = 0, dfsr = 0

4. > crash unaligned
   > panic
   === PROCESS EXCEPTION: 06 ====== xPSR: ffffffff ===
   r0 :         r1 :         r2 :         r3 :
   r4 :200c0d9e r5 :00000000 r6 :00000000 r7 :00000000
   r8 :00000000 r9 :00000000 r10:00000000 r11:00000000
   r12:         sp :00000000 lr :         pc :
   Unaligned
   mmfs = 1000000, shcsr = 0, hfsr = 0, dfsr = 0

Change-Id: Ife5c9bbc12dcf6c4922f18b7530b21a3b87e65b3
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/530138
2017-06-15 20:13:56 -07:00
philipchen
07c4c09b0b scarlet: modify power-on sequence
Merge PP900_USB_EN, PP900_PLL_EN, and PP900_PMU_EN.
Add a new config flag to enable different power-on sequences
on one SOC.

BUG=chrome-os-partner:62207, b:62307687
BRANCH=gru
TEST=build kevin/gru/scarlet

Change-Id: Iec3082384aa321636c59169b2bc55f773463f3d0
Reviewed-on: https://chromium-review.googlesource.com/434158
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/524979
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-06-08 16:39:37 -07:00
Duncan Laurie
dcedeab2cc skylake: Add workaround for boards that cannot save reset flags
Some hardware has an issue where the reset flags are lost on power cycle
because the EC backup ram loses power.  This causes the flag to not power
on the AP (ap-off) to be lost.

In order to pass FAFT it is required that boards support this flag, so
this commit adds a workaround where the skylake chipset code will call into
the board to ask if it has working reset flags and if not it will skip the
PMIC reset if the "ap-off" flag has been set.

The "ap-off" flag is purely for testing, it is not possible for users to
do this without having access to the EC console.  (which is currently not
possible at all with CCD unless you can also build a debug cr50 image)

BUG=b:38187362,b:35585876
BRANCH=none
TEST=manual testing on Eve: execute 'reboot ap-off' and ensure that the
AP does not power on.  Also ensure that 'dut-control power_state:rec' works
as expected and does not power off at the recovery screen due to a power
button press.

Change-Id: If11e17179e9173509b9a6ae1ef0d94a50ba181d0
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/514503
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-05-25 12:25:20 -07:00
Akshu Agrawal
335bbbf220 stoney: Remove throttle cpu from S3S0 power state
This was causing cpu to give lower performance.
Hard throttling is being handled in chipset_throttle_cpu.

BUG=None
TEST=Improved CPU benchmark

Change-Id: I0bff47ec0ce60f31fa1f30fdea94d45dfe05aa38
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/508569
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: YH Lin <yueherngl@chromium.org>
2017-05-20 01:45:54 -07:00
Daisuke Nojiri
760c89fe37 Fizz: Set up charge suppliers at boot
Fizz has two power sources: barrel jack and type-c port. It
selects a power source at boot and does not dynamicall switch
to the other ports after that.

Fizz initializes all power suppliers of all ports to zero then
initialize the source supplier (barrel jack or type-c port).

When both sources are provided, it prefers a barrel jack. This
detection is done by reading the voltage on PPVAR_PWR_IN.

If barrel jack is detected as a sink, type-c port works as a
source only. If type-c port is detected as a sink, type-c
port works as a sink only.

Fizz does not have a battery. So, battery module is removed.

BUG=b:37573548,b:37316498
BRANCH=none
TEST=Boot on both type-c & barrel jack.

Change-Id: If4f5ff0c6019d06ac9dacb5dd365f5aa96bffef3
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/499547
2017-05-17 19:06:31 -07:00
Daisuke Nojiri
e8982ea3cd Allow lid-less configuration
power_button_x86.c and switch.c assume there is a lid switch. This
patch separate them so that a board with power button but with no
lid can be configured properly.

This patch also moves backlight control to the board directory
so that only the boards with a backlight turn it on/off when power
state changes.

BUG=none
BRANCH=none
TEST=boot fizz. make buildall.

Change-Id: If4070cdc4b1221fae68b35ec3497335d81f192fd
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/489602
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-05-09 23:20:07 -07:00
Archana Patni
cc0068da34 power/intel_x86: add tablet switch event wake masks
The wake mask programming for S0ix is done in
EC. This patch adds handling for the tablet switch
events in the S0ix flows.

BRANCH=none
BUG=b:37223093
TEST=attach or detach base and check if event is generated

Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Jenny TC <jenny.tc@intel.com>

Change-Id: Ibd53e85d5a3a1b776e519b70860404684c9ab0fb
Reviewed-on: https://chromium-review.googlesource.com/486462
Commit-Ready: Jenny Tc <jenny.tc@intel.com>
Tested-by: Jenny Tc <jenny.tc@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-05-02 02:59:31 -07:00
Jimmy Wang
72306c7e02 kahlee: initial board setting
1. GPIO initial
2. board config
3. led control
4. power control of Stoney
5. battery setting

BRANCH=None
BUG=None
TEST=power on device and test manually

Change-Id: I14cc60bf2cdd40032b3cbdfacf68d7a3c17fe87c
Reviewed-on: https://chromium-review.googlesource.com/461624
Commit-Ready: YH Lin <yueherngl@chromium.org>
Tested-by: Lin Cloud <cloud_lin@compal.com>
Tested-by: Danny Kuo <Danny_Kuo@compal.com>
Reviewed-by: Danny Kuo <Danny_Kuo@compal.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-04-05 19:55:13 -07:00
Furquan Shaikh
bb184acdcc power/skylake: Use power_get_signals instead of power_has_signals
In chipset_handle_espi_reset_assert, check the state of SLP_SUS# signal
using power_get_signals instead of power_has_signals since we do not
care if the check fails. This avoids unwanted "power lost input" prints
on the EC console.

BUG=chrome-os-partner:63033
BRANCH=None
TEST=Verified that entry into S3 does not result in any "power lost
input" messages on EC console.

Change-Id: I88bc76a90b48e7c565423235f6e8431176ed4872
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/444262
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-02-18 03:11:00 -08:00
Furquan Shaikh
4ce529e25a chip/npcx/espi: Handle global reset events asserting eSPI_Reset#
In case there is a sudden power loss to PCH, then there are no eSPI VW
messages sent from the PCH to EC indicating power state transition into
S5. Instead, the eSPI compatibility spec defines such events as global
reset events. For global reset events, eSPI_Reset# signal is asserted
without SLP_SUS# being asserted. This acts as an indication to the EC
that there was a global reset event.

Add a callback chipset_handle_espi_reset_assert that takes any necessary
action whenever eSPI_Reset# pin is asserted. On skylake, it would check
if power button was being pressed and release the button.

BUG=chrome-os-partner:62014
BRANCH=None
TEST=Verified that apshutdown works as expected.

Change-Id: I409afa0d00faca55ae3aa577743cedac58d4d877
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/438935
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-02-09 20:48:47 -08:00
Sam Hurst
ca0d5aba6b ec: delete auron and rambi boards
These boards have been succeeded by newer boards.

BUG=chromium:686106
TEST=make -j buildall
CQ-DEPEND=CL:434909
BRANCH=none

Change-Id: I2c964c1fdd7f8bbc5dab07caa88864847ba4e312
Reviewed-on: https://chromium-review.googlesource.com/434540
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-01-31 21:58:36 -08:00
Furquan Shaikh
0196dc9c1a power/skylake: Add option to reset pmic using LDO_EN
Add a config option that can be used by chipset to provide PMIC reset
using LDO_EN. This is required for ensuring that the AP is power
cycled properly. Implement the special pmic reset for skylake
chipsets.

BUG=chrome-os-partner:61883
BRANCH=None
TEST=Verified that reboot on EC console resets the AP and does not get
stuck in G3 on poppy.

Change-Id: I5f680fede5cb4effa86243f51edfdea09db4d975
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/431192
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2017-01-23 03:48:08 -08:00
Vijay Hiremath
6550e44ed7 intel_x86: Handle unexpected power loss in S0iX
Picked the code from Glados branch.
 Change-Id: I0f24f717f712dcd46e3ddca2a8c86888739f3deb
 Reviewed-on: https://chromium-review.googlesource.com/390343

BUG=chrome-os-partner:61645
BRANCH=none
TEST=Manually tested on Reef. Reef exits from S0iX upon issuing
     'apreset warm' & 'apreset cold' from the ec console.

Change-Id: Ie5fa4ad79b7c78344e99fcbf4ba2b5b800f9934c
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/427393
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-21 10:03:45 -08:00
Vijay Hiremath
927b2e754f intel_x86: Handle RSMRST signal in Intel x86 common code
BUG=chrome-os-partner:59141
BRANCH=none
TEST=make buildall -j
     Reef can boot to OS. S3, S5, hibernate are working.

Change-Id: Iddd16cba5f1dc62341dfbc8568b490439b7d593b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/427018
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-21 10:03:45 -08:00
Vijay Hiremath
44eb5829c6 intel_x86: Make common code for LPC S0 <-> S0ix transitions
BUG=chrome-os-partner:59141
BRANCH=none
TEST=Manually tested on Reef. System can enter and exit from S0iX
     when LID is closed & opened respectively.

Change-Id: I5892da327c2dcdd400d5a7ade867bec1b80cbaa4
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/407047
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-21 10:03:45 -08:00
Vijay Hiremath
8e4d429172 power: Group Intel x86 power sequencing common code
Grouping the Intel x86 power sequencing common code so that
the future chipset power sequencing implementation can make
use of the existing code.

BUG=chrome-os-partner:59141
BRANCH=none
TEST=make buildall -j
     Manually tested on Reef & Chell.
     System can boot to OS. S3, S5, hibernate are working.

Change-Id: I29dc208eacb3db47c640d028e9551ab3d8d4288c
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/402272
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-20 22:40:32 -08:00
Vijay Hiremath
2ddd8d8e5f power: Extract Intel x86 power sequencing common code
Extracted Intel x86 power sequencing common code from skylake.c
and apollolake.c to implement common code for power sequencing.

BUG=chrome-os-partner:59141
BRANCH=none
TEST=make buildall -j
     Reef can boot to OS. S3, S5, hibernate are working.

Change-Id: I73478fcabb24d6d98cd474bae3586ce5b02986fe
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/406486
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-07 16:10:21 -08:00
Vijay Hiremath
4fa1c8b9e3 apollolake: Add support to enable eSPI signals
BUG=chrome-os-partner:59141
BRANCH=none
TEST=make buildall -j

Change-Id: I6d90d647a6e19c627aa68ddd8a203d6be8b2e32d
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/425820
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-06 20:38:59 -08:00
Vijay Hiremath
8a681c8e60 skylake: Reuse the sleep event code from the common code
BUG=chrome-os-partner:59141
BRANCH=none
TEST=make buildall -j

Change-Id: I881b92215f24ea047ec4fc3109b174ff1615de29
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/425486
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-01-06 20:38:58 -08:00
Shawn Nematbakhsh
0701e32446 power: rk3399: Wake from S3 on power button press rather than shutdown
BUG=chrome-os-partner:58599
BRANCH=gru
TEST=Boot kevin, go to S3, verify power button wakes. Hold power button
in S3, verify device wakes and then shuts down. Go to S3, close lid,
press power button, and verify no wake occurs.

Change-Id: I4fa2e4967babc18cea9b5ffc7cec264b6f2fa8e3
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/399518
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
(cherry picked from commit 97bdf83b41834c072c5d1be516c8186c7911cee3)
Reviewed-on: https://chromium-review.googlesource.com/415489
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-12-01 19:58:55 -08:00
Shawn Nematbakhsh
81d32b8106 power: rk3399: Use longer SYS_RST hold time on chipset reset
BUG=chrome-os-partner:57990
BRANCH=gru
TEST=On kevin, verify `apreset` and kernel panic cause successful AP
reset.

Change-Id: Ic5ad2fd2d2d08ae32a60314e30f4cdff061da164
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/395533
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 8fb0dedd8daebeca3757bc341d0a5355d3b26ba5)
Reviewed-on: https://chromium-review.googlesource.com/396136
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-12-01 19:58:50 -08:00
Archana Patni
b8406119c2 Apollolake: Enter/exit from S0ix based on host commands from kernel
This patch changes the entry/exit model for S0ix from a PCH
SLP_S0 signal based model to a hybrid host event/direct interrupt
model. The kernel will send host events on kernel freeze/thaw exit;
EC will initiate the S0ix entry based on host command and exit via
another host command from kernel.

The assertion of SLP_S0 comes later than HC(suspend) and deasserion
of SLP_S0 comes earlier than HC(resume).
        ________                        ________
SLP_S0          |______________________|
        _____                             ________
HC           |___________________________|

BRANCH=none
BUG=chrome-os-partner:58740
TEST=Build/flash EC and check 'echo freeze > /sys/power/state'
command in OS shell. Verify idle state transitions during display off
and periodic wakes from S0ix do not lead to state transitions in EC.

Change-Id: Ie18c6c2ac8998f59141641567d1d740cd72c2d2e
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>
Signed-off-by: Archana Patni <archana.patni@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/401072
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2016-11-17 16:09:44 -08:00
Martin Roth
897ce78bdd Fix various misspellings in comments
No functional changes.

BUG=none
BRANCH=none
TEST=make buildall passes

Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403417
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:53 -08:00
Vijay Hiremath
9b47a0812d skylake: Add support to S0iX based on host commands from Kernel
Picked the code from Glados branch.
 Change-Id: I4bf114235c4d542dd7cf0dad6427c771e54d4611
 https://chromium-review.googlesource.com/#/c/331358/

BUG=chrome-os-partner:59742
BRANCH=none
TEST=make buildall -j

Change-Id: Ib79f1209dfd9e6a9de0438cb1866bba2939e5393
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410036
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-11-13 10:58:58 -08:00
Gwendal Grignou
cbae8f9b32 kevin: Add Sensor in S3, disable keyboard wakeup in tablet mode.
Let sensor be powered on in S3. It is useful for Android and if we want to
disable keyboard wakeup based on lid angle.
Allow EC to disable touchpad and not send keyboard events when lid angle
is greater than 180.

BUG=chrome-os-partner:57510,chromium:620633
BRANCH=gru
TEST=In S3, check the sensors are readable.
Check that when in S3 and lid angle is < 180 EC sends keyboard events.
Check that when in S3 and lid angle is > 180 EC does not send keyboard
events.

Change-Id: I4e7959ed37bc5dfdf9c105ecae94c314b253d77f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406739
Commit-Ready: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-04 04:54:20 -07:00
Shawn Nematbakhsh
690873bc75 power: rk3399: Decrease max. latency for aborted suspend
Make several calls to msleep() rather than one single call.

BUG=chrome-os-partner:58474
BRANCH=gru
TEST=S/R stress test on kevin.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Icdc8f221c51519e0f2b95d273aa0523ea3a4eeee
Reviewed-on: https://chromium-review.googlesource.com/401930
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403460
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:06:49 -07:00
Shawn Nematbakhsh
c2d60f53bc power: rk3399: Adjust power-down sequencing delays
BUG=chrome-os-partner:58474
BRANCH=gru
TEST=suspend_stress_test on kevin for 50 cycles.

Change-Id: Ice721e04c6d4389520f40c4ca72f5bec0e1bdb5b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/399992
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403459
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:06:48 -07:00
Caesar Wang
8292c4c2df power: rk3399: turn off the center logic in s3
CQ-DEPEND=CL:386537
BUG=chrome-os-partner:54291
TEST=turn off the center-logic
BRANCH=None

Change-Id: I73577e15cc0a8474d8eb2ed1a48f5aba59e54c6a
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/381158
Reviewed-by: Catherine Xu <caxu@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-27 19:28:55 -07:00
Duncan Laurie
5cfa02b03c lpc: Add function for host reset without RCIN GPIO
Prior x86 boards have had GPIO for toggling RCIN directly on the PCH,
although many likely had HW-assisted methods as well.

With eve we need to generate an eSPI Virtual Wire for RCIN, but in reality
software control over RCIN Virtual Wire is not available with the npcx EC,
so the legacy LPC interface for pulsing KBRST must be used instead as this
is the only way to generate RCIN.

This method will likely vary on different EC chips, but for skylake it
can just be abstracted into the LPC module.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=successful 'apreset warm' on eve EC console

Change-Id: I7f9e7544a72877f75d05593b5e41f2f09a50e1c9
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400037
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:44:08 -07:00
Duncan Laurie
b142b05465 power: Add board callback before RSMRST# state change
This board function allows workarounds to be applied to a board after all
power rails are up but before the AP is out of reset.

Most workarounds for power sequencing can go in board init hooks, but for
devices where the power sequencing is driven by external PMIC the EC may
not get interrupts in time to handle workarounds.

For x86 platforms and boards which support RSMRST# passthrough this board
callback will allow workarounds to be applied despite the PMIC sequencing
by ensuring that the function is executed before RSMRST# deassertion.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=test IMVP8 workaround on multiple eve boards

Change-Id: I0569494084000a4b1738ee18aafce5c96900dc4b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/402591
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-26 01:44:06 -07:00
Duncan Laurie
b8050224e5 include: Add default state for ESPI and VW_SIGNALS
Add the default undefined state for CONFIG_ESPI and rename
CONFIG_VW_SIGNALS to CONFIG_ESPI_VW_SIGNALS.

BUG=chrome-os-partner:58666
BRANCH=none
TEST=pass presubmit checks

Change-Id: I45242d545915c16bb46f751532a01ab937cee5f0
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400032
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-25 17:33:42 -07:00
Shawn Nematbakhsh
d9b7d25b86 power: rk3399: Debounce PGOOD_SYS signal
PGOOD_SYS may glitch for a period not to exceed 1ms. When PGOOD_SYS or
PGOOD_AP are deasserted, wait for up to 100ms for both signals return
before transitioning out of S0.

BUG=chrome-os-partner:56822
BRANCH=gru
TEST=Manual on kevin, boot device and verify it remains in S0 without
spurious transitions to S3.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I95ccae54fc5939c835f00dc9b7cf88b9d0553c11
Reviewed-on: https://chromium-review.googlesource.com/393148
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit b867d3fc9dea04ac65f5288fb99d3ed65c127644)
Reviewed-on: https://chromium-review.googlesource.com/396139
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-17 17:40:47 -07:00
Shawn Nematbakhsh
710f4ff4ca power: rk3399: Enable PP900_PCIE earlier to prevent leakage
Enable PP90_PCIE along with PPVAR_LOGIC and PP900_AP to avoid leakage.

BUG=chrome-os-partner:57952
BRANCH=Gru
TEST=Verify kevin powers up / down successfully.

Change-Id: I6fa47edcdde482d3fa2f249cfdff6e060a445f42
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/390896
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit b41006ba84bc86e453c241296309fadf9a864032)
Reviewed-on: https://chromium-review.googlesource.com/391037
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-30 18:04:33 -07:00
Aseda Aboagye
8e75397652 power: common: Prevent console spam.
The power state driver would print out the current power state along
with its signals everytime a power signal interrupt was fired.  On some
systems, a signal may briefly go low and then come back before our
chipset module has a chance to notice.  This causes what appears to be
duplicate prints.

This commit tries to only print out the current power state when
something has actually changed.  If the input power signals or state
differs from the last time it checked, then the information will be
printed.

BUG=None
BRANCH=gru
TEST=Find a kevin where PGOOD goes away quite frequently.  Build and
flash; Verify that significantly less "power state S0" console spam is
emitted.
TEST=Verify that all state transitions are still printed.

Change-Id: I9d66c04e2ed79ab203c54f0a8dad82f32856bbf0
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/388761
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-09-26 11:59:15 -07:00
Aseda Aboagye
35352c8d79 power: common: Print RTC when changing states.
In order to help correlate EC logs with those from the kernel, it was
suggested that the EC could periodically print the RTC time.  This
commit prints out the RTC time when changing power states.

BUG=chrome-os-partner:57731
BRANCH=gru
TEST=Build and flash kevin.  Boot system up and suspend.  Verify that
RTC times are logged to the EC console.

Change-Id: Ia1ee1ec88c6733f863a703fb3f841ab74b80fcb9
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/388802
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-09-23 21:08:58 -07:00