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

From: Dmitry Torokhov

Date: Wed Apr 29 2026 - 15:20:02 EST


On Mon, Apr 27, 2026 at 05:46:57PM +0000, 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. Also set rx_buf to NULL because the value
> returned does not matter. Thus moving the 3 byte pattern to clear
> the command register to a single message.

Unfortunately my suggestion was flawed: I think this will flood the logs
with "Bufferless transfer has length %3". We need to have either tx or
rx buffer :(

Thanks.

--
Dmitry