Re: [PATCH] Input: ads7846 - don't use scratch for tx_buf when clearing register

From: Marek Vasut

Date: Sat Apr 25 2026 - 20:51:45 EST


On 4/24/26 9:25 PM, Kris Bahnsen wrote:
The workaround for XPT2046 clears the command register, giving the
touchscreen controller a NOP. The change incorrectly re-uses the
req->scratch variable which is used as rx_buf for xfer[5], so by
the time xfer[6] occurs, the contents of req->scratch may not be
0. It was found that the touchscreen controller can end up in
a completely unresponsive state due to it being given a command
the driver does not expect.

Instead, rely on the spi_transfer behavior of tx_buf being NULL to
transmit all 0 bits, moving the 3 bytes to a single message.

This change was tested on real TSC2046 and ADS7843 controllers,
but not the XPT2046 the workaround was originally created for.
Confirming that the original modification to clear the command
register does not impact either real controller.

Fixes: 781a07da9bb94 ("Input: ads7846 - add dummy command register clearing cycle")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Mark Featherston <mark@xxxxxxxxxxxxxx>
Signed-off-by: Mark Featherston <mark@xxxxxxxxxxxxxx>
Signed-off-by: Kris Bahnsen <kris@xxxxxxxxxxxxxx>
Tested-by: Marek Vasut <marex@xxxxxxxxxxxx> # XPT2046