Commit 506cd714 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] tuner-xc2028: use DVBv5 parameters on set_params()

Instead of using DVBv3 parameters, rely on DVBv5 parameters to
set the tuner.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 53ccd1ca
...@@ -1087,26 +1087,43 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe, ...@@ -1087,26 +1087,43 @@ static int xc2028_set_analog_freq(struct dvb_frontend *fe,
static int xc2028_set_params(struct dvb_frontend *fe, static int xc2028_set_params(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p) struct dvb_frontend_parameters *p)
{ {
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
u32 delsys = c->delivery_system;
u32 bw = c->bandwidth_hz;
struct xc2028_data *priv = fe->tuner_priv; struct xc2028_data *priv = fe->tuner_priv;
unsigned int type=0; unsigned int type=0;
fe_bandwidth_t bw = BANDWIDTH_8_MHZ;
u16 demod = 0; u16 demod = 0;
tuner_dbg("%s called\n", __func__); tuner_dbg("%s called\n", __func__);
switch(fe->ops.info.type) { switch (delsys) {
case FE_OFDM: case SYS_DVBT:
bw = p->u.ofdm.bandwidth; case SYS_DVBT2:
/* /*
* The only countries with 6MHz seem to be Taiwan/Uruguay. * The only countries with 6MHz seem to be Taiwan/Uruguay.
* Both seem to require QAM firmware for OFDM decoding * Both seem to require QAM firmware for OFDM decoding
* Tested in Taiwan by Terry Wu <terrywu2009@gmail.com> * Tested in Taiwan by Terry Wu <terrywu2009@gmail.com>
*/ */
if (bw == BANDWIDTH_6_MHZ) if (bw <= 6000000)
type |= QAM; type |= QAM;
switch (priv->ctrl.type) {
case XC2028_D2633:
type |= D2633;
break;
case XC2028_D2620:
type |= D2620;
break; break;
case FE_ATSC: case XC2028_AUTO:
bw = BANDWIDTH_6_MHZ; default:
/* Zarlink seems to need D2633 */
if (priv->ctrl.demod == XC3028_FE_ZARLINK456)
type |= D2633;
else
type |= D2620;
}
break;
case SYS_ATSC:
/* The only ATSC firmware (at least on v2.7) is D2633 */ /* The only ATSC firmware (at least on v2.7) is D2633 */
type |= ATSC | D2633; type |= ATSC | D2633;
break; break;
...@@ -1115,52 +1132,24 @@ static int xc2028_set_params(struct dvb_frontend *fe, ...@@ -1115,52 +1132,24 @@ static int xc2028_set_params(struct dvb_frontend *fe,
return -EINVAL; return -EINVAL;
} }
switch (bw) { if (bw <= 6000000) {
case BANDWIDTH_8_MHZ: type |= DTV6;
if (p->frequency < 470000000)
priv->ctrl.vhfbw7 = 0; priv->ctrl.vhfbw7 = 0;
else priv->ctrl.uhfbw8 = 0;
priv->ctrl.uhfbw8 = 1; } else if (bw <= 7000000) {
type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV8; if (c->frequency < 470000000)
type |= F8MHZ;
break;
case BANDWIDTH_7_MHZ:
if (p->frequency < 470000000)
priv->ctrl.vhfbw7 = 1; priv->ctrl.vhfbw7 = 1;
else else
priv->ctrl.uhfbw8 = 0; priv->ctrl.uhfbw8 = 0;
type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV7; type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV7;
type |= F8MHZ; type |= F8MHZ;
break; } else {
case BANDWIDTH_6_MHZ: if (c->frequency < 470000000)
type |= DTV6;
priv->ctrl.vhfbw7 = 0; priv->ctrl.vhfbw7 = 0;
priv->ctrl.uhfbw8 = 0;
break;
default:
tuner_err("error: bandwidth not supported.\n");
};
/*
Selects between D2633 or D2620 firmware.
It doesn't make sense for ATSC, since it should be D2633 on all cases
*/
if (fe->ops.info.type != FE_ATSC) {
switch (priv->ctrl.type) {
case XC2028_D2633:
type |= D2633;
break;
case XC2028_D2620:
type |= D2620;
break;
case XC2028_AUTO:
default:
/* Zarlink seems to need D2633 */
if (priv->ctrl.demod == XC3028_FE_ZARLINK456)
type |= D2633;
else else
type |= D2620; priv->ctrl.uhfbw8 = 1;
} type |= (priv->ctrl.vhfbw7 && priv->ctrl.uhfbw8) ? DTV78 : DTV8;
type |= F8MHZ;
} }
/* All S-code tables need a 200kHz shift */ /* All S-code tables need a 200kHz shift */
...@@ -1185,7 +1174,7 @@ static int xc2028_set_params(struct dvb_frontend *fe, ...@@ -1185,7 +1174,7 @@ static int xc2028_set_params(struct dvb_frontend *fe,
*/ */
} }
return generic_set_freq(fe, p->frequency, return generic_set_freq(fe, c->frequency,
V4L2_TUNER_DIGITAL_TV, type, 0, demod); V4L2_TUNER_DIGITAL_TV, type, 0, demod);
} }
......
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