public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kris Bahnsen <kris@embeddedts.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Marek Vasut <marex@denx.de>,
	stable@vger.kernel.org, Mark Featherston <mark@embeddedts.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] Input: ads7846 - don't use scratch for tx_buf when clearing register
Date: Thu, 30 Apr 2026 09:54:53 -0700	[thread overview]
Message-ID: <271d8aeb-1159-46f3-b290-31b6e094d8a0@embeddedTS.com> (raw)
In-Reply-To: <afJZSCXeoSO502o1@google.com>

Dmitry,

On 4/29/26 12:19 PM, Dmitry Torokhov wrote:
> 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 :(

Ah. I do see that dev_err() line in spi_transfer_one_message().
All of my testing up to this point has been with an SPI host driver
that implements its own transfer_one() operation so that error
was never actually reached.

I'll send a v3 today that reverts back to the two separate xfers,
using scratch for the rx_buf, and then NULL for tx_buf. That
sounds like that should be the path of least resistance.

> 
> Thanks.
> 

-- 
Kris Bahnsen
Software Engineer
embeddedTS


      reply	other threads:[~2026-04-30 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 17:46 [PATCH v2] Input: ads7846 - don't use scratch for tx_buf when clearing register Kris Bahnsen
2026-04-29 19:19 ` Dmitry Torokhov
2026-04-30 16:54   ` Kris Bahnsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=271d8aeb-1159-46f3-b290-31b6e094d8a0@embeddedTS.com \
    --to=kris@embeddedts.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark@embeddedts.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox