[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200212084218.32344-34-jiada_wang@mentor.com>
Date: Wed, 12 Feb 2020 00:42:03 -0800
From: Jiada Wang <jiada_wang@...tor.com>
To: <jikos@...nel.org>, <benjamin.tissoires@...hat.com>,
<rydberg@...math.org>, <dmitry.torokhov@...il.com>,
<nick@...anahar.org>, <bsz@...ihalf.com>
CC: <linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<erosca@...adit-jv.com>, <Andrew_Gabbasov@...tor.com>,
<jiada_wang@...tor.com>
Subject: [PATCH v7 33/48] input: atmel_mxt_ts: export GPIO reset line via sysfs
From: "George G. Davis" <george_davis@...tor.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@...tor.com>
Signed-off-by: Rajeev Kumar <rajeev_kumar@...tor.com>
Signed-off-by: Jiada Wang <jiada_wang@...tor.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 3c15ce499e34..b4ec565ee7dd 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -4082,6 +4082,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)
@@ -4114,6 +4127,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;
}
@@ -4123,6 +4140,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.17.1
Powered by blists - more mailing lists