Commit 827b5f3e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] mt312: convert set_fontend to use DVBv5 parameters

Instead of using dvb_frontend_parameters struct, that were
designed for a subset of the supported standards, use the DVBv5
cache information.

Also, fill the supported delivery systems at dvb_frontend_ops
struct.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 16e3d131
...@@ -531,9 +531,9 @@ static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc) ...@@ -531,9 +531,9 @@ static int mt312_read_ucblocks(struct dvb_frontend *fe, u32 *ubc)
return 0; return 0;
} }
static int mt312_set_frontend(struct dvb_frontend *fe, static int mt312_set_frontend(struct dvb_frontend *fe)
struct dvb_frontend_parameters *p)
{ {
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct mt312_state *state = fe->demodulator_priv; struct mt312_state *state = fe->demodulator_priv;
int ret; int ret;
u8 buf[5], config_val; u8 buf[5], config_val;
...@@ -553,16 +553,16 @@ static int mt312_set_frontend(struct dvb_frontend *fe, ...@@ -553,16 +553,16 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
|| (p->inversion > INVERSION_ON)) || (p->inversion > INVERSION_ON))
return -EINVAL; return -EINVAL;
if ((p->u.qpsk.symbol_rate < fe->ops.info.symbol_rate_min) if ((p->symbol_rate < fe->ops.info.symbol_rate_min)
|| (p->u.qpsk.symbol_rate > fe->ops.info.symbol_rate_max)) || (p->symbol_rate > fe->ops.info.symbol_rate_max))
return -EINVAL; return -EINVAL;
if ((p->u.qpsk.fec_inner < FEC_NONE) if ((p->fec_inner < FEC_NONE)
|| (p->u.qpsk.fec_inner > FEC_AUTO)) || (p->fec_inner > FEC_AUTO))
return -EINVAL; return -EINVAL;
if ((p->u.qpsk.fec_inner == FEC_4_5) if ((p->fec_inner == FEC_4_5)
|| (p->u.qpsk.fec_inner == FEC_8_9)) || (p->fec_inner == FEC_8_9))
return -EINVAL; return -EINVAL;
switch (state->id) { switch (state->id) {
...@@ -574,7 +574,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe, ...@@ -574,7 +574,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
ret = mt312_readreg(state, CONFIG, &config_val); ret = mt312_readreg(state, CONFIG, &config_val);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (p->u.qpsk.symbol_rate >= 30000000) { if (p->symbol_rate >= 30000000) {
/* Note that 30MS/s should use 90MHz */ /* Note that 30MS/s should use 90MHz */
if (state->freq_mult == 6) { if (state->freq_mult == 6) {
/* We are running 60MHz */ /* We are running 60MHz */
...@@ -609,19 +609,19 @@ static int mt312_set_frontend(struct dvb_frontend *fe, ...@@ -609,19 +609,19 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
} }
/* sr = (u16)(sr * 256.0 / 1000000.0) */ /* sr = (u16)(sr * 256.0 / 1000000.0) */
sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625); sr = mt312_div(p->symbol_rate * 4, 15625);
/* SYM_RATE */ /* SYM_RATE */
buf[0] = (sr >> 8) & 0x3f; buf[0] = (sr >> 8) & 0x3f;
buf[1] = (sr >> 0) & 0xff; buf[1] = (sr >> 0) & 0xff;
/* VIT_MODE */ /* VIT_MODE */
buf[2] = inv_tab[p->inversion] | fec_tab[p->u.qpsk.fec_inner]; buf[2] = inv_tab[p->inversion] | fec_tab[p->fec_inner];
/* QPSK_CTRL */ /* QPSK_CTRL */
buf[3] = 0x40; /* swap I and Q before QPSK demodulation */ buf[3] = 0x40; /* swap I and Q before QPSK demodulation */
if (p->u.qpsk.symbol_rate < 10000000) if (p->symbol_rate < 10000000)
buf[3] |= 0x04; /* use afc mode */ buf[3] |= 0x04; /* use afc mode */
/* GO */ /* GO */
...@@ -637,7 +637,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe, ...@@ -637,7 +637,7 @@ static int mt312_set_frontend(struct dvb_frontend *fe,
} }
static int mt312_get_frontend(struct dvb_frontend *fe, static int mt312_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p) struct dtv_frontend_properties *p)
{ {
struct mt312_state *state = fe->demodulator_priv; struct mt312_state *state = fe->demodulator_priv;
int ret; int ret;
...@@ -646,11 +646,11 @@ static int mt312_get_frontend(struct dvb_frontend *fe, ...@@ -646,11 +646,11 @@ static int mt312_get_frontend(struct dvb_frontend *fe,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = mt312_get_symbol_rate(state, &p->u.qpsk.symbol_rate); ret = mt312_get_symbol_rate(state, &p->symbol_rate);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = mt312_get_code_rate(state, &p->u.qpsk.fec_inner); ret = mt312_get_code_rate(state, &p->fec_inner);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -738,7 +738,7 @@ static void mt312_release(struct dvb_frontend *fe) ...@@ -738,7 +738,7 @@ static void mt312_release(struct dvb_frontend *fe)
#define MT312_SYS_CLK 90000000UL /* 90 MHz */ #define MT312_SYS_CLK 90000000UL /* 90 MHz */
static struct dvb_frontend_ops mt312_ops = { static struct dvb_frontend_ops mt312_ops = {
.delsys = { SYS_DVBS },
.info = { .info = {
.name = "Zarlink ???? DVB-S", .name = "Zarlink ???? DVB-S",
.type = FE_QPSK, .type = FE_QPSK,
...@@ -761,8 +761,8 @@ static struct dvb_frontend_ops mt312_ops = { ...@@ -761,8 +761,8 @@ static struct dvb_frontend_ops mt312_ops = {
.sleep = mt312_sleep, .sleep = mt312_sleep,
.i2c_gate_ctrl = mt312_i2c_gate_ctrl, .i2c_gate_ctrl = mt312_i2c_gate_ctrl,
.set_frontend_legacy = mt312_set_frontend, .set_frontend = mt312_set_frontend,
.get_frontend_legacy = mt312_get_frontend, .get_frontend = mt312_get_frontend,
.get_tune_settings = mt312_get_tune_settings, .get_tune_settings = mt312_get_tune_settings,
.read_status = mt312_read_status, .read_status = mt312_read_status,
......
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