aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/tda18271-fe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/tda18271-fe.c')
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index dbf0f619a90a..28c63fd4493e 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -40,7 +40,9 @@ struct tda18271_priv {
40 u8 i2c_addr; 40 u8 i2c_addr;
41 struct i2c_adapter *i2c_adap; 41 struct i2c_adapter *i2c_adap;
42 unsigned char tda18271_regs[TDA18271_NUM_REGS]; 42 unsigned char tda18271_regs[TDA18271_NUM_REGS];
43
43 enum tda18271_mode mode; 44 enum tda18271_mode mode;
45 enum tda18271_i2c_gate gate;
44 46
45 u32 frequency; 47 u32 frequency;
46 u32 bandwidth; 48 u32 bandwidth;
@@ -50,17 +52,39 @@ static int tda18271_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
50{ 52{
51 struct tda18271_priv *priv = fe->tuner_priv; 53 struct tda18271_priv *priv = fe->tuner_priv;
52 struct analog_tuner_ops *ops = fe->ops.analog_demod_ops; 54 struct analog_tuner_ops *ops = fe->ops.analog_demod_ops;
55 enum tda18271_i2c_gate gate;
53 int ret = 0; 56 int ret = 0;
54 57
55 switch (priv->mode) { 58 switch (priv->gate) {
56 case TDA18271_ANALOG: 59 case TDA18271_GATE_DIGITAL:
60 case TDA18271_GATE_ANALOG:
61 gate = priv->gate;
62 break;
63 case TDA18271_GATE_AUTO:
64 default:
65 switch (priv->mode) {
66 case TDA18271_DIGITAL:
67 gate = TDA18271_GATE_DIGITAL;
68 break;
69 case TDA18271_ANALOG:
70 default:
71 gate = TDA18271_GATE_ANALOG;
72 break;
73 }
74 }
75
76 switch (gate) {
77 case TDA18271_GATE_ANALOG:
57 if (ops && ops->i2c_gate_ctrl) 78 if (ops && ops->i2c_gate_ctrl)
58 ret = ops->i2c_gate_ctrl(fe, enable); 79 ret = ops->i2c_gate_ctrl(fe, enable);
59 break; 80 break;
60 case TDA18271_DIGITAL: 81 case TDA18271_GATE_DIGITAL:
61 if (fe->ops.i2c_gate_ctrl) 82 if (fe->ops.i2c_gate_ctrl)
62 ret = fe->ops.i2c_gate_ctrl(fe, enable); 83 ret = fe->ops.i2c_gate_ctrl(fe, enable);
63 break; 84 break;
85 default:
86 ret = -EINVAL;
87 break;
64 } 88 }
65 89
66 return ret; 90 return ret;
@@ -713,7 +737,8 @@ static struct dvb_tuner_ops tda18271_tuner_ops = {
713}; 737};
714 738
715struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, 739struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
716 struct i2c_adapter *i2c) 740 struct i2c_adapter *i2c,
741 enum tda18271_i2c_gate gate)
717{ 742{
718 struct tda18271_priv *priv = NULL; 743 struct tda18271_priv *priv = NULL;
719 744
@@ -724,6 +749,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
724 749
725 priv->i2c_addr = addr; 750 priv->i2c_addr = addr;
726 priv->i2c_adap = i2c; 751 priv->i2c_adap = i2c;
752 priv->gate = gate;
727 753
728 memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops, 754 memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,
729 sizeof(struct dvb_tuner_ops)); 755 sizeof(struct dvb_tuner_ops));