Commit fda23faa authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] cxd2820r: switch to .get_if_frequency()

All tuners used with cxd2820r offers IF frequency so switch that.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 8cffcc78
...@@ -366,13 +366,6 @@ static struct isl6423_config anysee_isl6423_config = { ...@@ -366,13 +366,6 @@ static struct isl6423_config anysee_isl6423_config = {
static struct cxd2820r_config anysee_cxd2820r_config = { static struct cxd2820r_config anysee_cxd2820r_config = {
.i2c_address = 0x6d, /* (0xda >> 1) */ .i2c_address = 0x6d, /* (0xda >> 1) */
.ts_mode = 0x38, .ts_mode = 0x38,
.if_dvbt_6 = 3550,
.if_dvbt_7 = 3700,
.if_dvbt_8 = 4150,
.if_dvbt2_6 = 3250,
.if_dvbt2_7 = 4000,
.if_dvbt2_8 = 4000,
.if_dvbc = 5000,
}; };
/* /*
......
...@@ -63,19 +63,6 @@ struct cxd2820r_config { ...@@ -63,19 +63,6 @@ struct cxd2820r_config {
*/ */
bool spec_inv; 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. /* GPIOs for all used modes.
* Default: none, disabled * Default: none, disabled
* Values: <see above> * Values: <see above>
......
...@@ -28,6 +28,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe, ...@@ -28,6 +28,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i; int ret, i;
u8 buf[2]; u8 buf[2];
u32 if_freq;
u16 if_ctl; u16 if_ctl;
u64 num; u64 num;
struct reg_val_mask tab[] = { struct reg_val_mask tab[] = {
...@@ -70,7 +71,17 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe, ...@@ -70,7 +71,17 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
priv->delivery_system = SYS_DVBC_ANNEX_AC; priv->delivery_system = SYS_DVBC_ANNEX_AC;
priv->ber_running = 0; /* tune stops BER counter */ 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; num *= 0x4000;
if_ctl = cxd2820r_div_u64_round_closest(num, 41000); if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = (if_ctl >> 8) & 0x3f; buf[0] = (if_ctl >> 8) & 0x3f;
......
...@@ -27,7 +27,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe, ...@@ -27,7 +27,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
struct cxd2820r_priv *priv = fe->demodulator_priv; struct cxd2820r_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i; int ret, i;
u32 if_khz, if_ctl; u32 if_freq, if_ctl;
u64 num; u64 num;
u8 buf[3], bw_param; u8 buf[3], bw_param;
u8 bw_params1[][5] = { u8 bw_params1[][5] = {
...@@ -80,17 +80,14 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe, ...@@ -80,17 +80,14 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
switch (c->bandwidth_hz) { switch (c->bandwidth_hz) {
case 6000000: case 6000000:
if_khz = priv->cfg.if_dvbt_6;
i = 0; i = 0;
bw_param = 2; bw_param = 2;
break; break;
case 7000000: case 7000000:
if_khz = priv->cfg.if_dvbt_7;
i = 1; i = 1;
bw_param = 1; bw_param = 1;
break; break;
case 8000000: case 8000000:
if_khz = priv->cfg.if_dvbt_8;
i = 2; i = 2;
bw_param = 0; bw_param = 0;
break; break;
...@@ -98,7 +95,17 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe, ...@@ -98,7 +95,17 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
return -EINVAL; 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; num *= 0x1000000;
if_ctl = cxd2820r_div_u64_round_closest(num, 41000); if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = ((if_ctl >> 16) & 0xff); buf[0] = ((if_ctl >> 16) & 0xff);
......
...@@ -27,7 +27,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, ...@@ -27,7 +27,7 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
struct cxd2820r_priv *priv = fe->demodulator_priv; struct cxd2820r_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i; int ret, i;
u32 if_khz, if_ctl; u32 if_freq, if_ctl;
u64 num; u64 num;
u8 buf[3], bw_param; u8 buf[3], bw_param;
u8 bw_params1[][5] = { u8 bw_params1[][5] = {
...@@ -93,22 +93,18 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, ...@@ -93,22 +93,18 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
switch (c->bandwidth_hz) { switch (c->bandwidth_hz) {
case 5000000: case 5000000:
if_khz = priv->cfg.if_dvbt2_5;
i = 0; i = 0;
bw_param = 3; bw_param = 3;
break; break;
case 6000000: case 6000000:
if_khz = priv->cfg.if_dvbt2_6;
i = 1; i = 1;
bw_param = 2; bw_param = 2;
break; break;
case 7000000: case 7000000:
if_khz = priv->cfg.if_dvbt2_7;
i = 2; i = 2;
bw_param = 1; bw_param = 1;
break; break;
case 8000000: case 8000000:
if_khz = priv->cfg.if_dvbt2_8;
i = 3; i = 3;
bw_param = 0; bw_param = 0;
break; break;
...@@ -116,7 +112,17 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe, ...@@ -116,7 +112,17 @@ int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
return -EINVAL; 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; num *= 0x1000000;
if_ctl = cxd2820r_div_u64_round_closest(num, 41000); if_ctl = cxd2820r_div_u64_round_closest(num, 41000);
buf[0] = ((if_ctl >> 16) & 0xff); buf[0] = ((if_ctl >> 16) & 0xff);
......
...@@ -500,13 +500,6 @@ static struct tda10023_config em28xx_tda10023_config = { ...@@ -500,13 +500,6 @@ static struct tda10023_config em28xx_tda10023_config = {
static struct cxd2820r_config em28xx_cxd2820r_config = { static struct cxd2820r_config em28xx_cxd2820r_config = {
.i2c_address = (0xd8 >> 1), .i2c_address = (0xd8 >> 1),
.ts_mode = CXD2820R_TS_SERIAL, .ts_mode = CXD2820R_TS_SERIAL,
.if_dvbt_6 = 3300,
.if_dvbt_7 = 3500,
.if_dvbt_8 = 4000,
.if_dvbt2_6 = 3300,
.if_dvbt2_7 = 3500,
.if_dvbt2_8 = 4000,
.if_dvbc = 5000,
/* enable LNA for DVB-T2 and DVB-C */ /* enable LNA for DVB-T2 and DVB-C */
.gpio_dvbt2[0] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | CXD2820R_GPIO_L, .gpio_dvbt2[0] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | CXD2820R_GPIO_L,
......
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