aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/corgi.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-09-24 23:15:15 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-09-24 23:15:15 -0400
commitc373ba999103fa794f041eab5bd490714d2dee88 (patch)
tree8f2b445b1e0af2491c83527967dbcda76054a486 /arch/arm/mach-pxa/corgi.c
parent6f3529f00a0a9ac06413d18d3926adf099cb59af (diff)
parent851b147e4411df6a1e7e90e2a609773c277eefd2 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'arch/arm/mach-pxa/corgi.c')
-rw-r--r--arch/arm/mach-pxa/corgi.c233
1 files changed, 136 insertions, 97 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 5363e1aea3fb..b536b5a5a10d 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -29,6 +29,7 @@
29#include <linux/spi/ads7846.h> 29#include <linux/spi/ads7846.h>
30#include <linux/spi/corgi_lcd.h> 30#include <linux/spi/corgi_lcd.h>
31#include <linux/mtd/sharpsl.h> 31#include <linux/mtd/sharpsl.h>
32#include <linux/input/matrix_keypad.h>
32#include <video/w100fb.h> 33#include <video/w100fb.h>
33 34
34#include <asm/setup.h> 35#include <asm/setup.h>
@@ -104,6 +105,28 @@ static unsigned long corgi_pin_config[] __initdata = {
104 GPIO6_MMC_CLK, 105 GPIO6_MMC_CLK,
105 GPIO8_MMC_CS0, 106 GPIO8_MMC_CS0,
106 107
108 /* GPIO Matrix Keypad */
109 GPIO66_GPIO, /* column 0 */
110 GPIO67_GPIO, /* column 1 */
111 GPIO68_GPIO, /* column 2 */
112 GPIO69_GPIO, /* column 3 */
113 GPIO70_GPIO, /* column 4 */
114 GPIO71_GPIO, /* column 5 */
115 GPIO72_GPIO, /* column 6 */
116 GPIO73_GPIO, /* column 7 */
117 GPIO74_GPIO, /* column 8 */
118 GPIO75_GPIO, /* column 9 */
119 GPIO76_GPIO, /* column 10 */
120 GPIO77_GPIO, /* column 11 */
121 GPIO58_GPIO, /* row 0 */
122 GPIO59_GPIO, /* row 1 */
123 GPIO60_GPIO, /* row 2 */
124 GPIO61_GPIO, /* row 3 */
125 GPIO62_GPIO, /* row 4 */
126 GPIO63_GPIO, /* row 5 */
127 GPIO64_GPIO, /* row 6 */
128 GPIO65_GPIO, /* row 7 */
129
107 /* GPIO */ 130 /* GPIO */
108 GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */ 131 GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */
109 GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */ 132 GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */
@@ -267,9 +290,115 @@ static struct platform_device corgifb_device = {
267/* 290/*
268 * Corgi Keyboard Device 291 * Corgi Keyboard Device
269 */ 292 */
293#define CORGI_KEY_CALENDER KEY_F1
294#define CORGI_KEY_ADDRESS KEY_F2
295#define CORGI_KEY_FN KEY_F3
296#define CORGI_KEY_CANCEL KEY_F4
297#define CORGI_KEY_OFF KEY_SUSPEND
298#define CORGI_KEY_EXOK KEY_F5
299#define CORGI_KEY_EXCANCEL KEY_F6
300#define CORGI_KEY_EXJOGDOWN KEY_F7
301#define CORGI_KEY_EXJOGUP KEY_F8
302#define CORGI_KEY_JAP1 KEY_LEFTCTRL
303#define CORGI_KEY_JAP2 KEY_LEFTALT
304#define CORGI_KEY_MAIL KEY_F10
305#define CORGI_KEY_OK KEY_F11
306#define CORGI_KEY_MENU KEY_F12
307
308static const uint32_t corgikbd_keymap[] = {
309 KEY(0, 1, KEY_1),
310 KEY(0, 2, KEY_3),
311 KEY(0, 3, KEY_5),
312 KEY(0, 4, KEY_6),
313 KEY(0, 5, KEY_7),
314 KEY(0, 6, KEY_9),
315 KEY(0, 7, KEY_0),
316 KEY(0, 8, KEY_BACKSPACE),
317 KEY(1, 1, KEY_2),
318 KEY(1, 2, KEY_4),
319 KEY(1, 3, KEY_R),
320 KEY(1, 4, KEY_Y),
321 KEY(1, 5, KEY_8),
322 KEY(1, 6, KEY_I),
323 KEY(1, 7, KEY_O),
324 KEY(1, 8, KEY_P),
325 KEY(2, 0, KEY_TAB),
326 KEY(2, 1, KEY_Q),
327 KEY(2, 2, KEY_E),
328 KEY(2, 3, KEY_T),
329 KEY(2, 4, KEY_G),
330 KEY(2, 5, KEY_U),
331 KEY(2, 6, KEY_J),
332 KEY(2, 7, KEY_K),
333 KEY(3, 0, CORGI_KEY_CALENDER),
334 KEY(3, 1, KEY_W),
335 KEY(3, 2, KEY_S),
336 KEY(3, 3, KEY_F),
337 KEY(3, 4, KEY_V),
338 KEY(3, 5, KEY_H),
339 KEY(3, 6, KEY_M),
340 KEY(3, 7, KEY_L),
341 KEY(3, 9, KEY_RIGHTSHIFT),
342 KEY(4, 0, CORGI_KEY_ADDRESS),
343 KEY(4, 1, KEY_A),
344 KEY(4, 2, KEY_D),
345 KEY(4, 3, KEY_C),
346 KEY(4, 4, KEY_B),
347 KEY(4, 5, KEY_N),
348 KEY(4, 6, KEY_DOT),
349 KEY(4, 8, KEY_ENTER),
350 KEY(4, 10, KEY_LEFTSHIFT),
351 KEY(5, 0, CORGI_KEY_MAIL),
352 KEY(5, 1, KEY_Z),
353 KEY(5, 2, KEY_X),
354 KEY(5, 3, KEY_MINUS),
355 KEY(5, 4, KEY_SPACE),
356 KEY(5, 5, KEY_COMMA),
357 KEY(5, 7, KEY_UP),
358 KEY(5, 11, CORGI_KEY_FN),
359 KEY(6, 0, KEY_SYSRQ),
360 KEY(6, 1, CORGI_KEY_JAP1),
361 KEY(6, 2, CORGI_KEY_JAP2),
362 KEY(6, 3, CORGI_KEY_CANCEL),
363 KEY(6, 4, CORGI_KEY_OK),
364 KEY(6, 5, CORGI_KEY_MENU),
365 KEY(6, 6, KEY_LEFT),
366 KEY(6, 7, KEY_DOWN),
367 KEY(6, 8, KEY_RIGHT),
368 KEY(7, 0, CORGI_KEY_OFF),
369 KEY(7, 1, CORGI_KEY_EXOK),
370 KEY(7, 2, CORGI_KEY_EXCANCEL),
371 KEY(7, 3, CORGI_KEY_EXJOGDOWN),
372 KEY(7, 4, CORGI_KEY_EXJOGUP),
373};
374
375static struct matrix_keymap_data corgikbd_keymap_data = {
376 .keymap = corgikbd_keymap,
377 .keymap_size = ARRAY_SIZE(corgikbd_keymap),
378};
379
380static const int corgikbd_row_gpios[] =
381 { 58, 59, 60, 61, 62, 63, 64, 65 };
382static const int corgikbd_col_gpios[] =
383 { 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77 };
384
385static struct matrix_keypad_platform_data corgikbd_pdata = {
386 .keymap_data = &corgikbd_keymap_data,
387 .row_gpios = corgikbd_row_gpios,
388 .col_gpios = corgikbd_col_gpios,
389 .num_row_gpios = ARRAY_SIZE(corgikbd_row_gpios),
390 .num_col_gpios = ARRAY_SIZE(corgikbd_col_gpios),
391 .col_scan_delay_us = 10,
392 .debounce_ms = 10,
393 .wakeup = 1,
394};
395
270static struct platform_device corgikbd_device = { 396static struct platform_device corgikbd_device = {
271 .name = "corgi-keyboard", 397 .name = "matrix-keypad",
272 .id = -1, 398 .id = -1,
399 .dev = {
400 .platform_data = &corgikbd_pdata,
401 },
273}; 402};
274 403
275/* 404/*
@@ -307,111 +436,20 @@ static struct platform_device corgiled_device = {
307 * The card detect interrupt isn't debounced so we delay it by 250ms 436 * The card detect interrupt isn't debounced so we delay it by 250ms
308 * to give the card a chance to fully insert/eject. 437 * to give the card a chance to fully insert/eject.
309 */ 438 */
310static struct pxamci_platform_data corgi_mci_platform_data;
311
312static int corgi_mci_init(struct device *dev, irq_handler_t corgi_detect_int, void *data)
313{
314 int err;
315
316 err = gpio_request(CORGI_GPIO_nSD_DETECT, "nSD_DETECT");
317 if (err)
318 goto err_out;
319
320 err = gpio_request(CORGI_GPIO_nSD_WP, "nSD_WP");
321 if (err)
322 goto err_free_1;
323
324 err = gpio_request(CORGI_GPIO_SD_PWR, "SD_PWR");
325 if (err)
326 goto err_free_2;
327
328 gpio_direction_input(CORGI_GPIO_nSD_DETECT);
329 gpio_direction_input(CORGI_GPIO_nSD_WP);
330 gpio_direction_output(CORGI_GPIO_SD_PWR, 0);
331
332 corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250);
333
334 err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int,
335 IRQF_DISABLED | IRQF_TRIGGER_RISING |
336 IRQF_TRIGGER_FALLING,
337 "MMC card detect", data);
338 if (err) {
339 pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
340 __func__);
341 goto err_free_3;
342 }
343 return 0;
344
345err_free_3:
346 gpio_free(CORGI_GPIO_SD_PWR);
347err_free_2:
348 gpio_free(CORGI_GPIO_nSD_WP);
349err_free_1:
350 gpio_free(CORGI_GPIO_nSD_DETECT);
351err_out:
352 return err;
353}
354
355static void corgi_mci_setpower(struct device *dev, unsigned int vdd)
356{
357 struct pxamci_platform_data* p_d = dev->platform_data;
358
359 gpio_set_value(CORGI_GPIO_SD_PWR, ((1 << vdd) & p_d->ocr_mask));
360}
361
362static int corgi_mci_get_ro(struct device *dev)
363{
364 return gpio_get_value(CORGI_GPIO_nSD_WP);
365}
366
367static void corgi_mci_exit(struct device *dev, void *data)
368{
369 free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data);
370 gpio_free(CORGI_GPIO_SD_PWR);
371 gpio_free(CORGI_GPIO_nSD_WP);
372 gpio_free(CORGI_GPIO_nSD_DETECT);
373}
374
375static struct pxamci_platform_data corgi_mci_platform_data = { 439static struct pxamci_platform_data corgi_mci_platform_data = {
376 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 440 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
377 .init = corgi_mci_init, 441 .gpio_card_detect = -1,
378 .get_ro = corgi_mci_get_ro, 442 .gpio_card_ro = CORGI_GPIO_nSD_WP,
379 .setpower = corgi_mci_setpower, 443 .gpio_power = CORGI_GPIO_SD_PWR,
380 .exit = corgi_mci_exit,
381}; 444};
382 445
383 446
384/* 447/*
385 * Irda 448 * Irda
386 */ 449 */
387static void corgi_irda_transceiver_mode(struct device *dev, int mode)
388{
389 gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF);
390 pxa2xx_transceiver_mode(dev, mode);
391}
392
393static int corgi_irda_startup(struct device *dev)
394{
395 int err;
396
397 err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON");
398 if (err)
399 return err;
400
401 gpio_direction_output(CORGI_GPIO_IR_ON, 1);
402 return 0;
403}
404
405static void corgi_irda_shutdown(struct device *dev)
406{
407 gpio_free(CORGI_GPIO_IR_ON);
408}
409
410static struct pxaficp_platform_data corgi_ficp_platform_data = { 450static struct pxaficp_platform_data corgi_ficp_platform_data = {
451 .gpio_pwdown = CORGI_GPIO_IR_ON,
411 .transceiver_cap = IR_SIRMODE | IR_OFF, 452 .transceiver_cap = IR_SIRMODE | IR_OFF,
412 .transceiver_mode = corgi_irda_transceiver_mode,
413 .startup = corgi_irda_startup,
414 .shutdown = corgi_irda_shutdown,
415}; 453};
416 454
417 455
@@ -636,6 +674,7 @@ static void __init corgi_init(void)
636 corgi_init_spi(); 674 corgi_init_spi();
637 675
638 pxa_set_udc_info(&udc_info); 676 pxa_set_udc_info(&udc_info);
677 corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250);
639 pxa_set_mci_info(&corgi_mci_platform_data); 678 pxa_set_mci_info(&corgi_mci_platform_data);
640 pxa_set_ficp_info(&corgi_ficp_platform_data); 679 pxa_set_ficp_info(&corgi_ficp_platform_data);
641 pxa_set_i2c_info(NULL); 680 pxa_set_i2c_info(NULL);