Commit b09cf61d authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] saa7134: 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 a0a9ff7f
...@@ -186,6 +186,7 @@ static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe) ...@@ -186,6 +186,7 @@ static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe)
static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
struct dvb_frontend_parameters* params) struct dvb_frontend_parameters* params)
{ {
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
u8 off[] = { 0x00, 0xf1}; u8 off[] = { 0x00, 0xf1};
u8 on[] = { 0x00, 0x71}; u8 on[] = { 0x00, 0x71};
struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)}; struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};
...@@ -196,7 +197,7 @@ static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, ...@@ -196,7 +197,7 @@ static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
/* set frequency (mt2050) */ /* set frequency (mt2050) */
f.tuner = 0; f.tuner = 0;
f.type = V4L2_TUNER_DIGITAL_TV; f.type = V4L2_TUNER_DIGITAL_TV;
f.frequency = params->frequency / 1000 * 16 / 1000; f.frequency = c->frequency / 1000 * 16 / 1000;
if (fe->ops.i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
i2c_transfer(&dev->i2c_adap, &msg, 1); i2c_transfer(&dev->i2c_adap, &msg, 1);
...@@ -289,6 +290,7 @@ static int philips_tda1004x_request_firmware(struct dvb_frontend *fe, ...@@ -289,6 +290,7 @@ static int philips_tda1004x_request_firmware(struct dvb_frontend *fe,
static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
{ {
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct saa7134_dev *dev = fe->dvb->priv; struct saa7134_dev *dev = fe->dvb->priv;
struct tda1004x_state *state = fe->demodulator_priv; struct tda1004x_state *state = fe->demodulator_priv;
u8 addr = state->config->tuner_address; u8 addr = state->config->tuner_address;
...@@ -299,7 +301,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ ...@@ -299,7 +301,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
u8 band, cp, filter; u8 band, cp, filter;
/* determine charge pump */ /* determine charge pump */
tuner_frequency = params->frequency + 36166000; tuner_frequency = c->frequency + 36166000;
if (tuner_frequency < 87000000) if (tuner_frequency < 87000000)
return -EINVAL; return -EINVAL;
else if (tuner_frequency < 130000000) else if (tuner_frequency < 130000000)
...@@ -324,28 +326,28 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ ...@@ -324,28 +326,28 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
return -EINVAL; return -EINVAL;
/* determine band */ /* determine band */
if (params->frequency < 49000000) if (c->frequency < 49000000)
return -EINVAL; return -EINVAL;
else if (params->frequency < 161000000) else if (c->frequency < 161000000)
band = 1; band = 1;
else if (params->frequency < 444000000) else if (c->frequency < 444000000)
band = 2; band = 2;
else if (params->frequency < 861000000) else if (c->frequency < 861000000)
band = 4; band = 4;
else else
return -EINVAL; return -EINVAL;
/* setup PLL filter */ /* setup PLL filter */
switch (params->u.ofdm.bandwidth) { switch (c->bandwidth_hz) {
case BANDWIDTH_6_MHZ: case 6000000:
filter = 0; filter = 0;
break; break;
case BANDWIDTH_7_MHZ: case 7000000:
filter = 0; filter = 0;
break; break;
case BANDWIDTH_8_MHZ: case 8000000:
filter = 1; filter = 1;
break; break;
...@@ -356,7 +358,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ ...@@ -356,7 +358,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
/* calculate divisor /* calculate divisor
* ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
*/ */
tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; tuner_frequency = (((c->frequency / 1000) * 6) + 217496) / 1000;
/* setup tuner buffer */ /* setup tuner buffer */
tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
......
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