提交 71c3ba9a 编写于 作者: K Kuninori Morimoto 提交者: Paul Mundt

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: NTony SIM <chinyeow.sim.xt@renesas.com>
Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 dba6f385
...@@ -576,12 +576,74 @@ static struct platform_device *ap4evb_devices[] __initdata = { ...@@ -576,12 +576,74 @@ static struct platform_device *ap4evb_devices[] __initdata = {
&sh_mmcif_device &sh_mmcif_device
}; };
/*
* FIXME !!
*
* gpio_no_direction
* gpio_pull_up
* are quick_hack.
*
* current gpio frame work doesn't have
* the method to control only pull up/down/free.
* this function should be replaced by correct gpio function
*/
static void __init gpio_no_direction(u32 addr)
{
__raw_writeb(0x00, addr);
}
static void __init gpio_pull_up(u32 addr)
{
u8 data = __raw_readb(addr);
data &= 0x0F;
data |= 0xC0;
__raw_writeb(data, addr);
}
/* TouchScreen */ /* TouchScreen */
#define IRQ28 evt2irq(0x3380) /* IRQ28A */ #define IRQ28 evt2irq(0x3380) /* IRQ28A */
#define IRQ7 evt2irq(0x02e0) /* IRQ7A */ #define IRQ7 evt2irq(0x02e0) /* IRQ7A */
static int ts_get_pendown_state(void)
{
int val1, val2;
gpio_free(GPIO_FN_IRQ28_123);
gpio_free(GPIO_FN_IRQ7_40);
gpio_request(GPIO_PORT123, NULL);
gpio_request(GPIO_PORT40, NULL);
gpio_direction_input(GPIO_PORT123);
gpio_direction_input(GPIO_PORT40);
val1 = gpio_get_value(GPIO_PORT123);
val2 = gpio_get_value(GPIO_PORT40);
gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */
gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
return val1 ^ val2;
}
#define PORT40CR 0xE6051028
#define PORT123CR 0xE605007B
static int ts_init(void)
{
gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */
gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
gpio_pull_up(PORT40CR);
gpio_pull_up(PORT123CR);
return 0;
}
static struct tsc2007_platform_data tsc2007_info = { static struct tsc2007_platform_data tsc2007_info = {
.model = 2007, .model = 2007,
.x_plate_ohms = 180, .x_plate_ohms = 180,
.get_pendown_state = ts_get_pendown_state,
.init_platform_hw = ts_init,
}; };
static struct i2c_board_info tsc_device = { static struct i2c_board_info tsc_device = {
...@@ -625,20 +687,6 @@ static void __init ap4evb_map_io(void) ...@@ -625,20 +687,6 @@ static void __init ap4evb_map_io(void)
shmobile_setup_console(); shmobile_setup_console();
} }
/*
* FIXME !!
*
* gpio_no_direction is quick_hack.
*
* current gpio frame work doesn't have
* the method to control only pull up/down/free.
* this function should be replaced by correct gpio function
*/
static void __init gpio_no_direction(u32 addr)
{
__raw_writeb(0x00, addr);
}
#define GPIO_PORT9CR 0xE6051009 #define GPIO_PORT9CR 0xE6051009
#define GPIO_PORT10CR 0xE605100A #define GPIO_PORT10CR 0xE605100A
...@@ -784,7 +832,6 @@ static void __init ap4evb_init(void) ...@@ -784,7 +832,6 @@ static void __init ap4evb_init(void)
gpio_request(GPIO_FN_KEYIN4, NULL); gpio_request(GPIO_FN_KEYIN4, NULL);
/* enable TouchScreen */ /* enable TouchScreen */
gpio_request(GPIO_FN_IRQ28_123, NULL);
set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW); set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW);
tsc_device.irq = IRQ28; tsc_device.irq = IRQ28;
...@@ -860,7 +907,6 @@ static void __init ap4evb_init(void) ...@@ -860,7 +907,6 @@ static void __init ap4evb_init(void)
lcdc_info.ch[0].lcd_size_cfg.height = 91; lcdc_info.ch[0].lcd_size_cfg.height = 91;
/* enable TouchScreen */ /* enable TouchScreen */
gpio_request(GPIO_FN_IRQ7_40, NULL);
set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
tsc_device.irq = IRQ7; tsc_device.irq = IRQ7;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册