diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/power-ipod6g.c')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/power-ipod6g.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/power-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/power-ipod6g.c new file mode 100644 index 0000000000..973e26968f --- /dev/null +++ b/firmware/target/arm/s5l8702/ipod6g/power-ipod6g.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: power-nano2g.c 28190 2010-10-01 18:09:10Z Buschel $ | ||
9 | * | ||
10 | * Copyright © 2009 Bertrik Sikken | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include <stdbool.h> | ||
22 | #include "config.h" | ||
23 | #include "inttypes.h" | ||
24 | #include "s5l8702.h" | ||
25 | #include "power.h" | ||
26 | #include "panic.h" | ||
27 | #include "pmu-target.h" | ||
28 | #include "usb_core.h" /* for usb_charging_maxcurrent_change */ | ||
29 | |||
30 | static int idepowered; | ||
31 | |||
32 | void power_off(void) | ||
33 | { | ||
34 | pmu_set_wake_condition(0x42); /* USB inserted or EXTON1 */ | ||
35 | pmu_enter_standby(); | ||
36 | |||
37 | while(1); | ||
38 | } | ||
39 | |||
40 | void power_init(void) | ||
41 | { | ||
42 | idepowered = false; | ||
43 | } | ||
44 | |||
45 | void ide_power_enable(bool on) | ||
46 | { | ||
47 | idepowered = on; | ||
48 | pmu_hdd_power(on); | ||
49 | } | ||
50 | |||
51 | bool ide_powered() | ||
52 | { | ||
53 | return idepowered; | ||
54 | } | ||
55 | |||
56 | #if CONFIG_CHARGING | ||
57 | |||
58 | #ifdef HAVE_USB_CHARGING_ENABLE | ||
59 | void usb_charging_maxcurrent_change(int maxcurrent) | ||
60 | { | ||
61 | bool on = (maxcurrent >= 500); | ||
62 | GPIOCMD = 0xb060e | (on ? 1 : 0); | ||
63 | } | ||
64 | #endif | ||
65 | |||
66 | unsigned int power_input_status(void) | ||
67 | { | ||
68 | return (PDAT(12) & 8) ? POWER_INPUT_NONE : POWER_INPUT_MAIN_CHARGER; | ||
69 | } | ||
70 | |||
71 | bool charging_state(void) | ||
72 | { | ||
73 | return false; //TODO: Figure out | ||
74 | } | ||
75 | #endif /* CONFIG_CHARGING */ | ||