Linux Tegra architecture development
 help / color / mirror / Atom feed
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 2/2] media: cec: tegra_cec: keep track of number of Rx Low Drives
Date: Wed, 15 Jul 2026 12:27:30 +0900	[thread overview]
Message-ID: <VIvQevwZQZidfkUQnq4N4Q@nvidia.com> (raw)
In-Reply-To: <3d1d723b914c3ed8389a032ebbf791146b92133c.1783677198.git.hverkuil+cisco@kernel.org>

On Friday, July 10, 2026 6:53 PM Hans Verkuil wrote:
> Keep track of Rx Low Drive conditions. Useful for detecting
> potential hardware/cable problems as it suggests unstable or
> incorrect voltage levels.
> 
> Note that the Tx Low Drive conditions are already logged in
> the CEC core.
> 
> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
> ---
>  drivers/media/cec/platform/tegra/tegra_cec.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/media/cec/platform/tegra/tegra_cec.c b/drivers/media/cec/platform/tegra/tegra_cec.c
> index f8ffaeb78118..e22a4625f192 100644
> --- a/drivers/media/cec/platform/tegra/tegra_cec.c
> +++ b/drivers/media/cec/platform/tegra/tegra_cec.c
> @@ -24,6 +24,7 @@
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
>  #include <linux/platform_device.h>
> +#include <linux/seq_file.h>
>  #include <linux/clk/tegra.h>
>  
>  #include <media/cec-notifier.h>
> @@ -47,6 +48,7 @@ struct tegra_cec {
>  	u32			tx_buf[CEC_MAX_MSG_SIZE];
>  	u8			tx_buf_cur;
>  	u8			tx_buf_cnt;
> +	u32			rx_total_low_drives;
>  };
>  
>  static inline u32 cec_read(struct tegra_cec *cec, u32 reg)
> @@ -116,6 +118,13 @@ static irqreturn_t tegra_cec_irq_handler(int irq, void *data)
>  		return IRQ_WAKE_THREAD;
>  	}
>  
> +	if (status & TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED) {
> +		dev_warn_ratelimited(dev, "RX bus error detected, generated low drive\n");
> +		cec->rx_total_low_drives++;
> +		cec_write(cec, TEGRA_CEC_INT_STAT,
> +			  TEGRA_CEC_INT_STAT_RX_BUS_ERROR_DETECTED);
> +	}
> +
>  	if ((status & TEGRA_CEC_INT_STAT_TX_ARBITRATION_FAILED) ||
>  		   (status & TEGRA_CEC_INT_STAT_TX_BUS_ANOMALY_DETECTED)) {
>  		tegra_cec_error_recovery(cec);
> @@ -241,6 +250,7 @@ static int tegra_cec_adap_enable(struct cec_adapter *adap, bool enable)
>  		  TEGRA_CEC_INT_MASK_TX_BUS_ANOMALY_DETECTED |
>  		  TEGRA_CEC_INT_MASK_TX_FRAME_TRANSMITTED |
>  		  TEGRA_CEC_INT_MASK_RX_REGISTER_FULL |
> +		  TEGRA_CEC_INT_MASK_RX_BUS_ERROR_DETECTED |
>  		  TEGRA_CEC_INT_MASK_RX_START_BIT_DETECTED);
>  
>  	/*
> @@ -318,11 +328,20 @@ static int tegra_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
>  	return 0;
>  }
>  
> +static void tegra_cec_adap_status(struct cec_adapter *adap, struct seq_file *file)
> +{
> +	struct tegra_cec *cec = adap->priv;
> +
> +	seq_printf(file, "receive low drive count: %u\n",
> +		   cec->rx_total_low_drives);
> +}
> +
>  static const struct cec_adap_ops tegra_cec_ops = {
>  	.adap_enable = tegra_cec_adap_enable,
>  	.adap_log_addr = tegra_cec_adap_log_addr,
>  	.adap_transmit = tegra_cec_adap_transmit,
>  	.adap_monitor_all_enable = tegra_cec_adap_monitor_all_enable,
> +	.adap_status = tegra_cec_adap_status,
>  };
>  
>  static int tegra_cec_probe(struct platform_device *pdev)
> -- 
> 2.53.0
> 
> 

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>



      reply	other threads:[~2026-07-15  3:27 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
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 [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=VIvQevwZQZidfkUQnq4N4Q@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