Commit Graph

46 Commits

Author SHA1 Message Date
Louis Yung-Chieh Lo
2e41eb9eb9 tegra: move to charger v2.
This would move all tegra boards to charger v2.

Also removed the unnecessary charge_keep_power_off(), which was
designed for USB power port and doesn't apply to Tegra platform.

BUG=none
BRANCH=nyan,big,blaze
TEST=build and run on nyan.

Change-Id: I9517a8885726ad6dce5a2865402da4b9551e009f
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194384
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-04-18 21:32:53 +00:00
Alec Berg
3344c8e2e6 Refactored keyboard scan enable flag to allow for multiple disable reasons
Refactored keyboard scan enable/disable flag such that it is a mask of
potential disable sources. When all disable sources are off, scanning is
enabled, otherwise scanning is disabled. This fixes a recently introduced
bug in which enabling/disabling keyboard scanning due to lid angle in S3
was interfering with enabling/disabling keyboard scanning due to power
button. This also allows for easy expansion for future causes for disabling
keyboard scanning.

BUG=chrome-os-partner:27851
BRANCH=rambi
TEST=Manual tests with a glimmer. Used the ksstate console command to
check state of keyboard scanning under all permutations of power button
pressed/unpressed, lid switch open/closed, and lid angle in tablet position
vs. laptop positon.

Change-Id: Ied4c5ebb94510b1078cd81d71373c0f1bd0d6678
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194287
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-11 20:02:30 +00:00
Randall Spangler
b81c977914 baytrail: Increase time after all voltages good to 15 ms
We had decreased this from 100 ms to 5 ms, but apparently we need at
least 10 ms.  Use 15 ms to give us some margin.

BUG=chrome-os-partner:25264
BRANCH=rambi
TEST=boot system

Change-Id: I4d96aeb1040a042bac46fa8701a073d3355bfd2a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190485
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-03-18 20:35:24 +00:00
Randall Spangler
9de183a5d6 rambi: Add 7 ms delay before turning off PP3300_DX at shutdown
This works around an issue where LCDVCC falls too slowly.  The impact
is to slow shutdown by 7 ms, which isn't noticeable to the user.

BUG=chrome-os-partner:26561
BRANCH=rambi
TEST=shut down rambi; still shuts down, and ~7 ms more time is spent
     in S0->S3 state.

     before:
	[429.933010 power state 3 = S0, in 0x043f]
	[429.933240 power state 7 = S0->S3, in 0x043f]
	[429.933614 power state 2 = S3, in 0x042b]
	[429.934013 power state 8 = S3->S5, in 0x0428]
     after:
	[20.355975 power state 3 = S0, in 0x003f]
	[20.356194 power state 7 = S0->S3, in 0x003f]
	[20.363957 power state 2 = S3, in 0x002c]
	[20.364179 power state 8 = S3->S5, in 0x002c]
	[20.364877 power state 1 = S5, in 0x0008]

Change-Id: Ie843bdcf740f3dbc1b866a0356cea2a8b42d4194
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189092
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-03-07 02:21:03 +00:00
Louis Yung-Chieh Lo
1484116cb0 stm32l: supports fake-hibernate
We don't have available GPIO pin for power button as the hibernate
(stand-by) wake-up source. Also, we don't want to do board change.

So, put the EC in a decent infinite loop to pretend the hibernate mode
and wait for particular wake-up event. This should be fine because
the AP is already down before EC hibernates.

BUG=chrome-os-partner:25435
BRANCH=Nyan
TEST=see comment #6 of issue for detailed test steps.

Change-Id: I2cae131789f9ca5808b60d5f2495222ca9016e7c
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186061
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-06 23:14:07 +00:00
Randall Spangler
930b41e6a9 Allow AP to set wireless power state in suspend
Previously, the AP could only set the current wireless power state.
It couldn't determine what the EC would do in S3, nor could it get the
current wireless power state.  Extend the wireless command to do so,
and add an EC console command to aid in debugging.

BUG=chrome-os-partner:25655
BRANCH=rambi
TEST=manual; expected numbers are from EC 'wireless' command
  AP off -> 0x0, 0x9
  AP on -> 0xd 0x9
  AP suspended -> 0x9 0x9
  AP on -> 0xd 0x9
  ectool wireless 0x1 -> 0x1 0x9
  ectool wireless 0xd -> 0xd 0x9
  ectool wireless 0 0 0 0 -> 0xd 0x9 (and prints 0xd 0x9 to root shell)
  ectool wireless 5 -1 -1 0 -> 0x5 0x9
  AP suspended -> 0x1 0x9 (doesn't turn on 0x8, just turns off 0x4)
  AP on -> 0xd 0x9
  ectool wireless 0 0 0 -1 -> 0xd 0x0
  AP suspended -> 0x0 0x0
  AP on -> 0xd 0x9

Change-Id: I8ead2d4a4423b51ec4f638bf94c62de98726b25c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187273
2014-02-22 00:50:37 +00:00
Louis Yung-Chieh Lo
e43074ebcf cleanup: nyan: remove unnecessary dependence to pmu_tpschrome.h
Nyan uses common/charge_state instead. So, fix the dependence.
Since snow/spring/pit are using common/pmu_tps65090_charger, keep them.

BUG=None
BRANCH=Nyan
TEST=build and works fine on Nyan 3.2

Change-Id: I985f7980578ac22602b1fbffa51edf039078bc05
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186337
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-14 17:46:34 +00:00
Randall Spangler
66eec4415a baytrail: reduce delay before SYS_PWROK assertion to 5 ms
Since we have only mini-PCIe devices, and no PCIe devices, we don't need a 100 ms delay.

BUG=chrome-os-partner:25264
BRANCH=rambi
TEST=boot system; AP boots normally

Change-Id: I3dd537154d70b8379ebc36cb71474420cba43d7d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185046
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-02-06 19:27:14 +00:00
Randall Spangler
fc054b4899 baytrail: Ensure touchscreen is in reset on S3->S5 transition
If the lid is open during shutdown, we were leaving the touchscreen
out of reset.  That increased S5 power consumption.

BUG=chrome-os-partner:25168
BRANCH=rambi
TEST=boot system, then power off with lid open
     'gpioget TOUCHSCREEN_RESET_L' --> 0

Change-Id: Ibcd4718f0e4197a8cbcf2bb88cfbfa38ed345ead
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185027
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-06 19:27:09 +00:00
Randall Spangler
7263e4571d rambi: Add delay between PP5000 and PP3300_DX enables
This may improve stability with power chaining.

BUG=chrome-os-partner:25271
BRANCH=rambi
TEST=boot system

Change-Id: Ia3d4776b7e47c4d3cbaa4d6f937241fd230243f2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183739
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-24 19:38:18 +00:00
Randall Spangler
44feb4b4e7 Fix leaving SUSP_VR_EN enabled if S5 rails fail to come up
We noticed this on a baytrail board, but the same problem exists in
haswell as well.  And while looking there, found that we skipped the
S5G3 state if the 5V rail failed to come up.

Fortunately, these are all rare corner cases; rails will always come
up on a good system.  So this only affects systems during bringup and
factory, not devices in the field.

BUG=chrome-os-partner:24915
BRANCH=rambi (and technically haswell, but may not be worth merging)
TEST=Try booting a system with a bad power rail; see that SUSP_VR_EN=0
     after the system fails to boot.

Change-Id: Ifd10841d298a0f2510a8b182250b717ea5643c99
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183733
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-24 19:37:44 +00:00
Randall Spangler
2d39c66ee9 rambi: Increase REST# pulse length for warm reboot
The PCH uses a 16 ms debounce, so need to assert the signal for twice
that to be assured of a reboot.

BUG=chrome-os-partner:25088
BRANCH=rambi
TEST=Alt+VolUp+R reboots the system

Change-Id: I51fd54fd992e4e54e6c3bc9c13f9fd59e9bf55ac
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183726
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2014-01-24 19:37:41 +00:00
Randall Spangler
75857e80d0 rambi: Leave 5V rail on in S3 if USB ports are powered
Previously, the 5V rail was disabled unconditionally in the S0->S3
transition.  Now, the rail is left powered if one or both of the USB
ports are powered.

BUG=chrome-os-partner:25178
BRANCH=rambi
TEST=Modify the OS to leave USB ports powered in S3.  Then suspend.  On
     the EC console, 'gpioget pp5000_en' should be 1.

Change-Id: I3c73f3fe228e940317c0da7330f117c7ab0a6d0c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183548
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-23 19:32:27 +00:00
Yung-Chieh Lo
8d3136f6b7 x86 & tegra: add CONFIG_POWER_COMMON.
For the better naming for power/common.h, we rename CONFIG_CHIPSET_X86
to CONFIG_POWER_COMMON (no one is actually using it). But keep
CONFIG_CHIPSER_TEGRA for power/build.mk.

BUG=chrome-os-partner:25068
BRANCH=nyan,falco,link,peppy,rambi,samus,squawks
TEST=build only

Change-Id: Ibf1a4c24088dfddac39b38a95b3b887c195152d5
Signed-off-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182732
2014-01-21 01:13:15 +00:00
Duncan Laurie
064624cc2d baytrail: Add config option to enable WiFi in suspend
Some WiFi devices do not tolerate losing power in suspend
and will not function properly after resume if they have
lost power.

Enable this on the Rambi device.

BUG=chrome-os-partner:24114
BRANCH=baytrail
TEST=complete mutiple successful suspend/resume cycles on rambi
and ensure that wifi continues to function and not cause a crash.

Change-Id: Id421f3138e429b247bfb3f5ffb92a06c0353bb97
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183047
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-17 23:59:46 +00:00
Louis Yung-Chieh Lo
2c0292958f tegra: refactor the power state machine.
Integrate with power/common.c -- a real state machine now. Also remove
duplicate and unused functions/consts.

BUG=chrome-os-partner:24831
BRANCH=nyan
TEST=on nyan rev 3.12.
re-plug AC: PASS, power on 2
reboot: PASS, power on 2
power off (S5), power on: PASS, power off 4, power on 5
power off (G3), power on: PASS, power off 4, power on 5
lid close / power off (S5)/ lid open: PASS, power on 3
lid close / power off (G3)/ lid open: PASS, power on 3
press power button and release: nothing happens after 15s.
button off (S5)/ on: PASS, power off 3, power on 4
button off (G3)/ on: PASS, power off 3, power on 4
power off (S5)/ button on: PASS, power off 4, power on 4
power off (G3)/ button on: PASS, power off 4, power on 4
button off (S5)/ power on: PASS, power off 3, power on 5
button off (G3)/ power on: PASS, power off 3, power on 4
button off (S5)/ lid open: PASS, power off 3, power on 3
button off (G3)/ lid open: PASS, power off 3, power on 3
is off, long press button (60s): power on 4, too long, shutdown, stay off
is on, long press button (60s): power off 3, stay off
apreset cold: entered to S5, power off 3, power on 5
apreset warm: power state is not changed, but reboots to BIOS.

Change-Id: Ie12fa4f79b6156f71f89155b2b01880914809c75
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182348
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-17 18:17:09 +00:00
Louis Yung-Chieh Lo
9867f8379a x86: generalize power state machine for all platforms (2/2)
Rename x86_* to power_signal_* and X86_* to POWER_*.

BUG=chrome-os-partner:24832
BRANCH=link,falco,samus,rambi,peppy,squawks,snow,spring,nyan
TEST=make -j buildall run_tests

Change-Id: Ifaa06391da5a483851ff56eca91fbf6d038dff0a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181719
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-09 05:30:49 +00:00
Louis Yung-Chieh Lo
375e75de27 nyan: use usleep() for PMIC_THERM_HOLD_TIME
It was udelay, which is busy-loop and other tasks have no chance to run.
usleep() could yield the CPU resource out.

BUG=None
BRANCH=nyan
TEST=other tasks get chance to run.
- Before:
[0.010242 not sysjump; forcing AP shutdown]
[0.060471 EC triggered warm reboot]

- After:
[0.010103 not sysjump; forcing AP shutdown]
[0.022985 event set 0x00000080]
[0.041828 Charge state init -> idle0 after 0.010393 sec]
[0.043327 Battery  98% / 1092h:15]
[0.060394 EC triggered warm reboot]

Change-Id: Id41a0b4fda5ac78b1b7f3e3f316b9721fcc3dd34
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181763
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-08 02:24:20 +00:00
Randall Spangler
59602b41e8 rambi: Remove duplicate EC_PWROK workaround for proto 1.5
After this change, only Rambi 2.0 boards will boot properly.

This cleanup is necessary before supporting other Baytrail systems.

BUG=chrome-os-partner:24414
BRANCH=rambi
TEST=as soon as I get a 2.0 board

Change-Id: Ic9e3afcee9dae5c0b7f31a7aa4500b2572ba92c6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181754
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-08 02:19:29 +00:00
Louis Yung-Chieh Lo
4e27a42ff9 x86: generalize power state machine for all platforms (1/2)
Renaming file names is the first step. Please see issue tracker
for more details.

BUG=chrome-os-partner:24832
BRANCH=link,falco,samus,rambi,peppy
TEST=build all x86 boards.
make clean BOARD=link && make -j32 BOARD=link && \
make clean BOARD=falco && make -j32 BOARD=falco && \
make clean BOARD=samus && make -j32 BOARD=samus && \
make clean BOARD=rambi && make -j32 BOARD=rambi && \
make clean BOARD=peppy && make -j32 BOARD=peppy

Change-Id: I3a296a0c14f6bebefa858438b1320061ac71dd38
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181400
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-07 04:53:06 +00:00
Louis Yung-Chieh Lo
9346e74039 nyan: implement chipset_reset() for cold/warm reset
For AP hang detection, the warm reset must be implemented. Since
the cold reset is easy, implement it at the same time.

BUG=chrome-os-partner:23822, chrome-os-partner:24789, chrome-os-partner:24558
BRANCH=nyan
TEST=on nyan rev 3.12
power on/off --> work as usual
power on, then apreset cold --> system is cold reset (off, then on)
power off, then apreset cold --> nothing happens. this is fine.
power on, then apreset warm --> system is warm reset (power trail is kept).
power off, then apreset warm --> nothing happens. this is fine.
power on --> system is back to normal again.

Change-Id: I010793b7a2d309e5d606fbc5877e9e3b07c8c5f3
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181164
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-03 23:04:27 +00:00
Louis Yung-Chieh Lo
9a11fab20e nyan: wait 225ms for PMIC RTC start-up
The first time the PMIC sees power (AC or battery) it needs 200ms
(+/-12% oscillator tolerance) for the RTC startup. In addition
there is a startup time of approx. 0.5msec until V2_5 regulator
starts up.

BUG=None
BRANCH=nyan
TEST=verified on rev 3.12 with AC/battery replug * 10.
Power button on/off and 'power on/off' are not effected.

Change-Id: I706829017a53c549601a925cb18d33b21c50eb76
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180677
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-20 00:38:20 +00:00
Louis Yung-Chieh Lo
41876dca3e nyan: change the XPSHOLD waiting time
According to the nVidia power engineer, we shall wait for 40ms to see
XPSHOLD asserted after PMIC_PWRON_L is asserted.

Also change the code since it was obscured. Comments was out-of-sync too.

BUG=None
BRANCH=None
TEST=Verified on rev 3.12.

Change-Id: If479d8398f4008f0b029d450b3d28ac98cdf969f
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180502
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-19 02:33:37 +00:00
Randall Spangler
6ab8e91658 cleanup: Remove checkpatch warnings
This make minor syntactic changes and renames some camel-cased symbols
to keep checkpatch from complaining.  The goal is to reduce the
temptation to use 'repo upload --no-verify'.

This is a big furball of find/replace, but no functional changes.

BUG=chromium:322144
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180495
2013-12-19 00:12:28 +00:00
Randall Spangler
400d7758bd rambi: Add duplicate GPIO outputs for proto 2.0 board
Proto 2.0 makes these changes:
  KBD_IRQ# moves from PM4 to PM3.
  EC_PWROK moves from PH2 to PJ1.

Since PM3 and PJ1 are unused on proto 1.5, it's harmless to duplicate
the current functionality on those outputs.  We can remove the old
outputs when we deprecate the 1.5 boards.

BUG=chrome-os-partner:24424
BRANCH=none
TEST=boot rambi

Change-Id: Iff77651ef575a8405878fe75f025a0507b02b771
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180081
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-12-16 22:57:31 +00:00
Randall Spangler
05bd0cdec7 Rename mixed-case config constants
This renames constants used in compiler conditionals to uppercase.
   BOARD_foo
   CHIP_foo
   CHIP_FAMILY_foo
   CHIP_VARIANT_foo
   CORE_foo

Mixed-case constants are still defined by the makefile, but are now no
longer used.  I will make one more pass in a week or so to catch any
that are part of someone else's CL, since otherwise this change might
silently merge correctly but result in incorrect compilation.  Then I
will remove defining the mixed-case constants.

BUG=chromium:322144
BRANCH=none
TEST=Build all boards.  Also, "git grep 'BOARD_[a-z]'" should return no
     results (similarly for CHIP, CORE, etc.)

Change-Id: I6418412e9f7ec604a35c2d426d12475dd83e7076
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179206
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-12-16 20:28:32 +00:00
Louis Yung-Chieh Lo
dd59e5f5da nyan: propagate EC reset to the AP reset for old boards.
New boards (rev >= 2.2) are not affected since chipset_force_shutdown()
is called. On old boards the power rails of old boards are not removed
completely. This CL ensures the AP is warm-reset after EC is reset.

BUG=None
BRANCH=nyan
TEST=nVidia verified on old boards.

Change-Id: Ia2c2b243534d8a73b9b4d5320aad4664b1ac8b12
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179521
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-14 02:31:46 +00:00
Louis Yung-Chieh Lo
d4ce7fd5f4 nyan: bring back set_ap_reset() for old boards.
Since some folks are still using old boards (rev <= 2.0), bring this back
so that they can reset system gracefully.

BUG=None
BRANCH=nyan
TEST=tested on rev 2.0
reboot  // EC and AP are rebooted
reset button on board  // EC and AP are reset
power off  // AP (rev 2.0) is expected NOT powered off.
power on

Change-Id: I35dbc5648b092c892dc06ce5676e1e68c695d477
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179851
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-13 02:44:38 +00:00
Louis Yung-Chieh Lo
b38fd45000 nyan: re-factor power button to use common/power_button.c
This is the first step of tegra power state re-factoring. Move the
power button logic to common/power_button.c.

Also, the GPIO KB_PWR_ON_L is renamed to POWER_BUTTON_L.

BUG=None
BRANCH=nyan
TEST=tested on nyan rev 3.12,
reboot: PASS, power on 2
power off / power on: PASS, power on 5
lid close / power off / lid open: PASS, power on 3
button on / off: PASS, ending loop 3, power on 4
power off / button on: PASS, ending loop 4, power on 4
button off / power on: PASS, ending loop 3, power on 5
button off / lid open: PASS, ending loop 3, power on 3

Change-Id: If07806b9c11cdba2b478a9a74d2b75be1d9f7acf
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179451
2013-12-11 00:13:51 +00:00
Louis Yung-Chieh Lo
90d83d2a67 nyan: force shutdown uses PMIC THERM instead.
Add a new pin PMIC_THERM_L (PA1) since AP_RESET_L (PA15) is removed.
To force shutdown, drive PMIC_THERM_L to low (default high) for 32us.

Also rename set_pmic_pwrok() -> set_pmic_pwron(). And add a debounce time
for PMIC_PWRON_L pin.

BUG=chrome-os-partner:24206
BRANCH=nyan
TEST=Verified on the frank's rework board.
'power off' shutdowns the AP immediately.
'reboot' reboots the EC and resets the AP as well.
'sysjump RW' still keeps AP alive.

Change-Id: I8643e19081a824e1f6adc812dfad0269222db8ea
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178631
2013-12-05 01:51:28 +00:00
Randall Spangler
804b24cc81 rambi: Remove proto1 workaround which leaves PP5000_EN on
proto1.5 boards should not need this workaround.

BUG=chrome-os-partner:23673
BRANCH=none
TEST=boot a proto1.5 board -> boots
     apshutdown -> off
     gpioget PP5000_EN -> 0
     powerbtn -> boots
     gpioget PP5000_EN -> 1

Change-Id: Ie7bb962a9be0934506a6a5d0aefda0282ebb15ec
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177668
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-12-03 22:15:25 +00:00
Yen Lin
b29aba1921 nyan: change power button long press timeout to 10.2 seconds
The worst case of the ONKEY long press timeout of AS3722 PMIC is
10.08 seconds, according to AMS. Increase of such timeout defines
to 10.2 seconds.

BUG=nvbug 1372063
BRANCH=nyan
TEST=verified on Venice2 boards that were failing to turn off power
     with 9 seconds timeout

Change-Id: I65c8ebaab0523874ceff621cdbda72d8b44f4864
Signed-off-by: Yen Lin <yelin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/177611
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-23 02:33:43 +00:00
Randall Spangler
34b94121c7 Remove bolt, daisy, kirby, puppy, slippy boards
These boards are unloved and unsupported.  They'll never grow up to be
laptops, and hardware is increasingly hard to come by.

Comparable functionality is available in the other, more-loved boards.

Removing these boards speeds up util/make_all.sh by 40%.  (If you're
not running that before every upload, you should be...)

BUG=chrome-os-partner:24062
BRANCH=none
TEST=build all remaining platforms and pass unit tests

Change-Id: I4d8a49e4d52d7393471f1b1cbef059c8db4a4f77
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177373
2013-11-21 22:21:56 +00:00
Randall Spangler
d72084463a rambi: Pause between S5 and G3 states
This gives the AP a chance to reboot, before the EC kills it by dropping rails.

BUG=chrome-os-partner:24120
BRANCH=none
TEST=on AP, write 0xe to 0xcf9; system should reboot instead of shutting down

Change-Id: I322a1193e90b4de37a4adaf547e1c6bf5be077c3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177305
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-11-19 23:16:26 +00:00
Louis Yung-Chieh Lo
082d8b2e2d nyan: supports immediate 'power off'.
Poll down AP_RESET_L pin to shutdown AP immediately, instead of
press the power button for 8 secs.

BRANCH=nyan
BUG=chrome-os-partner:23895
TEST=verified on nyan board 2.0 with follwoing tests:
    power off / power on: PASS. Tested 5+ times.
    lid close / power off / lid open: PASS. Tested 5+ times.
    button on / off: PASS. Test 5+ times. ~20% not boot (HOLD=1).
    power off / button on: PASS. Tested 5+ times.
    button off / power on: PASS. Test 5+ times. ~60% not boot (HOLD=1)
    button off / lid open: PASS. Test 5+ times. ~40% not boot (HOLD=1)

Change-Id: Iecc97f38ac7bd923745994594356029836d7b4e6
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177241
2013-11-19 06:06:52 +00:00
Alec Berg
b2a2821b4d rambi: Add low power idle to rambi
Added low power idle functionality to rambi but left it off by default.
To turn it on, define CONFIG_LOW_POWER_IDLE in rambi's board.h file.

BRANCH=none
BUG=chrome-os-partner:23947
TEST=Verified that the EC does not go into deep sleep when in S0, and that
it does go into deep sleep in S3, S5, and G3. Tested to make sure that
flashec works when the EC is in low speed deep sleep. Also verified
that the EC console times out after the timeout period and that it wakes
up on the next command. Did not measure power usage.

Change-Id: I0ab1a2dc7ca7ae4577fe5d0894c1bf82205dfea6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176159
Reviewed-by: Todd Broch <tbroch@chromium.org>
2013-11-09 04:39:00 +00:00
Louis Yung-Chieh Lo
308e02195d Take XPSHOLD back.
The XPSHOLD is not floated. It connects to +1.8V_VDDIO, which indicates
high when AP is on. So, bring it back.

Also remove the duplicated GPIO definition (GPIO_PWR_LED1).

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

BUG=chrome-os-partner:23929
BRANCH=nyan
TEST=verified on nyan. successfully boot up the machine.

Change-Id: I293a899bcdf255f36f6117627f66ed8231c9a70f
Reviewed-on: https://chromium-review.googlesource.com/176046
Reviewed-by: Yen Lin <yelin@nvidia.com>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Yung-chieh Lo <yjlou@chromium.org>
Tested-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-08 00:53:27 +00:00
Louis Yung-Chieh Lo
53aca69b7b Add TODO for TODO_XPSHOLD.
The TODO line was accidentally removed in the last CL.

BUG=None
TEST=None
BRANCH=None
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

Change-Id: Ia37e0f6bf21e072c714512d2eaa7ad69ef5fad93
Reviewed-on: https://chromium-review.googlesource.com/175632
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Yung-chieh Lo <yjlou@chromium.org>
Tested-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-05 02:32:57 +00:00
Louis Yung-Chieh Lo
e297b72563 Refine GPIO list of Nyan.
Refine the GPIO list according to the schematic.  Comment out the XPSHOLD in
power/tegra.c for compiling. Will fix later.

BUG=None
BRANCH=None
TEST=emerge-nyan chromeos-ec &&
make runtests -j 32 && make BOARD=nyan tests -j 32

Change-Id: Id0d682fd5d48e8a8a07785e86c07f45f07d866ab
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175534
2013-11-04 20:44:50 +00:00
Randall Spangler
c1e02ca220 cleanup: Yes, even more TODO comments
Almost done.  Comment changes only.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I974dfc12aa264e2035b3bae35a089c19344e7d45
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-04 19:48:49 +00:00
Randall Spangler
3266ae6a7e cleanup: Even more TODO comments
Update comments with more info, or remove if no longer applicable.

No code changes.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; pass unit tests

Change-Id: I5b56eeb500bc0f00e84e91ef99684f4b1b310972
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175418
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-01 20:07:24 +00:00
Randall Spangler
d7004207e5 cleanup: Update more TODO comments
Add bug links, reword, or remove as applicable.

No code changes, just comments.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: Id55dd530c10091d7ab9d0f942f750168fca793b4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175326
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-01 17:13:11 +00:00
Randall Spangler
2dc1418ccd cleanup: Assorted TODO comments
Remove comments if no longer applicable, or assign bug numbers if they
still are.  Tidy some debug output.  No code changes other than the
debug output.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms, pass unit tests

Change-Id: I2277e73fbf8cc93f3b1b35ee115e0f2f52eb8cf9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175215
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-31 18:43:39 +00:00
Randall Spangler
8eacb8ffe2 rambi: Enable PP5000 at boot
Due to power topology, PP5000 needs to be enabled as soon after
PP3300_DSW as possible.  Since PP3300_DSW is what powers the EC, the
EC needs to turn on PP5000 by default and leave it on.

BUG=chrome-os-partner:23673
BRANCH=none
TEST=reboot ap-off (this boots the EC without doing AP power sequencing)
     gpioget -> shows PP5000_EN=1, PP5000_GOOD=1

Change-Id: I5d493877d330b2543a493f8a2f3411003d5964ca
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174989
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-10-30 01:04:43 +00:00
Alec Berg
7e78087a91 lm4: Fixes low power bug after a sysjump
This fixes a bug in which after a sysjump, the sleep_mask is
reset, and the EC is allowed to go into a low power mode even
though the AP is still running. This causes numerous problems,
must notable of which is that a flashrom write fails with an
EC protocol mismatch error.

BUG=chrome-os-partner:23645
BRANCH=none
TEST=Execute a flashrom write and make sure the system does not
use the low power code immediately after.

Change-Id: I4d50282da0c5ba5b6488ed14a267a4d8cafe09a7
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174943
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-10-29 19:14:55 +00:00
Randall Spangler
8cf03ac056 Move source files to driver/ and power/ subdirs
The common/ subdir was getting cluttered.  Move drivers for external
components to a new driver/ tree, and move what used to be called
chipset_*.c to a new power/ directory.

This does not move/rename header files or CONFIG options.  That will
be done in subsequent steps, since moving and modifying .c files in
the same CL is harder to review.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I67a3003dc8564783a320335cf0e9620a21982d5e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173601
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-10-23 20:07:25 +00:00