Linux Media Controller development
 help / color / mirror / Atom feed
From: Ext745 <stealth3m@yahoo.com>
To: linux-media@vger.kernel.org
Cc: isely@pobox.com, mkrufky@linuxtv.org, mchehab@kernel.org,
	hverkuil@kernel.org, Ext745 <stealth3m@yahoo.com>
Subject: [PATCH v2 3/4] media: tda8290: report FM signal strength on the TDA8295
Date: Thu, 22 Oct 2026 19:25:47 -0400	[thread overview]
Message-ID: <20261022232548.526232-4-stealth3m@yahoo.com> (raw)
In-Reply-To: <20261022232548.526232-1-stealth3m@yahoo.com>

In FM radio mode the TDA8295's picture carrier PLL is off, so the H-PLL
lock bit that tda8295_has_signal() reads is never set and radio always
reports 0 % signal. In radio mode use the tuner IF AGC level instead
(0x28, T_IF_AGC_STAT): 0xff is maximum gain (no signal), strong local
stations read around 0x90.

Tested on an HVR-1950 in a dense urban FM band (stations 400 kHz
apart): 30 to 84 % on local stations, 0 to 26 % where the band is empty
(87.9-88.9 MHz); TV unchanged.  The AGC acts on the whole IF passband,
so between closely spaced stations the meter stays near their level
(73 to 86 % across 100-104 MHz): it shows that a signal is there, not
that this exact channel holds a station.  Seek in such a band can't rely
on the level alone.

Assisted-by: Claude Opus 5.5
Signed-off-by: Ext745 <stealth3m@yahoo.com>
---
v2:
- return -EREMOTEIO if the IF AGC read fails

 drivers/media/tuners/tda8290.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/media/tuners/tda8290.c b/drivers/media/tuners/tda8290.c
index 9ff0aa8cb..7441a5872 100644
--- a/drivers/media/tuners/tda8290.c
+++ b/drivers/media/tuners/tda8290.c
@@ -384,8 +384,23 @@ static int tda8295_has_signal(struct dvb_frontend *fe, u16 *signal)
 	struct tda8290_priv *priv = fe->analog_demod_priv;
 
 	unsigned char hvpll_stat = 0x26;
+	unsigned char t_if_agc_stat = 0x28;
 	unsigned char ret;
 
+	if (priv->tda8290_easy_mode == 0x80) {
+		/*
+		 * FM radio: the picture carrier PLL is off, so the H-PLL
+		 * lock bit is never set.  Use the tuner IF AGC level
+		 * instead: 0xff is maximum gain (no signal), strong local
+		 * stations read around 0x90.
+		 */
+		if (tuner_i2c_xfer_send_recv(&priv->i2c_props,
+					     &t_if_agc_stat, 1, &ret, 1) != 1)
+			return -EREMOTEIO;
+		*signal = min(0xff - ret, 0x80) * 65535 / 0x80;
+		return 0;
+	}
+
 	tuner_i2c_xfer_send_recv(&priv->i2c_props, &hvpll_stat, 1, &ret, 1);
 	*signal = (ret & 0x01) ? 65535 : 0;
 	return 0;
-- 
2.53.0


  parent reply	other threads:[~2026-10-22 23:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261022232548.526232-1-stealth3m.ref@yahoo.com>
2026-10-22 23:25 ` [PATCH v2 0/4] media: FM radio for the Hauppauge WinTV-HVR-1950 Ext745
2026-10-22 23:25   ` [PATCH v2 1/4] media: cx25840: demodulate FM radio from a 5.5 MHz sound IF Ext745
2026-10-22 23:25   ` [PATCH v2 2/4] media: cx25840: FM stereo with an optional HVR-1950 audio firmware Ext745
2026-10-22 23:25   ` Ext745 [this message]
2026-10-22 23:25   ` [PATCH v2 4/4] media: pvrusb2: enable FM radio on the HVR-1950 Ext745

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=20261022232548.526232-4-stealth3m@yahoo.com \
    --to=stealth3m@yahoo.com \
    --cc=hverkuil@kernel.org \
    --cc=isely@pobox.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mkrufky@linuxtv.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