1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 by Daniel Ankers
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
28 #include "synaptics-mep.h"
35 /* Power on and initialize the touchpad here because we need it for
36 both buttons and button lights */
39 char byte
= ascodec_read(AS3514_CVDD_DCDC3
);
40 byte
= (byte
& ~0x18) | 0x08;
41 ascodec_write(AS3514_CVDD_DCDC3
, byte
);
43 /* LEDs for REW, FFWD, MENU */
44 GPIOD_ENABLE
|= (0x40 | 0x20 | 0x04);
45 GPIOD_OUTPUT_VAL
|= (0x40 | 0x20 | 0x04);
46 GPIOD_OUTPUT_EN
|= (0x40 | 0x20 | 0x04);
50 GPIOL_OUTPUT_VAL
&= ~0x10;
51 GPIOL_OUTPUT_EN
|= 0x10;
54 /* enable DATA, ACK, CLK lines */
55 GPIOD_ENABLE
|= (0x10 | 0x08 | 0x02);
57 GPIOD_OUTPUT_EN
|= 0x08; /* ACK */
58 GPIOD_OUTPUT_VAL
|= 0x08; /* high */
60 GPIOD_OUTPUT_EN
&= ~0x02; /* CLK */
62 GPIOD_OUTPUT_EN
|= 0x10; /* DATA */
63 GPIOD_OUTPUT_VAL
|= 0x10; /* high */
67 logf("touchpad not ready");
77 ascodec_write(AS3514_DCDC15
, 0);
80 /* LCD off/sleep (otherwise the image slowly fades out) */
84 /* Send shutdown command to PMU */
85 byte
= ascodec_read(AS3514_SYSTEM
);
87 ascodec_write(AS3514_SYSTEM
, byte
);
89 /* Stop interrupts on both cores */
90 disable_interrupt(IRQ_FIQ_STATUS
);
94 /* Halt everything and wait for device to power off */
102 unsigned int power_input_status(void)
104 unsigned int status
= POWER_INPUT_NONE
;
106 /* GPIOF indicates that the connector is present,
107 GPIOB indicates that there's power there too.
108 Same status bits for both USB and the charger. */
109 if (!(GPIOF_INPUT_VAL
& 0x80) && (GPIOB_INPUT_VAL
& 0x40))
110 status
= POWER_INPUT_MAIN_CHARGER
;
115 void ide_power_enable(bool on
)