Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114006
b: refs/heads/master
c: d7cba04
h: refs/heads/master
v: v3
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Oct 12, 2008
1 parent c1176cc commit e5d5edc
Show file tree
Hide file tree
Showing 32 changed files with 91 additions and 125 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ebb8d68a5c8c236acd8e8cf8f0d6046e027a8e21
refs/heads/master: d7cba043d7ec840d67bd5143779d1febe7d83407
12 changes: 7 additions & 5 deletions trunk/drivers/media/common/tuners/tda827x.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,17 +447,19 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
else
arg = 0;
}
if (priv->cfg->tuner_callback)
priv->cfg->tuner_callback(priv->i2c_adap->algo_data,
gp_func, arg);
if (fe->callback)
fe->callback(priv->i2c_adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER,
gp_func, arg);
buf[1] = high ? 0 : 1;
if (priv->cfg->config == 2)
buf[1] = high ? 1 : 0;
i2c_transfer(priv->i2c_adap, &msg, 1);
break;
case 3: /* switch with GPIO of saa713x */
if (priv->cfg->tuner_callback)
priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high);
if (fe->callback)
fe->callback(priv->i2c_adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER, 0, high);
break;
}
}
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/common/tuners/tda827x.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ struct tda827x_config
/* interface to tda829x driver */
unsigned int config;
int switch_addr;
int (*tuner_callback) (void *dev, int command, int arg);

void (*agcf)(struct dvb_frontend *fe);
};
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/media/common/tuners/tda8290.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
priv->i2c_props.addr = i2c_addr;
priv->i2c_props.adap = i2c_adap;
priv->i2c_props.name = "tda829x";
if (cfg) {
if (cfg)
priv->cfg.config = cfg->lna_cfg;
priv->cfg.tuner_callback = cfg->tuner_callback;
}

if (tda8290_probe(&priv->i2c_props) == 0) {
priv->ver = TDA8290;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/common/tuners/tda8290.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

struct tda829x_config {
unsigned int lna_cfg;
int (*tuner_callback) (void *dev, int command, int arg);

unsigned int probe_tuner:1;
#define TDA829X_PROBE_TUNER 0
Expand Down
41 changes: 21 additions & 20 deletions trunk/drivers/media/common/tuners/tuner-xc2028.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ struct firmware_properties {
struct xc2028_data {
struct list_head hybrid_tuner_instance_list;
struct tuner_i2c_props i2c_props;
int (*tuner_callback) (void *dev,
int command, int arg);
void *video_dev;
__u32 frequency;

struct firmware_description *firm;
Expand Down Expand Up @@ -492,6 +489,23 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
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,
v4l2_std_id *id)
{
Expand Down Expand Up @@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,

if (!size) {
/* Special callback command received */
rc = priv->tuner_callback(priv->video_dev,
XC2028_TUNER_RESET, 0);
rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
if (rc < 0) {
tuner_err("Error at RESET code %d\n",
(*p) & 0x7f);
Expand All @@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
if (size >= 0xff00) {
switch (size) {
case 0xff00:
rc = priv->tuner_callback(priv->video_dev,
XC2028_RESET_CLK, 0);
rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0);
if (rc < 0) {
tuner_err("Error at RESET code %d\n",
(*p) & 0x7f);
Expand Down Expand Up @@ -715,8 +727,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));

/* Reset is needed before loading firmware */
rc = priv->tuner_callback(priv->video_dev,
XC2028_TUNER_RESET, 0);
rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
if (rc < 0)
goto fail;

Expand Down Expand Up @@ -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.
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);

Expand Down Expand Up @@ -1177,20 +1188,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
break;
case 1:
/* new tuner instance */
priv->tuner_callback = cfg->callback;
priv->ctrl.max_len = 13;

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;
break;
case 2:
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/media/common/tuners/tuner-xc2028.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ struct xc2028_ctrl {
struct xc2028_config {
struct i2c_adapter *i2c_adap;
u8 i2c_addr;
void *video_dev;
struct xc2028_ctrl *ctrl;
int (*callback) (void *dev, int command, int arg);
};

/* xc2028 commands for callback */
Expand Down
8 changes: 3 additions & 5 deletions trunk/drivers/media/common/tuners/xc5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ struct xc5000_priv {
u32 bandwidth;
u8 video_standard;
u8 rf_mode;

int (*tuner_callback) (void *priv, int command, int arg);
};

/* Misc Defines */
Expand Down Expand Up @@ -232,10 +230,11 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)

dprintk(1, "%s()\n", __func__);

if (priv->tuner_callback) {
ret = priv->tuner_callback(((fe->dvb) && (fe->dvb->priv)) ?
if (fe->callback) {
ret = fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
fe->dvb->priv :
priv->i2c_props.adap->algo_data,
DVB_FRONTEND_COMPONENT_TUNER,
XC5000_TUNER_RESET, 0);
if (ret)
printk(KERN_ERR "xc5000: reset failed\n");
Expand Down Expand Up @@ -975,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
/* new tuner instance */
priv->bandwidth = BANDWIDTH_6_MHZ;
priv->if_khz = cfg->if_khz;
priv->tuner_callback = cfg->tuner_callback;

fe->tuner_priv = priv;
break;
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/media/common/tuners/xc5000.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ struct i2c_adapter;
struct xc5000_config {
u8 i2c_address;
u32 if_khz;

int (*tuner_callback) (void *priv, int command, int arg);
};

/* xc5000 callback command */
Expand Down
7 changes: 5 additions & 2 deletions trunk/drivers/media/dvb/dvb-usb/cxusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
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_device *d = adap->dev;
Expand Down Expand Up @@ -770,14 +771,16 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
struct xc2028_config cfg = {
.i2c_adap = &adap->dev->i2c_adap,
.i2c_addr = 0x61,
.callback = dvico_bluebird_xc2028_callback,
};
static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE,
.max_len = 64,
.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);
if (fe == NULL || fe->ops.tuner_ops.set_config == NULL)
return -EIO;
Expand Down
8 changes: 5 additions & 3 deletions trunk/drivers/media/dvb/dvb-usb/dib0700_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
.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;

Expand Down Expand Up @@ -396,7 +397,6 @@ static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {

static struct xc2028_config stk7700ph_xc3028_config = {
.i2c_addr = 0x61,
.callback = stk7700ph_xc3028_callback,
.ctrl = &stk7700ph_xc3028_ctrl,
};

Expand Down Expand Up @@ -437,7 +437,9 @@ static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)
DIBX000_I2C_INTERFACE_TUNER, 1);

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)
== NULL ? -ENODEV : 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/au0828/au0828-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct au0828_board au0828_boards[] = {
/* Tuner callback function for au0828 boards. Currently only needed
* 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;

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/media/video/au0828/au0828-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ static struct au8522_config hauppauge_woodbury_config = {
static struct xc5000_config hauppauge_hvr950q_tunerconfig = {
.i2c_address = 0x61,
.if_khz = 6000,
.tuner_callback = au0828_tuner_callback
};

static struct mxl5007t_config mxl5007t_hvr950q_config = {
Expand Down Expand Up @@ -389,6 +388,8 @@ int au0828_dvb_register(struct au0828_dev *dev)
__func__);
return -1;
}
/* define general-purpose callback pointer */
dvb->frontend->callback = au0828_tuner_callback;

/* register everything */
ret = dvb_register(dev);
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/media/video/au0828/au0828.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ extern int au0828_debug;
extern struct au0828_board au0828_boards[];
extern struct usb_device_id au0828_usb_id_table[];
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);

/* ----------------------------------------------------------- */
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cx18/cx18-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void cx18_gpio_init(struct cx18 *cx)
}

/* 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 cx18_i2c_algo_callback_data *cb_data = algo->data;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cx18/cx18-gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
void cx18_gpio_init(struct cx18 *cx);
void cx18_reset_i2c_slaves_gpio(struct cx18 *cx);
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);
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cx23885/cx23885-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
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_dev *dev = port->dev;
Expand Down
12 changes: 2 additions & 10 deletions trunk/drivers/media/video/cx23885/cx23885-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,11 @@ static struct s5h1411_config dvico_s5h1411_config = {
static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
.i2c_address = 0x61,
.if_khz = 5380,
.tuner_callback = cx23885_tuner_callback,
};

static struct xc5000_config dvico_xc5000_tunerconfig = {
.i2c_address = 0x64,
.if_khz = 5380,
.tuner_callback = cx23885_tuner_callback,
};

static struct tda829x_config tda829x_no_probe = {
Expand Down Expand Up @@ -403,8 +401,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = {
.i2c_adap = &i2c_bus->i2c_adap,
.i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE,
Expand Down Expand Up @@ -443,8 +439,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = {
.i2c_adap = &dev->i2c_bus[1].i2c_adap,
.i2c_addr = 0x64,
.video_dev = port,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = XC3028L_DEFAULT_FIRMWARE,
Expand Down Expand Up @@ -485,8 +479,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = {
.i2c_adap = &i2c_bus->i2c_adap,
.i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE,
Expand All @@ -512,8 +504,6 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = {
.i2c_adap = &dev->i2c_bus[1].i2c_adap,
.i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = XC2028_DEFAULT_FIRMWARE,
Expand All @@ -536,6 +526,8 @@ static int dvb_register(struct cx23885_tsport *port)
printk("%s: frontend initialization failed\n", dev->name);
return -1;
}
/* define general-purpose callback pointer */
port->dvb.frontend->callback = cx23885_tuner_callback;

/* Put the analog decoder in standby to keep it quiet */
cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cx23885/cx23885.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ extern const unsigned int cx23885_bcount;
extern struct cx23885_subid cx23885_subids[];
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 int cx23885_ir_init(struct cx23885_dev *dev);
extern void cx23885_gpio_setup(struct cx23885_dev *dev);
Expand Down
Loading

0 comments on commit e5d5edc

Please sign in to comment.