ezx.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. /*
  2. * ezx.c - Common code for the EZX platform.
  3. *
  4. * Copyright (C) 2005-2006 Harald Welte <laforge@openezx.org>,
  5. * 2007-2008 Daniel Ribeiro <drwyrm@gmail.com>,
  6. * 2007-2008 Stefan Schmidt <stefan@datenfreihafen.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/delay.h>
  17. #include <linux/pwm.h>
  18. #include <linux/pwm_backlight.h>
  19. #include <linux/regulator/machine.h>
  20. #include <linux/regulator/fixed.h>
  21. #include <linux/input.h>
  22. #include <linux/gpio.h>
  23. #include <linux/gpio/machine.h>
  24. #include <linux/gpio_keys.h>
  25. #include <linux/leds-lp3944.h>
  26. #include <linux/platform_data/i2c-pxa.h>
  27. #include <asm/setup.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include "pxa27x.h"
  31. #include <linux/platform_data/video-pxafb.h>
  32. #include <linux/platform_data/usb-ohci-pxa27x.h>
  33. #include <mach/hardware.h>
  34. #include <linux/platform_data/keypad-pxa27x.h>
  35. #include <linux/platform_data/media/camera-pxa.h>
  36. #include "devices.h"
  37. #include "generic.h"
  38. #define EZX_NR_IRQS (IRQ_BOARD_START + 24)
  39. #define GPIO12_A780_FLIP_LID 12
  40. #define GPIO15_A1200_FLIP_LID 15
  41. #define GPIO15_A910_FLIP_LID 15
  42. #define GPIO12_E680_LOCK_SWITCH 12
  43. #define GPIO15_E6_LOCK_SWITCH 15
  44. #define GPIO50_nCAM_EN 50
  45. #define GPIO19_GEN1_CAM_RST 19
  46. #define GPIO28_GEN2_CAM_RST 28
  47. static struct pwm_lookup ezx_pwm_lookup[] __maybe_unused = {
  48. PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 78700,
  49. PWM_POLARITY_NORMAL),
  50. };
  51. static struct platform_pwm_backlight_data ezx_backlight_data = {
  52. .max_brightness = 1023,
  53. .dft_brightness = 1023,
  54. .enable_gpio = -1,
  55. };
  56. static struct platform_device ezx_backlight_device = {
  57. .name = "pwm-backlight",
  58. .dev = {
  59. .parent = &pxa27x_device_pwm0.dev,
  60. .platform_data = &ezx_backlight_data,
  61. },
  62. };
  63. static struct pxafb_mode_info mode_ezx_old = {
  64. .pixclock = 150000,
  65. .xres = 240,
  66. .yres = 320,
  67. .bpp = 16,
  68. .hsync_len = 10,
  69. .left_margin = 20,
  70. .right_margin = 10,
  71. .vsync_len = 2,
  72. .upper_margin = 3,
  73. .lower_margin = 2,
  74. .sync = 0,
  75. };
  76. static struct pxafb_mach_info ezx_fb_info_1 __maybe_unused = {
  77. .modes = &mode_ezx_old,
  78. .num_modes = 1,
  79. .lcd_conn = LCD_COLOR_TFT_16BPP,
  80. };
  81. static struct pxafb_mode_info mode_72r89803y01 = {
  82. .pixclock = 192308,
  83. .xres = 240,
  84. .yres = 320,
  85. .bpp = 32,
  86. .depth = 18,
  87. .hsync_len = 10,
  88. .left_margin = 20,
  89. .right_margin = 10,
  90. .vsync_len = 2,
  91. .upper_margin = 3,
  92. .lower_margin = 2,
  93. .sync = 0,
  94. };
  95. static struct pxafb_mach_info ezx_fb_info_2 __maybe_unused = {
  96. .modes = &mode_72r89803y01,
  97. .num_modes = 1,
  98. .lcd_conn = LCD_COLOR_TFT_18BPP,
  99. };
  100. static struct platform_device *ezx_devices[] __initdata __maybe_unused = {
  101. &ezx_backlight_device,
  102. };
  103. static unsigned long ezx_pin_config[] __initdata __maybe_unused = {
  104. /* PWM backlight */
  105. GPIO16_PWM0_OUT,
  106. /* BTUART */
  107. GPIO42_BTUART_RXD,
  108. GPIO43_BTUART_TXD,
  109. GPIO44_BTUART_CTS,
  110. GPIO45_BTUART_RTS,
  111. /* I2C */
  112. GPIO117_I2C_SCL,
  113. GPIO118_I2C_SDA,
  114. /* PCAP SSP */
  115. GPIO29_SSP1_SCLK,
  116. GPIO25_SSP1_TXD,
  117. GPIO26_SSP1_RXD,
  118. GPIO24_GPIO, /* pcap chip select */
  119. GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* pcap interrupt */
  120. GPIO4_GPIO | MFP_LPM_DRIVE_HIGH, /* WDI_AP */
  121. GPIO55_GPIO | MFP_LPM_DRIVE_HIGH, /* SYS_RESTART */
  122. /* MMC */
  123. GPIO32_MMC_CLK,
  124. GPIO92_MMC_DAT_0,
  125. GPIO109_MMC_DAT_1,
  126. GPIO110_MMC_DAT_2,
  127. GPIO111_MMC_DAT_3,
  128. GPIO112_MMC_CMD,
  129. GPIO11_GPIO, /* mmc detect */
  130. /* usb to external transceiver */
  131. GPIO34_USB_P2_2,
  132. GPIO35_USB_P2_1,
  133. GPIO36_USB_P2_4,
  134. GPIO39_USB_P2_6,
  135. GPIO40_USB_P2_5,
  136. GPIO53_USB_P2_3,
  137. /* usb to Neptune GSM chip */
  138. GPIO30_USB_P3_2,
  139. GPIO31_USB_P3_6,
  140. GPIO90_USB_P3_5,
  141. GPIO91_USB_P3_1,
  142. GPIO56_USB_P3_4,
  143. GPIO113_USB_P3_3,
  144. };
  145. #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_E680)
  146. static unsigned long gen1_pin_config[] __initdata = {
  147. /* flip / lockswitch */
  148. GPIO12_GPIO | WAKEUP_ON_EDGE_BOTH,
  149. /* bluetooth (bcm2035) */
  150. GPIO14_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
  151. GPIO48_GPIO, /* RESET */
  152. GPIO28_GPIO, /* WAKEUP */
  153. /* Neptune handshake */
  154. GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
  155. GPIO57_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
  156. GPIO13_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI */
  157. GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* WDI2 */
  158. GPIO82_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
  159. GPIO99_GPIO | MFP_LPM_DRIVE_HIGH, /* TC_MM_EN */
  160. /* sound */
  161. GPIO52_SSP3_SCLK,
  162. GPIO83_SSP3_SFRM,
  163. GPIO81_SSP3_TXD,
  164. GPIO89_SSP3_RXD,
  165. /* ssp2 pins to in */
  166. GPIO22_GPIO, /* SSP2_SCLK */
  167. GPIO37_GPIO, /* SSP2_SFRM */
  168. GPIO38_GPIO, /* SSP2_TXD */
  169. GPIO88_GPIO, /* SSP2_RXD */
  170. /* camera */
  171. GPIO23_CIF_MCLK,
  172. GPIO54_CIF_PCLK,
  173. GPIO85_CIF_LV,
  174. GPIO84_CIF_FV,
  175. GPIO27_CIF_DD_0,
  176. GPIO114_CIF_DD_1,
  177. GPIO51_CIF_DD_2,
  178. GPIO115_CIF_DD_3,
  179. GPIO95_CIF_DD_4,
  180. GPIO94_CIF_DD_5,
  181. GPIO17_CIF_DD_6,
  182. GPIO108_CIF_DD_7,
  183. GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
  184. GPIO19_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
  185. /* EMU */
  186. GPIO120_GPIO, /* EMU_MUX1 */
  187. GPIO119_GPIO, /* EMU_MUX2 */
  188. GPIO86_GPIO, /* SNP_INT_CTL */
  189. GPIO87_GPIO, /* SNP_INT_IN */
  190. };
  191. #endif
  192. #if defined(CONFIG_MACH_EZX_A1200) || defined(CONFIG_MACH_EZX_A910) || \
  193. defined(CONFIG_MACH_EZX_E2) || defined(CONFIG_MACH_EZX_E6)
  194. static unsigned long gen2_pin_config[] __initdata = {
  195. /* flip / lockswitch */
  196. GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH,
  197. /* EOC */
  198. GPIO10_GPIO | WAKEUP_ON_EDGE_RISE,
  199. /* bluetooth (bcm2045) */
  200. GPIO13_GPIO | WAKEUP_ON_EDGE_RISE, /* HOSTWAKE */
  201. GPIO37_GPIO, /* RESET */
  202. GPIO57_GPIO, /* WAKEUP */
  203. /* Neptune handshake */
  204. GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* BP_RDY */
  205. GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, /* AP_RDY */
  206. GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* WDI */
  207. GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, /* RESET */
  208. GPIO41_GPIO, /* BP_FLASH */
  209. /* sound */
  210. GPIO52_SSP3_SCLK,
  211. GPIO83_SSP3_SFRM,
  212. GPIO81_SSP3_TXD,
  213. GPIO82_SSP3_RXD,
  214. /* ssp2 pins to in */
  215. GPIO22_GPIO, /* SSP2_SCLK */
  216. GPIO14_GPIO, /* SSP2_SFRM */
  217. GPIO38_GPIO, /* SSP2_TXD */
  218. GPIO88_GPIO, /* SSP2_RXD */
  219. /* camera */
  220. GPIO23_CIF_MCLK,
  221. GPIO54_CIF_PCLK,
  222. GPIO85_CIF_LV,
  223. GPIO84_CIF_FV,
  224. GPIO27_CIF_DD_0,
  225. GPIO114_CIF_DD_1,
  226. GPIO51_CIF_DD_2,
  227. GPIO115_CIF_DD_3,
  228. GPIO95_CIF_DD_4,
  229. GPIO48_CIF_DD_5,
  230. GPIO93_CIF_DD_6,
  231. GPIO12_CIF_DD_7,
  232. GPIO50_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_EN */
  233. GPIO28_GPIO | MFP_LPM_DRIVE_HIGH, /* CAM_RST */
  234. GPIO17_GPIO, /* CAM_FLASH */
  235. };
  236. #endif
  237. #ifdef CONFIG_MACH_EZX_A780
  238. static unsigned long a780_pin_config[] __initdata = {
  239. /* keypad */
  240. GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  241. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  242. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  243. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  244. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  245. GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
  246. GPIO103_KP_MKOUT_0,
  247. GPIO104_KP_MKOUT_1,
  248. GPIO105_KP_MKOUT_2,
  249. GPIO106_KP_MKOUT_3,
  250. GPIO107_KP_MKOUT_4,
  251. /* attenuate sound */
  252. GPIO96_GPIO,
  253. };
  254. #endif
  255. #ifdef CONFIG_MACH_EZX_E680
  256. static unsigned long e680_pin_config[] __initdata = {
  257. /* keypad */
  258. GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  259. GPIO96_KP_DKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  260. GPIO97_KP_DKIN_4 | WAKEUP_ON_LEVEL_HIGH,
  261. GPIO98_KP_DKIN_5 | WAKEUP_ON_LEVEL_HIGH,
  262. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  263. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  264. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  265. GPIO103_KP_MKOUT_0,
  266. GPIO104_KP_MKOUT_1,
  267. GPIO105_KP_MKOUT_2,
  268. GPIO106_KP_MKOUT_3,
  269. /* MIDI */
  270. GPIO79_GPIO, /* VA_SEL_BUL */
  271. GPIO80_GPIO, /* FLT_SEL_BUL */
  272. GPIO78_GPIO, /* MIDI_RESET */
  273. GPIO33_GPIO, /* MIDI_CS */
  274. GPIO15_GPIO, /* MIDI_IRQ */
  275. GPIO49_GPIO, /* MIDI_NPWE */
  276. GPIO18_GPIO, /* MIDI_RDY */
  277. /* leds */
  278. GPIO46_GPIO,
  279. GPIO47_GPIO,
  280. };
  281. #endif
  282. #ifdef CONFIG_MACH_EZX_A1200
  283. static unsigned long a1200_pin_config[] __initdata = {
  284. /* keypad */
  285. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  286. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  287. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  288. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  289. GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
  290. GPIO103_KP_MKOUT_0,
  291. GPIO104_KP_MKOUT_1,
  292. GPIO105_KP_MKOUT_2,
  293. GPIO106_KP_MKOUT_3,
  294. GPIO107_KP_MKOUT_4,
  295. GPIO108_KP_MKOUT_5,
  296. };
  297. #endif
  298. #ifdef CONFIG_MACH_EZX_A910
  299. static unsigned long a910_pin_config[] __initdata = {
  300. /* keypad */
  301. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  302. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  303. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  304. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  305. GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
  306. GPIO103_KP_MKOUT_0,
  307. GPIO104_KP_MKOUT_1,
  308. GPIO105_KP_MKOUT_2,
  309. GPIO106_KP_MKOUT_3,
  310. GPIO107_KP_MKOUT_4,
  311. GPIO108_KP_MKOUT_5,
  312. /* WLAN */
  313. GPIO89_GPIO, /* RESET */
  314. GPIO33_GPIO, /* WAKEUP */
  315. GPIO94_GPIO | WAKEUP_ON_LEVEL_HIGH, /* HOSTWAKE */
  316. /* MMC CS */
  317. GPIO20_GPIO,
  318. };
  319. #endif
  320. #ifdef CONFIG_MACH_EZX_E2
  321. static unsigned long e2_pin_config[] __initdata = {
  322. /* keypad */
  323. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  324. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  325. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  326. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  327. GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
  328. GPIO103_KP_MKOUT_0,
  329. GPIO104_KP_MKOUT_1,
  330. GPIO105_KP_MKOUT_2,
  331. GPIO106_KP_MKOUT_3,
  332. GPIO107_KP_MKOUT_4,
  333. GPIO108_KP_MKOUT_5,
  334. };
  335. #endif
  336. #ifdef CONFIG_MACH_EZX_E6
  337. static unsigned long e6_pin_config[] __initdata = {
  338. /* keypad */
  339. GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
  340. GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
  341. GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
  342. GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
  343. GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
  344. GPIO103_KP_MKOUT_0,
  345. GPIO104_KP_MKOUT_1,
  346. GPIO105_KP_MKOUT_2,
  347. GPIO106_KP_MKOUT_3,
  348. GPIO107_KP_MKOUT_4,
  349. GPIO108_KP_MKOUT_5,
  350. };
  351. #endif
  352. /* KEYPAD */
  353. #ifdef CONFIG_MACH_EZX_A780
  354. static const unsigned int a780_key_map[] = {
  355. KEY(0, 0, KEY_SEND),
  356. KEY(0, 1, KEY_BACK),
  357. KEY(0, 2, KEY_END),
  358. KEY(0, 3, KEY_PAGEUP),
  359. KEY(0, 4, KEY_UP),
  360. KEY(1, 0, KEY_NUMERIC_1),
  361. KEY(1, 1, KEY_NUMERIC_2),
  362. KEY(1, 2, KEY_NUMERIC_3),
  363. KEY(1, 3, KEY_SELECT),
  364. KEY(1, 4, KEY_KPENTER),
  365. KEY(2, 0, KEY_NUMERIC_4),
  366. KEY(2, 1, KEY_NUMERIC_5),
  367. KEY(2, 2, KEY_NUMERIC_6),
  368. KEY(2, 3, KEY_RECORD),
  369. KEY(2, 4, KEY_LEFT),
  370. KEY(3, 0, KEY_NUMERIC_7),
  371. KEY(3, 1, KEY_NUMERIC_8),
  372. KEY(3, 2, KEY_NUMERIC_9),
  373. KEY(3, 3, KEY_HOME),
  374. KEY(3, 4, KEY_RIGHT),
  375. KEY(4, 0, KEY_NUMERIC_STAR),
  376. KEY(4, 1, KEY_NUMERIC_0),
  377. KEY(4, 2, KEY_NUMERIC_POUND),
  378. KEY(4, 3, KEY_PAGEDOWN),
  379. KEY(4, 4, KEY_DOWN),
  380. };
  381. static struct matrix_keymap_data a780_matrix_keymap_data = {
  382. .keymap = a780_key_map,
  383. .keymap_size = ARRAY_SIZE(a780_key_map),
  384. };
  385. static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
  386. .matrix_key_rows = 5,
  387. .matrix_key_cols = 5,
  388. .matrix_keymap_data = &a780_matrix_keymap_data,
  389. .direct_key_map = { KEY_CAMERA },
  390. .direct_key_num = 1,
  391. .debounce_interval = 30,
  392. };
  393. #endif /* CONFIG_MACH_EZX_A780 */
  394. #ifdef CONFIG_MACH_EZX_E680
  395. static const unsigned int e680_key_map[] = {
  396. KEY(0, 0, KEY_UP),
  397. KEY(0, 1, KEY_RIGHT),
  398. KEY(0, 2, KEY_RESERVED),
  399. KEY(0, 3, KEY_SEND),
  400. KEY(1, 0, KEY_DOWN),
  401. KEY(1, 1, KEY_LEFT),
  402. KEY(1, 2, KEY_PAGEUP),
  403. KEY(1, 3, KEY_PAGEDOWN),
  404. KEY(2, 0, KEY_RESERVED),
  405. KEY(2, 1, KEY_RESERVED),
  406. KEY(2, 2, KEY_RESERVED),
  407. KEY(2, 3, KEY_KPENTER),
  408. };
  409. static struct matrix_keymap_data e680_matrix_keymap_data = {
  410. .keymap = e680_key_map,
  411. .keymap_size = ARRAY_SIZE(e680_key_map),
  412. };
  413. static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
  414. .matrix_key_rows = 3,
  415. .matrix_key_cols = 4,
  416. .matrix_keymap_data = &e680_matrix_keymap_data,
  417. .direct_key_map = {
  418. KEY_CAMERA,
  419. KEY_RESERVED,
  420. KEY_RESERVED,
  421. KEY_F1,
  422. KEY_CANCEL,
  423. KEY_F2,
  424. },
  425. .direct_key_num = 6,
  426. .debounce_interval = 30,
  427. };
  428. #endif /* CONFIG_MACH_EZX_E680 */
  429. #ifdef CONFIG_MACH_EZX_A1200
  430. static const unsigned int a1200_key_map[] = {
  431. KEY(0, 0, KEY_RESERVED),
  432. KEY(0, 1, KEY_RIGHT),
  433. KEY(0, 2, KEY_PAGEDOWN),
  434. KEY(0, 3, KEY_RESERVED),
  435. KEY(0, 4, KEY_RESERVED),
  436. KEY(0, 5, KEY_RESERVED),
  437. KEY(1, 0, KEY_RESERVED),
  438. KEY(1, 1, KEY_DOWN),
  439. KEY(1, 2, KEY_CAMERA),
  440. KEY(1, 3, KEY_RESERVED),
  441. KEY(1, 4, KEY_RESERVED),
  442. KEY(1, 5, KEY_RESERVED),
  443. KEY(2, 0, KEY_RESERVED),
  444. KEY(2, 1, KEY_KPENTER),
  445. KEY(2, 2, KEY_RECORD),
  446. KEY(2, 3, KEY_RESERVED),
  447. KEY(2, 4, KEY_RESERVED),
  448. KEY(2, 5, KEY_SELECT),
  449. KEY(3, 0, KEY_RESERVED),
  450. KEY(3, 1, KEY_UP),
  451. KEY(3, 2, KEY_SEND),
  452. KEY(3, 3, KEY_RESERVED),
  453. KEY(3, 4, KEY_RESERVED),
  454. KEY(3, 5, KEY_RESERVED),
  455. KEY(4, 0, KEY_RESERVED),
  456. KEY(4, 1, KEY_LEFT),
  457. KEY(4, 2, KEY_PAGEUP),
  458. KEY(4, 3, KEY_RESERVED),
  459. KEY(4, 4, KEY_RESERVED),
  460. KEY(4, 5, KEY_RESERVED),
  461. };
  462. static struct matrix_keymap_data a1200_matrix_keymap_data = {
  463. .keymap = a1200_key_map,
  464. .keymap_size = ARRAY_SIZE(a1200_key_map),
  465. };
  466. static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
  467. .matrix_key_rows = 5,
  468. .matrix_key_cols = 6,
  469. .matrix_keymap_data = &a1200_matrix_keymap_data,
  470. .debounce_interval = 30,
  471. };
  472. #endif /* CONFIG_MACH_EZX_A1200 */
  473. #ifdef CONFIG_MACH_EZX_E6
  474. static const unsigned int e6_key_map[] = {
  475. KEY(0, 0, KEY_RESERVED),
  476. KEY(0, 1, KEY_RIGHT),
  477. KEY(0, 2, KEY_PAGEDOWN),
  478. KEY(0, 3, KEY_RESERVED),
  479. KEY(0, 4, KEY_RESERVED),
  480. KEY(0, 5, KEY_NEXTSONG),
  481. KEY(1, 0, KEY_RESERVED),
  482. KEY(1, 1, KEY_DOWN),
  483. KEY(1, 2, KEY_PROG1),
  484. KEY(1, 3, KEY_RESERVED),
  485. KEY(1, 4, KEY_RESERVED),
  486. KEY(1, 5, KEY_RESERVED),
  487. KEY(2, 0, KEY_RESERVED),
  488. KEY(2, 1, KEY_ENTER),
  489. KEY(2, 2, KEY_CAMERA),
  490. KEY(2, 3, KEY_RESERVED),
  491. KEY(2, 4, KEY_RESERVED),
  492. KEY(2, 5, KEY_WWW),
  493. KEY(3, 0, KEY_RESERVED),
  494. KEY(3, 1, KEY_UP),
  495. KEY(3, 2, KEY_SEND),
  496. KEY(3, 3, KEY_RESERVED),
  497. KEY(3, 4, KEY_RESERVED),
  498. KEY(3, 5, KEY_PLAYPAUSE),
  499. KEY(4, 0, KEY_RESERVED),
  500. KEY(4, 1, KEY_LEFT),
  501. KEY(4, 2, KEY_PAGEUP),
  502. KEY(4, 3, KEY_RESERVED),
  503. KEY(4, 4, KEY_RESERVED),
  504. KEY(4, 5, KEY_PREVIOUSSONG),
  505. };
  506. static struct matrix_keymap_data e6_keymap_data = {
  507. .keymap = e6_key_map,
  508. .keymap_size = ARRAY_SIZE(e6_key_map),
  509. };
  510. static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
  511. .matrix_key_rows = 5,
  512. .matrix_key_cols = 6,
  513. .matrix_keymap_data = &e6_keymap_data,
  514. .debounce_interval = 30,
  515. };
  516. #endif /* CONFIG_MACH_EZX_E6 */
  517. #ifdef CONFIG_MACH_EZX_A910
  518. static const unsigned int a910_key_map[] = {
  519. KEY(0, 0, KEY_NUMERIC_6),
  520. KEY(0, 1, KEY_RIGHT),
  521. KEY(0, 2, KEY_PAGEDOWN),
  522. KEY(0, 3, KEY_KPENTER),
  523. KEY(0, 4, KEY_NUMERIC_5),
  524. KEY(0, 5, KEY_CAMERA),
  525. KEY(1, 0, KEY_NUMERIC_8),
  526. KEY(1, 1, KEY_DOWN),
  527. KEY(1, 2, KEY_RESERVED),
  528. KEY(1, 3, KEY_F1), /* Left SoftKey */
  529. KEY(1, 4, KEY_NUMERIC_STAR),
  530. KEY(1, 5, KEY_RESERVED),
  531. KEY(2, 0, KEY_NUMERIC_7),
  532. KEY(2, 1, KEY_NUMERIC_9),
  533. KEY(2, 2, KEY_RECORD),
  534. KEY(2, 3, KEY_F2), /* Right SoftKey */
  535. KEY(2, 4, KEY_BACK),
  536. KEY(2, 5, KEY_SELECT),
  537. KEY(3, 0, KEY_NUMERIC_2),
  538. KEY(3, 1, KEY_UP),
  539. KEY(3, 2, KEY_SEND),
  540. KEY(3, 3, KEY_NUMERIC_0),
  541. KEY(3, 4, KEY_NUMERIC_1),
  542. KEY(3, 5, KEY_RECORD),
  543. KEY(4, 0, KEY_NUMERIC_4),
  544. KEY(4, 1, KEY_LEFT),
  545. KEY(4, 2, KEY_PAGEUP),
  546. KEY(4, 3, KEY_NUMERIC_POUND),
  547. KEY(4, 4, KEY_NUMERIC_3),
  548. KEY(4, 5, KEY_RESERVED),
  549. };
  550. static struct matrix_keymap_data a910_matrix_keymap_data = {
  551. .keymap = a910_key_map,
  552. .keymap_size = ARRAY_SIZE(a910_key_map),
  553. };
  554. static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
  555. .matrix_key_rows = 5,
  556. .matrix_key_cols = 6,
  557. .matrix_keymap_data = &a910_matrix_keymap_data,
  558. .debounce_interval = 30,
  559. };
  560. #endif /* CONFIG_MACH_EZX_A910 */
  561. #ifdef CONFIG_MACH_EZX_E2
  562. static const unsigned int e2_key_map[] = {
  563. KEY(0, 0, KEY_NUMERIC_6),
  564. KEY(0, 1, KEY_RIGHT),
  565. KEY(0, 2, KEY_NUMERIC_9),
  566. KEY(0, 3, KEY_NEXTSONG),
  567. KEY(0, 4, KEY_NUMERIC_5),
  568. KEY(0, 5, KEY_F1), /* Left SoftKey */
  569. KEY(1, 0, KEY_NUMERIC_8),
  570. KEY(1, 1, KEY_DOWN),
  571. KEY(1, 2, KEY_RESERVED),
  572. KEY(1, 3, KEY_PAGEUP),
  573. KEY(1, 4, KEY_NUMERIC_STAR),
  574. KEY(1, 5, KEY_F2), /* Right SoftKey */
  575. KEY(2, 0, KEY_NUMERIC_7),
  576. KEY(2, 1, KEY_KPENTER),
  577. KEY(2, 2, KEY_RECORD),
  578. KEY(2, 3, KEY_PAGEDOWN),
  579. KEY(2, 4, KEY_BACK),
  580. KEY(2, 5, KEY_NUMERIC_0),
  581. KEY(3, 0, KEY_NUMERIC_2),
  582. KEY(3, 1, KEY_UP),
  583. KEY(3, 2, KEY_SEND),
  584. KEY(3, 3, KEY_PLAYPAUSE),
  585. KEY(3, 4, KEY_NUMERIC_1),
  586. KEY(3, 5, KEY_SOUND), /* Music SoftKey */
  587. KEY(4, 0, KEY_NUMERIC_4),
  588. KEY(4, 1, KEY_LEFT),
  589. KEY(4, 2, KEY_NUMERIC_POUND),
  590. KEY(4, 3, KEY_PREVIOUSSONG),
  591. KEY(4, 4, KEY_NUMERIC_3),
  592. KEY(4, 5, KEY_RESERVED),
  593. };
  594. static struct matrix_keymap_data e2_matrix_keymap_data = {
  595. .keymap = e2_key_map,
  596. .keymap_size = ARRAY_SIZE(e2_key_map),
  597. };
  598. static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
  599. .matrix_key_rows = 5,
  600. .matrix_key_cols = 6,
  601. .matrix_keymap_data = &e2_matrix_keymap_data,
  602. .debounce_interval = 30,
  603. };
  604. #endif /* CONFIG_MACH_EZX_E2 */
  605. #if defined(CONFIG_MACH_EZX_A780) || defined(CONFIG_MACH_EZX_A910)
  606. /* camera */
  607. static struct regulator_consumer_supply camera_regulator_supplies[] = {
  608. REGULATOR_SUPPLY("vdd", "0-005d"),
  609. };
  610. static struct regulator_init_data camera_regulator_initdata = {
  611. .consumer_supplies = camera_regulator_supplies,
  612. .num_consumer_supplies = ARRAY_SIZE(camera_regulator_supplies),
  613. .constraints = {
  614. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  615. },
  616. };
  617. static struct fixed_voltage_config camera_regulator_config = {
  618. .supply_name = "camera_vdd",
  619. .microvolts = 2800000,
  620. .enable_high = 0,
  621. .init_data = &camera_regulator_initdata,
  622. };
  623. static struct platform_device camera_supply_regulator_device = {
  624. .name = "reg-fixed-voltage",
  625. .id = 1,
  626. .dev = {
  627. .platform_data = &camera_regulator_config,
  628. },
  629. };
  630. static struct gpiod_lookup_table camera_supply_gpiod_table = {
  631. .dev_id = "reg-fixed-voltage.1",
  632. .table = {
  633. GPIO_LOOKUP("gpio-pxa", GPIO50_nCAM_EN,
  634. NULL, GPIO_ACTIVE_HIGH),
  635. { },
  636. },
  637. };
  638. #endif
  639. #ifdef CONFIG_MACH_EZX_A780
  640. /* gpio_keys */
  641. static struct gpio_keys_button a780_buttons[] = {
  642. [0] = {
  643. .code = SW_LID,
  644. .gpio = GPIO12_A780_FLIP_LID,
  645. .active_low = 0,
  646. .desc = "A780 flip lid",
  647. .type = EV_SW,
  648. .wakeup = 1,
  649. },
  650. };
  651. static struct gpio_keys_platform_data a780_gpio_keys_platform_data = {
  652. .buttons = a780_buttons,
  653. .nbuttons = ARRAY_SIZE(a780_buttons),
  654. };
  655. static struct platform_device a780_gpio_keys = {
  656. .name = "gpio-keys",
  657. .id = -1,
  658. .dev = {
  659. .platform_data = &a780_gpio_keys_platform_data,
  660. },
  661. };
  662. /* camera */
  663. static int a780_camera_reset(struct device *dev)
  664. {
  665. gpio_set_value(GPIO19_GEN1_CAM_RST, 0);
  666. msleep(10);
  667. gpio_set_value(GPIO19_GEN1_CAM_RST, 1);
  668. return 0;
  669. }
  670. static int a780_camera_init(void)
  671. {
  672. int err;
  673. /*
  674. * GPIO50_nCAM_EN is active low
  675. * GPIO19_GEN1_CAM_RST is active on rising edge
  676. */
  677. err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
  678. if (err) {
  679. pr_err("%s: Failed to request CAM_RST\n", __func__);
  680. return err;
  681. }
  682. gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
  683. a780_camera_reset(NULL);
  684. return 0;
  685. }
  686. struct pxacamera_platform_data a780_pxacamera_platform_data = {
  687. .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
  688. PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
  689. PXA_CAMERA_PCP,
  690. .mclk_10khz = 5000,
  691. .sensor_i2c_adapter_id = 0,
  692. .sensor_i2c_address = 0x5d,
  693. };
  694. static struct i2c_board_info a780_i2c_board_info[] = {
  695. {
  696. I2C_BOARD_INFO("mt9m111", 0x5d),
  697. },
  698. };
  699. static struct platform_device *a780_devices[] __initdata = {
  700. &a780_gpio_keys,
  701. &camera_supply_regulator_device,
  702. };
  703. static void __init a780_init(void)
  704. {
  705. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  706. pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
  707. pxa2xx_mfp_config(ARRAY_AND_SIZE(a780_pin_config));
  708. pxa_set_ffuart_info(NULL);
  709. pxa_set_btuart_info(NULL);
  710. pxa_set_stuart_info(NULL);
  711. pxa_set_i2c_info(NULL);
  712. i2c_register_board_info(0, ARRAY_AND_SIZE(a780_i2c_board_info));
  713. pxa_set_fb_info(NULL, &ezx_fb_info_1);
  714. pxa_set_keypad_info(&a780_keypad_platform_data);
  715. if (a780_camera_init() == 0)
  716. pxa_set_camera_info(&a780_pxacamera_platform_data);
  717. gpiod_add_lookup_table(&camera_supply_gpiod_table);
  718. pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
  719. platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
  720. platform_add_devices(ARRAY_AND_SIZE(a780_devices));
  721. regulator_has_full_constraints();
  722. }
  723. MACHINE_START(EZX_A780, "Motorola EZX A780")
  724. .atag_offset = 0x100,
  725. .map_io = pxa27x_map_io,
  726. .nr_irqs = EZX_NR_IRQS,
  727. .init_irq = pxa27x_init_irq,
  728. .handle_irq = pxa27x_handle_irq,
  729. .init_time = pxa_timer_init,
  730. .init_machine = a780_init,
  731. .restart = pxa_restart,
  732. MACHINE_END
  733. #endif
  734. #ifdef CONFIG_MACH_EZX_E680
  735. /* gpio_keys */
  736. static struct gpio_keys_button e680_buttons[] = {
  737. [0] = {
  738. .code = KEY_SCREENLOCK,
  739. .gpio = GPIO12_E680_LOCK_SWITCH,
  740. .active_low = 0,
  741. .desc = "E680 lock switch",
  742. .type = EV_KEY,
  743. .wakeup = 1,
  744. },
  745. };
  746. static struct gpio_keys_platform_data e680_gpio_keys_platform_data = {
  747. .buttons = e680_buttons,
  748. .nbuttons = ARRAY_SIZE(e680_buttons),
  749. };
  750. static struct platform_device e680_gpio_keys = {
  751. .name = "gpio-keys",
  752. .id = -1,
  753. .dev = {
  754. .platform_data = &e680_gpio_keys_platform_data,
  755. },
  756. };
  757. static struct i2c_board_info __initdata e680_i2c_board_info[] = {
  758. { I2C_BOARD_INFO("tea5767", 0x81) },
  759. };
  760. static struct platform_device *e680_devices[] __initdata = {
  761. &e680_gpio_keys,
  762. };
  763. static void __init e680_init(void)
  764. {
  765. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  766. pxa2xx_mfp_config(ARRAY_AND_SIZE(gen1_pin_config));
  767. pxa2xx_mfp_config(ARRAY_AND_SIZE(e680_pin_config));
  768. pxa_set_ffuart_info(NULL);
  769. pxa_set_btuart_info(NULL);
  770. pxa_set_stuart_info(NULL);
  771. pxa_set_i2c_info(NULL);
  772. i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info));
  773. pxa_set_fb_info(NULL, &ezx_fb_info_1);
  774. pxa_set_keypad_info(&e680_keypad_platform_data);
  775. pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
  776. platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
  777. platform_add_devices(ARRAY_AND_SIZE(e680_devices));
  778. }
  779. MACHINE_START(EZX_E680, "Motorola EZX E680")
  780. .atag_offset = 0x100,
  781. .map_io = pxa27x_map_io,
  782. .nr_irqs = EZX_NR_IRQS,
  783. .init_irq = pxa27x_init_irq,
  784. .handle_irq = pxa27x_handle_irq,
  785. .init_time = pxa_timer_init,
  786. .init_machine = e680_init,
  787. .restart = pxa_restart,
  788. MACHINE_END
  789. #endif
  790. #ifdef CONFIG_MACH_EZX_A1200
  791. /* gpio_keys */
  792. static struct gpio_keys_button a1200_buttons[] = {
  793. [0] = {
  794. .code = SW_LID,
  795. .gpio = GPIO15_A1200_FLIP_LID,
  796. .active_low = 0,
  797. .desc = "A1200 flip lid",
  798. .type = EV_SW,
  799. .wakeup = 1,
  800. },
  801. };
  802. static struct gpio_keys_platform_data a1200_gpio_keys_platform_data = {
  803. .buttons = a1200_buttons,
  804. .nbuttons = ARRAY_SIZE(a1200_buttons),
  805. };
  806. static struct platform_device a1200_gpio_keys = {
  807. .name = "gpio-keys",
  808. .id = -1,
  809. .dev = {
  810. .platform_data = &a1200_gpio_keys_platform_data,
  811. },
  812. };
  813. static struct i2c_board_info __initdata a1200_i2c_board_info[] = {
  814. { I2C_BOARD_INFO("tea5767", 0x81) },
  815. };
  816. static struct platform_device *a1200_devices[] __initdata = {
  817. &a1200_gpio_keys,
  818. };
  819. static void __init a1200_init(void)
  820. {
  821. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  822. pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
  823. pxa2xx_mfp_config(ARRAY_AND_SIZE(a1200_pin_config));
  824. pxa_set_ffuart_info(NULL);
  825. pxa_set_btuart_info(NULL);
  826. pxa_set_stuart_info(NULL);
  827. pxa_set_i2c_info(NULL);
  828. i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info));
  829. pxa_set_fb_info(NULL, &ezx_fb_info_2);
  830. pxa_set_keypad_info(&a1200_keypad_platform_data);
  831. pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
  832. platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
  833. platform_add_devices(ARRAY_AND_SIZE(a1200_devices));
  834. }
  835. MACHINE_START(EZX_A1200, "Motorola EZX A1200")
  836. .atag_offset = 0x100,
  837. .map_io = pxa27x_map_io,
  838. .nr_irqs = EZX_NR_IRQS,
  839. .init_irq = pxa27x_init_irq,
  840. .handle_irq = pxa27x_handle_irq,
  841. .init_time = pxa_timer_init,
  842. .init_machine = a1200_init,
  843. .restart = pxa_restart,
  844. MACHINE_END
  845. #endif
  846. #ifdef CONFIG_MACH_EZX_A910
  847. /* gpio_keys */
  848. static struct gpio_keys_button a910_buttons[] = {
  849. [0] = {
  850. .code = SW_LID,
  851. .gpio = GPIO15_A910_FLIP_LID,
  852. .active_low = 0,
  853. .desc = "A910 flip lid",
  854. .type = EV_SW,
  855. .wakeup = 1,
  856. },
  857. };
  858. static struct gpio_keys_platform_data a910_gpio_keys_platform_data = {
  859. .buttons = a910_buttons,
  860. .nbuttons = ARRAY_SIZE(a910_buttons),
  861. };
  862. static struct platform_device a910_gpio_keys = {
  863. .name = "gpio-keys",
  864. .id = -1,
  865. .dev = {
  866. .platform_data = &a910_gpio_keys_platform_data,
  867. },
  868. };
  869. /* camera */
  870. static int a910_camera_reset(struct device *dev)
  871. {
  872. gpio_set_value(GPIO28_GEN2_CAM_RST, 0);
  873. msleep(10);
  874. gpio_set_value(GPIO28_GEN2_CAM_RST, 1);
  875. return 0;
  876. }
  877. static int a910_camera_init(void)
  878. {
  879. int err;
  880. /*
  881. * GPIO50_nCAM_EN is active low
  882. * GPIO28_GEN2_CAM_RST is active on rising edge
  883. */
  884. err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
  885. if (err) {
  886. pr_err("%s: Failed to request CAM_RST\n", __func__);
  887. return err;
  888. }
  889. gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
  890. a910_camera_reset(NULL);
  891. return 0;
  892. }
  893. struct pxacamera_platform_data a910_pxacamera_platform_data = {
  894. .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
  895. PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN |
  896. PXA_CAMERA_PCP,
  897. .mclk_10khz = 5000,
  898. .sensor_i2c_adapter_id = 0,
  899. .sensor_i2c_address = 0x5d,
  900. };
  901. /* leds-lp3944 */
  902. static struct lp3944_platform_data a910_lp3944_leds = {
  903. .leds_size = LP3944_LEDS_MAX,
  904. .leds = {
  905. [0] = {
  906. .name = "a910:red:",
  907. .status = LP3944_LED_STATUS_OFF,
  908. .type = LP3944_LED_TYPE_LED,
  909. },
  910. [1] = {
  911. .name = "a910:green:",
  912. .status = LP3944_LED_STATUS_OFF,
  913. .type = LP3944_LED_TYPE_LED,
  914. },
  915. [2] {
  916. .name = "a910:blue:",
  917. .status = LP3944_LED_STATUS_OFF,
  918. .type = LP3944_LED_TYPE_LED,
  919. },
  920. /* Leds 3 and 4 are used as display power switches */
  921. [3] = {
  922. .name = "a910::cli_display",
  923. .status = LP3944_LED_STATUS_OFF,
  924. .type = LP3944_LED_TYPE_LED_INVERTED
  925. },
  926. [4] = {
  927. .name = "a910::main_display",
  928. .status = LP3944_LED_STATUS_ON,
  929. .type = LP3944_LED_TYPE_LED_INVERTED
  930. },
  931. [5] = { .type = LP3944_LED_TYPE_NONE },
  932. [6] = {
  933. .name = "a910::torch",
  934. .status = LP3944_LED_STATUS_OFF,
  935. .type = LP3944_LED_TYPE_LED,
  936. },
  937. [7] = {
  938. .name = "a910::flash",
  939. .status = LP3944_LED_STATUS_OFF,
  940. .type = LP3944_LED_TYPE_LED_INVERTED,
  941. },
  942. },
  943. };
  944. static struct i2c_board_info __initdata a910_i2c_board_info[] = {
  945. {
  946. I2C_BOARD_INFO("lp3944", 0x60),
  947. .platform_data = &a910_lp3944_leds,
  948. },
  949. {
  950. I2C_BOARD_INFO("mt9m111", 0x5d),
  951. },
  952. };
  953. static struct platform_device *a910_devices[] __initdata = {
  954. &a910_gpio_keys,
  955. &camera_supply_regulator_device,
  956. };
  957. static void __init a910_init(void)
  958. {
  959. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  960. pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
  961. pxa2xx_mfp_config(ARRAY_AND_SIZE(a910_pin_config));
  962. pxa_set_ffuart_info(NULL);
  963. pxa_set_btuart_info(NULL);
  964. pxa_set_stuart_info(NULL);
  965. pxa_set_i2c_info(NULL);
  966. i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info));
  967. pxa_set_fb_info(NULL, &ezx_fb_info_2);
  968. pxa_set_keypad_info(&a910_keypad_platform_data);
  969. if (a910_camera_init() == 0)
  970. pxa_set_camera_info(&a910_pxacamera_platform_data);
  971. gpiod_add_lookup_table(&camera_supply_gpiod_table);
  972. pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
  973. platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
  974. platform_add_devices(ARRAY_AND_SIZE(a910_devices));
  975. regulator_has_full_constraints();
  976. }
  977. MACHINE_START(EZX_A910, "Motorola EZX A910")
  978. .atag_offset = 0x100,
  979. .map_io = pxa27x_map_io,
  980. .nr_irqs = EZX_NR_IRQS,
  981. .init_irq = pxa27x_init_irq,
  982. .handle_irq = pxa27x_handle_irq,
  983. .init_time = pxa_timer_init,
  984. .init_machine = a910_init,
  985. .restart = pxa_restart,
  986. MACHINE_END
  987. #endif
  988. #ifdef CONFIG_MACH_EZX_E6
  989. /* gpio_keys */
  990. static struct gpio_keys_button e6_buttons[] = {
  991. [0] = {
  992. .code = KEY_SCREENLOCK,
  993. .gpio = GPIO15_E6_LOCK_SWITCH,
  994. .active_low = 0,
  995. .desc = "E6 lock switch",
  996. .type = EV_KEY,
  997. .wakeup = 1,
  998. },
  999. };
  1000. static struct gpio_keys_platform_data e6_gpio_keys_platform_data = {
  1001. .buttons = e6_buttons,
  1002. .nbuttons = ARRAY_SIZE(e6_buttons),
  1003. };
  1004. static struct platform_device e6_gpio_keys = {
  1005. .name = "gpio-keys",
  1006. .id = -1,
  1007. .dev = {
  1008. .platform_data = &e6_gpio_keys_platform_data,
  1009. },
  1010. };
  1011. static struct i2c_board_info __initdata e6_i2c_board_info[] = {
  1012. { I2C_BOARD_INFO("tea5767", 0x81) },
  1013. };
  1014. static struct platform_device *e6_devices[] __initdata = {
  1015. &e6_gpio_keys,
  1016. };
  1017. static void __init e6_init(void)
  1018. {
  1019. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  1020. pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
  1021. pxa2xx_mfp_config(ARRAY_AND_SIZE(e6_pin_config));
  1022. pxa_set_ffuart_info(NULL);
  1023. pxa_set_btuart_info(NULL);
  1024. pxa_set_stuart_info(NULL);
  1025. pxa_set_i2c_info(NULL);
  1026. i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info));
  1027. pxa_set_fb_info(NULL, &ezx_fb_info_2);
  1028. pxa_set_keypad_info(&e6_keypad_platform_data);
  1029. pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
  1030. platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
  1031. platform_add_devices(ARRAY_AND_SIZE(e6_devices));
  1032. }
  1033. MACHINE_START(EZX_E6, "Motorola EZX E6")
  1034. .atag_offset = 0x100,
  1035. .map_io = pxa27x_map_io,
  1036. .nr_irqs = EZX_NR_IRQS,
  1037. .init_irq = pxa27x_init_irq,
  1038. .handle_irq = pxa27x_handle_irq,
  1039. .init_time = pxa_timer_init,
  1040. .init_machine = e6_init,
  1041. .restart = pxa_restart,
  1042. MACHINE_END
  1043. #endif
  1044. #ifdef CONFIG_MACH_EZX_E2
  1045. static struct i2c_board_info __initdata e2_i2c_board_info[] = {
  1046. { I2C_BOARD_INFO("tea5767", 0x81) },
  1047. };
  1048. static struct platform_device *e2_devices[] __initdata = {
  1049. };
  1050. static void __init e2_init(void)
  1051. {
  1052. pxa2xx_mfp_config(ARRAY_AND_SIZE(ezx_pin_config));
  1053. pxa2xx_mfp_config(ARRAY_AND_SIZE(gen2_pin_config));
  1054. pxa2xx_mfp_config(ARRAY_AND_SIZE(e2_pin_config));
  1055. pxa_set_ffuart_info(NULL);
  1056. pxa_set_btuart_info(NULL);
  1057. pxa_set_stuart_info(NULL);
  1058. pxa_set_i2c_info(NULL);
  1059. i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info));
  1060. pxa_set_fb_info(NULL, &ezx_fb_info_2);
  1061. pxa_set_keypad_info(&e2_keypad_platform_data);
  1062. pwm_add_table(ezx_pwm_lookup, ARRAY_SIZE(ezx_pwm_lookup));
  1063. platform_add_devices(ARRAY_AND_SIZE(ezx_devices));
  1064. platform_add_devices(ARRAY_AND_SIZE(e2_devices));
  1065. }
  1066. MACHINE_START(EZX_E2, "Motorola EZX E2")
  1067. .atag_offset = 0x100,
  1068. .map_io = pxa27x_map_io,
  1069. .nr_irqs = EZX_NR_IRQS,
  1070. .init_irq = pxa27x_init_irq,
  1071. .handle_irq = pxa27x_handle_irq,
  1072. .init_time = pxa_timer_init,
  1073. .init_machine = e2_init,
  1074. .restart = pxa_restart,
  1075. MACHINE_END
  1076. #endif