diff options
author | Kuninori Morimoto <morimoto.kuninori@renesas.com> | 2009-09-28 04:21:41 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-09-29 23:51:50 -0400 |
commit | 8810e0553fec6ff0a0db1431e388de39e2a2a512 (patch) | |
tree | d603b7d6e72420491f8a3fb42620f2f712009168 /arch/sh | |
parent | fe1dbfd3f992d5432d7463a5bd6c2fc96d3eccd8 (diff) |
sh: mach-ecovec24: Add TouchScreen support
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/boards/mach-ecovec24/setup.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 5f9881e16e2f..52912a6149c7 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/usb/r8a66597.h> | 19 | #include <linux/usb/r8a66597.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/i2c/tsc2007.h> | ||
21 | #include <linux/input.h> | 22 | #include <linux/input.h> |
22 | #include <video/sh_mobile_lcdc.h> | 23 | #include <video/sh_mobile_lcdc.h> |
23 | #include <media/sh_mobile_ceu.h> | 24 | #include <media/sh_mobile_ceu.h> |
@@ -376,6 +377,43 @@ static struct platform_device keysc_device = { | |||
376 | }, | 377 | }, |
377 | }; | 378 | }; |
378 | 379 | ||
380 | /* TouchScreen */ | ||
381 | #define IRQ0 32 | ||
382 | static int ts_get_pendown_state(void) | ||
383 | { | ||
384 | int val = 0; | ||
385 | gpio_free(GPIO_FN_INTC_IRQ0); | ||
386 | gpio_request(GPIO_PTZ0, NULL); | ||
387 | gpio_direction_input(GPIO_PTZ0); | ||
388 | |||
389 | val = gpio_get_value(GPIO_PTZ0); | ||
390 | |||
391 | gpio_free(GPIO_PTZ0); | ||
392 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); | ||
393 | |||
394 | return val ? 0 : 1; | ||
395 | } | ||
396 | |||
397 | static int ts_init(void) | ||
398 | { | ||
399 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); | ||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | struct tsc2007_platform_data tsc2007_info = { | ||
404 | .model = 2007, | ||
405 | .x_plate_ohms = 180, | ||
406 | .get_pendown_state = ts_get_pendown_state, | ||
407 | .init_platform_hw = ts_init, | ||
408 | }; | ||
409 | |||
410 | static struct i2c_board_info ts_i2c_clients = { | ||
411 | I2C_BOARD_INFO("tsc2007", 0x48), | ||
412 | .type = "tsc2007", | ||
413 | .platform_data = &tsc2007_info, | ||
414 | .irq = IRQ0, | ||
415 | }; | ||
416 | |||
379 | static struct platform_device *ecovec_devices[] __initdata = { | 417 | static struct platform_device *ecovec_devices[] __initdata = { |
380 | &heartbeat_device, | 418 | &heartbeat_device, |
381 | &nor_flash_device, | 419 | &nor_flash_device, |
@@ -590,6 +628,10 @@ static int __init arch_setup(void) | |||
590 | */ | 628 | */ |
591 | gpio_request(GPIO_PTF4, NULL); | 629 | gpio_request(GPIO_PTF4, NULL); |
592 | gpio_direction_output(GPIO_PTF4, 1); | 630 | gpio_direction_output(GPIO_PTF4, 1); |
631 | |||
632 | /* enable TouchScreen */ | ||
633 | i2c_register_board_info(0, &ts_i2c_clients, 1); | ||
634 | set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW); | ||
593 | } | 635 | } |
594 | 636 | ||
595 | /* enable CEU0 */ | 637 | /* enable CEU0 */ |