Skip to contentSkip to conversation

Input: s6sy761 - Add optional reset GPIO support

PATCH RESEND New Marco Mattiolo 1 participant 2 messages Dec 2 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH RESEND 2/5 Input: s6sy761 - Add optional reset GPIO support

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.

---
 drivers/input/touchscreen/s6sy761.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/input/touchscreen/s6sy761.c +11 -0
index c6cc5cba577a1..5972a3194a7dc 100644
@@ -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;
Signature · 1 line
2.53.0
#2 lore raw

PATCH RESEND 4/5 arm64: dts: qcom: sdm845-google: Group touchscreen pins, add mode-switch pin

In reply to a message not in the archive

Pixel 3 and Pixel 3 XL use different touchscreen controllers on the same
pins: reset on gpio99, interrupt on gpio125, and the AP/SLPI I2C bus switch on gpio136. Move the reset and interrupt pin configuration into a single touchscreen-default-state, add the switch pin to it, and use the grouped state on blueline.

---
 .../arm64/boot/dts/qcom/sdm845-google-blueline.dts | 19 ++++++++++++-
 arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi | 31 ++++++++++++++--------
 2 files changed, 38 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-google-blueline.dts +18 -1
index a000c75494f1c..a412d2e93850a 100644
@@ -26,7 +26,24 @@ &i2c2 {
 
 	status = "okay";
 
-	/* ST,FTS @ 49 */
+	touchscreen@49 {
+		compatible = "st,stmfts5";
+		reg = <0x49>;
+
+		pinctrl-0 = <&touchscreen_default>;
+		pinctrl-names = "default";
+
+		interrupts-extended = <&tlmm 125 IRQ_TYPE_LEVEL_LOW>;
+
+		mode-switch-gpios = <&tlmm 136 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&tlmm 99 GPIO_ACTIVE_LOW>;
+
+		avdd-supply = <&vreg_l19a_3p3>;
+		vdd-supply = <&vreg_l14a_1p8>;
+
+		touchscreen-size-x = <1080>;
+		touchscreen-size-y = <2160>;
+	};
 };
 
 &mdss_dsi0 {
arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi +20 -11
index 3c9656b88b696..a706efec1b10e 100644
@@ -523,18 +523,27 @@ firmware-pins {
 
 	};
 
-	touchscreen_reset: ts-reset-state {
-		pins = "gpio99";
-		function = "gpio";
-		drive-strength = <8>;
-		bias-pull-up;
-	};
+	touchscreen_default: touchscreen-default-state {
+		reset-pins {
+			pins = "gpio99";
+			function = "gpio";
+			drive-strength = <8>;
+			bias-pull-up;
+		};
+
+		irq-pins {
+			pins = "gpio125";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+		};
 
-	touchscreen_pins: ts-pins-gpio-state {
-		pins = "gpio125";
-		function = "gpio";
-		drive-strength = <2>;
-		bias-disable;
+		switch-pins {
+			pins = "gpio136";
+			function = "gpio";
+			drive-strength = <2>;
+			bias-disable;
+		};
 	};
 };
 
Signature · 1 line
2.53.0