From e409ca80381bdf4934f38a251161b7fe4d302e25 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Tue, 18 Jun 2019 17:16:53 +0800 Subject: [PATCH] focaltech_0flash: share gpio with LCD if defined in dts TP: For TDDI IC, TP reset is controled by LCD, LCD request reset gpio. But focaltech IC still need HW reset in TP driver. So we can control reset GPIO without request it, this GPIO is shared with LCD Change-Id: I65bbdb614ce7d9fd4f510ea4e23690072903bcf7 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1372626 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../focaltech_0flash_mmi/focaltech_core.c | 14 ++++++++++---- .../focaltech_0flash_mmi/focaltech_core.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c index 93347b31cd36..6ca19304d11d 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c @@ -1087,10 +1087,12 @@ static int fts_gpio_configure(struct fts_ts_data *data) /* request reset gpio */ if (gpio_is_valid(data->pdata->reset_gpio)) { - ret = gpio_request(data->pdata->reset_gpio, "fts_reset_gpio"); - if (ret) { - FTS_ERROR("[GPIO]reset gpio request failed"); - goto err_irq_gpio_dir; + if(!data->pdata->share_reset_gpio) { + ret = gpio_request(data->pdata->reset_gpio, "fts_reset_gpio"); + if (ret) { + FTS_ERROR("[GPIO]reset gpio request failed"); + goto err_irq_gpio_dir; + } } ret = gpio_direction_output(data->pdata->reset_gpio, 1); @@ -1208,6 +1210,10 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) if (pdata->reset_gpio < 0) FTS_ERROR("Unable to get reset_gpio"); + pdata->share_reset_gpio = of_property_read_bool(np, "focaltech,share_reset_gpio"); + if (pdata->share_reset_gpio) + FTS_INFO("TP reset pin is shared with LCD"); + pdata->irq_gpio = of_get_named_gpio_flags(np, "focaltech,irq-gpio", 0, &pdata->irq_gpio_flags); if (pdata->irq_gpio < 0) diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h index b6d3b6f34061..c110251eb569 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h @@ -118,6 +118,7 @@ struct fts_ts_platform_data { u32 irq_gpio_flags; u32 reset_gpio; u32 reset_gpio_flags; + bool share_reset_gpio; bool have_key; u32 key_number; u32 keys[FTS_MAX_KEYS];