summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c')
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c149
1 files changed, 0 insertions, 149 deletions
diff --git a/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c
deleted file mode 100644
index baf93b73aa..0000000000
--- a/firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c
+++ /dev/null
@@ -1,149 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 Vitja Makarov
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 <stdbool.h>
22
23#include "config.h"
24#include "cpu.h"
25#include "kernel.h"
26#include "system.h"
27#include "power.h"
28#include "backlight-target.h"
29
30#include "pcf50606.h"
31
32void power_init(void)
33{
34 pcf50606_write(PCF5060X_DCDC1, 0x90);
35 pcf50606_write(PCF5060X_DCDC2, 0x48);
36 pcf50606_write(PCF5060X_DCDC3, 0xfc);
37 pcf50606_write(PCF5060X_DCDC4, 0xb1);
38
39 pcf50606_write(PCF5060X_IOREGC, 0xe9);
40 /* 3.3V, touch-panel */
41 pcf50606_write(PCF5060X_D1REGC1, 0xf8);
42 pcf50606_write(PCF5060X_D2REGC1, 0xf2);
43 pcf50606_write(PCF5060X_D3REGC1, 0xf5);
44
45 pcf50606_write(PCF5060X_LPREGC1, 0x00);
46 pcf50606_write(PCF5060X_LPREGC2, 0x02);
47
48 pcf50606_write(PCF5060X_DCUDC1, 0xe6);
49 pcf50606_write(PCF5060X_DCUDC2, 0x30);
50
51 pcf50606_write(PCF5060X_DCDEC1, 0xe7);
52 pcf50606_write(PCF5060X_DCDEC2, 0x02);
53
54 pcf50606_write(PCF5060X_INT1M, 0x5b);
55 pcf50606_write(PCF5060X_INT1M, 0xaf);
56 pcf50606_write(PCF5060X_INT1M, 0x8f);
57
58 pcf50606_write(PCF5060X_OOCC1, 0x40);
59 pcf50606_write(PCF5060X_OOCC2, 0x05);
60
61 pcf50606_write(PCF5060X_MBCC3, 0x3a);
62 pcf50606_write(PCF5060X_GPOC1, 0x00);
63 pcf50606_write(PCF5060X_BBCC, 0xf8);
64}
65
66/* Control leds on ata2501 board */
67void power_touch_panel(bool on)
68{
69 if (on)
70 pcf50606_write(PCF5060X_D1REGC1, 0xf8);
71 else
72 pcf50606_write(PCF5060X_D1REGC1, 0x00);
73}
74
75void ide_power_enable(bool on)
76{
77 (void) on;
78}
79
80bool ide_powered(void)
81{
82 return true;
83}
84
85void power_off(void)
86{
87 /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */
88 pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK);
89}
90
91#if CONFIG_TUNER
92#include "tuner.h"
93
94/** Tuner **/
95static bool powered = false;
96
97#define TUNNER_CLK (1 << 5)
98#define TUNNER_DATA (1 << 6)
99#define TUNNER_NR_W (1 << 7)
100
101bool tuner_power(bool status)
102{
103 bool old_status;
104 lv24020lp_lock();
105
106 old_status = powered;
107
108 if (status != old_status)
109 {
110 if (status)
111 {
112 /* When power up, host should initialize the 3-wire bus
113 in host read mode: */
114
115 /* 1. Set direction of the DATA-line to input-mode. */
116 GPIOA_DIR &= ~TUNNER_DATA;
117
118 /* 2. Drive NR_W low */
119 GPIOA &= ~TUNNER_NR_W;
120 GPIOA_DIR |= TUNNER_NR_W;
121
122 /* 3. Drive CLOCK high */
123 GPIOA |= TUNNER_CLK;
124 GPIOA_DIR |= TUNNER_CLK;
125
126 lv24020lp_power(true);
127 }
128 else
129 {
130 lv24020lp_power(false);
131
132 /* set all as inputs */
133 GPIOC_DIR &= ~(TUNNER_CLK | TUNNER_DATA | TUNNER_NR_W);
134 }
135
136 powered = status;
137 }
138
139 lv24020lp_unlock();
140 return old_status;
141}
142
143#endif /* CONFIG_TUNER */
144
145unsigned int power_input_status(void)
146{
147 return (GPIOA & 0x1) ?
148 POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
149}