From 9bc99969001972d19096a9bc8716b6ea14f9de5f Mon Sep 17 00:00:00 2001 From: wuhao Date: Fri, 23 Nov 2012 15:28:05 +0800 Subject: [PATCH] rk292x : ft5x0x while suspend close vcctp and while resume open vcctp --- arch/arm/mach-rk2928/board-rk2926-sdk.c | 4 ++ drivers/input/touchscreen/ft5x0x.c | 51 ++++++++++++++++++++----- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-rk2928/board-rk2926-sdk.c b/arch/arm/mach-rk2928/board-rk2926-sdk.c index 67549b790552..f547670864d8 100755 --- a/arch/arm/mach-rk2928/board-rk2926-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2926-sdk.c @@ -387,7 +387,11 @@ static struct platform_device device_ion = { /*ft5x0x touchpad*/ #if defined (CONFIG_TOUCHSCREEN_FT5X0X) +#if defined(V86_VERSION_1_0) || defined(V86_VERSION_1_1) +#define TOUCH_RESET_PIN INVALID_GPIO +#else #define TOUCH_RESET_PIN RK2928_PIN0_PD3 +#endif #define TOUCH_EN_PIN NULL #define TOUCH_INT_PIN RK2928_PIN1_PB0 diff --git a/drivers/input/touchscreen/ft5x0x.c b/drivers/input/touchscreen/ft5x0x.c index 8e6665f096d7..c8dabff60f11 100644 --- a/drivers/input/touchscreen/ft5x0x.c +++ b/drivers/input/touchscreen/ft5x0x.c @@ -18,6 +18,7 @@ #include #include #include +#include //#define FT5X0X_DEBUG #ifdef FT5X0X_DEBUG @@ -230,6 +231,29 @@ static void ft5x0x_power_en(struct ft5x0x_data *tsdata, int on) mdelay(10); } #endif + if( tsdata->reset_gpio <= 0 ){ + struct regulator *vcc_tp; + vcc_tp = regulator_get(NULL, "vaux33"); // vcc28_cif + if (vcc_tp == NULL || IS_ERR(vcc_tp) ){ + printk(">>>> get cif vaux33 ldo failed!\n"); + return; + } + + if( on ){ //turn on + regulator_set_voltage(vcc_tp, 3300000, 3300000); + regulator_enable(vcc_tp); + printk(" %s set vpll vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(vcc_tp)); + regulator_put(vcc_tp); + }else{ //turn off + while(regulator_is_enabled(vcc_tp)>0){ + regulator_disable(vcc_tp); + } + printk(" %s regulator disable vcc tp \n",__func__); + regulator_put(vcc_tp); + } + } + + } static void ft5x0x_chip_reset(struct ft5x0x_data *tsdata) @@ -277,12 +301,14 @@ static int ft5x0x_chip_init(struct i2c_client * client) int i = 0, flag = 1; struct ft5x0x_data *tsdata = i2c_get_clientdata(client); - gpio_free(tsdata->reset_gpio); - err = gpio_request(tsdata->reset_gpio, "ft5x0x rst"); - if (err) { - DBG( "failed to request ft5x0x reset GPIO%d\n", tsdata->reset_gpio); - goto exit_alloc_gpio_rst_failed; - } + if( tsdata->reset_gpio > 0 ){ + gpio_free(tsdata->reset_gpio); + err = gpio_request(tsdata->reset_gpio, "ft5x0x rst"); + if (err) { + printk( "failed to request ft5x0x reset GPIO%d\n", tsdata->reset_gpio); + goto exit_alloc_gpio_rst_failed; + } + } #if defined (TOUCH_POWER_PIN) #if defined (TOUCH_POWER_MUX_NAME) @@ -507,8 +533,10 @@ static void ft5x0x_suspend(struct early_suspend *h) printk("ft5x0x enter sleep mode failed\n"); } #endif - disable_irq(g_client->irq); - //ft5x0x_power_en(ft5x0x, 0); + disable_irq(g_client->irq); + if( ft5x0x->reset_gpio <= 0 ){ + ft5x0x_power_en(ft5x0x, 0); + } } static void ft5x0x_resume(struct early_suspend *h) @@ -518,8 +546,11 @@ static void ft5x0x_resume(struct early_suspend *h) key_led_ctrl(0); printk("==ft5x0x_ts_resume=\n"); - //ft5x0x_power_en(ft5x0x, 1); - ft5x0x_chip_reset(ft5x0x); + if( ft5x0x->reset_gpio > 0 ){ + ft5x0x_chip_reset(ft5x0x); + }else{ + ft5x0x_power_en(ft5x0x, 1); + } mdelay(100); -- 2.34.1