Commit d7cba043 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (9049): convert tuner drivers to use dvb_frontend->callback

Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ebb8d68a
...@@ -447,17 +447,19 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, ...@@ -447,17 +447,19 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
else else
arg = 0; arg = 0;
} }
if (priv->cfg->tuner_callback) if (fe->callback)
priv->cfg->tuner_callback(priv->i2c_adap->algo_data, fe->callback(priv->i2c_adap->algo_data,
gp_func, arg); DVB_FRONTEND_COMPONENT_TUNER,
gp_func, arg);
buf[1] = high ? 0 : 1; buf[1] = high ? 0 : 1;
if (priv->cfg->config == 2) if (priv->cfg->config == 2)
buf[1] = high ? 1 : 0; buf[1] = high ? 1 : 0;
i2c_transfer(priv->i2c_adap, &msg, 1); i2c_transfer(priv->i2c_adap, &msg, 1);
break; break;
case 3: /* switch with GPIO of saa713x */ case 3: /* switch with GPIO of saa713x */
if (priv->cfg->tuner_callback) if (fe->callback)
priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high); fe->callback(priv->i2c_adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER, 0, high);
break; break;
} }
} }
......
...@@ -36,7 +36,6 @@ struct tda827x_config ...@@ -36,7 +36,6 @@ struct tda827x_config
/* interface to tda829x driver */ /* interface to tda829x driver */
unsigned int config; unsigned int config;
int switch_addr; int switch_addr;
int (*tuner_callback) (void *dev, int command, int arg);
void (*agcf)(struct dvb_frontend *fe); void (*agcf)(struct dvb_frontend *fe);
}; };
......
...@@ -672,10 +672,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, ...@@ -672,10 +672,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
priv->i2c_props.addr = i2c_addr; priv->i2c_props.addr = i2c_addr;
priv->i2c_props.adap = i2c_adap; priv->i2c_props.adap = i2c_adap;
priv->i2c_props.name = "tda829x"; priv->i2c_props.name = "tda829x";
if (cfg) { if (cfg)
priv->cfg.config = cfg->lna_cfg; priv->cfg.config = cfg->lna_cfg;
priv->cfg.tuner_callback = cfg->tuner_callback;
}
if (tda8290_probe(&priv->i2c_props) == 0) { if (tda8290_probe(&priv->i2c_props) == 0) {
priv->ver = TDA8290; priv->ver = TDA8290;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
struct tda829x_config { struct tda829x_config {
unsigned int lna_cfg; unsigned int lna_cfg;
int (*tuner_callback) (void *dev, int command, int arg);
unsigned int probe_tuner:1; unsigned int probe_tuner:1;
#define TDA829X_PROBE_TUNER 0 #define TDA829X_PROBE_TUNER 0
......
...@@ -71,9 +71,6 @@ struct firmware_properties { ...@@ -71,9 +71,6 @@ struct firmware_properties {
struct xc2028_data { struct xc2028_data {
struct list_head hybrid_tuner_instance_list; struct list_head hybrid_tuner_instance_list;
struct tuner_i2c_props i2c_props; struct tuner_i2c_props i2c_props;
int (*tuner_callback) (void *dev,
int command, int arg);
void *video_dev;
__u32 frequency; __u32 frequency;
struct firmware_description *firm; struct firmware_description *firm;
...@@ -492,6 +489,23 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -492,6 +489,23 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
return i; return i;
} }
static inline int do_tuner_callback(struct dvb_frontend *fe, int cmd, int arg)
{
struct xc2028_data *priv = fe->tuner_priv;
/* analog side (tuner-core) uses i2c_adap->algo_data.
* digital side is not guaranteed to have algo_data defined.
*
* digital side will always have fe->dvb defined.
* analog side (tuner-core) doesn't (yet) define fe->dvb.
*/
return (!fe->callback) ? -EINVAL :
fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
fe->dvb->priv : priv->i2c_props.adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER, cmd, arg);
}
static int load_firmware(struct dvb_frontend *fe, unsigned int type, static int load_firmware(struct dvb_frontend *fe, unsigned int type,
v4l2_std_id *id) v4l2_std_id *id)
{ {
...@@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
if (!size) { if (!size) {
/* Special callback command received */ /* Special callback command received */
rc = priv->tuner_callback(priv->video_dev, rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
XC2028_TUNER_RESET, 0);
if (rc < 0) { if (rc < 0) {
tuner_err("Error at RESET code %d\n", tuner_err("Error at RESET code %d\n",
(*p) & 0x7f); (*p) & 0x7f);
...@@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
if (size >= 0xff00) { if (size >= 0xff00) {
switch (size) { switch (size) {
case 0xff00: case 0xff00:
rc = priv->tuner_callback(priv->video_dev, rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0);
XC2028_RESET_CLK, 0);
if (rc < 0) { if (rc < 0) {
tuner_err("Error at RESET code %d\n", tuner_err("Error at RESET code %d\n",
(*p) & 0x7f); (*p) & 0x7f);
...@@ -715,8 +727,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, ...@@ -715,8 +727,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw)); memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
/* Reset is needed before loading firmware */ /* Reset is needed before loading firmware */
rc = priv->tuner_callback(priv->video_dev, rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
XC2028_TUNER_RESET, 0);
if (rc < 0) if (rc < 0)
goto fail; goto fail;
...@@ -933,7 +944,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, ...@@ -933,7 +944,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
The reset CLK is needed only with tm6000. The reset CLK is needed only with tm6000.
Driver should work fine even if this fails. Driver should work fine even if this fails.
*/ */
priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1); do_tuner_callback(fe, XC2028_RESET_CLK, 1);
msleep(10); msleep(10);
...@@ -1177,20 +1188,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, ...@@ -1177,20 +1188,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
break; break;
case 1: case 1:
/* new tuner instance */ /* new tuner instance */
priv->tuner_callback = cfg->callback;
priv->ctrl.max_len = 13; priv->ctrl.max_len = 13;
mutex_init(&priv->lock); mutex_init(&priv->lock);
/* analog side (tuner-core) uses i2c_adap->algo_data.
* digital side is not guaranteed to have algo_data defined.
*
* digital side will always have fe->dvb defined.
* analog side (tuner-core) doesn't (yet) define fe->dvb.
*/
priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ?
fe->dvb->priv : cfg->i2c_adap->algo_data;
fe->tuner_priv = priv; fe->tuner_priv = priv;
break; break;
case 2: case 2:
......
...@@ -39,9 +39,7 @@ struct xc2028_ctrl { ...@@ -39,9 +39,7 @@ struct xc2028_ctrl {
struct xc2028_config { struct xc2028_config {
struct i2c_adapter *i2c_adap; struct i2c_adapter *i2c_adap;
u8 i2c_addr; u8 i2c_addr;
void *video_dev;
struct xc2028_ctrl *ctrl; struct xc2028_ctrl *ctrl;
int (*callback) (void *dev, int command, int arg);
}; };
/* xc2028 commands for callback */ /* xc2028 commands for callback */
......
...@@ -58,8 +58,6 @@ struct xc5000_priv { ...@@ -58,8 +58,6 @@ struct xc5000_priv {
u32 bandwidth; u32 bandwidth;
u8 video_standard; u8 video_standard;
u8 rf_mode; u8 rf_mode;
int (*tuner_callback) (void *priv, int command, int arg);
}; };
/* Misc Defines */ /* Misc Defines */
...@@ -232,10 +230,11 @@ static void xc5000_TunerReset(struct dvb_frontend *fe) ...@@ -232,10 +230,11 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
if (priv->tuner_callback) { if (fe->callback) {
ret = priv->tuner_callback(((fe->dvb) && (fe->dvb->priv)) ? ret = fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
fe->dvb->priv : fe->dvb->priv :
priv->i2c_props.adap->algo_data, priv->i2c_props.adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER,
XC5000_TUNER_RESET, 0); XC5000_TUNER_RESET, 0);
if (ret) if (ret)
printk(KERN_ERR "xc5000: reset failed\n"); printk(KERN_ERR "xc5000: reset failed\n");
...@@ -975,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, ...@@ -975,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
/* new tuner instance */ /* new tuner instance */
priv->bandwidth = BANDWIDTH_6_MHZ; priv->bandwidth = BANDWIDTH_6_MHZ;
priv->if_khz = cfg->if_khz; priv->if_khz = cfg->if_khz;
priv->tuner_callback = cfg->tuner_callback;
fe->tuner_priv = priv; fe->tuner_priv = priv;
break; break;
......
...@@ -30,8 +30,6 @@ struct i2c_adapter; ...@@ -30,8 +30,6 @@ struct i2c_adapter;
struct xc5000_config { struct xc5000_config {
u8 i2c_address; u8 i2c_address;
u32 if_khz; u32 if_khz;
int (*tuner_callback) (void *priv, int command, int arg);
}; };
/* xc5000 callback command */ /* xc5000 callback command */
......
...@@ -742,7 +742,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -742,7 +742,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
return 0; return 0;
} }
static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg) static int dvico_bluebird_xc2028_callback(void *ptr, int component,
int command, int arg)
{ {
struct dvb_usb_adapter *adap = ptr; struct dvb_usb_adapter *adap = ptr;
struct dvb_usb_device *d = adap->dev; struct dvb_usb_device *d = adap->dev;
...@@ -770,7 +771,6 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -770,7 +771,6 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = &adap->dev->i2c_adap, .i2c_adap = &adap->dev->i2c_adap,
.i2c_addr = 0x61, .i2c_addr = 0x61,
.callback = dvico_bluebird_xc2028_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE, .fname = XC2028_DEFAULT_FIRMWARE,
...@@ -778,6 +778,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -778,6 +778,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
.demod = XC3028_FE_ZARLINK456, .demod = XC3028_FE_ZARLINK456,
}; };
/* FIXME: generalize & move to common area */
adap->fe->callback = dvico_bluebird_xc2028_callback;
fe = dvb_attach(xc2028_attach, adap->fe, &cfg); fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
if (fe == NULL || fe->ops.tuner_ops.set_config == NULL) if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
return -EIO; return -EIO;
......
...@@ -368,7 +368,8 @@ static struct dib7000p_config stk7700ph_dib7700_xc3028_config = { ...@@ -368,7 +368,8 @@ static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
}; };
static int stk7700ph_xc3028_callback(void *ptr, int command, int arg) static int stk7700ph_xc3028_callback(void *ptr, int component,
int command, int arg)
{ {
struct dvb_usb_adapter *adap = ptr; struct dvb_usb_adapter *adap = ptr;
...@@ -396,7 +397,6 @@ static struct xc2028_ctrl stk7700ph_xc3028_ctrl = { ...@@ -396,7 +397,6 @@ static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {
static struct xc2028_config stk7700ph_xc3028_config = { static struct xc2028_config stk7700ph_xc3028_config = {
.i2c_addr = 0x61, .i2c_addr = 0x61,
.callback = stk7700ph_xc3028_callback,
.ctrl = &stk7700ph_xc3028_ctrl, .ctrl = &stk7700ph_xc3028_ctrl,
}; };
...@@ -437,7 +437,9 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -437,7 +437,9 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
DIBX000_I2C_INTERFACE_TUNER, 1); DIBX000_I2C_INTERFACE_TUNER, 1);
stk7700ph_xc3028_config.i2c_adap = tun_i2c; stk7700ph_xc3028_config.i2c_adap = tun_i2c;
stk7700ph_xc3028_config.video_dev = adap;
/* FIXME: generalize & move to common area */
adap->fe->callback = stk7700ph_xc3028_callback;
return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config) return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)
== NULL ? -ENODEV : 0; == NULL ? -ENODEV : 0;
......
...@@ -46,7 +46,7 @@ struct au0828_board au0828_boards[] = { ...@@ -46,7 +46,7 @@ struct au0828_board au0828_boards[] = {
/* Tuner callback function for au0828 boards. Currently only needed /* Tuner callback function for au0828 boards. Currently only needed
* for HVR1500Q, which has an xc5000 tuner. * for HVR1500Q, which has an xc5000 tuner.
*/ */
int au0828_tuner_callback(void *priv, int command, int arg) int au0828_tuner_callback(void *priv, int component, int command, int arg)
{ {
struct au0828_dev *dev = priv; struct au0828_dev *dev = priv;
......
...@@ -53,7 +53,6 @@ static struct au8522_config hauppauge_woodbury_config = { ...@@ -53,7 +53,6 @@ static struct au8522_config hauppauge_woodbury_config = {
static struct xc5000_config hauppauge_hvr950q_tunerconfig = { static struct xc5000_config hauppauge_hvr950q_tunerconfig = {
.i2c_address = 0x61, .i2c_address = 0x61,
.if_khz = 6000, .if_khz = 6000,
.tuner_callback = au0828_tuner_callback
}; };
static struct mxl5007t_config mxl5007t_hvr950q_config = { static struct mxl5007t_config mxl5007t_hvr950q_config = {
...@@ -389,6 +388,8 @@ int au0828_dvb_register(struct au0828_dev *dev) ...@@ -389,6 +388,8 @@ int au0828_dvb_register(struct au0828_dev *dev)
__func__); __func__);
return -1; return -1;
} }
/* define general-purpose callback pointer */
dvb->frontend->callback = au0828_tuner_callback;
/* register everything */ /* register everything */
ret = dvb_register(dev); ret = dvb_register(dev);
......
...@@ -103,7 +103,8 @@ extern int au0828_debug; ...@@ -103,7 +103,8 @@ extern int au0828_debug;
extern struct au0828_board au0828_boards[]; extern struct au0828_board au0828_boards[];
extern struct usb_device_id au0828_usb_id_table[]; extern struct usb_device_id au0828_usb_id_table[];
extern void au0828_gpio_setup(struct au0828_dev *dev); extern void au0828_gpio_setup(struct au0828_dev *dev);
extern int au0828_tuner_callback(void *priv, int command, int arg); extern int au0828_tuner_callback(void *priv, int component,
int command, int arg);
extern void au0828_card_setup(struct au0828_dev *dev); extern void au0828_card_setup(struct au0828_dev *dev);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
......
...@@ -152,7 +152,7 @@ void cx18_gpio_init(struct cx18 *cx) ...@@ -152,7 +152,7 @@ void cx18_gpio_init(struct cx18 *cx)
} }
/* Xceive tuner reset function */ /* Xceive tuner reset function */
int cx18_reset_tuner_gpio(void *dev, int cmd, int value) int cx18_reset_tuner_gpio(void *dev, int component, int cmd, int value)
{ {
struct i2c_algo_bit_data *algo = dev; struct i2c_algo_bit_data *algo = dev;
struct cx18_i2c_algo_callback_data *cb_data = algo->data; struct cx18_i2c_algo_callback_data *cb_data = algo->data;
......
...@@ -23,5 +23,5 @@ ...@@ -23,5 +23,5 @@
void cx18_gpio_init(struct cx18 *cx); void cx18_gpio_init(struct cx18 *cx);
void cx18_reset_i2c_slaves_gpio(struct cx18 *cx); void cx18_reset_i2c_slaves_gpio(struct cx18 *cx);
void cx18_reset_ir_gpio(void *data); void cx18_reset_ir_gpio(void *data);
int cx18_reset_tuner_gpio(void *dev, int cmd, int value); int cx18_reset_tuner_gpio(void *dev, int component, int cmd, int value);
int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg); int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg);
...@@ -337,7 +337,7 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) ...@@ -337,7 +337,7 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
dev->name, tv.model); dev->name, tv.model);
} }
int cx23885_tuner_callback(void *priv, int command, int arg) int cx23885_tuner_callback(void *priv, int component, int command, int arg)
{ {
struct cx23885_tsport *port = priv; struct cx23885_tsport *port = priv;
struct cx23885_dev *dev = port->dev; struct cx23885_dev *dev = port->dev;
......
...@@ -189,13 +189,11 @@ static struct s5h1411_config dvico_s5h1411_config = { ...@@ -189,13 +189,11 @@ static struct s5h1411_config dvico_s5h1411_config = {
static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
.i2c_address = 0x61, .i2c_address = 0x61,
.if_khz = 5380, .if_khz = 5380,
.tuner_callback = cx23885_tuner_callback,
}; };
static struct xc5000_config dvico_xc5000_tunerconfig = { static struct xc5000_config dvico_xc5000_tunerconfig = {
.i2c_address = 0x64, .i2c_address = 0x64,
.if_khz = 5380, .if_khz = 5380,
.tuner_callback = cx23885_tuner_callback,
}; };
static struct tda829x_config tda829x_no_probe = { static struct tda829x_config tda829x_no_probe = {
...@@ -403,8 +401,6 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -403,8 +401,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = &i2c_bus->i2c_adap, .i2c_adap = &i2c_bus->i2c_adap,
.i2c_addr = 0x61, .i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_tuner_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE, .fname = XC2028_DEFAULT_FIRMWARE,
...@@ -443,8 +439,6 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -443,8 +439,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = &dev->i2c_bus[1].i2c_adap, .i2c_adap = &dev->i2c_bus[1].i2c_adap,
.i2c_addr = 0x64, .i2c_addr = 0x64,
.video_dev = port,
.callback = cx23885_tuner_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = XC3028L_DEFAULT_FIRMWARE, .fname = XC3028L_DEFAULT_FIRMWARE,
...@@ -485,8 +479,6 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -485,8 +479,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = &i2c_bus->i2c_adap, .i2c_adap = &i2c_bus->i2c_adap,
.i2c_addr = 0x61, .i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_tuner_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE, .fname = XC2028_DEFAULT_FIRMWARE,
...@@ -512,8 +504,6 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -512,8 +504,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = &dev->i2c_bus[1].i2c_adap, .i2c_adap = &dev->i2c_bus[1].i2c_adap,
.i2c_addr = 0x61, .i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_tuner_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE, .fname = XC2028_DEFAULT_FIRMWARE,
...@@ -536,6 +526,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -536,6 +526,8 @@ static int dvb_register(struct cx23885_tsport *port)
printk("%s: frontend initialization failed\n", dev->name); printk("%s: frontend initialization failed\n", dev->name);
return -1; return -1;
} }
/* define general-purpose callback pointer */
port->dvb.frontend->callback = cx23885_tuner_callback;
/* Put the analog decoder in standby to keep it quiet */ /* Put the analog decoder in standby to keep it quiet */
cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL); cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL);
......
...@@ -411,7 +411,7 @@ extern const unsigned int cx23885_bcount; ...@@ -411,7 +411,7 @@ extern const unsigned int cx23885_bcount;
extern struct cx23885_subid cx23885_subids[]; extern struct cx23885_subid cx23885_subids[];
extern const unsigned int cx23885_idcount; extern const unsigned int cx23885_idcount;
extern int cx23885_tuner_callback(void *priv, int command, int arg); extern int cx23885_tuner_callback(void *priv, int component, int command, int arg);
extern void cx23885_card_list(struct cx23885_dev *dev); extern void cx23885_card_list(struct cx23885_dev *dev);
extern int cx23885_ir_init(struct cx23885_dev *dev); extern int cx23885_ir_init(struct cx23885_dev *dev);
extern void cx23885_gpio_setup(struct cx23885_dev *dev); extern void cx23885_gpio_setup(struct cx23885_dev *dev);
......
...@@ -2308,9 +2308,21 @@ static int cx88_dvico_xc2028_callback(struct cx88_core *core, ...@@ -2308,9 +2308,21 @@ static int cx88_dvico_xc2028_callback(struct cx88_core *core,
{ {
switch (command) { switch (command) {
case XC2028_TUNER_RESET: case XC2028_TUNER_RESET:
cx_write(MO_GP0_IO, 0x101000); switch (core->boardnr) {
mdelay(5); case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
cx_set(MO_GP0_IO, 0x101010); /* GPIO-4 xc3028 tuner */
cx_set(MO_GP0_IO, 0x00001000);
cx_clear(MO_GP0_IO, 0x00000010);
msleep(100);
cx_set(MO_GP0_IO, 0x00000010);
msleep(100);
break;
default:
cx_write(MO_GP0_IO, 0x101000);
mdelay(5);
cx_set(MO_GP0_IO, 0x101010);
}
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -2419,6 +2431,7 @@ static int cx88_xc2028_tuner_callback(struct cx88_core *core, ...@@ -2419,6 +2431,7 @@ static int cx88_xc2028_tuner_callback(struct cx88_core *core,
case CX88_BOARD_PROLINK_PV_8000GT: case CX88_BOARD_PROLINK_PV_8000GT:
return cx88_pv_8000gt_callback(core, command, arg); return cx88_pv_8000gt_callback(core, command, arg);
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO: case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO:
case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
return cx88_dvico_xc2028_callback(core, command, arg); return cx88_dvico_xc2028_callback(core, command, arg);
} }
...@@ -2486,7 +2499,7 @@ static int cx88_xc5000_tuner_callback(struct cx88_core *core, ...@@ -2486,7 +2499,7 @@ static int cx88_xc5000_tuner_callback(struct cx88_core *core,
return 0; /* Should never be here */ return 0; /* Should never be here */
} }
int cx88_tuner_callback(void *priv, int command, int arg) int cx88_tuner_callback(void *priv, int component, int command, int arg)
{ {
struct i2c_algo_bit_data *i2c_algo = priv; struct i2c_algo_bit_data *i2c_algo = priv;
struct cx88_core *core; struct cx88_core *core;
...@@ -2503,6 +2516,9 @@ int cx88_tuner_callback(void *priv, int command, int arg) ...@@ -2503,6 +2516,9 @@ int cx88_tuner_callback(void *priv, int command, int arg)
return -EINVAL; return -EINVAL;
} }
if (component != DVB_FRONTEND_COMPONENT_TUNER)
return -EINVAL;
switch (core->board.tuner_type) { switch (core->board.tuner_type) {
case TUNER_XC2028: case TUNER_XC2028:
info_printk(core, "Calling XC2028/3028 callback\n"); info_printk(core, "Calling XC2028/3028 callback\n");
......
...@@ -405,40 +405,6 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, ...@@ -405,40 +405,6 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe,
return 0; return 0;
} }
static int cx88_pci_nano_callback(void *ptr, int command, int arg)
{
struct cx88_core *core = ptr;
switch (command) {
case XC2028_TUNER_RESET:
/* Send the tuner in then out of reset */
dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg);
switch (core->boardnr) {
case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO:
/* GPIO-4 xc3028 tuner */
cx_set(MO_GP0_IO, 0x00001000);
cx_clear(MO_GP0_IO, 0x00000010);
msleep(100);
cx_set(MO_GP0_IO, 0x00000010);
msleep(100);
break;
}
break;
case XC2028_RESET_CLK:
dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg);
break;
default:
dprintk(1, "%s: unknown command %d, arg %d\n", __func__,
command, arg);
return -EINVAL;
}
return 0;
}
static struct cx24123_config geniatech_dvbs_config = { static struct cx24123_config geniatech_dvbs_config = {
.demod_address = 0x55, .demod_address = 0x55,
.set_ts_params = cx24123_set_ts_param, .set_ts_params = cx24123_set_ts_param,
...@@ -486,7 +452,6 @@ static struct s5h1409_config kworld_atsc_120_config = { ...@@ -486,7 +452,6 @@ static struct s5h1409_config kworld_atsc_120_config = {
static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = { static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
.i2c_address = 0x64, .i2c_address = 0x64,
.if_khz = 5380, .if_khz = 5380,
.tuner_callback = cx88_tuner_callback,
}; };
static struct zl10353_config cx88_geniatech_x8000_mt = { static struct zl10353_config cx88_geniatech_x8000_mt = {
...@@ -507,7 +472,6 @@ static struct s5h1411_config dvico_fusionhdtv7_config = { ...@@ -507,7 +472,6 @@ static struct s5h1411_config dvico_fusionhdtv7_config = {
static struct xc5000_config dvico_fusionhdtv7_tuner_config = { static struct xc5000_config dvico_fusionhdtv7_tuner_config = {
.i2c_address = 0xc2 >> 1, .i2c_address = 0xc2 >> 1,
.if_khz = 5380, .if_khz = 5380,
.tuner_callback = cx88_tuner_callback,
}; };
static int attach_xc3028(u8 addr, struct cx8802_dev *dev) static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
...@@ -518,7 +482,6 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev) ...@@ -518,7 +482,6 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
.i2c_adap = &dev->core->i2c_adap, .i2c_adap = &dev->core->i2c_adap,
.i2c_addr = addr, .i2c_addr = addr,
.ctrl = &ctl, .ctrl = &ctl,
.callback = cx88_tuner_callback,
}; };
if (!dev->dvb.frontend) { if (!dev->dvb.frontend) {
...@@ -912,7 +875,6 @@ static int dvb_register(struct cx8802_dev *dev) ...@@ -912,7 +875,6 @@ static int dvb_register(struct cx8802_dev *dev)
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = &core->i2c_adap, .i2c_adap = &core->i2c_adap,
.i2c_addr = 0x61, .i2c_addr = 0x61,
.callback = cx88_pci_nano_callback,
}; };
static struct xc2028_ctrl ctl = { static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE, .fname = XC2028_DEFAULT_FIRMWARE,
...@@ -1035,6 +997,8 @@ static int dvb_register(struct cx8802_dev *dev) ...@@ -1035,6 +997,8 @@ static int dvb_register(struct cx8802_dev *dev)
core->name); core->name);
return -EINVAL; return -EINVAL;
} }
/* define general-purpose callback pointer */
dev->dvb.frontend->callback = cx88_tuner_callback;
/* Ensure all frontends negotiate bus access */ /* Ensure all frontends negotiate bus access */
dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; dev->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;
......
...@@ -607,7 +607,7 @@ extern void cx88_call_i2c_clients(struct cx88_core *core, ...@@ -607,7 +607,7 @@ extern void cx88_call_i2c_clients(struct cx88_core *core,
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* cx88-cards.c */ /* cx88-cards.c */
extern int cx88_tuner_callback(void *dev, int command, int arg); extern int cx88_tuner_callback(void *dev, int component, int command, int arg);
extern int cx88_get_resources(const struct cx88_core *core, extern int cx88_get_resources(const struct cx88_core *core,
struct pci_dev *pci); struct pci_dev *pci);
extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr); extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
......
...@@ -1271,7 +1271,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = { ...@@ -1271,7 +1271,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
{0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT}, {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT},
}; };
int em28xx_tuner_callback(void *ptr, int command, int arg) int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
{ {
int rc = 0; int rc = 0;
struct em28xx *dev = ptr; struct em28xx *dev = ptr;
......
...@@ -249,7 +249,6 @@ static int attach_xc3028(u8 addr, struct em28xx *dev) ...@@ -249,7 +249,6 @@ static int attach_xc3028(u8 addr, struct em28xx *dev)
memset(&cfg, 0, sizeof(cfg)); memset(&cfg, 0, sizeof(cfg));
cfg.i2c_adap = &dev->i2c_adap; cfg.i2c_adap = &dev->i2c_adap;
cfg.i2c_addr = addr; cfg.i2c_addr = addr;
cfg.callback = em28xx_tuner_callback;
if (!dev->dvb->frontend) { if (!dev->dvb->frontend) {
printk(KERN_ERR "%s/2: dvb frontend not attached. " printk(KERN_ERR "%s/2: dvb frontend not attached. "
...@@ -474,6 +473,8 @@ static int dvb_init(struct em28xx *dev) ...@@ -474,6 +473,8 @@ static int dvb_init(struct em28xx *dev)
result = -EINVAL; result = -EINVAL;
goto out_free; goto out_free;
} }
/* define general-purpose callback pointer */
dvb->frontend->callback = em28xx_tuner_callback;
/* register everything */ /* register everything */
result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev); result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);
......
...@@ -528,7 +528,7 @@ extern struct em28xx_board em28xx_boards[]; ...@@ -528,7 +528,7 @@ extern struct em28xx_board em28xx_boards[];
extern struct usb_device_id em28xx_id_table[]; extern struct usb_device_id em28xx_id_table[];
extern const unsigned int em28xx_bcount; extern const unsigned int em28xx_bcount;
void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
int em28xx_tuner_callback(void *ptr, int command, int arg); int em28xx_tuner_callback(void *ptr, int component, int command, int arg);
/* Provided by em28xx-input.c */ /* Provided by em28xx-input.c */
/* TODO: Check if the standard get_key handlers on ir-common can be used */ /* TODO: Check if the standard get_key handlers on ir-common can be used */
......
...@@ -124,7 +124,7 @@ void ivtv_reset_ir_gpio(struct ivtv *itv) ...@@ -124,7 +124,7 @@ void ivtv_reset_ir_gpio(struct ivtv *itv)
} }
/* Xceive tuner reset function */ /* Xceive tuner reset function */
int ivtv_reset_tuner_gpio(void *dev, int cmd, int value) int ivtv_reset_tuner_gpio(void *dev, int component, int cmd, int value)
{ {
struct i2c_algo_bit_data *algo = dev; struct i2c_algo_bit_data *algo = dev;
struct ivtv *itv = algo->data; struct ivtv *itv = algo->data;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/* GPIO stuff */ /* GPIO stuff */
void ivtv_gpio_init(struct ivtv *itv); void ivtv_gpio_init(struct ivtv *itv);
void ivtv_reset_ir_gpio(struct ivtv *itv); void ivtv_reset_ir_gpio(struct ivtv *itv);
int ivtv_reset_tuner_gpio(void *dev, int cmd, int value); int ivtv_reset_tuner_gpio(void *dev, int component, int cmd, int value);
int ivtv_gpio(struct ivtv *itv, unsigned int command, void *arg); int ivtv_gpio(struct ivtv *itv, unsigned int command, void *arg);
#endif #endif
...@@ -5576,7 +5576,7 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev, ...@@ -5576,7 +5576,7 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev,
return 0; return 0;
} }
int saa7134_tuner_callback(void *priv, int command, int arg) int saa7134_tuner_callback(void *priv, int component, int command, int arg)
{ {
struct saa7134_dev *dev = priv; struct saa7134_dev *dev = priv;
if (dev != NULL) { if (dev != NULL) {
......
...@@ -553,7 +553,6 @@ static int configure_tda827x_fe(struct saa7134_dev *dev, ...@@ -553,7 +553,6 @@ static int configure_tda827x_fe(struct saa7134_dev *dev,
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static struct tda827x_config tda827x_cfg_0 = { static struct tda827x_config tda827x_cfg_0 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init, .init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep, .sleep = philips_tda827x_tuner_sleep,
.config = 0, .config = 0,
...@@ -561,7 +560,6 @@ static struct tda827x_config tda827x_cfg_0 = { ...@@ -561,7 +560,6 @@ static struct tda827x_config tda827x_cfg_0 = {
}; };
static struct tda827x_config tda827x_cfg_1 = { static struct tda827x_config tda827x_cfg_1 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init, .init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep, .sleep = philips_tda827x_tuner_sleep,
.config = 1, .config = 1,
...@@ -569,7 +567,6 @@ static struct tda827x_config tda827x_cfg_1 = { ...@@ -569,7 +567,6 @@ static struct tda827x_config tda827x_cfg_1 = {
}; };
static struct tda827x_config tda827x_cfg_2 = { static struct tda827x_config tda827x_cfg_2 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init, .init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep, .sleep = philips_tda827x_tuner_sleep,
.config = 2, .config = 2,
...@@ -577,7 +574,6 @@ static struct tda827x_config tda827x_cfg_2 = { ...@@ -577,7 +574,6 @@ static struct tda827x_config tda827x_cfg_2 = {
}; };
static struct tda827x_config tda827x_cfg_2_sw42 = { static struct tda827x_config tda827x_cfg_2_sw42 = {
.tuner_callback = saa7134_tuner_callback,
.init = philips_tda827x_tuner_init, .init = philips_tda827x_tuner_init,
.sleep = philips_tda827x_tuner_sleep, .sleep = philips_tda827x_tuner_sleep,
.config = 2, .config = 2,
...@@ -836,7 +832,6 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe) ...@@ -836,7 +832,6 @@ static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
} }
static struct tda827x_config ads_duo_cfg = { static struct tda827x_config ads_duo_cfg = {
.tuner_callback = saa7134_tuner_callback,
.init = ads_duo_tuner_init, .init = ads_duo_tuner_init,
.sleep = ads_duo_tuner_sleep, .sleep = ads_duo_tuner_sleep,
.config = 0 .config = 0
...@@ -1366,6 +1361,8 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1366,6 +1361,8 @@ static int dvb_init(struct saa7134_dev *dev)
printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
return -1; return -1;
} }
/* define general-purpose callback pointer */
dev->dvb.frontend->callback = saa7134_tuner_callback;
/* register everything else */ /* register everything else */
ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev, ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev,
......
...@@ -653,7 +653,7 @@ extern struct pci_device_id __devinitdata saa7134_pci_tbl[]; ...@@ -653,7 +653,7 @@ extern struct pci_device_id __devinitdata saa7134_pci_tbl[];
extern int saa7134_board_init1(struct saa7134_dev *dev); extern int saa7134_board_init1(struct saa7134_dev *dev);
extern int saa7134_board_init2(struct saa7134_dev *dev); extern int saa7134_board_init2(struct saa7134_dev *dev);
int saa7134_tuner_callback(void *priv, int command, int arg); int saa7134_tuner_callback(void *priv, int component, int command, int arg);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
......
...@@ -92,7 +92,6 @@ struct tuner { ...@@ -92,7 +92,6 @@ struct tuner {
unsigned int type; /* chip type id */ unsigned int type; /* chip type id */
unsigned int config; unsigned int config;
int (*tuner_callback) (void *dev, int command, int arg);
const char *name; const char *name;
}; };
...@@ -346,7 +345,7 @@ static struct xc5000_config xc5000_cfg; ...@@ -346,7 +345,7 @@ static struct xc5000_config xc5000_cfg;
static void set_type(struct i2c_client *c, unsigned int type, static void set_type(struct i2c_client *c, unsigned int type,
unsigned int new_mode_mask, unsigned int new_config, unsigned int new_mode_mask, unsigned int new_config,
int (*tuner_callback) (void *dev, int command,int arg)) int (*tuner_callback) (void *dev, int component, int cmd, int arg))
{ {
struct tuner *t = i2c_get_clientdata(c); struct tuner *t = i2c_get_clientdata(c);
struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops; struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
...@@ -362,7 +361,7 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -362,7 +361,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
t->config = new_config; t->config = new_config;
if (tuner_callback != NULL) { if (tuner_callback != NULL) {
tuner_dbg("defining GPIO callback\n"); tuner_dbg("defining GPIO callback\n");
t->tuner_callback = tuner_callback; t->fe.callback = tuner_callback;
} }
if (t->mode == T_UNINITIALIZED) { if (t->mode == T_UNINITIALIZED) {
...@@ -385,7 +384,6 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -385,7 +384,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
{ {
struct tda829x_config cfg = { struct tda829x_config cfg = {
.lna_cfg = t->config, .lna_cfg = t->config,
.tuner_callback = t->tuner_callback,
}; };
if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter, if (!dvb_attach(tda829x_attach, &t->fe, t->i2c->adapter,
t->i2c->addr, &cfg)) t->i2c->addr, &cfg))
...@@ -433,7 +431,6 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -433,7 +431,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
struct xc2028_config cfg = { struct xc2028_config cfg = {
.i2c_adap = t->i2c->adapter, .i2c_adap = t->i2c->adapter,
.i2c_addr = t->i2c->addr, .i2c_addr = t->i2c->addr,
.callback = t->tuner_callback,
}; };
if (!dvb_attach(xc2028_attach, &t->fe, &cfg)) if (!dvb_attach(xc2028_attach, &t->fe, &cfg))
goto attach_failed; goto attach_failed;
...@@ -450,7 +447,6 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -450,7 +447,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
xc5000_cfg.i2c_address = t->i2c->addr; xc5000_cfg.i2c_address = t->i2c->addr;
xc5000_cfg.if_khz = 5380; xc5000_cfg.if_khz = 5380;
xc5000_cfg.tuner_callback = t->tuner_callback;
if (!dvb_attach(xc5000_attach, if (!dvb_attach(xc5000_attach,
&t->fe, t->i2c->adapter, &xc5000_cfg)) &t->fe, t->i2c->adapter, &xc5000_cfg))
goto attach_failed; goto attach_failed;
...@@ -1224,7 +1220,7 @@ static int tuner_probe(struct i2c_client *client, ...@@ -1224,7 +1220,7 @@ static int tuner_probe(struct i2c_client *client,
} else { } else {
t->mode = V4L2_TUNER_DIGITAL_TV; t->mode = V4L2_TUNER_DIGITAL_TV;
} }
set_type(client, t->type, t->mode_mask, t->config, t->tuner_callback); set_type(client, t->type, t->mode_mask, t->config, t->fe.callback);
list_add_tail(&t->list, &tuner_list); list_add_tail(&t->list, &tuner_list);
return 0; return 0;
} }
......
...@@ -179,7 +179,7 @@ struct tuner_setup { ...@@ -179,7 +179,7 @@ struct tuner_setup {
unsigned int type; /* Tuner type */ unsigned int type; /* Tuner type */
unsigned int mode_mask; /* Allowed tuner modes */ unsigned int mode_mask; /* Allowed tuner modes */
unsigned int config; /* configuraion for more complex tuners */ unsigned int config; /* configuraion for more complex tuners */
int (*tuner_callback) (void *dev, int command,int arg); int (*tuner_callback) (void *dev, int component, int cmd, int arg);
}; };
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment