Skip to content

Commit

Permalink
V4L/DVB (8646): cx23885: Convert framework to use a single tuner call…
Browse files Browse the repository at this point in the history
…back function.

Code reduction. Tuner callback now assumes that tsport is passed as the void arg.

Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Steven Toth authored and Mauro Carvalho Chehab committed Oct 12, 2008
1 parent 1288687 commit 89ce221
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
31 changes: 8 additions & 23 deletions drivers/media/video/cx23885/cx23885-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,15 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
dev->name, tv.model);
}

static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
int command, int arg)
int cx23885_tuner_callback(void *priv, int command, int arg)
{
struct cx23885_tsport *port = priv;
struct cx23885_dev *dev = port->dev;
u32 bitmask = 0;

if (command == XC2028_RESET_CLK)
return 0;

if (command != 0) {
printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
__func__, command);
Expand All @@ -354,9 +358,9 @@ static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,

/* Two identical tuners on two different i2c buses,
* we need to reset the correct gpio. */
if (port == 0)
if (port->nr == 0)
bitmask = 0x01;
else if (port == 1)
else if (port->nr == 1)
bitmask = 0x04;
}
break;
Expand All @@ -372,25 +376,6 @@ static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
return 0;
}

int cx23885_xc5000_tuner_callback(void *priv, int command, int arg)
{
struct cx23885_i2c *bus = priv;
struct cx23885_dev *dev = bus->dev;

return cx23885_tuner_callback(dev, bus->nr, command, arg);
}

int cx23885_xc3028_tuner_callback(void *priv, int command, int arg)
{
struct cx23885_tsport *port = priv;
struct cx23885_dev *dev = port->dev;

if (command == XC2028_RESET_CLK)
return 0;

return cx23885_tuner_callback(dev, port->nr, command, arg);
}

void cx23885_gpio_setup(struct cx23885_dev *dev)
{
switch(dev->board) {
Expand Down
16 changes: 9 additions & 7 deletions drivers/media/video/cx23885/cx23885-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ static struct s5h1411_config dvico_s5h1411_config = {
static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
.i2c_address = 0x61,
.if_khz = 5380,
.tuner_callback = cx23885_xc5000_tuner_callback,
.tuner_callback = cx23885_tuner_callback,
};

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

static struct tda829x_config tda829x_no_probe = {
Expand Down Expand Up @@ -391,7 +391,7 @@ static int dvb_register(struct cx23885_tsport *port)
if (port->dvb.frontend != NULL)
dvb_attach(xc5000_attach, port->dvb.frontend,
&i2c_bus->i2c_adap,
&hauppauge_hvr1500q_tunerconfig, i2c_bus);
&hauppauge_hvr1500q_tunerconfig, port);
break;
case CX23885_BOARD_HAUPPAUGE_HVR1500:
i2c_bus = &dev->i2c_bus[1];
Expand All @@ -403,7 +403,8 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = {
.i2c_adap = &i2c_bus->i2c_adap,
.i2c_addr = 0x61,
.callback = cx23885_xc3028_tuner_callback,
.video_dev = port,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = "xc3028-v27.fw",
Expand Down Expand Up @@ -442,7 +443,8 @@ static int dvb_register(struct cx23885_tsport *port)
struct xc2028_config cfg = {
.i2c_adap = &dev->i2c_bus[1].i2c_adap,
.i2c_addr = 0x64,
.callback = cx23885_xc3028_tuner_callback,
.video_dev = port,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = "xc3028L-v36.fw",
Expand Down Expand Up @@ -470,7 +472,7 @@ static int dvb_register(struct cx23885_tsport *port)
if (port->dvb.frontend != NULL)
dvb_attach(xc5000_attach, port->dvb.frontend,
&i2c_bus->i2c_adap,
&dvico_xc5000_tunerconfig, i2c_bus);
&dvico_xc5000_tunerconfig, port);
break;
case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: {
i2c_bus = &dev->i2c_bus[port->nr - 1];
Expand All @@ -484,7 +486,7 @@ static int dvb_register(struct cx23885_tsport *port)
.i2c_adap = &i2c_bus->i2c_adap,
.i2c_addr = 0x61,
.video_dev = port,
.callback = cx23885_xc3028_tuner_callback,
.callback = cx23885_tuner_callback,
};
static struct xc2028_ctrl ctl = {
.fname = "xc3028-v27.fw",
Expand Down
3 changes: 1 addition & 2 deletions drivers/media/video/cx23885/cx23885.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,7 @@ extern const unsigned int cx23885_bcount;
extern struct cx23885_subid cx23885_subids[];
extern const unsigned int cx23885_idcount;

extern int cx23885_xc5000_tuner_callback(void *priv, int command, int arg);
extern int cx23885_xc3028_tuner_callback(void *priv, int command, int arg);
extern int cx23885_tuner_callback(void *priv, 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

0 comments on commit 89ce221

Please sign in to comment.