summaryrefslogtreecommitdiff
path: root/firmware/target/arm/ipod/power-ipod.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/ipod/power-ipod.c')
-rw-r--r--firmware/target/arm/ipod/power-ipod.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c
new file mode 100644
index 0000000000..8932b95cdd
--- /dev/null
+++ b/firmware/target/arm/ipod/power-ipod.c
@@ -0,0 +1,81 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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#include "config.h"
20#include "cpu.h"
21#include <stdbool.h>
22#include "adc.h"
23#include "kernel.h"
24#include "system.h"
25#include "power.h"
26#include "hwcompat.h"
27#include "logf.h"
28#include "pcf50605.h"
29#include "usb.h"
30#include "lcd.h"
31
32void power_init(void)
33{
34 pcf50605_init();
35}
36
37bool charger_inserted(void)
38{
39#ifdef IPOD_VIDEO
40 return (GPIOL_INPUT_VAL & 0x08)?false:true;
41#else
42 /* This needs filling in for other ipods. */
43 return false;
44#endif
45}
46
47/* Returns true if the unit is charging the batteries. */
48bool charging_state(void) {
49 return (GPIOB_INPUT_VAL & 0x01)?false:true;
50}
51
52
53void ide_power_enable(bool on)
54{
55 /* We do nothing on the iPod */
56 (void)on;
57}
58
59bool ide_powered(void)
60{
61 /* pretend we are always powered - we don't turn it off on the ipod */
62 return true;
63}
64
65void power_off(void)
66{
67#if defined(HAVE_LCD_COLOR)
68 /* Clear the screen and backdrop to
69 remove ghosting effect on shutdown */
70 lcd_set_backdrop(NULL);
71 lcd_set_background(LCD_WHITE);
72 lcd_clear_display();
73 lcd_update();
74 sleep(HZ/16);
75#endif
76
77#ifndef BOOTLOADER
78 /* We don't turn off the ipod, we put it in a deep sleep */
79 pcf50605_standby_mode();
80#endif
81}