All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Robert Lowery <rglowery@exemail.com.au>
Cc: Terry Wu <terrywu2009@gmail.com>, Andy Walls <awalls@radix.net>,
	Devin Heitmueller <dheitmueller@kernellabs.com>,
	Vincent McIntyre <vincent.mcintyre@gmail.com>,
	linux-media@vger.kernel.org,
	Stefan Ringel <stefan.ringel@arcor.de>,
	Steven Toth <stoth@kernellabs.com>
Subject: Re: [RESEND] Re: DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1)   tuning  regression
Date: Fri, 19 Feb 2010 02:53:05 -0200	[thread overview]
Message-ID: <4B7E1931.3090007@redhat.com> (raw)
In-Reply-To: <1197.115.70.135.213.1262917283.squirrel@webmail.exetel.com.au>

Robert Lowery wrote:
> Mauro's new code does the 500000 offset unconditionally for DTV7 by
> setting offset = 2250000, not just when the ZARLINK456 or DIBCOM52 tables
> were explicitly selected.  This change is what appears to cause issues for
> me.

I've reviewed all information and troubles we have with xc3028 tuning,
including the reports related to newer firmwares for XC3028L. I think
that the right fix is the one provided on this patch.

Could you all please verify if this patch fixes the issues, without causing
any regression?

Cheers,
Mauro.

---

V4L/DVB: tuner-xc2028: fix tuning logic

There's one reported regression in Australia (DTV7) and some
reported troubles with newer firmwares. Rework the logic to improve
tuner on those cases.

Thanks-to: Robert Lowery <rglowery@exemail.com.au>
Thanks-to: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/common/tuners/tuner-xc2028.c |   51 ++++++++++++++++++++--------
 1 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c
index ed50168..eb782a0 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -932,30 +932,49 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
 	 * that xc2028 will be in a safe state.
 	 * Maybe this might also be needed for DTV.
 	 */
-	if (new_mode == T_ANALOG_TV)
+	if (new_mode == T_ANALOG_TV) {
 		rc = send_seq(priv, {0x00, 0x00});
 
-	/*
-	 * Digital modes require an offset to adjust to the
-	 * proper frequency.
-	 * Analog modes require offset = 0
-	 */
-	if (new_mode == T_DIGITAL_TV) {
-		/* Sets the offset according with firmware */
+		/* Analog modes require offset = 0 */
+	} else {
+		/*
+		 * Digital modes require an offset to adjust to the
+		 * proper frequency. The offset depends on what
+		 * firmware version is used.
+		 */
+
+		/*
+		 * Adjust to the center frequency. This is calculated by the
+		 * formula: offset = 1.25MHz - BW/2
+		 * For DTV 7/8, the firmware uses BW = 8000, so it needs a
+		 * further adjustment to get the frequency center on VHF
+		 */
 		if (priv->cur_fw.type & DTV6)
 			offset = 1750000;
 		else if (priv->cur_fw.type & DTV7)
 			offset = 2250000;
 		else	/* DTV8 or DTV78 */
 			offset = 2750000;
+		if ((priv->cur_fw.type & DTV78) && freq < 470000000)
+			offset -= 500000;
 
 		/*
-		 * We must adjust the offset by 500kHz  when
-		 * tuning a 7MHz VHF channel with DTV78 firmware
-		 * (used in Australia, Italy and Germany)
+		 * xc3028 additional "magic"
+		 * Depending on the firmware version, it needs some adjustments
+		 * to properly centralize the frequency. This seems to be
+		 * needed to compensate the SCODE table adjustments made by
+		 * newer firmwares
 		 */
-		if ((priv->cur_fw.type & DTV78) && freq < 470000000)
-			offset -= 500000;
+
+		if (priv->firm_version >= 0x0302) {
+			if (priv->cur_fw.type & DTV7)
+				offset -= 300000;
+			else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 */
+				offset += 200000;
+		} else {
+			if (priv->cur_fw.type & DTV7)
+				offset -= 500000;
+		}
 	}
 
 	div = (freq - offset + DIV / 2) / DIV;
@@ -1114,7 +1133,11 @@ static int xc2028_set_params(struct dvb_frontend *fe,
 
 	/* All S-code tables need a 200kHz shift */
 	if (priv->ctrl.demod) {
-		demod = priv->ctrl.demod + 200;
+		/*
+		 * Newer firmwares require a 200 kHz offset only for ATSC
+		 */
+		if (type == ATSC || priv->firm_version < 0x0302)
+			demod = priv->ctrl.demod + 200;
 		/*
 		 * The DTV7 S-code table needs a 700 kHz shift.
 		 * Thanks to Terry Wu <terrywu2009@gmail.com> for reporting this
-- 
1.6.6.1


  parent reply	other threads:[~2010-02-19  4:54 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  6:17 DViCO FusionHDTV DVB-T Dual Digital 4 (rev 1) tuning regression Robert Lowery
2009-11-26  8:27 ` Robert Lowery
2009-11-26  9:37   ` Vincent McIntyre
2009-11-26  9:57     ` Vincent McIntyre
2009-11-26 11:22     ` Robert Lowery
2009-11-26 23:35       ` Robert Lowery
2009-12-01  9:18         ` Vincent McIntyre
2009-12-01 12:40           ` Robert Lowery
2009-12-02 14:57           ` Devin Heitmueller
2009-12-08  6:02             ` [RESEND] " Robert Lowery
2009-12-08  9:03               ` Vincent McIntyre
2009-12-15 23:49               ` Robert Lowery
2010-01-04  4:27                 ` Robert Lowery
2010-01-05  2:27                   ` Andy Walls
2010-01-05  3:13                     ` Devin Heitmueller
2010-01-05  3:43                       ` Andy Walls
2010-01-05  3:18                     ` Andy Walls
2010-01-06  3:20                       ` Robert Lowery
2010-01-07  1:51                         ` Andy Walls
2010-01-07  5:03                           ` Robert Lowery
2010-01-07 13:48                             ` Terry Wu
2010-01-07 14:04                               ` Terry Wu
2010-01-07 14:18                                 ` Terry Wu
2010-01-07 14:42                                   ` Terry Wu
2010-01-08  2:21                                     ` Robert Lowery
     [not found]                                       ` <6ab2c27e1001080007h70bcf309u65251763a70200c6@mail.gmail.com>
2010-01-08  8:12                                         ` Terry Wu
2010-02-19  4:53                                       ` Mauro Carvalho Chehab [this message]
2010-02-19  6:12                                         ` Robert Lowery
2010-02-19 10:18                                         ` Robert Lowery
2010-02-19 12:23                                           ` Mauro Carvalho Chehab
2010-02-19 14:07                                           ` Mauro Carvalho Chehab
2010-02-19 14:17                                             ` Robert Lowery
2010-03-12 10:34                                             ` Vincent McIntyre
2010-03-13 23:51                                               ` Andy Walls

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=4B7E1931.3090007@redhat.com \
    --to=mchehab@redhat.com \
    --cc=awalls@radix.net \
    --cc=dheitmueller@kernellabs.com \
    --cc=linux-media@vger.kernel.org \
    --cc=rglowery@exemail.com.au \
    --cc=stefan.ringel@arcor.de \
    --cc=stoth@kernellabs.com \
    --cc=terrywu2009@gmail.com \
    --cc=vincent.mcintyre@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.