diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-21 06:39:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-31 05:27:39 -0500 |
commit | 53ccd1ca69c14e29ce927c4992e5b5ceae379d64 (patch) | |
tree | 3e1f59e27d0b2d61a56a7134f9d8a05b7e1efd3e /drivers/media/common | |
parent | 5ca1c94deafa6bdd68a9a7e65e4b3fbb39cfcfa5 (diff) |
[media] tda827x: use DVBv5 parameters on set_params()
Instead of using DVBv3 parameters, rely on DVBv5 parameters to
set the tuner.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/tda827x.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index e0d5b43772b8..7316308d9388 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c | |||
@@ -155,9 +155,11 @@ static int tuner_transfer(struct dvb_frontend *fe, | |||
155 | static int tda827xo_set_params(struct dvb_frontend *fe, | 155 | static int tda827xo_set_params(struct dvb_frontend *fe, |
156 | struct dvb_frontend_parameters *params) | 156 | struct dvb_frontend_parameters *params) |
157 | { | 157 | { |
158 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
158 | struct tda827x_priv *priv = fe->tuner_priv; | 159 | struct tda827x_priv *priv = fe->tuner_priv; |
159 | u8 buf[14]; | 160 | u8 buf[14]; |
160 | int rc; | 161 | int rc; |
162 | u32 band; | ||
161 | 163 | ||
162 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | 164 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, |
163 | .buf = buf, .len = sizeof(buf) }; | 165 | .buf = buf, .len = sizeof(buf) }; |
@@ -165,18 +167,20 @@ static int tda827xo_set_params(struct dvb_frontend *fe, | |||
165 | u32 N; | 167 | u32 N; |
166 | 168 | ||
167 | dprintk("%s:\n", __func__); | 169 | dprintk("%s:\n", __func__); |
168 | switch (params->u.ofdm.bandwidth) { | 170 | if (c->bandwidth_hz == 0) { |
169 | case BANDWIDTH_6_MHZ: | 171 | if_freq = 5000000; |
172 | band = BANDWIDTH_8_MHZ; | ||
173 | } else if (c->bandwidth_hz <= 6000000) { | ||
170 | if_freq = 4000000; | 174 | if_freq = 4000000; |
171 | break; | 175 | band = BANDWIDTH_6_MHZ; |
172 | case BANDWIDTH_7_MHZ: | 176 | } else if (c->bandwidth_hz <= 7000000) { |
173 | if_freq = 4500000; | 177 | if_freq = 4500000; |
174 | break; | 178 | band = BANDWIDTH_7_MHZ; |
175 | default: /* 8 MHz or Auto */ | 179 | } else { /* 8 MHz */ |
176 | if_freq = 5000000; | 180 | if_freq = 5000000; |
177 | break; | 181 | band = BANDWIDTH_8_MHZ; |
178 | } | 182 | } |
179 | tuner_freq = params->frequency; | 183 | tuner_freq = c->frequency; |
180 | 184 | ||
181 | i = 0; | 185 | i = 0; |
182 | while (tda827x_table[i].lomax < tuner_freq) { | 186 | while (tda827x_table[i].lomax < tuner_freq) { |
@@ -220,8 +224,8 @@ static int tda827xo_set_params(struct dvb_frontend *fe, | |||
220 | if (rc < 0) | 224 | if (rc < 0) |
221 | goto err; | 225 | goto err; |
222 | 226 | ||
223 | priv->frequency = params->frequency; | 227 | priv->frequency = c->frequency; |
224 | priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; | 228 | priv->bandwidth = band; |
225 | 229 | ||
226 | return 0; | 230 | return 0; |
227 | 231 | ||
@@ -516,9 +520,11 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, | |||
516 | static int tda827xa_set_params(struct dvb_frontend *fe, | 520 | static int tda827xa_set_params(struct dvb_frontend *fe, |
517 | struct dvb_frontend_parameters *params) | 521 | struct dvb_frontend_parameters *params) |
518 | { | 522 | { |
523 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | ||
519 | struct tda827x_priv *priv = fe->tuner_priv; | 524 | struct tda827x_priv *priv = fe->tuner_priv; |
520 | struct tda827xa_data *frequency_map = tda827xa_dvbt; | 525 | struct tda827xa_data *frequency_map = tda827xa_dvbt; |
521 | u8 buf[11]; | 526 | u8 buf[11]; |
527 | u32 band; | ||
522 | 528 | ||
523 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, | 529 | struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, |
524 | .buf = buf, .len = sizeof(buf) }; | 530 | .buf = buf, .len = sizeof(buf) }; |
@@ -531,18 +537,20 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
531 | tda827xa_lna_gain(fe, 1, NULL); | 537 | tda827xa_lna_gain(fe, 1, NULL); |
532 | msleep(20); | 538 | msleep(20); |
533 | 539 | ||
534 | switch (params->u.ofdm.bandwidth) { | 540 | if (c->bandwidth_hz == 0) { |
535 | case BANDWIDTH_6_MHZ: | 541 | if_freq = 5000000; |
542 | band = BANDWIDTH_8_MHZ; | ||
543 | } else if (c->bandwidth_hz <= 6000000) { | ||
536 | if_freq = 4000000; | 544 | if_freq = 4000000; |
537 | break; | 545 | band = BANDWIDTH_6_MHZ; |
538 | case BANDWIDTH_7_MHZ: | 546 | } else if (c->bandwidth_hz <= 7000000) { |
539 | if_freq = 4500000; | 547 | if_freq = 4500000; |
540 | break; | 548 | band = BANDWIDTH_7_MHZ; |
541 | default: /* 8 MHz or Auto */ | 549 | } else { /* 8 MHz */ |
542 | if_freq = 5000000; | 550 | if_freq = 5000000; |
543 | break; | 551 | band = BANDWIDTH_8_MHZ; |
544 | } | 552 | } |
545 | tuner_freq = params->frequency; | 553 | tuner_freq = c->frequency; |
546 | 554 | ||
547 | if (fe->ops.info.type == FE_QAM) { | 555 | if (fe->ops.info.type == FE_QAM) { |
548 | dprintk("%s select tda827xa_dvbc\n", __func__); | 556 | dprintk("%s select tda827xa_dvbc\n", __func__); |
@@ -645,9 +653,8 @@ static int tda827xa_set_params(struct dvb_frontend *fe, | |||
645 | if (rc < 0) | 653 | if (rc < 0) |
646 | goto err; | 654 | goto err; |
647 | 655 | ||
648 | priv->frequency = params->frequency; | 656 | priv->frequency = c->frequency; |
649 | priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; | 657 | priv->bandwidth = band; |
650 | |||
651 | 658 | ||
652 | return 0; | 659 | return 0; |
653 | 660 | ||