summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2011-11-13 14:41:25 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-24 17:54:04 -0200
commitfda23faaff3b28a987c22da5f3a17b9f3d4acef8 (patch)
treee4dd0371287b0aef94fbd33249181603b11595b5 /drivers/media/dvb/frontends
parent8cffcc78996c25a04423e294faa1bb5bba3e420e (diff)
[media] cxd2820r: switch to .get_if_frequency()
All tuners used with cxd2820r offers IF frequency so switch that. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/cxd2820r.h13
-rw-r--r--drivers/media/dvb/frontends/cxd2820r_c.c13
-rw-r--r--drivers/media/dvb/frontends/cxd2820r_t.c17
-rw-r--r--drivers/media/dvb/frontends/cxd2820r_t2.c18
4 files changed, 36 insertions, 25 deletions
diff --git a/drivers/media/dvb/frontends/cxd2820r.h b/drivers/media/dvb/frontends/cxd2820r.h
index 03cab7b547f..cf0f546aa1d 100644
--- a/drivers/media/dvb/frontends/cxd2820r.h
+++ b/drivers/media/dvb/frontends/cxd2820r.h
@@ -63,19 +63,6 @@ struct cxd2820r_config {
*/
bool spec_inv;
- /* IFs for all used modes.
- * Default: none, must set
- * Values: <kHz>
- */
- u16 if_dvbt_6;
- u16 if_dvbt_7;
- u16 if_dvbt_8;
- u16 if_dvbt2_5;
- u16 if_dvbt2_6;
- u16 if_dvbt2_7;
- u16 if_dvbt2_8;
- u16 if_dvbc;
-
/* GPIOs for all used modes.
* Default: none, disabled
* Values: <see above>
diff --git a/drivers/media/dvb/frontends/cxd2820r_c.c b/drivers/media/dvb/frontends/cxd2820r_c.c
index b85f5011e34..c4128773f2e 100644
--- a/drivers/media/dvb/frontends/cxd2820r_c.c
+++ b/drivers/media/dvb/frontends/cxd2820r_c.c
@@ -28,6 +28,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i;
u8 buf[2];
+ u32 if_freq;
u16 if_ctl;
u64 num;
struct reg_val_mask tab[] = {
@@ -70,7 +71,17 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
priv->delivery_system = SYS_DVBC_ANNEX_AC;
priv->ber_running = 0; /* tune stops BER counter */
- num = priv->cfg.if_dvbc;
+ /* program IF frequency */
+ if (fe->ops.tuner_ops.get_if_frequency) {
+ ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq);
+ if (ret)
+ goto error;
+ } else
+ if_freq = 0;
+
+ dbg("%s: if_freq=%d", __func__, if_freq);
+
+ num = if_freq / 1000; /* Hz => kHz */
num *= 0x4000;
if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = (if_ctl >> 8) & 0x3f;
diff --git a/drivers/media/dvb/frontends/cxd2820r_t.c b/drivers/media/dvb/frontends/cxd2820r_t.c
index a04f9c81010..86e17e65ddf 100644
--- a/drivers/media/dvb/frontends/cxd2820r_t.c
+++ b/drivers/media/dvb/frontends/cxd2820r_t.c
@@ -27,7 +27,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
struct cxd2820r_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i;
- u32 if_khz, if_ctl;
+ u32 if_freq, if_ctl;
u64 num;
u8 buf[3], bw_param;
u8 bw_params1[][5] = {
@@ -80,17 +80,14 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
switch (c->bandwidth_hz) {
case 6000000:
- if_khz = priv->cfg.if_dvbt_6;
i = 0;
bw_param = 2;
break;
case 7000000:
- if_khz = priv->cfg.if_dvbt_7;
i = 1;
bw_param = 1;
break;
case 8000000:
- if_khz = priv->cfg.if_dvbt_8;
i = 2;
bw_param = 0;
break;
@@ -98,7 +95,17 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
return -EINVAL;
}
- num = if_khz;
+ /* program IF frequency */
+ if (fe->ops.tuner_ops.get_if_frequency) {
+ ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq);
+ if (ret)
+ goto error;
+ } else
+ if_freq = 0;
+
+ dbg("%s: if_freq=%d", __func__, if_freq);
+
+ num = if_freq / 1000; /* Hz => kHz */
num *= 0x1000000;
if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = ((if_ctl >> 16) & 0xff);
diff --git a/drivers/media/dvb/frontends/cxd2820r_t2.c b/drivers/media/dvb/frontends/cxd2820r_t2.c
index 6548588309f..8635b075f62 100644
--- a/drivers/media/dvb/frontends/cxd2820r_t2.c
+++ b/drivers/media/dvb/frontends/cxd2820r_t2.c
@@ -27,7 +27,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
struct cxd2820r_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i;
- u32 if_khz, if_ctl;
+ u32 if_freq, if_ctl;
u64 num;
u8 buf[3], bw_param;
u8 bw_params1[][5] = {
@@ -93,22 +93,18 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
switch (c->bandwidth_hz) {
case 5000000:
- if_khz = priv->cfg.if_dvbt2_5;
i = 0;
bw_param = 3;
break;
case 6000000:
- if_khz = priv->cfg.if_dvbt2_6;
i = 1;
bw_param = 2;
break;
case 7000000:
- if_khz = priv->cfg.if_dvbt2_7;
i = 2;
bw_param = 1;
break;
case 8000000:
- if_khz = priv->cfg.if_dvbt2_8;
i = 3;
bw_param = 0;
break;
@@ -116,7 +112,17 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
return -EINVAL;
}
- num = if_khz;
+ /* program IF frequency */
+ if (fe->ops.tuner_ops.get_if_frequency) {
+ ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_freq);
+ if (ret)
+ goto error;
+ } else
+ if_freq = 0;
+
+ dbg("%s: if_freq=%d", __func__, if_freq);
+
+ num = if_freq / 1000; /* Hz => kHz */
num *= 0x1000000;
if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = ((if_ctl >> 16) & 0xff);