aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2010-07-14 03:01:16 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-08-04 03:08:37 -0400
commit71c3ba9a94c88c43e7216869531c8fbbacd15d9b (patch)
treebea62b7a6476bba6dde9dbbc5a7e4af512477a64 /arch/arm/mach-shmobile
parentdba6f385b83d7f19eb1d4df12f422bab945c7f10 (diff)
ARM: mach-shmobile: ap4evb: Add ts_get_pendown_state for tsc2007
This function is necessary to ensure the detection of pen-down. This patch support both QHD / WVGA pannel. Tested-by: Tony SIM <chinyeow.sim.xt@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c78
1 files changed, 62 insertions, 16 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index e8a9d7990d34..968601201fb5 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -576,12 +576,74 @@ static struct platform_device *ap4evb_devices[] __initdata = {
576 &sh_mmcif_device 576 &sh_mmcif_device
577}; 577};
578 578
579/*
580 * FIXME !!
581 *
582 * gpio_no_direction
583 * gpio_pull_up
584 * are quick_hack.
585 *
586 * current gpio frame work doesn't have
587 * the method to control only pull up/down/free.
588 * this function should be replaced by correct gpio function
589 */
590static void __init gpio_no_direction(u32 addr)
591{
592 __raw_writeb(0x00, addr);
593}
594
595static void __init gpio_pull_up(u32 addr)
596{
597 u8 data = __raw_readb(addr);
598
599 data &= 0x0F;
600 data |= 0xC0;
601 __raw_writeb(data, addr);
602}
603
579/* TouchScreen */ 604/* TouchScreen */
580#define IRQ28 evt2irq(0x3380) /* IRQ28A */ 605#define IRQ28 evt2irq(0x3380) /* IRQ28A */
581#define IRQ7 evt2irq(0x02e0) /* IRQ7A */ 606#define IRQ7 evt2irq(0x02e0) /* IRQ7A */
607static int ts_get_pendown_state(void)
608{
609 int val1, val2;
610
611 gpio_free(GPIO_FN_IRQ28_123);
612 gpio_free(GPIO_FN_IRQ7_40);
613
614 gpio_request(GPIO_PORT123, NULL);
615 gpio_request(GPIO_PORT40, NULL);
616
617 gpio_direction_input(GPIO_PORT123);
618 gpio_direction_input(GPIO_PORT40);
619
620 val1 = gpio_get_value(GPIO_PORT123);
621 val2 = gpio_get_value(GPIO_PORT40);
622
623 gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */
624 gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
625
626 return val1 ^ val2;
627}
628
629#define PORT40CR 0xE6051028
630#define PORT123CR 0xE605007B
631static int ts_init(void)
632{
633 gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */
634 gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
635
636 gpio_pull_up(PORT40CR);
637 gpio_pull_up(PORT123CR);
638
639 return 0;
640}
641
582static struct tsc2007_platform_data tsc2007_info = { 642static struct tsc2007_platform_data tsc2007_info = {
583 .model = 2007, 643 .model = 2007,
584 .x_plate_ohms = 180, 644 .x_plate_ohms = 180,
645 .get_pendown_state = ts_get_pendown_state,
646 .init_platform_hw = ts_init,
585}; 647};
586 648
587static struct i2c_board_info tsc_device = { 649static struct i2c_board_info tsc_device = {
@@ -625,20 +687,6 @@ static void __init ap4evb_map_io(void)
625 shmobile_setup_console(); 687 shmobile_setup_console();
626} 688}
627 689
628/*
629 * FIXME !!
630 *
631 * gpio_no_direction is quick_hack.
632 *
633 * current gpio frame work doesn't have
634 * the method to control only pull up/down/free.
635 * this function should be replaced by correct gpio function
636 */
637static void __init gpio_no_direction(u32 addr)
638{
639 __raw_writeb(0x00, addr);
640}
641
642#define GPIO_PORT9CR 0xE6051009 690#define GPIO_PORT9CR 0xE6051009
643#define GPIO_PORT10CR 0xE605100A 691#define GPIO_PORT10CR 0xE605100A
644 692
@@ -784,7 +832,6 @@ static void __init ap4evb_init(void)
784 gpio_request(GPIO_FN_KEYIN4, NULL); 832 gpio_request(GPIO_FN_KEYIN4, NULL);
785 833
786 /* enable TouchScreen */ 834 /* enable TouchScreen */
787 gpio_request(GPIO_FN_IRQ28_123, NULL);
788 set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW); 835 set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW);
789 836
790 tsc_device.irq = IRQ28; 837 tsc_device.irq = IRQ28;
@@ -860,7 +907,6 @@ static void __init ap4evb_init(void)
860 lcdc_info.ch[0].lcd_size_cfg.height = 91; 907 lcdc_info.ch[0].lcd_size_cfg.height = 91;
861 908
862 /* enable TouchScreen */ 909 /* enable TouchScreen */
863 gpio_request(GPIO_FN_IRQ7_40, NULL);
864 set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); 910 set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
865 911
866 tsc_device.irq = IRQ7; 912 tsc_device.irq = IRQ7;