Commit dcc9a129 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] sp8870: 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 6bfc3667
...@@ -168,13 +168,13 @@ static int sp8870_read_data_valid_signal(struct sp8870_state* state) ...@@ -168,13 +168,13 @@ static int sp8870_read_data_valid_signal(struct sp8870_state* state)
return (sp8870_readreg(state, 0x0D02) > 0); return (sp8870_readreg(state, 0x0D02) > 0);
} }
static int configure_reg0xc05 (struct dvb_frontend_parameters *p, u16 *reg0xc05) static int configure_reg0xc05 (struct dtv_frontend_properties *p, u16 *reg0xc05)
{ {
int known_parameters = 1; int known_parameters = 1;
*reg0xc05 = 0x000; *reg0xc05 = 0x000;
switch (p->u.ofdm.constellation) { switch (p->modulation) {
case QPSK: case QPSK:
break; break;
case QAM_16: case QAM_16:
...@@ -190,7 +190,7 @@ static int configure_reg0xc05 (struct dvb_frontend_parameters *p, u16 *reg0xc05) ...@@ -190,7 +190,7 @@ static int configure_reg0xc05 (struct dvb_frontend_parameters *p, u16 *reg0xc05)
return -EINVAL; return -EINVAL;
}; };
switch (p->u.ofdm.hierarchy_information) { switch (p->hierarchy) {
case HIERARCHY_NONE: case HIERARCHY_NONE:
break; break;
case HIERARCHY_1: case HIERARCHY_1:
...@@ -209,7 +209,7 @@ static int configure_reg0xc05 (struct dvb_frontend_parameters *p, u16 *reg0xc05) ...@@ -209,7 +209,7 @@ static int configure_reg0xc05 (struct dvb_frontend_parameters *p, u16 *reg0xc05)
return -EINVAL; return -EINVAL;
}; };
switch (p->u.ofdm.code_rate_HP) { switch (p->code_rate_HP) {
case FEC_1_2: case FEC_1_2:
break; break;
case FEC_2_3: case FEC_2_3:
...@@ -245,9 +245,9 @@ static int sp8870_wake_up(struct sp8870_state* state) ...@@ -245,9 +245,9 @@ static int sp8870_wake_up(struct sp8870_state* state)
return sp8870_writereg(state, 0xC18, 0x00D); return sp8870_writereg(state, 0xC18, 0x00D);
} }
static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, static int sp8870_set_frontend_parameters(struct dvb_frontend *fe)
struct dvb_frontend_parameters *p)
{ {
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct sp8870_state* state = fe->demodulator_priv; struct sp8870_state* state = fe->demodulator_priv;
int err; int err;
u16 reg0xc05; u16 reg0xc05;
...@@ -277,15 +277,15 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, ...@@ -277,15 +277,15 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe,
sp8870_writereg(state, 0x030A, 0x0000); sp8870_writereg(state, 0x030A, 0x0000);
// filter for 6/7/8 Mhz channel // filter for 6/7/8 Mhz channel
if (p->u.ofdm.bandwidth == BANDWIDTH_6_MHZ) if (p->bandwidth_hz == 6000000)
sp8870_writereg(state, 0x0311, 0x0002); sp8870_writereg(state, 0x0311, 0x0002);
else if (p->u.ofdm.bandwidth == BANDWIDTH_7_MHZ) else if (p->bandwidth_hz == 7000000)
sp8870_writereg(state, 0x0311, 0x0001); sp8870_writereg(state, 0x0311, 0x0001);
else else
sp8870_writereg(state, 0x0311, 0x0000); sp8870_writereg(state, 0x0311, 0x0000);
// scan order: 2k first = 0x0000, 8k first = 0x0001 // scan order: 2k first = 0x0000, 8k first = 0x0001
if (p->u.ofdm.transmission_mode == TRANSMISSION_MODE_2K) if (p->transmission_mode == TRANSMISSION_MODE_2K)
sp8870_writereg(state, 0x0338, 0x0000); sp8870_writereg(state, 0x0338, 0x0000);
else else
sp8870_writereg(state, 0x0338, 0x0001); sp8870_writereg(state, 0x0338, 0x0001);
...@@ -459,8 +459,9 @@ static int lockups; ...@@ -459,8 +459,9 @@ static int lockups;
/* only for debugging: counter for channel switches */ /* only for debugging: counter for channel switches */
static int switches; static int switches;
static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) static int sp8870_set_frontend(struct dvb_frontend *fe)
{ {
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct sp8870_state* state = fe->demodulator_priv; struct sp8870_state* state = fe->demodulator_priv;
/* /*
...@@ -479,7 +480,8 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par ...@@ -479,7 +480,8 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par
for (trials = 1; trials <= MAXTRIALS; trials++) { for (trials = 1; trials <= MAXTRIALS; trials++) {
if ((err = sp8870_set_frontend_parameters(fe, p))) err = sp8870_set_frontend_parameters(fe);
if (err)
return err; return err;
for (check_count = 0; check_count < MAXCHECKS; check_count++) { for (check_count = 0; check_count < MAXCHECKS; check_count++) {
...@@ -579,7 +581,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, ...@@ -579,7 +581,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config,
} }
static struct dvb_frontend_ops sp8870_ops = { static struct dvb_frontend_ops sp8870_ops = {
.delsys = { SYS_DVBT },
.info = { .info = {
.name = "Spase SP8870 DVB-T", .name = "Spase SP8870 DVB-T",
.type = FE_OFDM, .type = FE_OFDM,
...@@ -600,7 +602,7 @@ static struct dvb_frontend_ops sp8870_ops = { ...@@ -600,7 +602,7 @@ static struct dvb_frontend_ops sp8870_ops = {
.sleep = sp8870_sleep, .sleep = sp8870_sleep,
.i2c_gate_ctrl = sp8870_i2c_gate_ctrl, .i2c_gate_ctrl = sp8870_i2c_gate_ctrl,
.set_frontend_legacy = sp8870_set_frontend, .set_frontend = sp8870_set_frontend,
.get_tune_settings = sp8870_get_tune_settings, .get_tune_settings = sp8870_get_tune_settings,
.read_status = sp8870_read_status, .read_status = sp8870_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