porting touch driver form rk28 to rk29sdk

This commit is contained in:
sakura
2010-12-06 12:06:35 +08:00
parent 45e7d17827
commit 5367aa0ab8
4 changed files with 73 additions and 0 deletions

View File

@@ -226,6 +226,53 @@ static struct platform_device rk29_vpu_mem_device = {
},
};
/*HANNSTAR_P1003 touch*/
#if defined (CONFIG_HANNSTAR_P1003)
#define TOUCH_POWER_PIN RK29_PIN6_PD2
#define TOUCH_RESET_PIN RK29_PIN6_PC3
#define TOUCH_INT_PIN RK29_PIN0_PA2
int p1003_init_platform_hw(void)
{
if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){
gpio_free(TOUCH_RESET_PIN);
printk("p1003_init_platform_hw gpio_request error\n");
return -EIO;
}
if(gpio_request(TOUCH_POWER_PIN,NULL) != 0){
gpio_free(TOUCH_POWER_PIN);
printk("p1003_init_platform_hw gpio_request error\n");
return -EIO;
}
if(gpio_request(TOUCH_INT_PIN,NULL) != 0){
gpio_free(TOUCH_INT_PIN);
printk("p1003_init_platform_hw gpio_request error\n");
return -EIO;
}
gpio_pull_updown(TOUCH_INT_PIN, 1);
gpio_direction_output(TOUCH_RESET_PIN, 0);
gpio_direction_output(TOUCH_POWER_PIN, 1);
gpio_set_value(TOUCH_POWER_PIN,GPIO_HIGH);
mdelay(500);
gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
mdelay(500);
gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
return 0;
}
struct p1003_platform_data p1003_info = {
.model= 1003,
.init_platform_hw= p1003_init_platform_hw,
};
#endif
/*****************************************************************************************
* i2c devices
* author: kfx@rock-chips.com
@@ -371,6 +418,15 @@ static struct i2c_board_info __initdata board_i2c1_devices[] = {
#ifdef CONFIG_I2C2_RK29
static struct i2c_board_info __initdata board_i2c2_devices[] = {
#if defined (CONFIG_HANNSTAR_P1003)
{
.type = "p1003_touch",
.addr = 0x04,
.flags = 0,
.irq = RK29_PIN0_PA2,
.platform_data = &p1003_info,
},
#endif
};
#endif

View File

@@ -105,6 +105,17 @@ struct rk29_i2s_platform_data {
int (*io_deinit)(void);
};
/*p1003 touch */
struct p1003_platform_data {
u16 model;
int (*get_pendown_state)(void);
int (*init_platform_hw)(void);
int (*p1003_platform_sleep)(void);
int (*p1003_platform_wakeup)(void);
void (*exit_platform_hw)(void);
};
void __init rk29_map_common_io(void);
void __init rk29_clock_init(void);

View File

@@ -575,5 +575,10 @@ config TOUCHSCREEN_PCAP
To compile this driver as a module, choose M here: the
module will be called pcap_ts.
config HANNSTAR_P1003
tristate "Hannstar P1003 touchscreen"
depends on I2C2_RK29
help
RK29 hannstar touch
endif

View File

@@ -49,3 +49,4 @@ obj-$(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) += xpt2046_ts_320X480.o
obj-$(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI) += xpt2046_cbn_ts.o calibration_ts.o largenum_ts.o calib_iface_ts.o
obj-$(CONFIG_TOUCHSCREEN_IT7250) += ctp_it7250.o
obj-$(CONFIG_RK28_I2C_TS_NTP070) += ntp070.o
obj-$(CONFIG_HANNSTAR_P1003) += hannstar_p1003.o