On Fri Jul 10 11:53:17 2026 +0200, 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 <[email protected]>
> Reviewed-by: Mikko Perttunen <[email protected]>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Patch committed.
Thanks,
Mauro Carvalho Chehab
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;
}
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]