[media] siano: split get_frontend into per-std functions

Instead of handling both DVB-T and ISDB-T at the same get_frontend
function, break it intow one function per-delivery system.
That makes the code clearer as we start to add support for DVBv5
statistics, and for ISDB-T get frontend stuff.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2013-03-09 12:05:58 -03:00
parent 80ccb51a0f
commit eab0fa0f04

View File

@ -863,131 +863,150 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe)
}
}
static int smsdvb_get_frontend(struct dvb_frontend *fe)
static int smsdvb_get_frontend_dvb(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *fep = &fe->dtv_property_cache;
struct smsdvb_client_t *client =
container_of(fe, struct smsdvb_client_t, frontend);
struct smscore_device_t *coredev = client->coredev;
struct TRANSMISSION_STATISTICS_S *td =
&client->sms_stat_dvb.TransmissionData;
fep->frequency = td->Frequency;
switch (td->Bandwidth) {
case 6:
fep->bandwidth_hz = 6000000;
break;
case 7:
fep->bandwidth_hz = 7000000;
break;
case 8:
fep->bandwidth_hz = 8000000;
break;
}
switch (td->TransmissionMode) {
case 2:
fep->transmission_mode = TRANSMISSION_MODE_2K;
break;
case 8:
fep->transmission_mode = TRANSMISSION_MODE_8K;
}
switch (td->GuardInterval) {
case 0:
fep->guard_interval = GUARD_INTERVAL_1_32;
break;
case 1:
fep->guard_interval = GUARD_INTERVAL_1_16;
break;
case 2:
fep->guard_interval = GUARD_INTERVAL_1_8;
break;
case 3:
fep->guard_interval = GUARD_INTERVAL_1_4;
break;
}
switch (td->CodeRate) {
case 0:
fep->code_rate_HP = FEC_1_2;
break;
case 1:
fep->code_rate_HP = FEC_2_3;
break;
case 2:
fep->code_rate_HP = FEC_3_4;
break;
case 3:
fep->code_rate_HP = FEC_5_6;
break;
case 4:
fep->code_rate_HP = FEC_7_8;
break;
}
switch (td->LPCodeRate) {
case 0:
fep->code_rate_LP = FEC_1_2;
break;
case 1:
fep->code_rate_LP = FEC_2_3;
break;
case 2:
fep->code_rate_LP = FEC_3_4;
break;
case 3:
fep->code_rate_LP = FEC_5_6;
break;
case 4:
fep->code_rate_LP = FEC_7_8;
break;
}
switch (td->Constellation) {
case 0:
fep->modulation = QPSK;
break;
case 1:
fep->modulation = QAM_16;
break;
case 2:
fep->modulation = QAM_64;
break;
}
switch (td->Hierarchy) {
case 0:
fep->hierarchy = HIERARCHY_NONE;
break;
case 1:
fep->hierarchy = HIERARCHY_1;
break;
case 2:
fep->hierarchy = HIERARCHY_2;
break;
case 3:
fep->hierarchy = HIERARCHY_4;
break;
}
fep->inversion = INVERSION_AUTO;
return 0;
}
static int smsdvb_get_frontend_isdb(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *fep = &fe->dtv_property_cache;
struct smsdvb_client_t *client =
container_of(fe, struct smsdvb_client_t, frontend);
struct TRANSMISSION_STATISTICS_S *td =
&client->sms_stat_dvb.TransmissionData;
fep->frequency = td->Frequency;
fep->bandwidth_hz = 6000000;
/* todo: retrive the other parameters */
return 0;
}
static int smsdvb_get_frontend(struct dvb_frontend *fe)
{
struct smsdvb_client_t *client =
container_of(fe, struct smsdvb_client_t, frontend);
struct smscore_device_t *coredev = client->coredev;
switch (smscore_get_device_mode(coredev)) {
case DEVICE_MODE_DVBT:
case DEVICE_MODE_DVBT_BDA:
fep->frequency = td->Frequency;
switch (td->Bandwidth) {
case 6:
fep->bandwidth_hz = 6000000;
break;
case 7:
fep->bandwidth_hz = 7000000;
break;
case 8:
fep->bandwidth_hz = 8000000;
break;
}
switch (td->TransmissionMode) {
case 2:
fep->transmission_mode = TRANSMISSION_MODE_2K;
break;
case 8:
fep->transmission_mode = TRANSMISSION_MODE_8K;
}
switch (td->GuardInterval) {
case 0:
fep->guard_interval = GUARD_INTERVAL_1_32;
break;
case 1:
fep->guard_interval = GUARD_INTERVAL_1_16;
break;
case 2:
fep->guard_interval = GUARD_INTERVAL_1_8;
break;
case 3:
fep->guard_interval = GUARD_INTERVAL_1_4;
break;
}
switch (td->CodeRate) {
case 0:
fep->code_rate_HP = FEC_1_2;
break;
case 1:
fep->code_rate_HP = FEC_2_3;
break;
case 2:
fep->code_rate_HP = FEC_3_4;
break;
case 3:
fep->code_rate_HP = FEC_5_6;
break;
case 4:
fep->code_rate_HP = FEC_7_8;
break;
}
switch (td->LPCodeRate) {
case 0:
fep->code_rate_LP = FEC_1_2;
break;
case 1:
fep->code_rate_LP = FEC_2_3;
break;
case 2:
fep->code_rate_LP = FEC_3_4;
break;
case 3:
fep->code_rate_LP = FEC_5_6;
break;
case 4:
fep->code_rate_LP = FEC_7_8;
break;
}
switch (td->Constellation) {
case 0:
fep->modulation = QPSK;
break;
case 1:
fep->modulation = QAM_16;
break;
case 2:
fep->modulation = QAM_64;
break;
}
switch (td->Hierarchy) {
case 0:
fep->hierarchy = HIERARCHY_NONE;
break;
case 1:
fep->hierarchy = HIERARCHY_1;
break;
case 2:
fep->hierarchy = HIERARCHY_2;
break;
case 3:
fep->hierarchy = HIERARCHY_4;
break;
}
fep->inversion = INVERSION_AUTO;
break;
return smsdvb_get_frontend_dvb(fe);
case DEVICE_MODE_ISDBT:
case DEVICE_MODE_ISDBT_BDA:
fep->frequency = td->Frequency;
fep->bandwidth_hz = 6000000;
/* todo: retrive the other parameters */
break;
return smsdvb_get_frontend_isdb(fe);
default:
return -EINVAL;
}
return 0;
}
static int smsdvb_init(struct dvb_frontend *fe)