diff options
Diffstat (limited to 'firmware/target/coldfire/iaudio/power-x5m5.c')
-rw-r--r-- | firmware/target/coldfire/iaudio/power-x5m5.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/power-x5m5.c b/firmware/target/coldfire/iaudio/power-x5m5.c new file mode 100644 index 0000000000..e9bdde16ec --- /dev/null +++ b/firmware/target/coldfire/iaudio/power-x5m5.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
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 "config.h" | ||
22 | #include "cpu.h" | ||
23 | #include <stdbool.h> | ||
24 | #include "kernel.h" | ||
25 | #include "system.h" | ||
26 | #include "power.h" | ||
27 | #include "pcf50606.h" | ||
28 | #include "lcd-remote-target.h" | ||
29 | |||
30 | void power_init(void) | ||
31 | { | ||
32 | /* Charger detect */ | ||
33 | and_l(~0x01000000, &GPIO1_ENABLE); | ||
34 | or_l(0x01000000, &GPIO1_FUNCTION); | ||
35 | |||
36 | pcf50606_init(); | ||
37 | } | ||
38 | |||
39 | unsigned int power_input_status(void) | ||
40 | { | ||
41 | return (GPIO1_READ & 0x01000000) ? | ||
42 | POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; | ||
43 | } | ||
44 | |||
45 | void ide_power_enable(bool on) | ||
46 | { | ||
47 | /* GPOOD3 */ | ||
48 | int level = disable_irq_save(); | ||
49 | pcf50606_write(0x3c, on ? 0x07 : 0x00); | ||
50 | restore_irq(level); | ||
51 | } | ||
52 | |||
53 | bool ide_powered(void) | ||
54 | { | ||
55 | int level = disable_irq_save(); | ||
56 | int value = pcf50606_read(0x3c); | ||
57 | restore_irq(level); | ||
58 | return (value & 0x07) != 0; | ||
59 | } | ||
60 | |||
61 | void power_off(void) | ||
62 | { | ||
63 | lcd_remote_poweroff(); | ||
64 | set_irq_level(DISABLE_INTERRUPTS); | ||
65 | and_l(~0x00000008, &GPIO_OUT); /* Set KEEPACT low */ | ||
66 | asm("halt"); | ||
67 | } | ||
68 | |||
69 | #if (CONFIG_TUNER & TEA5767) | ||
70 | bool tuner_power(bool status) | ||
71 | { | ||
72 | (void)status; | ||
73 | return true; | ||
74 | } | ||
75 | #endif | ||