Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181709
b: refs/heads/master
c: 7f2199c
h: refs/heads/master
i:
  181707: 571e13e
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Feb 26, 2010
1 parent df7d4c1 commit 48a1a4d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d90a4ae4ae5a5e535782ab090507898e042db81a
refs/heads/master: 7f2199c03b4946f1b79514b3411e3dbf130a6bba
77 changes: 60 additions & 17 deletions trunk/drivers/media/common/tuners/tuner-xc2028.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,30 +917,68 @@ 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 1
/*
* The proper adjustment would be to do it at s-code table.
* However, this didn't work, as reported by
* Robert Lowery <rglowery@exemail.com.au>
*/

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

#else
/*
* Still need tests for XC3028L (firmware 3.2 or upper)
* So, for now, let's just comment the per-firmware
* version of this change. Reports with xc3028l working
* with and without the lines bellow are welcome
*/

if (priv->firm_version < 0x0302) {
if (priv->cur_fw.type & DTV7)
offset += 500000;
} else {
if (priv->cur_fw.type & DTV7)
offset -= 300000;
else if (type != ATSC) /* DVB @6MHz, DTV 8 and DTV 7/8 */
offset += 200000;
}
#endif
}

div = (freq - offset + DIV / 2) / DIV;
Expand Down Expand Up @@ -1097,17 +1135,22 @@ 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
*
* DTV7 is only used in Australia. Germany or Italy may also
* use this firmware after initialization, but a tune to a UHF
* channel should then cause DTV78 to be used.
*
* Unfortunately, on real-field tests, the s-code offset
* didn't work as expected, as reported by
* Robert Lowery <rglowery@exemail.com.au>
*/
if (type & DTV7)
demod += 500;
}

return generic_set_freq(fe, p->frequency,
Expand Down

0 comments on commit 48a1a4d

Please sign in to comment.