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

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