Turn off VDD3 when CPU is off and AC is not connected
This commit is contained in:
parent
ee8e0a2257
commit
825677bfb5
@ -35,6 +35,7 @@ struct Gpio __code VA_EC_EN = GPIO(J, 4);
|
|||||||
struct Gpio __code VR_ON = GPIO(H, 4);
|
struct Gpio __code VR_ON = GPIO(H, 4);
|
||||||
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
struct Gpio __code WLAN_EN = GPIO(G, 1);
|
||||||
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
struct Gpio __code WLAN_PWR_EN = GPIO(A, 3);
|
||||||
|
struct Gpio __code XLP_OUT = GPIO(B, 4);
|
||||||
|
|
||||||
void gpio_init() {
|
void gpio_init() {
|
||||||
// Enable LPC reset on GPD2
|
// Enable LPC reset on GPD2
|
||||||
|
@ -46,5 +46,6 @@ extern struct Gpio __code VA_EC_EN;
|
|||||||
extern struct Gpio __code VR_ON;
|
extern struct Gpio __code VR_ON;
|
||||||
extern struct Gpio __code WLAN_EN;
|
extern struct Gpio __code WLAN_EN;
|
||||||
extern struct Gpio __code WLAN_PWR_EN;
|
extern struct Gpio __code WLAN_PWR_EN;
|
||||||
|
extern struct Gpio __code XLP_OUT;
|
||||||
|
|
||||||
#endif // _BOARD_GPIO_H
|
#endif // _BOARD_GPIO_H
|
||||||
|
@ -399,14 +399,14 @@ void power_event(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32_t last_time = 0;
|
||||||
|
uint32_t time = time_get();
|
||||||
if (power_state == POWER_STATE_S0) {
|
if (power_state == POWER_STATE_S0) {
|
||||||
// CPU on, green light
|
// CPU on, green light
|
||||||
gpio_set(&LED_PWR, true);
|
gpio_set(&LED_PWR, true);
|
||||||
gpio_set(&LED_ACIN, false);
|
gpio_set(&LED_ACIN, false);
|
||||||
} else if (power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3) {
|
} else if (power_state == POWER_STATE_S3 || power_state == POWER_STATE_DS3) {
|
||||||
// Suspended, flashing green light
|
// Suspended, flashing green light
|
||||||
static uint32_t last_time = 0;
|
|
||||||
uint32_t time = time_get();
|
|
||||||
if (
|
if (
|
||||||
(time < last_time) // overflow
|
(time < last_time) // overflow
|
||||||
||
|
||
|
||||||
@ -421,9 +421,19 @@ void power_event(void) {
|
|||||||
gpio_set(&LED_PWR, false);
|
gpio_set(&LED_PWR, false);
|
||||||
gpio_set(&LED_ACIN, true);
|
gpio_set(&LED_ACIN, true);
|
||||||
} else {
|
} else {
|
||||||
// CPU off and AC adapter unplugged, no light
|
// CPU off and AC adapter unplugged, flashing orange light
|
||||||
gpio_set(&LED_PWR, false);
|
gpio_set(&LED_PWR, false);
|
||||||
gpio_set(&LED_ACIN, false);
|
if (
|
||||||
|
(time < last_time) // overflow
|
||||||
|
||
|
||||||
|
(time >= (last_time + 1000)) // timeout
|
||||||
|
) {
|
||||||
|
gpio_set(&LED_ACIN, !gpio_get(&LED_ACIN));
|
||||||
|
last_time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to kill VDD3
|
||||||
|
gpio_set(&XLP_OUT, false);
|
||||||
}
|
}
|
||||||
#endif // DEEP_SX
|
#endif // DEEP_SX
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user