Common routine for use of dvb-core, demodulator and tuner for check given DVB-C annex A parameters correctness. Signed-off-by: Antti Palosaari <crope@xxxxxx> --- drivers/media/dvb-core/dvb_frontend.c | 54 +++++++++++++++++++++++++++++++++++ drivers/media/dvb-core/dvb_frontend.h | 1 + 2 files changed, 55 insertions(+) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 6413c74..6a19c87 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2759,6 +2759,60 @@ int dvb_validate_params_dvbt2(struct dvb_frontend *fe) } EXPORT_SYMBOL(dvb_validate_params_dvbt2); +int dvb_validate_params_dvbc_annex_a(struct dvb_frontend *fe) +{ + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + + dev_dbg(fe->dvb->device, "%s:\n", __func__); + + switch (c->delivery_system) { + case SYS_DVBC_ANNEX_A: + break; + default: + dev_dbg(fe->dvb->device, "%s: delivery_system=%d\n", __func__, + c->delivery_system); + return -EINVAL; + } + + /* + * TODO: NorDig Unified 2.2 specifies input frequency range + * 110 - 862 MHz. Do not limit it now as w_scan seems to start from + * 73 MHz until reason is clear. + */ + if (c->frequency >= 0 && c->frequency <= 862000000) { + ; + } else { + dev_dbg(fe->dvb->device, "%s: frequency=%d\n", __func__, + c->frequency); + return -EINVAL; + } + + if (c->symbol_rate >= 1000000 && c->symbol_rate <= 7000000) { + ; + } else { + dev_dbg(fe->dvb->device, "%s: symbol_rate=%d\n", __func__, + c->symbol_rate); + return -EINVAL; + } + + switch (c->modulation) { + case QAM_AUTO: + case QAM_16: + case QAM_32: + case QAM_64: + case QAM_128: + case QAM_256: + break; + default: + dev_dbg(fe->dvb->device, "%s: modulation=%d\n", __func__, + c->modulation); + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL(dvb_validate_params_dvbc_annex_a); + int dvb_register_frontend(struct dvb_adapter* dvb, struct dvb_frontend* fe) { diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index bcd572d..e6e6fe1 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -427,5 +427,6 @@ extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime); extern int dvb_validate_params_dvbt(struct dvb_frontend *fe); extern int dvb_validate_params_dvbt2(struct dvb_frontend *fe); +extern int dvb_validate_params_dvbc_annex_a(struct dvb_frontend *fe); #endif -- 1.7.11.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html