diff options
author | Mike Rapoport <mike@compulab.co.il> | 2011-04-24 18:09:05 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-05-03 05:38:09 -0400 |
commit | 96974a249b0cf3537f49115a59be67e2c54f315c (patch) | |
tree | 4415a81a5ad4a91313bacf6b534b77f5556858a9 /arch/arm/mach-omap2/board-omap3stalker.c | |
parent | d14f81741f4ca5c96f52eff0210c8da0b0997d6f (diff) |
omap: consolidate touch screen initialization among different boards
Add common-board-devices.c that will contain the code for peripheral
devices initializatoin shared between multiple boards.
Start small with touchscreen initialization.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3stalker.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3stalker.c | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 848016c6a245..671ceb0c7a6f 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <plat/mcspi.h> | 45 | #include <plat/mcspi.h> |
46 | #include <linux/input/matrix_keypad.h> | 46 | #include <linux/input/matrix_keypad.h> |
47 | #include <linux/spi/spi.h> | 47 | #include <linux/spi/spi.h> |
48 | #include <linux/spi/ads7846.h> | ||
49 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
50 | #include <linux/smsc911x.h> | 49 | #include <linux/smsc911x.h> |
51 | #include <linux/i2c/at24.h> | 50 | #include <linux/i2c/at24.h> |
@@ -54,6 +53,7 @@ | |||
54 | #include "mux.h" | 53 | #include "mux.h" |
55 | #include "hsmmc.h" | 54 | #include "hsmmc.h" |
56 | #include "timer-gp.h" | 55 | #include "timer-gp.h" |
56 | #include "common-board-devices.h" | ||
57 | 57 | ||
58 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 58 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
59 | #include <plat/gpmc-smsc911x.h> | 59 | #include <plat/gpmc-smsc911x.h> |
@@ -498,49 +498,6 @@ static int __init omap3_stalker_i2c_init(void) | |||
498 | } | 498 | } |
499 | 499 | ||
500 | #define OMAP3_STALKER_TS_GPIO 175 | 500 | #define OMAP3_STALKER_TS_GPIO 175 |
501 | static void ads7846_dev_init(void) | ||
502 | { | ||
503 | if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0) | ||
504 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); | ||
505 | |||
506 | gpio_direction_input(OMAP3_STALKER_TS_GPIO); | ||
507 | gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310); | ||
508 | } | ||
509 | |||
510 | static int ads7846_get_pendown_state(void) | ||
511 | { | ||
512 | return !gpio_get_value(OMAP3_STALKER_TS_GPIO); | ||
513 | } | ||
514 | |||
515 | static struct ads7846_platform_data ads7846_config = { | ||
516 | .x_max = 0x0fff, | ||
517 | .y_max = 0x0fff, | ||
518 | .x_plate_ohms = 180, | ||
519 | .pressure_max = 255, | ||
520 | .debounce_max = 10, | ||
521 | .debounce_tol = 3, | ||
522 | .debounce_rep = 1, | ||
523 | .get_pendown_state = ads7846_get_pendown_state, | ||
524 | .keep_vref_on = 1, | ||
525 | .settle_delay_usecs = 150, | ||
526 | }; | ||
527 | |||
528 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
529 | .turbo_mode = 0, | ||
530 | .single_channel = 1, /* 0: slave, 1: master */ | ||
531 | }; | ||
532 | |||
533 | static struct spi_board_info omap3stalker_spi_board_info[] = { | ||
534 | [0] = { | ||
535 | .modalias = "ads7846", | ||
536 | .bus_num = 1, | ||
537 | .chip_select = 0, | ||
538 | .max_speed_hz = 1500000, | ||
539 | .controller_data = &ads7846_mcspi_config, | ||
540 | .irq = OMAP_GPIO_IRQ(OMAP3_STALKER_TS_GPIO), | ||
541 | .platform_data = &ads7846_config, | ||
542 | }, | ||
543 | }; | ||
544 | 501 | ||
545 | static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { | 502 | static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { |
546 | }; | 503 | }; |
@@ -602,13 +559,11 @@ static void __init omap3_stalker_init(void) | |||
602 | ARRAY_SIZE(omap3_stalker_devices)); | 559 | ARRAY_SIZE(omap3_stalker_devices)); |
603 | 560 | ||
604 | omap_display_init(&omap3_stalker_dss_data); | 561 | omap_display_init(&omap3_stalker_dss_data); |
605 | spi_register_board_info(omap3stalker_spi_board_info, | ||
606 | ARRAY_SIZE(omap3stalker_spi_board_info)); | ||
607 | 562 | ||
608 | omap_serial_init(); | 563 | omap_serial_init(); |
609 | usb_musb_init(&musb_board_data); | 564 | usb_musb_init(&musb_board_data); |
610 | usbhs_init(&usbhs_bdata); | 565 | usbhs_init(&usbhs_bdata); |
611 | ads7846_dev_init(); | 566 | omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); |
612 | 567 | ||
613 | omap_mux_init_gpio(21, OMAP_PIN_OUTPUT); | 568 | omap_mux_init_gpio(21, OMAP_PIN_OUTPUT); |
614 | omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP); | 569 | omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP); |