u8 i2c_addr;
struct i2c_adapter *i2c_adap;
unsigned char tda18271_regs[TDA18271_NUM_REGS];
+
enum tda18271_mode mode;
+ enum tda18271_i2c_gate gate;
u32 frequency;
u32 bandwidth;
{
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;
};
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;
priv->i2c_addr = addr;
priv->i2c_adap = i2c;
+ priv->gate = gate;
memcpy(&fe->ops.tuner_ops, &tda18271_tuner_ops,
sizeof(struct dvb_tuner_ops));
#include <linux/i2c.h>
#include "dvb_frontend.h"
+enum tda18271_i2c_gate {
+ TDA18271_GATE_AUTO = 0,
+ TDA18271_GATE_ANALOG,
+ TDA18271_GATE_DIGITAL,
+};
+
#if defined(CONFIG_DVB_TDA18271) || (defined(CONFIG_DVB_TDA18271_MODULE) && defined(MODULE))
extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
- struct i2c_adapter *i2c);
+ struct i2c_adapter *i2c,
+ enum tda18271_i2c_gate gate);
#else
static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
u8 addr,
- struct i2c_adapter *i2c)
+ struct i2c_adapter *i2c,
+ enum tda18271_i2c_gate gate);
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
return NULL;