From: Marco Mattiolo Date: Fri, 04 Dec 2026 23:13:14 +0100 Subject: [PATCH 3/5] Input: s6sy761 - Add mode-switch support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261204-crosshatch_touchscreen-v1-3-9f76ff10eab1@runbox.com> References: <20261204-crosshatch_touchscreen-v1-0-9f76ff10eab1@runbox.com> In-Reply-To: <20261204-crosshatch_touchscreen-v1-0-9f76ff10eab1@runbox.com> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andi Shyti , Bjorn Andersson , Konrad Dybcio , Abel Vesa Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, David Heidelberg , Marco Mattiolo X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1632; i=marco.mattiolo@runbox.com; h=from:subject:message-id; bh=/WrbT8U1lP9CLM/QZ5gmBYkZq6lh2vP0iPmuTUrWTBQ=; b=owEBbQKS/ZANAwAKAXOPlyqe18XHAcsmYgBrEzr/OqaXi6oU2O0AFKTXQ4TS8owxTx5+LG5r8 8pbFq7fONWJAjMEAAEKAB0WIQQa0L7o5CIZYebcNTFzj5cqntfFxwUCaxM6/wAKCRBzj5cqntfF x+k5D/4zteHnDj+w8eiH6mwa3Y8qSMSpuHqV7DGMxVVwdlmi+W3XTW3mX5m+FbkZxH13EQiex4Z BRzSopFJCi11UraQyxdWphwldMpn/aO1HjbkxeBmG4P7IAyBNqQ1+oTjz3pkqGBYBcTmH+OSsgs 5rFBiYIX6V04N5UOqlH1bVydD1ooq+lZEU3tXhisJESZ4sn8LzgqoXqgFsgR0aPGKCEEWG32jYB Oejnc/Xza+VYQ0z0xD0DWR0VFpsdrWEU+yq5UCLAN9myMH3Njz/bLeC3wEbbc8GEScef8ZLl9Vm Cp9JpJBIOY8X1KeDxF9YIVB81l1zgBKgu5FxNjQdwaLUUaVxXbLh9NE6nu9+gxYxNqeiwy7oxFn Gny1ePSkAG2JfokRIM3oi5oSXwM2eN/J0zaIIOzSeJww5QtCuzr+T5ZbkX7coENsGcDgfS15MUo E/WN/H+NyvTtfpknf5tWVG8xQaGylWTYwNpl8+KSb76oICaF6KLjJxzlQBVyZaDyfNReHKfiHJs RIe1DOzXm4lgQ47RGJSp0Tp6iGAMRpCDHB/RQCk2GN4kskLfdmvAOLnhxHwdc3Ck15/1OW+0gR/ PR3j2u4GNUE9gYeyjp52lO2d3ApgLTFBN5dnTFQsenWwCzdOwtvYb7rGIfB1aqeuhCpomCl1lvI hidu9+1kMY+vXGQ== X-Developer-Key: i=marco.mattiolo@runbox.com; a=openpgp; fpr=1AD0BEE8E4221961E6DC3531738F972A9ED7C5C7 X-Endpoint-Received: by B4 Relay for marco.mattiolo@runbox.com/default with auth_id=1746 List-Id: B4 Relay Submissions On the Pixel 3 XL the touch I2C bus can be driven either by the AP or by the SLPI sensor DSP, selected by a GPIO. Take the optional "mode-switch-gpios" line and assert it at probe, before the first I2C access, so the AP owns the bus. Handing the bus back to the SLPI for low-power touch is not supported. Suggested-by: David Heidelberg Signed-off-by: Marco Mattiolo --- 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 5972a3194a7d..7f2730e30699 100644 --- a/drivers/input/touchscreen/s6sy761.c +++ b/drivers/input/touchscreen/s6sy761.c @@ -407,6 +407,7 @@ static void s6sy761_power_off(void *data) static int s6sy761_probe(struct i2c_client *client) { struct s6sy761_data *sdata; + struct gpio_desc *gpiod; unsigned int max_x, max_y; int err; @@ -436,6 +437,16 @@ static int s6sy761_probe(struct i2c_client *client) return dev_err_probe(&client->dev, PTR_ERR(sdata->reset_gpio), "Failed to get reset GPIO\n"); + /* + * Some boards share the touch I2C bus between the AP and the SLPI + * sensor DSP; make the AP the bus master before talking to the chip. + */ + gpiod = devm_gpiod_get_optional(&client->dev, "mode-switch", + GPIOD_OUT_HIGH); + if (IS_ERR(gpiod)) + return dev_err_probe(&client->dev, PTR_ERR(gpiod), + "Failed to get mode-switch GPIO\n"); + err = devm_add_action_or_reset(&client->dev, s6sy761_power_off, sdata); if (err) return err; -- 2.53.0