diff mbox series

[PATCHv4,3/4] Input: EXC3000: Add reset gpio support

Message ID 20200805160520.456570-4-sebastian.reichel@collabora.com (mailing list archive)
State Accepted
Commit 27aced19e098ba00e87a09d6ba6d4518e89319c3
Headers show
Series EXC3000 Updates | expand

Commit Message

Sebastian Reichel Aug. 5, 2020, 4:05 p.m. UTC
Add basic support for an optional reset gpio.

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 .../input/touchscreen/eeti,exc3000.yaml         |  2 ++
 drivers/input/touchscreen/exc3000.c             | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

Comments

Rob Herring Aug. 6, 2020, 2:50 p.m. UTC | #1
On Wed, 05 Aug 2020 18:05:19 +0200, Sebastian Reichel wrote:
> Add basic support for an optional reset gpio.
> 
> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  .../input/touchscreen/eeti,exc3000.yaml         |  2 ++
>  drivers/input/touchscreen/exc3000.c             | 17 +++++++++++++++++
>  2 files changed, 19 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>
Dmitry Torokhov Aug. 7, 2020, 12:37 a.m. UTC | #2
On Wed, Aug 05, 2020 at 06:05:19PM +0200, Sebastian Reichel wrote:
> Add basic support for an optional reset gpio.
> 
> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Applied, thank you.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/eeti,exc3000.yaml b/Documentation/devicetree/bindings/input/touchscreen/eeti,exc3000.yaml
index 7e6e23f8fa00..007adbc89c14 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/eeti,exc3000.yaml
+++ b/Documentation/devicetree/bindings/input/touchscreen/eeti,exc3000.yaml
@@ -22,6 +22,8 @@  properties:
     const: 0x2a
   interrupts:
     maxItems: 1
+  reset-gpios:
+    maxItems: 1
   touchscreen-size-x: true
   touchscreen-size-y: true
   touchscreen-inverted-x: true
diff --git a/drivers/input/touchscreen/exc3000.c b/drivers/input/touchscreen/exc3000.c
index b497bd2ae41d..203f50acaab7 100644
--- a/drivers/input/touchscreen/exc3000.c
+++ b/drivers/input/touchscreen/exc3000.c
@@ -8,7 +8,9 @@ 
  */
 
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/device.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
 #include <linux/input/mt.h>
@@ -30,6 +32,9 @@ 
 
 #define EXC3000_TIMEOUT_MS		100
 
+#define EXC3000_RESET_MS		10
+#define EXC3000_READY_MS		100
+
 static const struct i2c_device_id exc3000_id[];
 
 struct eeti_dev_info {
@@ -63,6 +68,7 @@  struct exc3000_data {
 	const struct eeti_dev_info *info;
 	struct input_dev *input;
 	struct touchscreen_properties prop;
+	struct gpio_desc *reset;
 	struct timer_list timer;
 	u8 buf[2 * EXC3000_LEN_FRAME];
 };
@@ -204,6 +210,17 @@  static int exc3000_probe(struct i2c_client *client)
 	}
 	timer_setup(&data->timer, exc3000_timer, 0);
 
+	data->reset = devm_gpiod_get_optional(&client->dev, "reset",
+					      GPIOD_OUT_HIGH);
+	if (IS_ERR(data->reset))
+		return PTR_ERR(data->reset);
+
+	if (data->reset) {
+		msleep(EXC3000_RESET_MS);
+		gpiod_set_value_cansleep(data->reset, 0);
+		msleep(EXC3000_READY_MS);
+	}
+
 	input = devm_input_allocate_device(&client->dev);
 	if (!input)
 		return -ENOMEM;