* [PATCH 0/2] Input: sx8654 - fix SX8650 reset and status handling
@ 2026-11-23 18:41 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
` (2 more replies)
0 siblings, 3 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
Fix two independent issues introduced with SX8650 support. Its soft-reset
register is 0x1f, unlike the other supported variants. Also retain the
signed SMBus status return so an I2C error cannot be interpreted as a
conversion interrupt.
On Almond+, writing the old reset address acknowledged but left CTRL2
unchanged; using 0x1f restored the documented reset value. An isolated
harness using the actual driver helpers exercised 39167 cases under
ASan/UBSan, including negative status reads and both reset paths. ARM
built-in and module compilation passed on Linux v7.4-rc4.
These fixes are independent of the Cortina platform series. Local
OpenWrt conversion-rate and recovery policy changes are not included.
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
Fil Dunsky (2):
Input: sx8654 - use the SX8650 soft-reset register
Input: sx8654 - check SX8650 status read errors
drivers/input/touchscreen/sx8654.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-sx8650-fixes-d4995bbfdd79
Best regards,
--
Fil Dunsky <filipp.dunsky@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [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
* Re: [PATCH 0/2] Input: sx8654 - fix SX8650 reset and status handling
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 ` [PATCH 2/2] Input: sx8654 - check SX8650 status read errors Fil Dunsky via B4 Relay
@ 2026-11-24 4:39 ` Dmitry Torokhov
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2026-11-24 4:39 UTC (permalink / raw)
To: filipp.dunsky; +Cc: linux-input, stable
On Mon, Nov 23, 2026 at 09:41:44PM +0300, Fil Dunsky via B4 Relay wrote:
> Fix two independent issues introduced with SX8650 support. Its soft-reset
> register is 0x1f, unlike the other supported variants. Also retain the
> signed SMBus status return so an I2C error cannot be interpreted as a
> conversion interrupt.
>
> On Almond+, writing the old reset address acknowledged but left CTRL2
> unchanged; using 0x1f restored the documented reset value. An isolated
> harness using the actual driver helpers exercised 39167 cases under
> ASan/UBSan, including negative status reads and both reset paths. ARM
> built-in and module compilation passed on Linux v7.4-rc4.
>
> These fixes are independent of the Cortina platform series. Local
> OpenWrt conversion-rate and recovery policy changes are not included.
>
> Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
> ---
> Fil Dunsky (2):
> Input: sx8654 - use the SX8650 soft-reset register
> Input: sx8654 - check SX8650 status read errors
Applied the lot, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-24 4:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox