From: Mikko Perttunen <mperttunen@nvidia.com>
To: linux-media@vger.kernel.org, Hans Verkuil <hverkuil+cisco@kernel.org>
Cc: Thierry Reding <thierry.reding@kernel.org>,
linux-tegra@vger.kernel.org,
Hans Verkuil <hverkuil+cisco@kernel.org>
Subject: Re: [PATCH 1/2] media: cec: tegra_cec: don't break off msg on NACK
Date: Wed, 15 Jul 2026 12:23:33 +0900 [thread overview]
Message-ID: <WqURKHqjRKyXoPKn5biymA@nvidia.com> (raw)
In-Reply-To: <7e50d6027e1676650d52905cd20eb212c01cd3e5.1783677198.git.hverkuil+cisco@kernel.org>
On Friday, July 10, 2026 6:53 PM Hans Verkuil wrote:
> The Tegra CEC hardware has a bug where, if the first attempt
> to transmit a message is NACKed so the transmit is aborted,
> then the second attempt can contain corrupt data.
>
> Ensure that the full message is always transmitted to avoid hitting
> this bug.
>
> I suspect some internal state is not reset in the case of aborting
> a message due to a NACK.
>
> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
> ---
> drivers/media/cec/platform/tegra/tegra_cec.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/cec/platform/tegra/tegra_cec.c b/drivers/media/cec/platform/tegra/tegra_cec.c
> index fe66336e734f..f8ffaeb78118 100644
> --- a/drivers/media/cec/platform/tegra/tegra_cec.c
> +++ b/drivers/media/cec/platform/tegra/tegra_cec.c
> @@ -243,7 +243,18 @@ static int tegra_cec_adap_enable(struct cec_adapter *adap, bool enable)
> TEGRA_CEC_INT_MASK_RX_REGISTER_FULL |
> TEGRA_CEC_INT_MASK_RX_START_BIT_DETECTED);
>
> - cec_write(cec, TEGRA_CEC_HW_CONTROL, TEGRA_CEC_HWCTRL_TX_RX_MODE);
> + /*
> + * TX_NAK_MODE ensures that the whole message is transmitted even
> + * if each byte is NACKed. Without this flag the retransmit of the
> + * messages after a NACK can be corrupt. This is a bug in the hardware.
> + *
> + * While less efficient, in practice you rarely transmit messages
> + * that can be NACKed, with the exception of POLL messages which
> + * are just one byte anyway.
> + */
> + cec_write(cec, TEGRA_CEC_HW_CONTROL,
> + TEGRA_CEC_HWCTRL_TX_RX_MODE |
> + TEGRA_CEC_HWCTRL_TX_NAK_MODE);
> return 0;
> }
>
> --
> 2.53.0
>
>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
next prev parent reply other threads:[~2026-07-15 3:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 9:53 [PATCH 0/2] media: tegra_cec: a fix and an enhancement Hans Verkuil
2026-07-10 9:53 ` [PATCH 1/2] media: cec: tegra_cec: don't break off msg on NACK Hans Verkuil
2026-07-15 3:23 ` Mikko Perttunen [this message]
2026-07-10 9:53 ` [PATCH 2/2] media: cec: tegra_cec: keep track of number of Rx Low Drives Hans Verkuil
2026-07-15 3:27 ` Mikko Perttunen
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=WqURKHqjRKyXoPKn5biymA@nvidia.com \
--to=mperttunen@nvidia.com \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@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