summaryrefslogtreecommitdiff
path: root/common/gaia_power.c
Commit message (Collapse)AuthorAgeFilesLines
...
* stm32: assert/de-assert GPIO_PMIC_PWRON_L with keyboard power eventDavid Hendricks2012-05-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This sets the PMIC_PWRON_L signal to correspond with the keyboard power button state. BUG=chrome-os-partner:9821 TEST=Tested on Lucas (see notes below) Signed-off-by: David Hendricks <dhendrix@chromium.org> 1. AC power plugged in, AP off, EC booted > gpioget PMIC_PWRON_L 1* PMIC_PWRON_L 2. AP running, press and release power button (should see screen zoom out and then back in, but I don't have a monitor...) 2a. AP running, power button not pressed > gpioget PMIC_PWRON_L 1 PMIC_PWRON_L 2b. Press power button > Waiting for long power press 280507864 > gpioget PMIC_PWRON_L 0* PMIC_PWRON_L 2c. release power button before 8s > Cancel power off > gpioget PMIC_PWRON_L 1* PMIC_PWRON_L 3. From AP off state, press and hold keyboard power button > gpioget PMIC_PWRON_L 0* PMIC_PWRON_L After 8s, we see: Timeout waiting for GPIO 0/KB_PWR_ON_L Power button was not released in time Shutdown complete. 4. AP on, press and hold keyboard power button > gpioget PMIC_PWRON_L 1 PMIC_PWRON_L > Waiting for long power press 654024769 > gpioget PMIC_PWRON_L 0* PMIC_PWRON_L > Power off after long press now=654025073, 0 ending loop 2 Shutdown complete. <-- Note: This message comes from power_off() which also de-asserts PMIC_PWRON_L > gpioget PMIC_PWRON_L 1* PMIC_PWRON_L Change-Id: I6955771707ecea2926570be0e8bd77ebddbca4d4
* Better help for console commandsRandall Spangler2012-05-251-1/+4
| | | | | | | | | | | | | | | | | | | | Additional help messages and usage are gated by CONFIG_CONSOLE_CMDHELP, so we can turn it on if there's space (adds about 3KB to image size) and turn it off when there isn't. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=manual 1) help 2) help list 3) help gpioset 4) gpioset -> wrong number of params 5) gpioset fred 0 -> param1 bad 6) gpioset cpu_prochot fred -> param2 bad Change-Id: Ibe99f37212020f763ebe65a068e6aa83a809a370
* stm32: keep power across sysjumpVincent Palatin2012-05-181-0/+4
| | | | | | | | | | | | | | Ensure we can jump between EC images without powering down the GAIA AP : - preserve GPIO state - go back to "power-on" state if needed in GAIA state machine. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:8865 TEST=On Daisy, boot Linux, then type "sysjump B" and observed we can still interact with Linux without any AP reboot. Change-Id: Ia2bd0f65ea348813b120bcc3a3f3bdfa96a9877a
* daisy: Refactor the power taskSimon Glass2012-05-141-87/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a set of functions to deal with power on/power off, and checking the power button. Then use these functions in a new top-level power control loop. This implements the following features: - Cold reset powers off the AP When powered off: - Press pwron turns on the AP - Hold pwron turns on the AP, and then 16s later turns it off and leaves it off until pwron is released and pressed again When powered on: - The PMIC PWRON signal is released one second after the power button is released (we expect that U-Boot as asserted XPSHOLD by then) - Holding pwron for 8s powers off the AP - Pressing and releasing pwron within that 8s is ignored - If XPSHOLD is dropped by the AP, then we power the AP off BUG=chrome-os-partner:9424 TEST=very ad-hoc: 1. build and boot on daisy, flash U-Boot with USB using 'cros_bundle_firmware -w usb', inserting daisy USB cable when it says 'Reseting board via servo...' 2. Press cold reset, then power on, see that it powers on 3. Then hold power-on for 8 seconds and see that it power off 4. XPSHOLD function not tested yet (this should work in Daisy 2) Change-Id: Ie471af0b4e690de7d6340e47e148c8ce3cda94f3 Signed-off-by: Simon Glass <sjg@chromium.org>
* daisy: Deal with no-timeout explicity in wait_in_signal()Simon Glass2012-05-141-10/+17
| | | | | | | | | | | | | | | | | | This function accepts a timeout value of -1, so add a comment to that effect. Also make it deal with this explicitly since the current function seems to return prematurely in that case. BUG=chrome-os-partner:9424 TEST=very ad-hoc: 1. build and boot on daisy, flash U-Boot with USB using 'cros_bundle_firmware -w usb', inserting daisy USB cable when it says 'Reseting board via servo...' 2. Press cold reset, then power on, see that it powers on 3. Then hold power-on for 8 seconds and see that it power off 4. XPSHOLD function not tested yet Change-Id: I01bd81997836333ca33e61d48823e8ff41034d5f Signed-off-by: Simon Glass <sjg@chromium.org>
* Drop DPWROK when system is off for more than 10 secrelease-R20-2268.BRandall Spangler2012-05-091-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | This saves ~70mw of power. To make this work, I also had to stretch the power button signal to give the system a chance to come back up when the user taps the power button. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9574 TEST=manual For each of the following tests, wait ~15 sec after the system is powered off to give it a chance to drop DPWROK. 1) tap power button -> system turns on 2) hold power button 1 sec -> system turns on 3) open lid -> system turns on 4) silego reset (power+refresh, or power+esc on proto1) -> system stays off 5) silego recovery (power+esc+refresh) -> system turns on 6) hold down power button and type 'reboot' on EC console -> system turns on 7) type 'powerbtn' on EC console -> system turns on Change-Id: I781cf3e665104192521b7fb9ff75a3c3e7f43464
* daisy: Rename power signals to indicate polaritySimon Glass2012-05-031-12/+12
| | | | | | | | | | | | | | | | | GPIO_KB_PWR_ON and GPIO_PMIC_PWRON are active low, so add _L to each name to make this clearer. BUG=chrome-os-partner:9424 TEST=very ad-hoc: 1. build and boot on daisy, flash U-Boot with USB using 'cros_bundle_firmware -w usb', inserting daisy USB cable when it says 'Reseting board via servo...' 2. Press cold reset, then power on, see that it powers on 3. Then hold power-on for 8 seconds and see that it power off 4. XPSHOLD function not tested yet Change-Id: Ibdc0064477c36e8658ef5605cdd5811c2283aff9 Signed-off-by: Simon Glass <sjg@chromium.org>
* daisy v1.02: power sequencing updatesDavid Hendricks2012-04-271-10/+33
| | | | | | | | | | | | | | | | | | | | | | | Note: This will not work on older (0.94 boards). - Use power button (KB_PWR_ON) to drive power sequencing events and disable EC_PWRON. This is because EC_PWRON and KB_PWR_ON shared an external interrupt line. Daisy v2.x will fix this so that both can be enabled. Note: KB_PWR_ON is active low, wihle EC_PWRON is active high. - Relay power button state to PMIC. Also, since we are driving PMIC_PWRON instead of PMIC_ACOK now, so updated the naming. - Add a keyboard power button debounce period to avoid accidentally powering the system back on after keyboard power-off. Signed-off-by: David Hendricks <dhendrix@chromium.org> BUG=None TEST=tested on daisy (frh@ verified behavior using a scope) Change-Id: I5338eebe42c9b43a07af371a450db23276b2a574
* Use console output instead of uart output for console commandsRandall Spangler2012-04-241-4/+7
| | | | | | | | | | | | This completes console output cleanup. The remaining calls to uart_puts() and uart_printf() actually need to be that way. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual Change-Id: Ib1d6d370d30429017b3d11994894fece75fab6ea
* Don't trigger watchdog when power button is held downSimon Glass2012-04-121-0/+6
| | | | | | | | | | | | | | | This situation occurs during USB download - the EC resets itself which causes USB programming to generally fail. Is this the correct fix? BUG=none TEST=build on daisy and discovery; run on daisy $ cros_bundle_firmware -b daisy -w usb See that it now succeeds Change-Id: I293e85d08d3c488d5b6bebe3379deb949f211986 Signed-off-by: Simon Glass <sjg@chromium.org>
* Change task messages to eventsRandall Spangler2012-04-061-7/+7
| | | | | | | | | | | | | Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7461 TEST=manual make BOARD={bds,link,daisy} make tests flash link system and make sure it boots Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
* Add platform-neutral chipset interfaceRandall Spangler2012-03-051-3/+23
| | | | | | | | | | | | | ...since x86_power_in_S0() is a terrible function to have implemented for gaia chipsets, and I need to add more detectable states for lid switch handling anyway. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=none Change-Id: I0c90c6875b27d1bf23f093e88e34eabf2a8c86e4
* stm32l: update GAIA power sequencing timingsVincent Palatin2012-02-241-2/+2
| | | | | | | | | | | | | Update the timeouts during the power on sequence as recommended by Frank. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=run EC firmware on ADV board and let Frank control he likes the signals. Change-Id: I7391a1cdd5ad74e0c22e15eb996955c5b7719154
* stm32l: fix ACOK signalVincent Palatin2012-02-231-2/+2
| | | | | | | | | | | | | The PMIC_ACOK signal is active-low. Let's drive it correctly. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=On ADV board, check that a short key press on the power button is now able to start the board Change-Id: Iea71939aeb532618019a9e7774721703c632976f
* stm32l: add a simple shutdown sequence for GAIA SoC.Vincent Palatin2012-02-211-5/+50
| | | | | | | | | | | | | | Either a 8-second press on the power button or the XPSHOLD signal going down (triggered the AP/PMIC shutdown sequence) will trigger a shutdown of the system and switch off all power rails. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=on Discovery, test manually various power key press duration and see power on/power off traces. Change-Id: Ic37e4a51fe6b131034e24c55f05dae8119ce9992
* stm32l: add a simple power sequencing for Daisy boardVincent Palatin2012-02-161-0/+144
This should be enough to switch on the board from either the power button or the EC console. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=None TEST=run Daisy firmware on Discovery board with logic analyzer attached to GPIO pins. With an added task to simulate PMIC startup and AP startup, check the timing chart looks good. Change-Id: I5dfeab05d0481d121ddacb36b69a542cc1bd428c