summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorSteven Toth <stoth@linuxtv.org>2008-09-11 22:52:32 -0400
committerSteven Toth <stoth@linuxtv.org>2008-09-11 22:52:32 -0400
commit60bc4d4c87081996e0d9a995671f4b3f52441a41 (patch)
tree9a09622e26eadfcf43671273d1da04f1ebf5ded3 /linux/drivers/media/dvb
parent82f2ae0113e7fab5af5ca56ed9ef508f3581dbe5 (diff)
downloadmediapointer-dvb-s2-60bc4d4c87081996e0d9a995671f4b3f52441a41.tar.gz
mediapointer-dvb-s2-60bc4d4c87081996e0d9a995671f4b3f52441a41.tar.bz2
S2API: Reduce demod driver complexity by using a cache sync
From: Steven Toth <stoth@linuxtv.org> For demod drivers, we want a single tuning function (set_frontend) to have access to the properly constructed dvb_frontend_parameters structure, or the cache values - regardless of whether the legacy or new API is being used. This cuts down on redundant code in the demod drivers and ensures the tuning parameters are consistent regardless of the API entry type. Priority: normal Signed-off-by: Steven Toth <stoth@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 9f9a92457..e618aa131 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1004,6 +1004,42 @@ int is_legacy_delivery_system(fe_delivery_system_t s)
return 0;
}
+/* Synchronise the legacy tuning parameters into the cache, so that demodulator
+ * drivers can use a single set_frontend tuning function, regardless of whether
+ * it's being used for the legacy or new API, reducing code and complexity.
+ */
+void dtv_property_cache_sync(struct dvb_frontend *fe, struct dvb_frontend_parameters *p)
+{
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
+
+ c->frequency = p->frequency;
+ c->inversion = p->inversion;
+
+ switch (fe->ops.info.type) {
+ case FE_QPSK:
+ c->symbol_rate = p->u.qpsk.symbol_rate;
+ c->fec_inner = p->u.qpsk.fec_inner;
+ break;
+ case FE_QAM:
+ c->symbol_rate = p->u.qam.symbol_rate;
+ c->fec_inner = p->u.qam.fec_inner;
+ c->modulation = p->u.qam.modulation;
+ break;
+ case FE_OFDM:
+ c->bandwidth = p->u.ofdm.bandwidth;
+ c->code_rate_HP = p->u.ofdm.code_rate_HP;
+ c->code_rate_LP = p->u.ofdm.code_rate_LP;
+ c->modulation = p->u.ofdm.constellation;
+ c->transmission_mode = p->u.ofdm.transmission_mode;
+ c->guard_interval = p->u.ofdm.guard_interval;
+ c->hierarchy = p->u.ofdm.hierarchy_information;
+ break;
+ case FE_ATSC:
+ c->modulation = p->u.vsb.modulation;
+ break;
+ }
+}
+
int dtv_property_cache_submit(struct dvb_frontend *fe)
{
@@ -1559,6 +1595,8 @@ static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file,
case FE_SET_FRONTEND: {
struct dvb_frontend_tune_settings fetunesettings;
+ dtv_property_cache_sync(fe, &fepriv->parameters);
+
if(fe->dtv_property_cache.state == DTV_TUNE) {
if (dvb_frontend_check_parameters(fe, &fepriv->parameters) < 0) {
err = -EINVAL;