summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-16 17:53:32 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2007-12-16 17:53:32 -0500
commite204914b6924b0eda3d4a8adbe8334c5ed27d457 (patch)
tree1dcc04a5b03f45c2ff1369fe078ceb94bfa2f5d6 /linux/drivers
parent72459008a1643c4804ee6688426d7c29a66a545b (diff)
downloadmediapointer-dvb-s2-e204914b6924b0eda3d4a8adbe8334c5ed27d457.tar.gz
mediapointer-dvb-s2-e204914b6924b0eda3d4a8adbe8334c5ed27d457.tar.bz2
tuner: convert tda9887 to use TUNER_SET_CONFIG
From: Michael Krufky <mkrufky@linuxtv.org> Use TUNER_SET_CONFIG to set configuration in tda9887's private state structure, rather than storing tda9887-specific configuration within struct tuner. Update handling of TUNER_SET_CONFIG by tuner-core, to call &t->fe.ops.analog_demod_ops rather than &t->fe.ops.tuner_ops analog_demod_ops.set_config passes the request to tuner_ops.set_config, so this does not break other drivers. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/tda9887.c47
-rw-r--r--linux/drivers/media/video/tuner-core.c12
-rw-r--r--linux/drivers/media/video/tuner-driver.h3
3 files changed, 33 insertions, 29 deletions
diff --git a/linux/drivers/media/video/tda9887.c b/linux/drivers/media/video/tda9887.c
index f262055c9..77e40d0ec 100644
--- a/linux/drivers/media/video/tda9887.c
+++ b/linux/drivers/media/video/tda9887.c
@@ -42,6 +42,7 @@ struct tda9887_priv {
struct tuner_i2c_props i2c_props;
unsigned char data[4];
+ unsigned int config;
struct tuner *t;
};
@@ -484,31 +485,31 @@ static int tda9887_set_insmod(struct dvb_frontend *fe)
return 0;
}
-static int tda9887_set_config(struct dvb_frontend *fe)
+static int tda9887_do_config(struct dvb_frontend *fe)
{
struct tda9887_priv *priv = fe->analog_demod_priv;
struct tuner *t = priv->t;
char *buf = priv->data;
- if (t->tda9887_config & TDA9887_PORT1_ACTIVE)
+ if (priv->config & TDA9887_PORT1_ACTIVE)
buf[1] &= ~cOutputPort1Inactive;
- if (t->tda9887_config & TDA9887_PORT1_INACTIVE)
+ if (priv->config & TDA9887_PORT1_INACTIVE)
buf[1] |= cOutputPort1Inactive;
- if (t->tda9887_config & TDA9887_PORT2_ACTIVE)
+ if (priv->config & TDA9887_PORT2_ACTIVE)
buf[1] &= ~cOutputPort2Inactive;
- if (t->tda9887_config & TDA9887_PORT2_INACTIVE)
+ if (priv->config & TDA9887_PORT2_INACTIVE)
buf[1] |= cOutputPort2Inactive;
- if (t->tda9887_config & TDA9887_QSS)
+ if (priv->config & TDA9887_QSS)
buf[1] |= cQSS;
- if (t->tda9887_config & TDA9887_INTERCARRIER)
+ if (priv->config & TDA9887_INTERCARRIER)
buf[1] &= ~cQSS;
- if (t->tda9887_config & TDA9887_AUTOMUTE)
+ if (priv->config & TDA9887_AUTOMUTE)
buf[1] |= cAutoMuteFmActive;
- if (t->tda9887_config & TDA9887_DEEMPHASIS_MASK) {
+ if (priv->config & TDA9887_DEEMPHASIS_MASK) {
buf[2] &= ~0x60;
- switch (t->tda9887_config & TDA9887_DEEMPHASIS_MASK) {
+ switch (priv->config & TDA9887_DEEMPHASIS_MASK) {
case TDA9887_DEEMPHASIS_NONE:
buf[2] |= cDeemphasisOFF;
break;
@@ -520,21 +521,22 @@ static int tda9887_set_config(struct dvb_frontend *fe)
break;
}
}
- if (t->tda9887_config & TDA9887_TOP_SET) {
+ if (priv->config & TDA9887_TOP_SET) {
buf[2] &= ~cTopMask;
- buf[2] |= (t->tda9887_config >> 8) & cTopMask;
+ buf[2] |= (priv->config >> 8) & cTopMask;
}
- if ((t->tda9887_config & TDA9887_INTERCARRIER_NTSC) && (t->std & V4L2_STD_NTSC))
+ if ((priv->config & TDA9887_INTERCARRIER_NTSC) &&
+ (t->std & V4L2_STD_NTSC))
buf[1] &= ~cQSS;
- if (t->tda9887_config & TDA9887_GATING_18)
+ if (priv->config & TDA9887_GATING_18)
buf[3] &= ~cGating_36;
if (t->mode == V4L2_TUNER_RADIO) {
- if (t->tda9887_config & TDA9887_RIF_41_3) {
+ if (priv->config & TDA9887_RIF_41_3) {
buf[3] &= ~cVideoIFMask;
buf[3] |= cRadioIF_41_30;
}
- if (t->tda9887_config & TDA9887_GAIN_NORMAL)
+ if (priv->config & TDA9887_GAIN_NORMAL)
buf[3] &= ~cTunerGainLow;
}
@@ -581,7 +583,7 @@ static void tda9887_configure(struct dvb_frontend *fe)
priv->data[1] |= cOutputPort1Inactive;
priv->data[1] |= cOutputPort2Inactive;
- tda9887_set_config(fe);
+ tda9887_do_config(fe);
tda9887_set_insmod(fe);
if (t->mode == T_STANDBY) {
@@ -640,6 +642,16 @@ static void tda9887_set_params(struct dvb_frontend *fe,
tda9887_configure(fe);
}
+static int tda9887_set_config(struct dvb_frontend *fe, void *priv_cfg)
+{
+ struct tda9887_priv *priv = fe->analog_demod_priv;
+
+ priv->config = *(unsigned int *)priv_cfg;
+ tda9887_configure(fe);
+
+ return 0;
+}
+
static void tda9887_release(struct dvb_frontend *fe)
{
kfree(fe->analog_demod_priv);
@@ -655,6 +667,7 @@ static struct analog_tuner_ops tda9887_tuner_ops = {
.tuner_status = tda9887_tuner_status,
.get_afc = tda9887_get_afc,
.release = tda9887_release,
+ .set_config = tda9887_set_config,
};
int tda9887_attach(struct tuner *t)
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 47aafed34..5b5a38eaf 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -877,25 +877,19 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
#endif
case TUNER_SET_CONFIG:
{
- struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
+ struct analog_tuner_ops *ops = t->fe.ops.analog_demod_ops;
struct v4l2_priv_tun_config *cfg = arg;
if (t->type != cfg->tuner)
break;
- if (t->type == TUNER_TDA9887) {
- t->tda9887_config = *(unsigned int *)cfg->priv;
- set_freq(client, t->tv_freq);
- break;
- }
-
- if (NULL == fe_tuner_ops->set_config) {
+ if ((NULL == ops) || (NULL == ops->set_config)) {
tuner_warn("Tuner frontend module has no way to "
"set config\n");
break;
}
- fe_tuner_ops->set_config(&t->fe, cfg->priv);
+ ops->set_config(&t->fe, cfg->priv);
break;
}
/* --- v4l ioctls --- */
diff --git a/linux/drivers/media/video/tuner-driver.h b/linux/drivers/media/video/tuner-driver.h
index 7f43dc68a..417753b7c 100644
--- a/linux/drivers/media/video/tuner-driver.h
+++ b/linux/drivers/media/video/tuner-driver.h
@@ -69,9 +69,6 @@ struct tuner {
struct dvb_frontend fe;
- /* used by tda9887 */
- unsigned int tda9887_config;
-
unsigned int config;
int (*tuner_callback) (void *dev, int command,int arg);
};