diff options
Diffstat (limited to 'firmware/target/arm/iriver/h10/power-h10.c')
-rw-r--r-- | firmware/target/arm/iriver/h10/power-h10.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/firmware/target/arm/iriver/h10/power-h10.c b/firmware/target/arm/iriver/h10/power-h10.c new file mode 100644 index 0000000000..58dd25174f --- /dev/null +++ b/firmware/target/arm/iriver/h10/power-h10.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* Created from power.c using some iPod code, and some custom stuff based on | ||
21 | GPIO analysis | ||
22 | */ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "cpu.h" | ||
26 | #include <stdbool.h> | ||
27 | #include "adc.h" | ||
28 | #include "kernel.h" | ||
29 | #include "system.h" | ||
30 | #include "power.h" | ||
31 | #include "hwcompat.h" | ||
32 | #include "logf.h" | ||
33 | #include "usb.h" | ||
34 | |||
35 | #if CONFIG_CHARGING == CHARGING_CONTROL | ||
36 | bool charger_enabled; | ||
37 | #endif | ||
38 | |||
39 | #if 0 | ||
40 | #ifdef CONFIG_TUNER | ||
41 | |||
42 | static bool powered = false; | ||
43 | |||
44 | bool radio_powered() | ||
45 | { | ||
46 | return powered; | ||
47 | } | ||
48 | |||
49 | bool radio_power(bool status) | ||
50 | { | ||
51 | bool old_status = powered; | ||
52 | powered = status; | ||
53 | #ifdef HAVE_TUNER_PWR_CTRL | ||
54 | if (status) | ||
55 | { | ||
56 | and_b(~0x04, &PADRL); /* drive PA2 low for tuner enable */ | ||
57 | sleep(1); /* let the voltage settle */ | ||
58 | } | ||
59 | else | ||
60 | or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ | ||
61 | #endif | ||
62 | return old_status; | ||
63 | } | ||
64 | |||
65 | #endif /* #ifdef CONFIG_TUNER */ | ||
66 | #endif | ||
67 | |||
68 | void power_init(void) | ||
69 | { | ||
70 | } | ||
71 | |||
72 | bool charger_inserted(void) | ||
73 | { | ||
74 | return (GPIOL_INPUT_VAL & 0x04)?true:false; /* FIXME: This only checks if USB is connected */ | ||
75 | } | ||
76 | |||
77 | void ide_power_enable(bool on) | ||
78 | { | ||
79 | (void)on; | ||
80 | /* We do nothing on the iPod */ | ||
81 | } | ||
82 | |||
83 | |||
84 | bool ide_powered(void) | ||
85 | { | ||
86 | /* pretend we are always powered - we don't turn it off on the ipod */ | ||
87 | return true; | ||
88 | } | ||
89 | |||
90 | void power_off(void) | ||
91 | { | ||
92 | /* set_irq_level(HIGHEST_IRQ_LEVEL);*/ | ||
93 | #ifndef BOOTLOADER | ||
94 | /* We don't turn off the ipod, we put it in a deep sleep */ | ||
95 | /* pcf50605_standby_mode(); */ | ||
96 | while(1) | ||
97 | yield(); | ||
98 | #endif | ||
99 | } | ||