Files
OpenCellular/include/power_button.h
Shawn Nematbakhsh 1de5ac02ec skylake: Use a simulated power button press to force-shutdown the AP
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>
2015-06-04 01:15:55 +00:00

58 lines
1.4 KiB
C

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Power button API for Chrome EC */
#ifndef __CROS_EC_POWER_BUTTON_H
#define __CROS_EC_POWER_BUTTON_H
#include "common.h"
/**
* Return non-zero if power button is pressed.
*
* Uses the debounced button state, not the raw signal from the GPIO.
*/
int power_button_is_pressed(void);
/**
* Wait for the power button to be released
*
* @param timeout_us Timeout in microseconds, or -1 to wait forever
* @return EC_SUCCESS if ok, or
* EC_ERROR_TIMEOUT if power button failed to release
*/
int power_button_wait_for_release(unsigned int timeout_us);
/**
* Return non-zero if power button signal asserted at hardware input.
*
*/
int power_button_signal_asserted(void);
/**
* Interrupt handler for power button.
*
* @param signal Signal which triggered the interrupt.
*/
void power_button_interrupt(enum gpio_signal signal);
/**
* For x86 systems, force-assert the power button signal to the PCH.
*/
void power_button_pch_press(void);
/**
* For x86 systems, force-deassert the power button signal to the PCH.
*/
void power_button_pch_release(void);
/**
* For x86 systems, force a pulse of the power button signal to the PCH.
*/
void power_button_pch_pulse(void);
#endif /* __CROS_EC_POWER_BUTTON_H */