sync hh.org
[hh.org.git] / include / asm-arm / arch-pxa / aximx5-gpio.h
blobc164db85460e613e11f0bd84df1c5cc92aa7e4bb
1 /*
2 * Dell Axim X5 GPIO definitions.
4 * Authors: Martin Demin <demo@twincar.sk>,
5 * Andrew Zabolotny <anpaza@mail.ru>
7 * Here are the definition of most of the Dell Axim GPIOs.
8 * Keep in mind that this file is a result of a great reverse-engineering
9 * work, and not from a Dell source, thus some definitions may be wrong
10 * (especially those that aren't used yet in drivers). These are usually
11 * marked either by "Unconfirmed guess" comments, or a ??? in comment.
13 * Only GPIOs with alternate function=0 are defined here (even if unknown
14 * there is a comment saying it is unknown, and this means they use AF=0).
17 #ifndef _AXIMX5_GPIO_H_
18 #define _AXIMX5_GPIO_H_
20 #define GET_AXIMX5_GPIO(gpio) \
21 (GPLR(GPIO_NR_AXIMX5_ ## gpio) & GPIO_bit(GPIO_NR_AXIMX5_ ## gpio))
23 #define SET_AXIMX5_GPIO(gpio, setp) \
24 do { \
25 if (setp) \
26 GPSR(GPIO_NR_AXIMX5_ ## gpio) = GPIO_bit(GPIO_NR_AXIMX5_ ## gpio); \
27 else \
28 GPCR(GPIO_NR_AXIMX5_ ## gpio) = GPIO_bit(GPIO_NR_AXIMX5_ ## gpio); \
29 } while (0)
31 #define SET_AXIMX5_GPIO_N(gpio, setp) \
32 do { \
33 if (setp) \
34 GPCR(GPIO_NR_AXIMX5_ ## gpio ## _N) = GPIO_bit(GPIO_NR_AXIMX5_ ## gpio ## _N); \
35 else \
36 GPSR(GPIO_NR_AXIMX5_ ## gpio ## _N) = GPIO_bit(GPIO_NR_AXIMX5_ ## gpio ## _N); \
37 } while (0)
39 #define AXIMX5_IRQ(gpio) \
40 IRQ_GPIO(GPIO_NR_AXIMX5_ ## gpio)
42 #define GPIO_NR_AXIMX5_POWER_BUTTON_N 0
43 #define GPIO_NR_AXIMX5_RESET_BUTTON_N 1
44 #define GPIO_NR_AXIMX5_MQ1132_INT 2 /* Interrupt from MediaQ 1132 */
45 #define GPIO_NR_AXIMX5_BATTERY_LATCH 3 /* Battery latch closed (1) or open (0) */
46 #define GPIO_NR_AXIMX5_CRADLE_DETECT_N 4 /* PDA is in cradle (0) or out of cradle (1) */
47 /* GPIO5 is unknown */
48 #define GPIO_NR_AXIMX5_SD_DETECT_N 6 /* SD/MMC card inserted (1) */
49 #define GPIO_NR_AXIMX5_PCMCIA_DETECT_N 7 /* CF card inserted (1) */
50 #define GPIO_NR_AXIMX5_PCMCIA_BVD1 8 /* Unconfirmed guess */
51 #define GPIO_NR_AXIMX5_MAINBAT_RDY 9 /* Main battery inserted (huh?) */
52 #define GPIO_NR_AXIMX5_BUTTON_RECORD 10
53 #define GPIO_NR_AXIMX5_BUTTON_CALENDAR 11
54 #define GPIO_NR_AXIMX5_BUTTON_CONTACTS 12
55 #define GPIO_NR_AXIMX5_BUTTON_MAILBOX 13
56 #define GPIO_NR_AXIMX5_BUTTON_HOME 14
57 #define GPIO_NR_AXIMX5_AC_POWER_N 17 /* AC power (0) or battery power (1) */
58 #define GPIO_NR_AXIMX5_RS232_DCD 19 /* Power to serial level converter */
59 /* GPIO20 is unknown (output) */
60 /* GPIO21 is unknown (input) */
61 #define GPIO_NR_AXIMX5_USB_PULL_UP_N 22
62 /* GPIO23 is unknown (output) */
63 /* GPIO24 is unknown (output) */
64 #define GPIO_NR_AXIMX5_POWER_OK 25 /* Power source is enough ??? */
65 #define GPIO_NR_AXIMX5_PCMCIA_ADD_EN_N 26 /* !enable address to be driven to PCMCIA bus */
66 #define GPIO_NR_AXIMX5_JOY_PRESSED 27 /* Joystick pressed (any of JOY_? bits); 0 - down */
67 #define GPIO_NR_AXIMX5_TOUCHSCREEN 32 /* Touchscreen comparator */
68 /* GPIO58 is unknown (output) */
69 #define GPIO_NR_AXIMX5_CHARGING 59
70 #define GPIO_NR_AXIMX5_FLASH_WE 60 /* Flash write enable */
71 #define GPIO_NR_AXIMX5_PCMCIA_BVD2 61 /* Unconfirmed guess */
72 #define GPIO_NR_AXIMX5_PCMCIA_RESET 62
73 #define GPIO_NR_AXIMX5_PCMCIA_BUFF_EN_N 63 /* enable PCMCIA buffers ??? */
74 #define GPIO_NR_AXIMX5_JOY_NW 64 /* 0 - down, 1 - up */
75 #define GPIO_NR_AXIMX5_JOY_NE 65 /* 0 - down, 1 - up */
76 #define GPIO_NR_AXIMX5_JOY_SE 66 /* 0 - down, 1 - up */
77 #define GPIO_NR_AXIMX5_JOY_SW 67 /* 0 - down, 1 - up */
78 #define GPIO_JOY_DIR (GPLR2 & 15)
79 /* The up, down, left and right joystick directions are given by combination
80 * of two respective buttons. Most of the time the joystick "center" button
81 * (GPIO27) is also pressed together with above buttons, although when
82 * pressing it carefully you can trigger just the above GPIOs, without 27.
84 #define GPIO_NR_AXIMX5_SCROLL_DOWN 68
85 #define GPIO_NR_AXIMX5_SCROLL_PUSH 69
86 #define GPIO_NR_AXIMX5_SCROLL_UP 70
87 #define GPIO_NR_AXIMX5_MQ1132_POWER_N 71 /* MediaQ power */
88 #define GPIO_NR_AXIMX5_MQ1132_ADD_EN 72 /* MediaQ address bus enable */
89 #define GPIO_NR_AXIMX5_LED_MANUAL_SELECT_N 73 /* Enable LED select via MediaQ GPIO54 */
90 #define GPIO_NR_AXIMX5_LED_CHARGER_SELECT 74 /* Enable LED select by charger */
91 #define GPIO_NR_AXIMX5_LED_GREEN_ENABLE_N 80 /* Enable Green LED (0) */
93 /* GPIOs 75-77 determine the type of cradle that has been plugged in */
94 #define AXIMX5_CONNECTOR_TYPE \
95 ((GPLR2 >> (75 - 64)) & 7)
96 #define AXIMX5_CONNECTOR_IS_SERIAL(x) \
97 ((x) == 2 || (x) == 4)
98 #define AXIMX5_CONNECTOR_IS_USB(x) \
99 ((x) == 3 || (x) == 6)
100 #define AXIMX5_CONNECTOR_IS_CRADLE(x) \
101 ((x) < 4)
103 /*------------------------------- MediaQ 1132 GPIOs --------------------------*/
105 /* GPIO0 -- seems unused */
106 #define GPIO_NR_AXIMX5_MQ1132_FP_ENABLE 1 /* enable the flat panel */
107 #define GPIO_NR_AXIMX5_MQ1132_CF_IREQ 2 /* the CompactFlash interrupt request */
108 /* GPIO20 -- vertical scan direction ??? */
109 /* GPIO21 -- unknown ??? default output 0 */
110 /* GPIO22 -- also somehow related to flat panel; 0 - image is disabled */
111 #define GPIO_NR_AXIMX5_MQ1132_AMP_MUTE 23 /* Mute the amplifier */
112 #define GPIO_NR_AXIMX5_MQ1132_AMP_SHUTDOWN 24 /* Shutdown the amplifier */
113 /* GPIO25 -- unknown ??? default output 1 */
114 #define GPIO_NR_AXIMX5_MQ1132_LED_SELECT 54 /* 0 - green; 1 - yellow */
115 /* GPIO55 -- unused ??? maybe somehow SD/MMC related? */
116 /* GPIO60 -- seems unused */
117 #define GPIO_NR_AXIMX5_MQ1132_BACKUP_LOAD 61 /* Connect a 3.3k resistor to backup battery */
118 /* GPIO62 -- unknown ??? default input/output 1 */
119 #define GPIO_NR_AXIMX5_MQ1132_IR_POWER 63 /* Infrared transceiver power */
120 #define GPIO_NR_AXIMX5_MQ1132_BACKLIGHT 64 /* Enable backlight */
121 #define GPIO_NR_AXIMX5_MQ1132_PCMCIA_POWER 65 /* Enable power to PCMCIA slot */
122 #define GPIO_NR_AXIMX5_MQ1132_BATTERY_TYPE 66 /* Detect battery: (0)3400mAh, (1)1400mAh */
124 #endif /* _AXIMX5_GPIO_H_ */