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

[media] or51132: 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 81931e94
...@@ -306,9 +306,9 @@ static int modulation_fw_class(fe_modulation_t modulation) ...@@ -306,9 +306,9 @@ static int modulation_fw_class(fe_modulation_t modulation)
} }
} }
static int or51132_set_parameters(struct dvb_frontend* fe, static int or51132_set_parameters(struct dvb_frontend *fe)
struct dvb_frontend_parameters *param)
{ {
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
int ret; int ret;
struct or51132_state* state = fe->demodulator_priv; struct or51132_state* state = fe->demodulator_priv;
const struct firmware *fw; const struct firmware *fw;
...@@ -317,8 +317,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe, ...@@ -317,8 +317,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
/* Upload new firmware only if we need a different one */ /* Upload new firmware only if we need a different one */
if (modulation_fw_class(state->current_modulation) != if (modulation_fw_class(state->current_modulation) !=
modulation_fw_class(param->u.vsb.modulation)) { modulation_fw_class(p->modulation)) {
switch(modulation_fw_class(param->u.vsb.modulation)) { switch (modulation_fw_class(p->modulation)) {
case MOD_FWCLASS_VSB: case MOD_FWCLASS_VSB:
dprintk("set_parameters VSB MODE\n"); dprintk("set_parameters VSB MODE\n");
fwname = OR51132_VSB_FIRMWARE; fwname = OR51132_VSB_FIRMWARE;
...@@ -335,7 +335,7 @@ static int or51132_set_parameters(struct dvb_frontend* fe, ...@@ -335,7 +335,7 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
break; break;
default: default:
printk("or51132: Modulation type(%d) UNSUPPORTED\n", printk("or51132: Modulation type(%d) UNSUPPORTED\n",
param->u.vsb.modulation); p->modulation);
return -1; return -1;
} }
printk("or51132: Waiting for firmware upload(%s)...\n", printk("or51132: Waiting for firmware upload(%s)...\n",
...@@ -357,8 +357,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe, ...@@ -357,8 +357,8 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
state->config->set_ts_params(fe, clock_mode); state->config->set_ts_params(fe, clock_mode);
} }
/* Change only if we are actually changing the modulation */ /* Change only if we are actually changing the modulation */
if (state->current_modulation != param->u.vsb.modulation) { if (state->current_modulation != p->modulation) {
state->current_modulation = param->u.vsb.modulation; state->current_modulation = p->modulation;
or51132_setmode(fe); or51132_setmode(fe);
} }
...@@ -371,12 +371,12 @@ static int or51132_set_parameters(struct dvb_frontend* fe, ...@@ -371,12 +371,12 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
or51132_setmode(fe); or51132_setmode(fe);
/* Update current frequency */ /* Update current frequency */
state->current_frequency = param->frequency; state->current_frequency = p->frequency;
return 0; return 0;
} }
static int or51132_get_parameters(struct dvb_frontend* fe, static int or51132_get_parameters(struct dvb_frontend* fe,
struct dvb_frontend_parameters *param) struct dtv_frontend_properties *p)
{ {
struct or51132_state* state = fe->demodulator_priv; struct or51132_state* state = fe->demodulator_priv;
int status; int status;
...@@ -389,21 +389,28 @@ static int or51132_get_parameters(struct dvb_frontend* fe, ...@@ -389,21 +389,28 @@ static int or51132_get_parameters(struct dvb_frontend* fe,
return -EREMOTEIO; return -EREMOTEIO;
} }
switch(status&0xff) { switch(status&0xff) {
case 0x06: param->u.vsb.modulation = VSB_8; break; case 0x06:
case 0x43: param->u.vsb.modulation = QAM_64; break; p->modulation = VSB_8;
case 0x45: param->u.vsb.modulation = QAM_256; break; break;
default: case 0x43:
if (retry--) goto start; p->modulation = QAM_64;
printk(KERN_WARNING "or51132: unknown status 0x%02x\n", break;
status&0xff); case 0x45:
return -EREMOTEIO; p->modulation = QAM_256;
break;
default:
if (retry--)
goto start;
printk(KERN_WARNING "or51132: unknown status 0x%02x\n",
status&0xff);
return -EREMOTEIO;
} }
/* FIXME: Read frequency from frontend, take AFC into account */ /* FIXME: Read frequency from frontend, take AFC into account */
param->frequency = state->current_frequency; p->frequency = state->current_frequency;
/* FIXME: How to read inversion setting? Receiver 6 register? */ /* FIXME: How to read inversion setting? Receiver 6 register? */
param->inversion = INVERSION_AUTO; p->inversion = INVERSION_AUTO;
return 0; return 0;
} }
...@@ -579,7 +586,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, ...@@ -579,7 +586,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
} }
static struct dvb_frontend_ops or51132_ops = { static struct dvb_frontend_ops or51132_ops = {
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
.info = { .info = {
.name = "Oren OR51132 VSB/QAM Frontend", .name = "Oren OR51132 VSB/QAM Frontend",
.type = FE_ATSC, .type = FE_ATSC,
...@@ -597,8 +604,8 @@ static struct dvb_frontend_ops or51132_ops = { ...@@ -597,8 +604,8 @@ static struct dvb_frontend_ops or51132_ops = {
.init = or51132_init, .init = or51132_init,
.sleep = or51132_sleep, .sleep = or51132_sleep,
.set_frontend_legacy = or51132_set_parameters, .set_frontend = or51132_set_parameters,
.get_frontend_legacy = or51132_get_parameters, .get_frontend = or51132_get_parameters,
.get_tune_settings = or51132_get_tune_settings, .get_tune_settings = or51132_get_tune_settings,
.read_status = or51132_read_status, .read_status = or51132_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