1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2009 by Szymon Dziok
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 ****************************************************************************/
30 #include "synaptics-mep.h"
34 GPIOD_ENABLE
|= 0x80; /* enable ACK */
35 GPIOA_ENABLE
|= (0x10 | 0x20); /* enable DATA, CLK */
37 GPIOD_OUTPUT_EN
|= 0x80; /* set ACK */
38 GPIOD_OUTPUT_VAL
|= 0x80; /* high */
40 GPIOA_OUTPUT_EN
&= ~0x20; /* CLK */
42 GPIOA_OUTPUT_EN
|= 0x10; /* set DATA */
43 GPIOA_OUTPUT_VAL
|= 0x10; /* high */
47 logf("touchpad not ready");
49 /* Max touch sensivity = 0x77, Rate=80/s,NoFilter=0,
50 KeyMatrix=0,Buttons=1,Relative=0,Absolute=1.
51 MEP parameter 0x20 - Report Modes */
52 touchpad_set_parameter(0,0x20,0x7785);
53 /* MinAbsReporting=0, NotAllCapButtons=0,SingleCapButton=0,
54 50msDebounce=0,MotionReporting=1 (reduce transmission overhead),
55 ClipZifnoFinger=0,DisableDeceleration=0,Dribble=0.
56 MEP parameter 0x21 - Enhanced Operating Configuration */
57 touchpad_set_parameter(0,0x21,0x0008);
58 /* Set the GPO_LEVELS = 0 - for the button lights */
59 touchpad_set_parameter(0,0x23,0x0000);
61 /* Sound unmute (on) */
62 GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL
, 0x10);
65 unsigned int power_input_status(void)
67 unsigned int status
= POWER_INPUT_NONE
;
68 /* GPIOL - external charger connected */
69 if (GPIOL_INPUT_VAL
& 0x20)
70 status
= POWER_INPUT_MAIN_CHARGER
;
71 /* GPIOL - usb connected */
72 if (GPIOL_INPUT_VAL
& 0x04)
73 status
|= POWER_INPUT_USB_CHARGER
;
78 void ide_power_enable(bool on
)
81 GPIO_SET_BITWISE(GPIOC_OUTPUT_VAL
, 0x08);
86 GPIO_CLEAR_BITWISE(GPIOC_OUTPUT_VAL
, 0x08);
90 bool ide_powered(void)
92 return ((GPIOC_INPUT_VAL
& 0x08) == 1);
97 /* Sound mute (off) */
99 GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL
, 0x10);
101 GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL
, 0x80);
102 /* button lights off */
103 touchpad_set_parameter(0,0x22,0x0000);
105 ide_power_enable(false);
107 GPO32_VAL
|= 0x40000000;
108 GPO32_ENABLE
|= 0x40000000;
109 /* lcd controller off ? - makes lcd white until power on */
110 GPIO_CLEAR_BITWISE(GPIOJ_OUTPUT_VAL
, 0x04);
111 /* a way to poweroff while charging = system_reset */
112 if (power_input_status())