From: Jiada Wang <jiada_wang@mentor.com> To: <nick@shmanahar.org>, <dmitry.torokhov@gmail.com> Cc: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <jiada_wang@mentor.com>, <george_davis@mentor.com> Subject: [PATCH v2 34/49] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Tue, 27 Aug 2019 15:30:00 +0900 [thread overview] Message-ID: <20190827063015.20794-5-jiada_wang@mentor.com> (raw) In-Reply-To: <20190827063015.20794-1-jiada_wang@mentor.com> From: "George G. Davis" <george_davis@mentor.com> N.B. Modifying the atmel_mxt_ts GPIO reset line during operation will cause problems with normal driver operation. This feature is provided as a diagnostic debug aid. It does not take into consideration any pending operations which may be in progress. Modifying the atmel_mxt_ts GPIO reset line at any time will inevitably cause the driver to fail. Signed-off-by: George G. Davis <george_davis@mentor.com> Signed-off-by: Rajeev Kumar <rajeev_kumar@mentor.com> Signed-off-by: Jiada Wang <jiada_wang@mentor.com> --- drivers/input/touchscreen/atmel_mxt_ts.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 560d46634bae..35f41bfa70d5 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4083,6 +4083,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + if (data->reset_gpio) { + error = gpiod_export(data->reset_gpio, 0); + if (error) + return error; + + error = gpiod_export_link(&client->dev, "reset", + data->reset_gpio); + if (error) { + gpiod_unexport(data->reset_gpio); + return error; + } + } + if (data->suspend_mode == MXT_SUSPEND_REGULATOR) { error = mxt_acquire_irq(data); if (error) @@ -4115,6 +4128,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) err_free_object: mxt_free_input_device(data); mxt_free_object_table(data); + if (data->reset_gpio) { + sysfs_remove_link(&client->dev.kobj, "reset"); + gpiod_unexport(data->reset_gpio); + } return error; } @@ -4124,6 +4141,10 @@ static int mxt_remove(struct i2c_client *client) disable_irq(data->irq); sysfs_remove_group(&client->dev.kobj, &mxt_fw_attr_group); + if (data->reset_gpio) { + sysfs_remove_link(&client->dev.kobj, "reset"); + gpiod_unexport(data->reset_gpio); + } mxt_debug_msg_remove(data); mxt_sysfs_remove(data); mxt_free_input_device(data); -- 2.19.2
WARNING: multiple messages have this Message-ID (diff)
From: Jiada Wang <jiada_wang@mentor.com> To: nick@shmanahar.org, dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, jiada_wang@mentor.com, george_davis@mentor.com Subject: [PATCH v2 34/49] input: atmel_mxt_ts: export GPIO reset line via sysfs Date: Tue, 27 Aug 2019 15:30:00 +0900 [thread overview] Message-ID: <20190827063015.20794-5-jiada_wang@mentor.com> (raw) In-Reply-To: <20190827063015.20794-1-jiada_wang@mentor.com> From: "George G. Davis" <george_davis@mentor.com> N.B. Modifying the atmel_mxt_ts GPIO reset line during operation will cause problems with normal driver operation. This feature is provided as a diagnostic debug aid. It does not take into consideration any pending operations which may be in progress. Modifying the atmel_mxt_ts GPIO reset line at any time will inevitably cause the driver to fail. Signed-off-by: George G. Davis <george_davis@mentor.com> Signed-off-by: Rajeev Kumar <rajeev_kumar@mentor.com> Signed-off-by: Jiada Wang <jiada_wang@mentor.com> --- drivers/input/touchscreen/atmel_mxt_ts.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 560d46634bae..35f41bfa70d5 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -4083,6 +4083,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + if (data->reset_gpio) { + error = gpiod_export(data->reset_gpio, 0); + if (error) + return error; + + error = gpiod_export_link(&client->dev, "reset", + data->reset_gpio); + if (error) { + gpiod_unexport(data->reset_gpio); + return error; + } + } + if (data->suspend_mode == MXT_SUSPEND_REGULATOR) { error = mxt_acquire_irq(data); if (error) @@ -4115,6 +4128,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) err_free_object: mxt_free_input_device(data); mxt_free_object_table(data); + if (data->reset_gpio) { + sysfs_remove_link(&client->dev.kobj, "reset"); + gpiod_unexport(data->reset_gpio); + } return error; } @@ -4124,6 +4141,10 @@ static int mxt_remove(struct i2c_client *client) disable_irq(data->irq); sysfs_remove_group(&client->dev.kobj, &mxt_fw_attr_group); + if (data->reset_gpio) { + sysfs_remove_link(&client->dev.kobj, "reset"); + gpiod_unexport(data->reset_gpio); + } mxt_debug_msg_remove(data); mxt_sysfs_remove(data); mxt_free_input_device(data); -- 2.19.2
next prev parent reply other threads:[~2019-08-27 6:30 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-27 6:29 [PATCH v2 30/49] Input: atmel_mxt_ts - implement improved debug message interface Jiada Wang 2019-08-27 6:29 ` Jiada Wang 2019-08-27 6:29 ` [PATCH v2 31/49] Input: atmel_mxt_ts - eliminate data->raw_info_block Jiada Wang 2019-08-27 6:29 ` Jiada Wang 2019-08-27 6:29 ` [PATCH v2 32/49] Input: atmel_mxt_ts - Change call-points of mxt_free_* functions Jiada Wang 2019-08-27 6:29 ` Jiada Wang 2019-08-27 6:29 ` [PATCH v2 33/49] Input: atmel_mxt_ts - rely on calculated_crc rather than file config_crc Jiada Wang 2019-08-27 6:29 ` Jiada Wang 2019-08-27 6:30 ` Jiada Wang [this message] 2019-08-27 6:30 ` [PATCH v2 34/49] input: atmel_mxt_ts: export GPIO reset line via sysfs Jiada Wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190827063015.20794-5-jiada_wang@mentor.com \ --to=jiada_wang@mentor.com \ --cc=dmitry.torokhov@gmail.com \ --cc=george_davis@mentor.com \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=nick@shmanahar.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.