summaryrefslogtreecommitdiff
path: root/firmware/target/arm/philips/power-hdd.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/philips/power-hdd.c')
-rw-r--r--firmware/target/arm/philips/power-hdd.c121
1 files changed, 121 insertions, 0 deletions
diff --git a/firmware/target/arm/philips/power-hdd.c b/firmware/target/arm/philips/power-hdd.c
new file mode 100644
index 0000000000..c348567529
--- /dev/null
+++ b/firmware/target/arm/philips/power-hdd.c
@@ -0,0 +1,121 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Mark Arigo
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
22#include "config.h"
23#include "cpu.h"
24#include <stdbool.h>
25#include "kernel.h"
26#include "system.h"
27#include "power.h"
28#include "logf.h"
29#include "usb.h"
30#include "synaptics-mep.h"
31
32void power_init(void)
33{
34 /* power off bit */
35 GPIOB_ENABLE |= 0x80;
36 GPIOB_OUTPUT_VAL |= 0x80;
37 GPIOB_OUTPUT_EN |= 0x80;
38
39 /* charger inserted bit */
40 GPIOE_ENABLE |= 0x20;
41 GPIOE_INPUT_VAL |= 0x20;
42
43#if CONFIG_TUNER
44 /* fm antenna? */
45 GPIOE_ENABLE |= 0x40;
46 GPIOE_OUTPUT_EN |= 0x40;
47 GPIOE_OUTPUT_VAL &= ~0x40; /* off */
48#endif
49
50#ifndef BOOTLOADER
51 /* enable touchpad here because we need it for
52 both buttons and button lights */
53 GPO32_ENABLE |= 0x80;
54 GPO32_VAL &= ~0x80;
55 udelay(1000);
56
57 GPIOD_ENABLE |= 0x80; /* enable ACK */
58 GPIOA_ENABLE |= (0x10 | 0x20); /* enable DATA, CLK */
59
60 GPIOD_OUTPUT_EN |= 0x80; /* set ACK */
61 GPIOD_OUTPUT_VAL |= 0x80; /* high */
62
63 GPIOA_OUTPUT_EN &= ~0x20; /* CLK */
64
65 GPIOA_OUTPUT_EN |= 0x10; /* set DATA */
66 GPIOA_OUTPUT_VAL |= 0x10; /* high */
67
68 if (!touchpad_init())
69 {
70 logf("touchpad not ready");
71 }
72#endif
73}
74
75unsigned int power_input_status(void)
76{
77 unsigned int status = POWER_INPUT_NONE;
78
79 /* AC charger */
80 if (GPIOE_INPUT_VAL & 0x20)
81 status |= POWER_INPUT_MAIN_CHARGER;
82
83 /* Do nothing with USB for now
84 if (GPIOE_INPUT_VAL & 0x4)
85 status |= POWER_INPUT_USB_CHARGER;
86 */
87
88 return status;
89}
90
91void ide_power_enable(bool on)
92{
93 (void)on;
94 /* We do nothing */
95}
96
97bool ide_powered(void)
98{
99 /* pretend we are always powered - we don't turn it off */
100 return true;
101}
102
103void power_off(void)
104{
105 /* power off bit */
106 GPIOB_ENABLE |= 0x80;
107 GPIOB_OUTPUT_VAL &= ~0x80;
108 GPIOB_OUTPUT_EN |= 0x80;
109}
110
111#if CONFIG_TUNER
112bool tuner_power(bool status)
113{
114 if (status)
115 GPIOE_OUTPUT_VAL |= 0x40;
116 else
117 GPIOE_OUTPUT_VAL &= ~0x40;
118
119 return status;
120}
121#endif