Linux Input/HID development
 help / color / mirror / Atom feed
From: Marco Mattiolo via B4 Relay <devnull+marco.mattiolo.runbox.com@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Andi Shyti <andi.shyti@kernel.org>,
	 Bjorn Andersson <andersson@kernel.org>,
	 Konrad Dybcio <konradybcio@kernel.org>,
	Abel Vesa <abelvesa@kernel.org>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-arm-msm@vger.kernel.org, David Heidelberg <david@ixit.cz>,
	 Marco Mattiolo <marco.mattiolo@runbox.com>
Subject: [PATCH 2/5] Input: s6sy761 - Add optional reset GPIO support
Date: Fri, 04 Dec 2026 23:13:13 +0100	[thread overview]
Message-ID: <20261204-crosshatch_touchscreen-v1-2-9f76ff10eab1@runbox.com> (raw)
In-Reply-To: <20261204-crosshatch_touchscreen-v1-0-9f76ff10eab1@runbox.com>

From: Marco Mattiolo <marco.mattiolo@runbox.com>

Add support for an optional "reset-gpios" property. If present, the
controller is held in reset from probe until its supplies are enabled,
released before the existing 140 ms boot wait, and put back into reset
before the supplies are disabled.

Suggested-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Marco Mattiolo <marco.mattiolo@runbox.com>
---
 drivers/input/touchscreen/s6sy761.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/input/touchscreen/s6sy761.c b/drivers/input/touchscreen/s6sy761.c
index c6cc5cba577a..5972a3194a7d 100644
--- a/drivers/input/touchscreen/s6sy761.c
+++ b/drivers/input/touchscreen/s6sy761.c
@@ -6,6 +6,7 @@
 
 #include <linux/unaligned.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/input/mt.h>
 #include <linux/input/touchscreen.h>
@@ -102,6 +103,7 @@ struct s6sy761_data {
 	struct i2c_client *client;
 	struct regulator_bulk_data regulators[2];
 	struct input_dev *input;
+	struct gpio_desc *reset_gpio;
 	struct touchscreen_properties prop;
 
 	u8 data[S6SY761_EVENT_SIZE * S6SY761_EVENT_COUNT];
@@ -301,6 +303,8 @@ static int s6sy761_power_on(struct s6sy761_data *sdata)
 	if (ret)
 		return ret;
 
+	/* release the optional reset line, then wait for the boot */
+	gpiod_set_value_cansleep(sdata->reset_gpio, 0);
 	msleep(140);
 
 	/* double check whether the touch is functional */
@@ -395,6 +399,7 @@ static void s6sy761_power_off(void *data)
 	if (!sdata->powered_up)
 		return;
 
+	gpiod_set_value_cansleep(sdata->reset_gpio, 1);
 	regulator_bulk_disable(ARRAY_SIZE(sdata->regulators), sdata->regulators);
 	sdata->powered_up = false;
 }
@@ -425,6 +430,12 @@ static int s6sy761_probe(struct i2c_client *client)
 	if (err)
 		return err;
 
+	sdata->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
+						    GPIOD_OUT_HIGH);
+	if (IS_ERR(sdata->reset_gpio))
+		return dev_err_probe(&client->dev, PTR_ERR(sdata->reset_gpio),
+				     "Failed to get reset GPIO\n");
+
 	err = devm_add_action_or_reset(&client->dev, s6sy761_power_off, sdata);
 	if (err)
 		return err;

-- 
2.53.0



  parent reply	other threads:[~2026-12-04 22:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 22:13 [PATCH 0/5] Introduce Samsung S6SY761 (Google Pixel 3 XL) touchscreen Marco Mattiolo via B4 Relay
2026-12-04 22:13 ` [PATCH 1/5] dt-bindings: input: touchscreen: samsung,s6sy761: Introduce reset and mode-switch GPIOs Marco Mattiolo via B4 Relay
2026-12-04 22:20   ` sashiko-bot
2026-12-04 22:13 ` Marco Mattiolo via B4 Relay [this message]
2026-12-04 22:26   ` [PATCH 2/5] Input: s6sy761 - Add optional reset GPIO support sashiko-bot
2026-12-04 22:13 ` [PATCH 3/5] Input: s6sy761 - Add mode-switch support Marco Mattiolo via B4 Relay
2026-12-04 22:25   ` sashiko-bot
2026-12-04 22:13 ` [PATCH 4/5] arm64: dts: qcom: sdm845-google: Group touchscreen pins, add mode-switch pin Marco Mattiolo via B4 Relay
2026-12-04 22:21   ` sashiko-bot
2026-12-04 22:32   ` David Heidelberg
2026-12-04 22:13 ` [PATCH 5/5] arm64: dts: qcom: sdm845-google-crosshatch: Add touchscreen support Marco Mattiolo via B4 Relay
2026-12-04 22:22   ` sashiko-bot

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=20261204-crosshatch_touchscreen-v1-2-9f76ff10eab1@runbox.com \
    --to=devnull+marco.mattiolo.runbox.com@kernel.org \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=andi.shyti@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=marco.mattiolo@runbox.com \
    --cc=robh@kernel.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox