summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/frontends/tda18271-fe.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-12-12 00:40:19 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-12-12 00:40:19 -0200
commit4981413b8584d461413c56d89f91b5d11796aa31 (patch)
tree3cefe1767733ce1bf019ffcb41a4cc07a71cca92 /linux/drivers/media/dvb/frontends/tda18271-fe.c
parentc30e05a83632aeb144f9d3912d39162564244a34 (diff)
parentbfea07eb7991bd4da2c596c6b9aa2c878328dbc7 (diff)
downloadmediapointer-dvb-s2-4981413b8584d461413c56d89f91b5d11796aa31.tar.gz
mediapointer-dvb-s2-4981413b8584d461413c56d89f91b5d11796aa31.tar.bz2
merge: http://linuxtv.org/hg/~mkrufky/tda18271
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/dvb/frontends/tda18271-fe.c')
-rw-r--r--linux/drivers/media/dvb/frontends/tda18271-fe.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/linux/drivers/media/dvb/frontends/tda18271-fe.c b/linux/drivers/media/dvb/frontends/tda18271-fe.c
index d90fc2ebc..915fb92fb 100644
--- a/linux/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/linux/drivers/media/dvb/frontends/tda18271-fe.c
@@ -32,14 +32,18 @@ MODULE_PARM_DESC(debug, "set debug level (info=1, map=2, reg=4 (or-able))");
/*---------------------------------------------------------------------*/
-#define TDA18271_ANALOG 0
-#define TDA18271_DIGITAL 1
+enum tda18271_mode {
+ TDA18271_ANALOG,
+ TDA18271_DIGITAL,
+};
struct tda18271_priv {
u8 i2c_addr;
struct i2c_adapter *i2c_adap;
unsigned char tda18271_regs[TDA18271_NUM_REGS];
- int mode;
+
+ enum tda18271_mode mode;
+ enum tda18271_i2c_gate gate;
u32 frequency;
u32 bandwidth;
@@ -49,17 +53,39 @@ static int tda18271_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct tda18271_priv *priv = fe->tuner_priv;
struct analog_tuner_ops *ops = fe->ops.analog_demod_ops;
+ enum tda18271_i2c_gate gate;
int ret = 0;
- switch (priv->mode) {
- case TDA18271_ANALOG:
+ switch (priv->gate) {
+ case TDA18271_GATE_DIGITAL:
+ case TDA18271_GATE_ANALOG:
+ gate = priv->gate;
+ break;
+ case TDA18271_GATE_AUTO:
+ default:
+ switch (priv->mode) {
+ case TDA18271_DIGITAL:
+ gate = TDA18271_GATE_DIGITAL;
+ break;
+ case TDA18271_ANALOG:
+ default:
+ gate = TDA18271_GATE_ANALOG;
+ break;
+ }
+ }
+
+ switch (gate) {
+ case TDA18271_GATE_ANALOG:
if (ops && ops->i2c_gate_ctrl)
ret = ops->i2c_gate_ctrl(fe, enable);
break;
- case TDA18271_DIGITAL:
+ case TDA18271_GATE_DIGITAL:
if (fe->ops.i2c_gate_ctrl)
ret = fe->ops.i2c_gate_ctrl(fe, enable);
break;
+ default:
+ ret = -EINVAL;
+ break;
}
return ret;
@@ -717,7 +743,8 @@ static struct dvb_tuner_ops tda18271_tuner_ops = {
};
struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
- struct i2c_adapter *i2c)
+ struct i2c_adapter *i2c,
+ enum tda18271_i2c_gate gate)
{
struct tda18271_priv *priv = NULL;
@@ -728,6 +755,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
priv->i2c_addr = addr;
priv->i2c_adap = i2c;
+ priv->gate = gate;
memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,
sizeof(struct dvb_tuner_ops));