diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-12-09 20:23:30 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:03:32 -0500 |
commit | e435f95ce6468f0240f050e14c9eac93e2fe7e71 (patch) | |
tree | 574b8764e3206b37666bda01acc2b0f1a4d44dde /drivers | |
parent | 7206abbc2d19b6846b879fb266672b40da9961cb (diff) |
V4L/DVB (6801): tda18271: pass i2c gate configuration into tda18271_attach()
If we pass TDA18271_GATE_DIGITAL into tda18271_attach(), it will always try to
use the digital demodulator's i2c gate.
If we pass TDA18271_GATE_ANALOG into tda18271_attach(), it will always try to
use the analog demodulator's i2c gate.
If we pass TDA18271_GATE_AUTO into tda18271_attach(), it will try to use the
analog demodulator's i2c gate when tuning in analog mode, and it will try to
use the digital demodulator's i2c gate when tuning in digital mode.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-fe.c | 34 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271.h | 12 | ||||
-rw-r--r-- | drivers/media/video/tda8290.c | 3 |
3 files changed, 42 insertions, 7 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 | ||
715 | struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | 739 | struct 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)); |
diff --git a/drivers/media/dvb/frontends/tda18271.h b/drivers/media/dvb/frontends/tda18271.h index a8a19a7197f0..d8400337263b 100644 --- a/drivers/media/dvb/frontends/tda18271.h +++ b/drivers/media/dvb/frontends/tda18271.h | |||
@@ -24,13 +24,21 @@ | |||
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include "dvb_frontend.h" | 25 | #include "dvb_frontend.h" |
26 | 26 | ||
27 | enum tda18271_i2c_gate { | ||
28 | TDA18271_GATE_AUTO = 0, | ||
29 | TDA18271_GATE_ANALOG, | ||
30 | TDA18271_GATE_DIGITAL, | ||
31 | }; | ||
32 | |||
27 | #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE)) | 33 | #if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE)) |
28 | extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | 34 | extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, |
29 | struct i2c_adapter *i2c); | 35 | struct i2c_adapter *i2c, |
36 | enum tda18271_i2c_gate gate); | ||
30 | #else | 37 | #else |
31 | static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, | 38 | static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, |
32 | u8 addr, | 39 | u8 addr, |
33 | struct i2c_adapter *i2c) | 40 | struct i2c_adapter *i2c, |
41 | enum tda18271_i2c_gate gate); | ||
34 | { | 42 | { |
35 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); | 43 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); |
36 | return NULL; | 44 | return NULL; |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 403f96f998ec..a451d9480c1d 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -574,7 +574,8 @@ static int tda829x_find_tuner(struct dvb_frontend *fe) | |||
574 | if (data == 0x83) { | 574 | if (data == 0x83) { |
575 | priv->ver |= TDA18271; | 575 | priv->ver |= TDA18271; |
576 | tda18271_attach(fe, priv->tda827x_addr, | 576 | tda18271_attach(fe, priv->tda827x_addr, |
577 | priv->i2c_props.adap); | 577 | priv->i2c_props.adap, |
578 | TDA18271_GATE_ANALOG); | ||
578 | } else { | 579 | } else { |
579 | if ((data & 0x3c) == 0) | 580 | if ((data & 0x3c) == 0) |
580 | priv->ver |= TDA8275; | 581 | priv->ver |= TDA8275; |