1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Dave Chapman
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
24 #include "button-target.h"
30 unsigned char data
[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */
32 /* Clear pending interrupts from pcf50606 */
33 pcf50606_read_multiple(0x02, data
, 3);
35 /* Set outputs as per OF - further investigation required. */
36 pcf50606_write(PCF5060X_DCDEC1
, 0xe4);
37 pcf50606_write(PCF5060X_IOREGC
, 0xf5);
38 pcf50606_write(PCF5060X_D1REGC1
, 0xf5);
39 pcf50606_write(PCF5060X_D2REGC1
, 0xe9);
40 pcf50606_write(PCF5060X_D3REGC1
, 0xf8); /* WM8985 3.3v */
41 pcf50606_write(PCF5060X_DCUDC1
, 0xe7);
42 pcf50606_write(PCF5060X_LPREGC1
, 0x0);
43 pcf50606_write(PCF5060X_LPREGC2
, 0x2);
46 IEN
|= EXT3_IRQ_MASK
; /* Unmask EXT3 */
50 void ide_power_enable(bool on
)
55 bool ide_powered(void)
62 /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */
63 pcf50606_write(PCF5060X_OOCC1
, GOSTDBY
| CHGWAK
| EXTONWAK
);
69 unsigned char data
[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */
71 /* Clear pending interrupts from pcf50606 */
72 int fiq_status
= disable_fiq_save();
73 pcf50606_read_multiple(0x02, data
, 3);
77 /* ONKEY1S: don't reset the timeout, because we want a way to power off
78 the player in the event of a crashed plugin or UIE/panic, etc. */
80 /* ONKEY1S: reset timeout as we're using SW poweroff */
81 pcf50606_write(0x08, pcf50606_read(0x08) | 0x02); /* OOCC1: TOTRST=1 */
87 /* Touchscreen event, do something about it */
88 button_set_touch_available();
90 restore_fiq(fiq_status
);
95 bool charger_inserted(void)
97 return (GPIOC
& (1<<26)) ? false:true;
101 #else /* SIMULATOR */
103 bool charger_inserted(void)
108 void charger_enable(bool on
)
117 void ide_power_enable(bool on
)
122 #endif /* SIMULATOR */