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-omap3touchbook.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-omap3touchbook.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3touchbook.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index 127cb1752bdd..15f9d7ddc230 100644 --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "mux.h" | 52 | #include "mux.h" |
53 | #include "hsmmc.h" | 53 | #include "hsmmc.h" |
54 | #include "timer-gp.h" | 54 | #include "timer-gp.h" |
55 | #include "common-board-devices.h" | ||
55 | 56 | ||
56 | #include <asm/setup.h> | 57 | #include <asm/setup.h> |
57 | 58 | ||
@@ -301,19 +302,7 @@ static int __init omap3_touchbook_i2c_init(void) | |||
301 | return 0; | 302 | return 0; |
302 | } | 303 | } |
303 | 304 | ||
304 | static void __init omap3_ads7846_init(void) | 305 | static struct ads7846_platform_data ads7846_pdata = { |
305 | { | ||
306 | if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) { | ||
307 | printk(KERN_ERR "Failed to request GPIO %d for " | ||
308 | "ads7846 pen down IRQ\n", OMAP3_TS_GPIO); | ||
309 | return; | ||
310 | } | ||
311 | |||
312 | gpio_direction_input(OMAP3_TS_GPIO); | ||
313 | gpio_set_debounce(OMAP3_TS_GPIO, 310); | ||
314 | } | ||
315 | |||
316 | static struct ads7846_platform_data ads7846_config = { | ||
317 | .x_min = 100, | 306 | .x_min = 100, |
318 | .y_min = 265, | 307 | .y_min = 265, |
319 | .x_max = 3950, | 308 | .x_max = 3950, |
@@ -327,23 +316,6 @@ static struct ads7846_platform_data ads7846_config = { | |||
327 | .keep_vref_on = 1, | 316 | .keep_vref_on = 1, |
328 | }; | 317 | }; |
329 | 318 | ||
330 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | ||
331 | .turbo_mode = 0, | ||
332 | .single_channel = 1, /* 0: slave, 1: master */ | ||
333 | }; | ||
334 | |||
335 | static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = { | ||
336 | { | ||
337 | .modalias = "ads7846", | ||
338 | .bus_num = 4, | ||
339 | .chip_select = 0, | ||
340 | .max_speed_hz = 1500000, | ||
341 | .controller_data = &ads7846_mcspi_config, | ||
342 | .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO), | ||
343 | .platform_data = &ads7846_config, | ||
344 | } | ||
345 | }; | ||
346 | |||
347 | static struct gpio_led gpio_leds[] = { | 319 | static struct gpio_led gpio_leds[] = { |
348 | { | 320 | { |
349 | .name = "touchbook::usr0", | 321 | .name = "touchbook::usr0", |
@@ -526,9 +498,7 @@ static void __init omap3_touchbook_init(void) | |||
526 | gpio_direction_output(176, true); | 498 | gpio_direction_output(176, true); |
527 | 499 | ||
528 | /* Touchscreen and accelerometer */ | 500 | /* Touchscreen and accelerometer */ |
529 | spi_register_board_info(omap3_ads7846_spi_board_info, | 501 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); |
530 | ARRAY_SIZE(omap3_ads7846_spi_board_info)); | ||
531 | omap3_ads7846_init(); | ||
532 | usb_musb_init(&musb_board_data); | 502 | usb_musb_init(&musb_board_data); |
533 | usbhs_init(&usbhs_bdata); | 503 | usbhs_init(&usbhs_bdata); |
534 | omap3touchbook_flash_init(); | 504 | omap3touchbook_flash_init(); |