[media] firedtv: 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.

Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2011-12-26 16:12:40 -03:00
parent e4b40030bf
commit e11eb28876
3 changed files with 59 additions and 55 deletions

View File

@ -335,7 +335,7 @@ static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
* (not supported by the AVC standard) * (not supported by the AVC standard)
*/ */
static int avc_tuner_tuneqpsk(struct firedtv *fdtv, static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
struct dvb_frontend_parameters *params) struct dtv_frontend_properties *p)
{ {
struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_command_frame *c = (void *)fdtv->avc_data;
@ -349,15 +349,15 @@ static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
else else
c->operand[3] = SFE_VENDOR_OPCODE_TUNE_QPSK; c->operand[3] = SFE_VENDOR_OPCODE_TUNE_QPSK;
c->operand[4] = (params->frequency >> 24) & 0xff; c->operand[4] = (p->frequency >> 24) & 0xff;
c->operand[5] = (params->frequency >> 16) & 0xff; c->operand[5] = (p->frequency >> 16) & 0xff;
c->operand[6] = (params->frequency >> 8) & 0xff; c->operand[6] = (p->frequency >> 8) & 0xff;
c->operand[7] = params->frequency & 0xff; c->operand[7] = p->frequency & 0xff;
c->operand[8] = ((params->u.qpsk.symbol_rate / 1000) >> 8) & 0xff; c->operand[8] = ((p->symbol_rate / 1000) >> 8) & 0xff;
c->operand[9] = (params->u.qpsk.symbol_rate / 1000) & 0xff; c->operand[9] = (p->symbol_rate / 1000) & 0xff;
switch (params->u.qpsk.fec_inner) { switch (p->fec_inner) {
case FEC_1_2: c->operand[10] = 0x1; break; case FEC_1_2: c->operand[10] = 0x1; break;
case FEC_2_3: c->operand[10] = 0x2; break; case FEC_2_3: c->operand[10] = 0x2; break;
case FEC_3_4: c->operand[10] = 0x3; break; case FEC_3_4: c->operand[10] = 0x3; break;
@ -416,7 +416,7 @@ static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
} }
static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv, static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
struct dvb_frontend_parameters *params) struct dtv_frontend_properties *p)
{ {
struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_command_frame *c = (void *)fdtv->avc_data;
@ -435,8 +435,8 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
| 1 << 4 /* Frequency */ | 1 << 4 /* Frequency */
| 1 << 3 /* Symbol_Rate */ | 1 << 3 /* Symbol_Rate */
| 0 << 2 /* FEC_outer */ | 0 << 2 /* FEC_outer */
| (params->u.qam.fec_inner != FEC_AUTO ? 1 << 1 : 0) | (p->fec_inner != FEC_AUTO ? 1 << 1 : 0)
| (params->u.qam.modulation != QAM_AUTO ? 1 << 0 : 0); | (p->modulation != QAM_AUTO ? 1 << 0 : 0);
/* multiplex_valid_flags, low byte */ /* multiplex_valid_flags, low byte */
c->operand[6] = 0 << 7 /* NetworkID */ c->operand[6] = 0 << 7 /* NetworkID */
@ -447,15 +447,15 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
c->operand[9] = 0x00; c->operand[9] = 0x00;
c->operand[10] = 0x00; c->operand[10] = 0x00;
c->operand[11] = (((params->frequency / 4000) >> 16) & 0xff) | (2 << 6); c->operand[11] = (((p->frequency / 4000) >> 16) & 0xff) | (2 << 6);
c->operand[12] = ((params->frequency / 4000) >> 8) & 0xff; c->operand[12] = ((p->frequency / 4000) >> 8) & 0xff;
c->operand[13] = (params->frequency / 4000) & 0xff; c->operand[13] = (p->frequency / 4000) & 0xff;
c->operand[14] = ((params->u.qpsk.symbol_rate / 1000) >> 12) & 0xff; c->operand[14] = ((p->symbol_rate / 1000) >> 12) & 0xff;
c->operand[15] = ((params->u.qpsk.symbol_rate / 1000) >> 4) & 0xff; c->operand[15] = ((p->symbol_rate / 1000) >> 4) & 0xff;
c->operand[16] = ((params->u.qpsk.symbol_rate / 1000) << 4) & 0xf0; c->operand[16] = ((p->symbol_rate / 1000) << 4) & 0xf0;
c->operand[17] = 0x00; c->operand[17] = 0x00;
switch (params->u.qpsk.fec_inner) { switch (p->fec_inner) {
case FEC_1_2: c->operand[18] = 0x1; break; case FEC_1_2: c->operand[18] = 0x1; break;
case FEC_2_3: c->operand[18] = 0x2; break; case FEC_2_3: c->operand[18] = 0x2; break;
case FEC_3_4: c->operand[18] = 0x3; break; case FEC_3_4: c->operand[18] = 0x3; break;
@ -467,7 +467,7 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
default: c->operand[18] = 0x0; default: c->operand[18] = 0x0;
} }
switch (params->u.qam.modulation) { switch (p->modulation) {
case QAM_16: c->operand[19] = 0x08; break; case QAM_16: c->operand[19] = 0x08; break;
case QAM_32: c->operand[19] = 0x10; break; case QAM_32: c->operand[19] = 0x10; break;
case QAM_64: c->operand[19] = 0x18; break; case QAM_64: c->operand[19] = 0x18; break;
@ -484,9 +484,8 @@ static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
} }
static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv, static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
struct dvb_frontend_parameters *params) struct dtv_frontend_properties *p)
{ {
struct dvb_ofdm_parameters *ofdm = &params->u.ofdm;
struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_command_frame *c = (void *)fdtv->avc_data;
c->opcode = AVC_OPCODE_DSD; c->opcode = AVC_OPCODE_DSD;
@ -501,42 +500,42 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
c->operand[5] = c->operand[5] =
0 << 7 /* reserved */ 0 << 7 /* reserved */
| 1 << 6 /* CenterFrequency */ | 1 << 6 /* CenterFrequency */
| (ofdm->bandwidth != BANDWIDTH_AUTO ? 1 << 5 : 0) | (p->bandwidth_hz != 0 ? 1 << 5 : 0)
| (ofdm->constellation != QAM_AUTO ? 1 << 4 : 0) | (p->modulation != QAM_AUTO ? 1 << 4 : 0)
| (ofdm->hierarchy_information != HIERARCHY_AUTO ? 1 << 3 : 0) | (p->hierarchy != HIERARCHY_AUTO ? 1 << 3 : 0)
| (ofdm->code_rate_HP != FEC_AUTO ? 1 << 2 : 0) | (p->code_rate_HP != FEC_AUTO ? 1 << 2 : 0)
| (ofdm->code_rate_LP != FEC_AUTO ? 1 << 1 : 0) | (p->code_rate_LP != FEC_AUTO ? 1 << 1 : 0)
| (ofdm->guard_interval != GUARD_INTERVAL_AUTO ? 1 << 0 : 0); | (p->guard_interval != GUARD_INTERVAL_AUTO ? 1 << 0 : 0);
/* multiplex_valid_flags, low byte */ /* multiplex_valid_flags, low byte */
c->operand[6] = c->operand[6] =
0 << 7 /* NetworkID */ 0 << 7 /* NetworkID */
| (ofdm->transmission_mode != TRANSMISSION_MODE_AUTO ? 1 << 6 : 0) | (p->transmission_mode != TRANSMISSION_MODE_AUTO ? 1 << 6 : 0)
| 0 << 5 /* OtherFrequencyFlag */ | 0 << 5 /* OtherFrequencyFlag */
| 0 << 0 /* reserved */ ; | 0 << 0 /* reserved */ ;
c->operand[7] = 0x0; c->operand[7] = 0x0;
c->operand[8] = (params->frequency / 10) >> 24; c->operand[8] = (p->frequency / 10) >> 24;
c->operand[9] = ((params->frequency / 10) >> 16) & 0xff; c->operand[9] = ((p->frequency / 10) >> 16) & 0xff;
c->operand[10] = ((params->frequency / 10) >> 8) & 0xff; c->operand[10] = ((p->frequency / 10) >> 8) & 0xff;
c->operand[11] = (params->frequency / 10) & 0xff; c->operand[11] = (p->frequency / 10) & 0xff;
switch (ofdm->bandwidth) { switch (p->bandwidth_hz) {
case BANDWIDTH_7_MHZ: c->operand[12] = 0x20; break; case 7000000: c->operand[12] = 0x20; break;
case BANDWIDTH_8_MHZ: case 8000000:
case BANDWIDTH_6_MHZ: /* not defined by AVC spec */ case 6000000: /* not defined by AVC spec */
case BANDWIDTH_AUTO: case 0:
default: c->operand[12] = 0x00; default: c->operand[12] = 0x00;
} }
switch (ofdm->constellation) { switch (p->modulation) {
case QAM_16: c->operand[13] = 1 << 6; break; case QAM_16: c->operand[13] = 1 << 6; break;
case QAM_64: c->operand[13] = 2 << 6; break; case QAM_64: c->operand[13] = 2 << 6; break;
case QPSK: case QPSK:
default: c->operand[13] = 0x00; default: c->operand[13] = 0x00;
} }
switch (ofdm->hierarchy_information) { switch (p->hierarchy) {
case HIERARCHY_1: c->operand[13] |= 1 << 3; break; case HIERARCHY_1: c->operand[13] |= 1 << 3; break;
case HIERARCHY_2: c->operand[13] |= 2 << 3; break; case HIERARCHY_2: c->operand[13] |= 2 << 3; break;
case HIERARCHY_4: c->operand[13] |= 3 << 3; break; case HIERARCHY_4: c->operand[13] |= 3 << 3; break;
@ -545,7 +544,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
default: break; default: break;
} }
switch (ofdm->code_rate_HP) { switch (p->code_rate_HP) {
case FEC_2_3: c->operand[13] |= 1; break; case FEC_2_3: c->operand[13] |= 1; break;
case FEC_3_4: c->operand[13] |= 2; break; case FEC_3_4: c->operand[13] |= 2; break;
case FEC_5_6: c->operand[13] |= 3; break; case FEC_5_6: c->operand[13] |= 3; break;
@ -554,7 +553,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
default: break; default: break;
} }
switch (ofdm->code_rate_LP) { switch (p->code_rate_LP) {
case FEC_2_3: c->operand[14] = 1 << 5; break; case FEC_2_3: c->operand[14] = 1 << 5; break;
case FEC_3_4: c->operand[14] = 2 << 5; break; case FEC_3_4: c->operand[14] = 2 << 5; break;
case FEC_5_6: c->operand[14] = 3 << 5; break; case FEC_5_6: c->operand[14] = 3 << 5; break;
@ -563,7 +562,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
default: c->operand[14] = 0x00; break; default: c->operand[14] = 0x00; break;
} }
switch (ofdm->guard_interval) { switch (p->guard_interval) {
case GUARD_INTERVAL_1_16: c->operand[14] |= 1 << 3; break; case GUARD_INTERVAL_1_16: c->operand[14] |= 1 << 3; break;
case GUARD_INTERVAL_1_8: c->operand[14] |= 2 << 3; break; case GUARD_INTERVAL_1_8: c->operand[14] |= 2 << 3; break;
case GUARD_INTERVAL_1_4: c->operand[14] |= 3 << 3; break; case GUARD_INTERVAL_1_4: c->operand[14] |= 3 << 3; break;
@ -572,7 +571,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
default: break; default: break;
} }
switch (ofdm->transmission_mode) { switch (p->transmission_mode) {
case TRANSMISSION_MODE_8K: c->operand[14] |= 1 << 1; break; case TRANSMISSION_MODE_8K: c->operand[14] |= 1 << 1; break;
case TRANSMISSION_MODE_2K: case TRANSMISSION_MODE_2K:
case TRANSMISSION_MODE_AUTO: case TRANSMISSION_MODE_AUTO:
@ -586,7 +585,7 @@ static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
} }
int avc_tuner_dsd(struct firedtv *fdtv, int avc_tuner_dsd(struct firedtv *fdtv,
struct dvb_frontend_parameters *params) struct dtv_frontend_properties *p)
{ {
struct avc_command_frame *c = (void *)fdtv->avc_data; struct avc_command_frame *c = (void *)fdtv->avc_data;
int pos, ret; int pos, ret;
@ -598,9 +597,9 @@ int avc_tuner_dsd(struct firedtv *fdtv,
switch (fdtv->type) { switch (fdtv->type) {
case FIREDTV_DVB_S: case FIREDTV_DVB_S:
case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, params); break; case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, p); break;
case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, params); break; case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, p); break;
case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, params); break; case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, p); break;
default: default:
BUG(); BUG();
} }

View File

@ -141,16 +141,16 @@ static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int fdtv_set_frontend(struct dvb_frontend *fe, static int fdtv_set_frontend(struct dvb_frontend *fe)
struct dvb_frontend_parameters *params)
{ {
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct firedtv *fdtv = fe->sec_priv; struct firedtv *fdtv = fe->sec_priv;
return avc_tuner_dsd(fdtv, params); return avc_tuner_dsd(fdtv, p);
} }
static int fdtv_get_frontend(struct dvb_frontend *fe, static int fdtv_get_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params) struct dtv_frontend_properties *params)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
@ -173,8 +173,8 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
ops->init = fdtv_dvb_init; ops->init = fdtv_dvb_init;
ops->sleep = fdtv_sleep; ops->sleep = fdtv_sleep;
ops->set_frontend_legacy = fdtv_set_frontend; ops->set_frontend = fdtv_set_frontend;
ops->get_frontend_legacy = fdtv_get_frontend; ops->get_frontend = fdtv_get_frontend;
ops->get_property = fdtv_get_property; ops->get_property = fdtv_get_property;
ops->set_property = fdtv_set_property; ops->set_property = fdtv_set_property;
@ -192,6 +192,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
switch (fdtv->type) { switch (fdtv->type) {
case FIREDTV_DVB_S: case FIREDTV_DVB_S:
ops->delsys[0] = SYS_DVBS;
fi->type = FE_QPSK; fi->type = FE_QPSK;
fi->frequency_min = 950000; fi->frequency_min = 950000;
@ -211,6 +212,8 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
break; break;
case FIREDTV_DVB_S2: case FIREDTV_DVB_S2:
ops->delsys[0] = SYS_DVBS;
ops->delsys[1] = SYS_DVBS;
fi->type = FE_QPSK; fi->type = FE_QPSK;
fi->frequency_min = 950000; fi->frequency_min = 950000;
@ -231,6 +234,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
break; break;
case FIREDTV_DVB_C: case FIREDTV_DVB_C:
ops->delsys[0] = SYS_DVBC_ANNEX_A;
fi->type = FE_QAM; fi->type = FE_QAM;
fi->frequency_min = 47000000; fi->frequency_min = 47000000;
@ -249,6 +253,7 @@ void fdtv_frontend_init(struct firedtv *fdtv, const char *name)
break; break;
case FIREDTV_DVB_T: case FIREDTV_DVB_T:
ops->delsys[0] = SYS_DVBT;
fi->type = FE_OFDM; fi->type = FE_OFDM;
fi->frequency_min = 49000000; fi->frequency_min = 49000000;

View File

@ -112,8 +112,8 @@ struct firedtv {
/* firedtv-avc.c */ /* firedtv-avc.c */
int avc_recv(struct firedtv *fdtv, void *data, size_t length); int avc_recv(struct firedtv *fdtv, void *data, size_t length);
int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat); int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
struct dvb_frontend_parameters; struct dtv_frontend_properties;
int avc_tuner_dsd(struct firedtv *fdtv, struct dvb_frontend_parameters *params); int avc_tuner_dsd(struct firedtv *fdtv, struct dtv_frontend_properties *params);
int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]); int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
int avc_tuner_get_ts(struct firedtv *fdtv); int avc_tuner_get_ts(struct firedtv *fdtv);
int avc_identify_subunit(struct firedtv *fdtv); int avc_identify_subunit(struct firedtv *fdtv);