Commit 19289a24 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] cx22702: 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 fd607212
...@@ -146,7 +146,7 @@ static int cx22702_set_inversion(struct cx22702_state *state, int inversion) ...@@ -146,7 +146,7 @@ static int cx22702_set_inversion(struct cx22702_state *state, int inversion)
/* Retrieve the demod settings */ /* Retrieve the demod settings */
static int cx22702_get_tps(struct cx22702_state *state, static int cx22702_get_tps(struct cx22702_state *state,
struct dvb_ofdm_parameters *p) struct dtv_frontend_properties *p)
{ {
u8 val; u8 val;
...@@ -157,27 +157,27 @@ static int cx22702_get_tps(struct cx22702_state *state, ...@@ -157,27 +157,27 @@ static int cx22702_get_tps(struct cx22702_state *state,
val = cx22702_readreg(state, 0x01); val = cx22702_readreg(state, 0x01);
switch ((val & 0x18) >> 3) { switch ((val & 0x18) >> 3) {
case 0: case 0:
p->constellation = QPSK; p->modulation = QPSK;
break; break;
case 1: case 1:
p->constellation = QAM_16; p->modulation = QAM_16;
break; break;
case 2: case 2:
p->constellation = QAM_64; p->modulation = QAM_64;
break; break;
} }
switch (val & 0x07) { switch (val & 0x07) {
case 0: case 0:
p->hierarchy_information = HIERARCHY_NONE; p->hierarchy = HIERARCHY_NONE;
break; break;
case 1: case 1:
p->hierarchy_information = HIERARCHY_1; p->hierarchy = HIERARCHY_1;
break; break;
case 2: case 2:
p->hierarchy_information = HIERARCHY_2; p->hierarchy = HIERARCHY_2;
break; break;
case 3: case 3:
p->hierarchy_information = HIERARCHY_4; p->hierarchy = HIERARCHY_4;
break; break;
} }
...@@ -260,9 +260,9 @@ static int cx22702_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) ...@@ -260,9 +260,9 @@ static int cx22702_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
} }
/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ /* Talk to the demod, set the FEC, GUARD, QAM settings etc */
static int cx22702_set_tps(struct dvb_frontend *fe, static int cx22702_set_tps(struct dvb_frontend *fe)
struct dvb_frontend_parameters *p)
{ {
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
u8 val; u8 val;
struct cx22702_state *state = fe->demodulator_priv; struct cx22702_state *state = fe->demodulator_priv;
...@@ -277,14 +277,14 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -277,14 +277,14 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
/* set bandwidth */ /* set bandwidth */
val = cx22702_readreg(state, 0x0C) & 0xcf; val = cx22702_readreg(state, 0x0C) & 0xcf;
switch (p->u.ofdm.bandwidth) { switch (p->bandwidth_hz) {
case BANDWIDTH_6_MHZ: case 6000000:
val |= 0x20; val |= 0x20;
break; break;
case BANDWIDTH_7_MHZ: case 7000000:
val |= 0x10; val |= 0x10;
break; break;
case BANDWIDTH_8_MHZ: case 8000000:
break; break;
default: default:
dprintk("%s: invalid bandwidth\n", __func__); dprintk("%s: invalid bandwidth\n", __func__);
...@@ -292,15 +292,15 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -292,15 +292,15 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
} }
cx22702_writereg(state, 0x0C, val); cx22702_writereg(state, 0x0C, val);
p->u.ofdm.code_rate_LP = FEC_AUTO; /* temp hack as manual not working */ p->code_rate_LP = FEC_AUTO; /* temp hack as manual not working */
/* use auto configuration? */ /* use auto configuration? */
if ((p->u.ofdm.hierarchy_information == HIERARCHY_AUTO) || if ((p->hierarchy == HIERARCHY_AUTO) ||
(p->u.ofdm.constellation == QAM_AUTO) || (p->modulation == QAM_AUTO) ||
(p->u.ofdm.code_rate_HP == FEC_AUTO) || (p->code_rate_HP == FEC_AUTO) ||
(p->u.ofdm.code_rate_LP == FEC_AUTO) || (p->code_rate_LP == FEC_AUTO) ||
(p->u.ofdm.guard_interval == GUARD_INTERVAL_AUTO) || (p->guard_interval == GUARD_INTERVAL_AUTO) ||
(p->u.ofdm.transmission_mode == TRANSMISSION_MODE_AUTO)) { (p->transmission_mode == TRANSMISSION_MODE_AUTO)) {
/* TPS Source - use hardware driven values */ /* TPS Source - use hardware driven values */
cx22702_writereg(state, 0x06, 0x10); cx22702_writereg(state, 0x06, 0x10);
...@@ -316,7 +316,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -316,7 +316,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
} }
/* manually programmed values */ /* manually programmed values */
switch (p->u.ofdm.constellation) { /* mask 0x18 */ switch (p->modulation) { /* mask 0x18 */
case QPSK: case QPSK:
val = 0x00; val = 0x00;
break; break;
...@@ -327,10 +327,10 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -327,10 +327,10 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
val = 0x10; val = 0x10;
break; break;
default: default:
dprintk("%s: invalid constellation\n", __func__); dprintk("%s: invalid modulation\n", __func__);
return -EINVAL; return -EINVAL;
} }
switch (p->u.ofdm.hierarchy_information) { /* mask 0x07 */ switch (p->hierarchy) { /* mask 0x07 */
case HIERARCHY_NONE: case HIERARCHY_NONE:
break; break;
case HIERARCHY_1: case HIERARCHY_1:
...@@ -348,7 +348,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -348,7 +348,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
} }
cx22702_writereg(state, 0x06, val); cx22702_writereg(state, 0x06, val);
switch (p->u.ofdm.code_rate_HP) { /* mask 0x38 */ switch (p->code_rate_HP) { /* mask 0x38 */
case FEC_NONE: case FEC_NONE:
case FEC_1_2: case FEC_1_2:
val = 0x00; val = 0x00;
...@@ -369,7 +369,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -369,7 +369,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
dprintk("%s: invalid code_rate_HP\n", __func__); dprintk("%s: invalid code_rate_HP\n", __func__);
return -EINVAL; return -EINVAL;
} }
switch (p->u.ofdm.code_rate_LP) { /* mask 0x07 */ switch (p->code_rate_LP) { /* mask 0x07 */
case FEC_NONE: case FEC_NONE:
case FEC_1_2: case FEC_1_2:
break; break;
...@@ -391,7 +391,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -391,7 +391,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
} }
cx22702_writereg(state, 0x07, val); cx22702_writereg(state, 0x07, val);
switch (p->u.ofdm.guard_interval) { /* mask 0x0c */ switch (p->guard_interval) { /* mask 0x0c */
case GUARD_INTERVAL_1_32: case GUARD_INTERVAL_1_32:
val = 0x00; val = 0x00;
break; break;
...@@ -408,7 +408,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe, ...@@ -408,7 +408,7 @@ static int cx22702_set_tps(struct dvb_frontend *fe,
dprintk("%s: invalid guard_interval\n", __func__); dprintk("%s: invalid guard_interval\n", __func__);
return -EINVAL; return -EINVAL;
} }
switch (p->u.ofdm.transmission_mode) { /* mask 0x03 */ switch (p->transmission_mode) { /* mask 0x03 */
case TRANSMISSION_MODE_2K: case TRANSMISSION_MODE_2K:
break; break;
case TRANSMISSION_MODE_8K: case TRANSMISSION_MODE_8K:
...@@ -547,14 +547,14 @@ static int cx22702_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) ...@@ -547,14 +547,14 @@ static int cx22702_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
} }
static int cx22702_get_frontend(struct dvb_frontend *fe, static int cx22702_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p) struct dtv_frontend_properties *c)
{ {
struct cx22702_state *state = fe->demodulator_priv; struct cx22702_state *state = fe->demodulator_priv;
u8 reg0C = cx22702_readreg(state, 0x0C); u8 reg0C = cx22702_readreg(state, 0x0C);
p->inversion = reg0C & 0x1 ? INVERSION_ON : INVERSION_OFF; c->inversion = reg0C & 0x1 ? INVERSION_ON : INVERSION_OFF;
return cx22702_get_tps(state, &p->u.ofdm); return cx22702_get_tps(state, c);
} }
static int cx22702_get_tune_settings(struct dvb_frontend *fe, static int cx22702_get_tune_settings(struct dvb_frontend *fe,
...@@ -603,7 +603,7 @@ struct dvb_frontend *cx22702_attach(const struct cx22702_config *config, ...@@ -603,7 +603,7 @@ struct dvb_frontend *cx22702_attach(const struct cx22702_config *config,
EXPORT_SYMBOL(cx22702_attach); EXPORT_SYMBOL(cx22702_attach);
static const struct dvb_frontend_ops cx22702_ops = { static const struct dvb_frontend_ops cx22702_ops = {
.delsys = { SYS_DVBT },
.info = { .info = {
.name = "Conexant CX22702 DVB-T", .name = "Conexant CX22702 DVB-T",
.type = FE_OFDM, .type = FE_OFDM,
...@@ -622,8 +622,8 @@ static const struct dvb_frontend_ops cx22702_ops = { ...@@ -622,8 +622,8 @@ static const struct dvb_frontend_ops cx22702_ops = {
.init = cx22702_init, .init = cx22702_init,
.i2c_gate_ctrl = cx22702_i2c_gate_ctrl, .i2c_gate_ctrl = cx22702_i2c_gate_ctrl,
.set_frontend_legacy = cx22702_set_tps, .set_frontend = cx22702_set_tps,
.get_frontend_legacy = cx22702_get_frontend, .get_frontend = cx22702_get_frontend,
.get_tune_settings = cx22702_get_tune_settings, .get_tune_settings = cx22702_get_tune_settings,
.read_status = cx22702_read_status, .read_status = cx22702_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