mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
V4L/DVB (6449): tda18271: clean up i2c_gate handling
Call analog_demod_ops->i2c_gate_ctrl when in analog tuning mode, and frontend_ops.i2c_gate_ctrl when in digital tuning mode. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
a72dd305f9
commit
7d11c53c5d
2 changed files with 26 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
|
EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/
|
||||||
|
EXTRA_CFLAGS += -Idrivers/media/video/
|
||||||
|
|
||||||
obj-$(CONFIG_DVB_PLL) += dvb-pll.o
|
obj-$(CONFIG_DVB_PLL) += dvb-pll.o
|
||||||
obj-$(CONFIG_DVB_STV0299) += stv0299.o
|
obj-$(CONFIG_DVB_STV0299) += stv0299.o
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
#include "tuner-driver.h"
|
||||||
|
|
||||||
#include "tda18271.h"
|
#include "tda18271.h"
|
||||||
|
|
||||||
|
@ -324,6 +325,26 @@ struct tda18271_priv {
|
||||||
u32 bandwidth;
|
u32 bandwidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
switch (priv->mode) {
|
||||||
|
case TDA18271_ANALOG:
|
||||||
|
if (ops && ops->i2c_gate_ctrl)
|
||||||
|
ret = ops->i2c_gate_ctrl(fe, enable);
|
||||||
|
break;
|
||||||
|
case TDA18271_DIGITAL:
|
||||||
|
if (fe->ops.i2c_gate_ctrl)
|
||||||
|
ret = fe->ops.i2c_gate_ctrl(fe, enable);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void tda18271_dump_regs(struct dvb_frontend *fe)
|
static void tda18271_dump_regs(struct dvb_frontend *fe)
|
||||||
|
@ -363,14 +384,12 @@ static void tda18271_read_regs(struct dvb_frontend *fe)
|
||||||
.buf = regs, .len = 16 }
|
.buf = regs, .len = 16 }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (fe->ops.i2c_gate_ctrl)
|
tda18271_i2c_gate_ctrl(fe, 1);
|
||||||
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
||||||
|
|
||||||
/* read all registers */
|
/* read all registers */
|
||||||
ret = i2c_transfer(priv->i2c_adap, msg, 2);
|
ret = i2c_transfer(priv->i2c_adap, msg, 2);
|
||||||
|
|
||||||
if (fe->ops.i2c_gate_ctrl)
|
tda18271_i2c_gate_ctrl(fe, 0);
|
||||||
fe->ops.i2c_gate_ctrl(fe, 0);
|
|
||||||
|
|
||||||
if (ret != 2)
|
if (ret != 2)
|
||||||
printk("ERROR: %s: i2c_transfer returned: %d\n",
|
printk("ERROR: %s: i2c_transfer returned: %d\n",
|
||||||
|
@ -396,14 +415,12 @@ static void tda18271_write_regs(struct dvb_frontend *fe, int idx, int len)
|
||||||
buf[i] = regs[idx-1+i];
|
buf[i] = regs[idx-1+i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fe->ops.i2c_gate_ctrl)
|
tda18271_i2c_gate_ctrl(fe, 1);
|
||||||
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
||||||
|
|
||||||
/* write registers */
|
/* write registers */
|
||||||
ret = i2c_transfer(priv->i2c_adap, &msg, 1);
|
ret = i2c_transfer(priv->i2c_adap, &msg, 1);
|
||||||
|
|
||||||
if (fe->ops.i2c_gate_ctrl)
|
tda18271_i2c_gate_ctrl(fe, 0);
|
||||||
fe->ops.i2c_gate_ctrl(fe, 0);
|
|
||||||
|
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
printk(KERN_WARNING "ERROR: %s: i2c_transfer returned: %d\n",
|
printk(KERN_WARNING "ERROR: %s: i2c_transfer returned: %d\n",
|
||||||
|
|
Loading…
Reference in a new issue