Commit 98ab8550 authored by Gianluca Gennari's avatar Gianluca Gennari Committed by Mauro Carvalho Chehab

[media] xc3028: fix center frequency calculation for DTV78 firmware

This patch replaces the previous one proposed in the thread "xc3028:
force reload of DTV7 firmware in VHF band with Zarlink demodulator",
at the linux-media@vger.kernel.org ML.

The problem is that the firmware DTV78 works fine in UHF band (8 MHz
bandwidth) but is not working at all in VHF band (7 MHz bandwidth).
Reading the comments inside the code, I figured out that the real
problem could be connected to the formula used to calculate the center
frequency offset in VHF band.

In fact, removing this adjustment fixes the problem:

		if ((priv->cur_fw.type & DTV78) && freq < 470000000)
			offset -= 500000;

This is coherent to what was implemented for the DTV7 firmware by an
Australian user:

		if (priv->cur_fw.type & DTV7)
			offset += 500000;

In the end, now the center frequency is the same for all firmwares
(DTV7, DTV8, DTV78) and doesn't depend on channel bandwidth.

The final code looks clean and simple, and there is no need for any
"magic" adjustment:

		if (priv->cur_fw.type & DTV6)
			offset = 1750000;
		else	/* DTV7 or DTV8 or DTV78 */
			offset = 2750000;
Signed-off-by: default avatarGianluca Gennari <gennarone@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0abffb94
...@@ -962,14 +962,24 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, ...@@ -962,14 +962,24 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
* For DTV 7/8, the firmware uses BW = 8000, so it needs a * For DTV 7/8, the firmware uses BW = 8000, so it needs a
* further adjustment to get the frequency center on VHF * further adjustment to get the frequency center on VHF
*/ */
/*
* The firmware DTV78 used to work fine in UHF band (8 MHz
* bandwidth) but not at all in VHF band (7 MHz bandwidth).
* The real problem was connected to the formula used to
* calculate the center frequency offset in VHF band.
* In fact, removing the 500KHz adjustment fixed the problem.
* This is coherent to what was implemented for the DTV7
* firmware.
* In the end, now the center frequency is the same for all 3
* firmwares (DTV7, DTV8, DTV78) and doesn't depend on channel
* bandwidth.
*/
if (priv->cur_fw.type & DTV6) if (priv->cur_fw.type & DTV6)
offset = 1750000; offset = 1750000;
else if (priv->cur_fw.type & DTV7) else /* DTV7 or DTV8 or DTV78 */
offset = 2250000;
else /* DTV8 or DTV78 */
offset = 2750000; offset = 2750000;
if ((priv->cur_fw.type & DTV78) && freq < 470000000)
offset -= 500000;
/* /*
* xc3028 additional "magic" * xc3028 additional "magic"
...@@ -979,17 +989,13 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, ...@@ -979,17 +989,13 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
* newer firmwares * newer firmwares
*/ */
#if 1
/* /*
* The proper adjustment would be to do it at s-code table. * The proper adjustment would be to do it at s-code table.
* However, this didn't work, as reported by * However, this didn't work, as reported by
* Robert Lowery <rglowery@exemail.com.au> * Robert Lowery <rglowery@exemail.com.au>
*/ */
if (priv->cur_fw.type & DTV7) #if 0
offset += 500000;
#else
/* /*
* Still need tests for XC3028L (firmware 3.2 or upper) * Still need tests for XC3028L (firmware 3.2 or upper)
* So, for now, let's just comment the per-firmware * So, for now, let's just comment the per-firmware
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment