ezx.c 29 KB

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