aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index ce1de403e99e..7e9cd7921314 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -993,6 +993,42 @@ int is_legacy_delivery_system(fe_delivery_system_t s)
993 return 0; 993 return 0;
994} 994}
995 995
996/* Synchronise the legacy tuning parameters into the cache, so that demodulator
997 * drivers can use a single set_frontend tuning function, regardless of whether
998 * it's being used for the legacy or new API, reducing code and complexity.
999 */
1000void dtv_property_cache_sync(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
1001{
1002 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
1003
1004 c->frequency = p->frequency;
1005 c->inversion = p->inversion;
1006
1007 switch (fe->ops.info.type) {
1008 case FE_QPSK:
1009 c->symbol_rate = p->u.qpsk.symbol_rate;
1010 c->fec_inner = p->u.qpsk.fec_inner;
1011 break;
1012 case FE_QAM:
1013 c->symbol_rate = p->u.qam.symbol_rate;
1014 c->fec_inner = p->u.qam.fec_inner;
1015 c->modulation = p->u.qam.modulation;
1016 break;
1017 case FE_OFDM:
1018 c->bandwidth = p->u.ofdm.bandwidth;
1019 c->code_rate_HP = p->u.ofdm.code_rate_HP;
1020 c->code_rate_LP = p->u.ofdm.code_rate_LP;
1021 c->modulation = p->u.ofdm.constellation;
1022 c->transmission_mode = p->u.ofdm.transmission_mode;
1023 c->guard_interval = p->u.ofdm.guard_interval;
1024 c->hierarchy = p->u.ofdm.hierarchy_information;
1025 break;
1026 case FE_ATSC:
1027 c->modulation = p->u.vsb.modulation;
1028 break;
1029 }
1030}
1031
996int dtv_property_cache_submit(struct dvb_frontend *fe) 1032int dtv_property_cache_submit(struct dvb_frontend *fe)
997{ 1033{
998 1034
@@ -1548,6 +1584,8 @@ static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file,
1548 case FE_SET_FRONTEND: { 1584 case FE_SET_FRONTEND: {
1549 struct dvb_frontend_tune_settings fetunesettings; 1585 struct dvb_frontend_tune_settings fetunesettings;
1550 1586
1587 dtv_property_cache_sync(fe, &fepriv->parameters);
1588
1551 if(fe->dtv_property_cache.state == DTV_TUNE) { 1589 if(fe->dtv_property_cache.state == DTV_TUNE) {
1552 if (dvb_frontend_check_parameters(fe, &fepriv->parameters) < 0) { 1590 if (dvb_frontend_check_parameters(fe, &fepriv->parameters) < 0) {
1553 err = -EINVAL; 1591 err = -EINVAL;