From a79f36ec04f9b33c90db025ef8d2da77c0d5d896 Mon Sep 17 00:00:00 2001 From: Weixin Zhou Date: Sun, 7 Feb 2021 17:30:10 +0800 Subject: [PATCH] input: touchscreen: ft5436: fix vdd can not be closed Signed-off-by: Weixin Zhou Change-Id: I69fb237e2bd23ce6061172a0df68e7c54efe647b --- .../focaltech_touch_ft5436/focaltech_core.c | 12 +++++++----- .../focaltech_touch_ft5436/focaltech_core.h | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.c b/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.c index d3ea520257e5..932b2f866274 100644 --- a/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.c @@ -1010,10 +1010,12 @@ static int fts_power_source_init(struct fts_ts_data *ts_data) fts_pinctrl_select_normal(ts_data); #endif - ts_data->power_disabled = true; - ret = fts_power_source_ctrl(ts_data, ENABLE); - if (ret) { - FTS_ERROR("fail to enable power(regulator)"); + if (!regulator_is_enabled(ts_data->vdd)) { + ts_data->power_disabled = true; + ret = fts_power_source_ctrl(ts_data, ENABLE); + if (ret) { + FTS_ERROR("fail to enable power(regulator)"); + } } FTS_FUNC_EXIT(); @@ -1228,7 +1230,7 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) 0, &pdata->irq_gpio_flags); if (pdata->pwr_gpio < 0) FTS_ERROR("Unable to get pwr_gpio"); - + else gpio_direction_output(pdata->pwr_gpio, 1); ret = of_property_read_u32(np, "focaltech,max-touch-number", &temp_val); diff --git a/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.h b/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.h index 5f2ce2571265..f613eca2fbee 100644 --- a/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_touch_ft5436/focaltech_core.h @@ -114,11 +114,11 @@ struct ftxxxx_proc { }; struct fts_ts_platform_data { - u32 irq_gpio; + int irq_gpio; u32 irq_gpio_flags; - u32 reset_gpio; + int reset_gpio; u32 reset_gpio_flags; - u32 pwr_gpio; + int pwr_gpio; u32 pwr_gpio_flags; bool have_key; u32 key_number;