1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
35 #if defined(IPOD_1G2G) || defined(IPOD_3G)
36 GPIOC_ENABLE
|= 0x40; /* GPIO C6 is HDD power (low active) */
37 GPIOC_OUTPUT_VAL
&= ~0x40; /* on by default */
38 GPIOC_OUTPUT_EN
|= 0x40; /* enable output */
46 unsigned int power_input_status(void)
48 unsigned int status
= POWER_INPUT_NONE
;
50 #if defined(IPOD_NANO) || defined(IPOD_VIDEO)
51 if ((GPIOL_INPUT_VAL
& 0x08) == 0)
52 status
= POWER_INPUT_MAIN_CHARGER
;
54 if ((GPIOL_INPUT_VAL
& 0x10) != 0)
55 status
|= POWER_INPUT_USB_CHARGER
;
57 #elif defined(IPOD_4G) || defined(IPOD_COLOR) \
58 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
59 /* C2 is firewire power */
60 if ((GPIOC_INPUT_VAL
& 0x04) == 0)
61 status
= POWER_INPUT_MAIN_CHARGER
;
63 #elif defined(IPOD_3G)
65 if ((GPIOC_INPUT_VAL
& 0x10) == 0)
66 status
= POWER_INPUT_MAIN_CHARGER
;
69 /* This needs filling in for other ipods. */
75 /* Returns true if the unit is charging the batteries. */
76 bool charging_state(void) {
77 return (GPIOB_INPUT_VAL
& 0x01)?false:true;
79 #endif /* CONFIG_CHARGING */
82 void ide_power_enable(bool on
)
84 #if defined(IPOD_1G2G) || defined(IPOD_3G)
86 GPIOC_OUTPUT_VAL
&= ~0x40;
88 GPIOC_OUTPUT_VAL
|= 0x40;
89 #elif defined(IPOD_4G) || defined(IPOD_COLOR) \
90 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
93 GPIO_CLEAR_BITWISE(GPIOJ_OUTPUT_VAL
, 0x04);
99 GPIO_SET_BITWISE(GPIOJ_OUTPUT_VAL
, 0x04);
101 #elif defined(IPOD_VIDEO)
104 GPO32_VAL
&= ~0x40000000;
110 GPO32_VAL
|= 0x40000000;
113 (void)on
; /* Do nothing. */
117 bool ide_powered(void)
119 #if defined(IPOD_1G2G) || defined(IPOD_3G)
120 return !(GPIOC_OUTPUT_VAL
& 0x40);
121 #elif defined(IPOD_4G) || defined(IPOD_COLOR) \
122 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
123 return !(GPIOJ_OUTPUT_VAL
& 0x04);
124 #elif defined(IPOD_VIDEO)
125 return !(GPO32_VAL
& 0x40000000);
127 return true; /* Pretend we are always powered */
133 #if defined(HAVE_LCD_COLOR) && !defined(HAVE_LCD_SHUTDOWN)
134 /* Clear the screen and backdrop to
135 remove ghosting effect on shutdown */
136 lcd_set_backdrop(NULL
);
137 lcd_set_background(LCD_WHITE
);
145 /* we cannot turn off the 1st gen/ 2nd gen yet. Need to figure out sleep mode. */
148 /* We don't turn off the ipod, we put it in a deep sleep */
149 pcf50605_standby_mode();