* [PATCH 1/2] Input: sx8654 - use the SX8650 soft-reset register
2026-11-23 18:41 [PATCH 0/2] Input: sx8654 - fix SX8650 reset and status handling Fil Dunsky via B4 Relay
@ 2026-11-23 18:41 ` Fil Dunsky via B4 Relay
2026-11-23 18:41 ` [PATCH 2/2] Input: sx8654 - check SX8650 status read errors Fil Dunsky via B4 Relay
2026-11-24 4:39 ` [PATCH 0/2] Input: sx8654 - fix SX8650 reset and status handling Dmitry Torokhov
2 siblings, 0 replies; 4+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-23 18:41 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, stable
From: Fil Dunsky <filipp.dunsky@gmail.com>
The SX8650 register map uses five address bits and places soft reset at
0x1f. Sending the SX8654 address 0x3f also changes the command bits, so
it does not reset an SX8650.
Select the soft-reset register from the chip data, retaining 0x3f for
the SX8654/SX8655/SX8656 variants. Hardware reset through NRST is
unchanged.
On Almond+, programming CTRL2 to 5 and writing 0xde to 0x3f leaves CTRL2
at 5. Writing 0xde to 0x1f restores its reset value of 0. Both I2C
writes acknowledge, so checking only the write return value misses the
failure.
Fixes: 43df039c6d92 ("Input: sx8654 - add sx8650 support")
Cc: stable@vger.kernel.org
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
drivers/input/touchscreen/sx8654.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index 23fb0c683..13dd80a8e 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -42,6 +42,7 @@
#define I2C_REG_IRQMASK 0x22
#define I2C_REG_IRQSRC 0x23
#define I2C_REG_SOFTRESET 0x3f
+#define I2C_REG_SX8650_SOFTRESET 0x1f
#define I2C_REG_SX8650_STAT 0x05
#define SX8650_STAT_CONVIRQ BIT(7)
@@ -86,6 +87,7 @@
#define CH_Y 0x01
struct sx865x_data {
+ u8 reg_softreset;
u8 cmd_manual;
u8 chan_mask;
bool has_irq_penrelease;
@@ -244,7 +246,8 @@ static int sx8654_reset(struct sx8654 *ts)
gpiod_set_value_cansleep(ts->gpio_reset, 0);
} else {
dev_dbg(&ts->client->dev, "NRST unavailable, try softreset\n");
- err = i2c_smbus_write_byte_data(ts->client, I2C_REG_SOFTRESET,
+ err = i2c_smbus_write_byte_data(ts->client,
+ ts->data->reg_softreset,
SOFTRESET_VALUE);
if (err)
return err;
@@ -413,6 +416,7 @@ static int sx8654_probe(struct i2c_client *client)
}
static const struct sx865x_data sx8650_data = {
+ .reg_softreset = I2C_REG_SX8650_SOFTRESET,
.cmd_manual = 0xb0,
.has_irq_penrelease = false,
.has_reg_irqmask = false,
@@ -421,6 +425,7 @@ static const struct sx865x_data sx8650_data = {
};
static const struct sx865x_data sx8654_data = {
+ .reg_softreset = I2C_REG_SOFTRESET,
.cmd_manual = 0xc0,
.has_irq_penrelease = true,
.has_reg_irqmask = true,
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] Input: sx8654 - check SX8650 status read errors
2026-11-23 18:41 [PATCH 0/2] Input: sx8654 - fix SX8650 reset and status handling Fil Dunsky via B4 Relay
2026-11-23 18:41 ` [PATCH 1/2] Input: sx8654 - use the SX8650 soft-reset register Fil Dunsky via B4 Relay
@ 2026-11-23 18:41 ` Fil Dunsky via B4 Relay
2026-11-24 4:39 ` [PATCH 0/2] Input: sx8654 - fix SX8650 reset and status handling Dmitry Torokhov
2 siblings, 0 replies; 4+ messages in thread
From: Fil Dunsky via B4 Relay @ 2026-11-23 18:41 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, stable
From: Fil Dunsky <filipp.dunsky@gmail.com>
Keep the signed return value of i2c_smbus_read_byte_data and reject
errors before testing CONVIRQ. Truncating an errno to u8 can set the
conversion-pending bit; for example, -EIO becomes 0xfb and causes a
channel read and potentially a touch report after the failed status
read.
Fixes: 43df039c6d92 ("Input: sx8654 - add sx8650 support")
Cc: stable@vger.kernel.org
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
drivers/input/touchscreen/sx8654.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index 13dd80a8e..1ae00cc2a 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -130,8 +130,7 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
{
struct sx8654 *ts = handle;
struct device *dev = &ts->client->dev;
- int len, i;
- u8 stat;
+ int len, i, stat;
u16 x, y;
u16 ch;
u16 chdata;
@@ -142,6 +141,9 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
stat = i2c_smbus_read_byte_data(ts->client, CMD_READ_REGISTER
| I2C_REG_SX8650_STAT);
+ if (stat < 0)
+ return IRQ_HANDLED;
+
if (!(stat & SX8650_STAT_CONVIRQ)) {
dev_dbg(dev, "%s ignore stat [0x%02x]", __func__, stat);
return IRQ_HANDLED;
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread