aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885
diff options
context:
space:
mode:
authorSteven Toth <stoth@hauppauge.com>2008-08-04 21:18:19 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:49 -0400
commit89ce2216e338f62c411bea12df37a2f54f2ce13a (patch)
tree8df317f81f8c8896dbed193cff4b9c614910ba6d /drivers/media/video/cx23885
parent12886871ae7a6f4e2b1ea371f6604d8239dda724 (diff)
V4L/DVB (8646): cx23885: Convert framework to use a single tuner callback 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>
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c31
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c16
-rw-r--r--drivers/media/video/cx23885/cx23885.h3
3 files changed, 18 insertions, 32 deletions
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 46d70262107b..0daffc3dbec0 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -329,11 +329,15 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
329 dev->name, tv.model); 329 dev->name, tv.model);
330} 330}
331 331
332static int cx23885_tuner_callback(struct cx23885_dev *dev, int port, 332int cx23885_tuner_callback(void *priv, int command, int arg)
333 int command, int arg)
334{ 333{
334 struct cx23885_tsport *port = priv;
335 struct cx23885_dev *dev = port->dev;
335 u32 bitmask = 0; 336 u32 bitmask = 0;
336 337
338 if (command == XC2028_RESET_CLK)
339 return 0;
340
337 if (command != 0) { 341 if (command != 0) {
338 printk(KERN_ERR "%s(): Unknown command 0x%x.\n", 342 printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
339 __func__, command); 343 __func__, command);
@@ -354,9 +358,9 @@ static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
354 358
355 /* Two identical tuners on two different i2c buses, 359 /* Two identical tuners on two different i2c buses,
356 * we need to reset the correct gpio. */ 360 * we need to reset the correct gpio. */
357 if (port == 0) 361 if (port->nr == 0)
358 bitmask = 0x01; 362 bitmask = 0x01;
359 else if (port == 1) 363 else if (port->nr == 1)
360 bitmask = 0x04; 364 bitmask = 0x04;
361 } 365 }
362 break; 366 break;
@@ -372,25 +376,6 @@ static int cx23885_tuner_callback(struct cx23885_dev *dev, int port,
372 return 0; 376 return 0;
373} 377}
374 378
375int cx23885_xc5000_tuner_callback(void *priv, int command, int arg)
376{
377 struct cx23885_i2c *bus = priv;
378 struct cx23885_dev *dev = bus->dev;
379
380 return cx23885_tuner_callback(dev, bus->nr, command, arg);
381}
382
383int cx23885_xc3028_tuner_callback(void *priv, int command, int arg)
384{
385 struct cx23885_tsport *port = priv;
386 struct cx23885_dev *dev = port->dev;
387
388 if (command == XC2028_RESET_CLK)
389 return 0;
390
391 return cx23885_tuner_callback(dev, port->nr, command, arg);
392}
393
394void cx23885_gpio_setup(struct cx23885_dev *dev) 379void cx23885_gpio_setup(struct cx23885_dev *dev)
395{ 380{
396 switch(dev->board) { 381 switch(dev->board) {
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index dbbbf5b0d2e1..f8564bb0d428 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -189,13 +189,13 @@ static struct s5h1411_config dvico_s5h1411_config = {
189static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { 189static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
190 .i2c_address = 0x61, 190 .i2c_address = 0x61,
191 .if_khz = 5380, 191 .if_khz = 5380,
192 .tuner_callback = cx23885_xc5000_tuner_callback, 192 .tuner_callback = cx23885_tuner_callback,
193}; 193};
194 194
195static struct xc5000_config dvico_xc5000_tunerconfig = { 195static struct xc5000_config dvico_xc5000_tunerconfig = {
196 .i2c_address = 0x64, 196 .i2c_address = 0x64,
197 .if_khz = 5380, 197 .if_khz = 5380,
198 .tuner_callback = cx23885_xc5000_tuner_callback, 198 .tuner_callback = cx23885_tuner_callback,
199}; 199};
200 200
201static struct tda829x_config tda829x_no_probe = { 201static struct tda829x_config tda829x_no_probe = {
@@ -391,7 +391,7 @@ static int dvb_register(struct cx23885_tsport *port)
391 if (port->dvb.frontend != NULL) 391 if (port->dvb.frontend != NULL)
392 dvb_attach(xc5000_attach, port->dvb.frontend, 392 dvb_attach(xc5000_attach, port->dvb.frontend,
393 &i2c_bus->i2c_adap, 393 &i2c_bus->i2c_adap,
394 &hauppauge_hvr1500q_tunerconfig, i2c_bus); 394 &hauppauge_hvr1500q_tunerconfig, port);
395 break; 395 break;
396 case CX23885_BOARD_HAUPPAUGE_HVR1500: 396 case CX23885_BOARD_HAUPPAUGE_HVR1500:
397 i2c_bus = &dev->i2c_bus[1]; 397 i2c_bus = &dev->i2c_bus[1];
@@ -403,7 +403,8 @@ static int dvb_register(struct cx23885_tsport *port)
403 struct xc2028_config cfg = { 403 struct xc2028_config cfg = {
404 .i2c_adap = &i2c_bus->i2c_adap, 404 .i2c_adap = &i2c_bus->i2c_adap,
405 .i2c_addr = 0x61, 405 .i2c_addr = 0x61,
406 .callback = cx23885_xc3028_tuner_callback, 406 .video_dev = port,
407 .callback = cx23885_tuner_callback,
407 }; 408 };
408 static struct xc2028_ctrl ctl = { 409 static struct xc2028_ctrl ctl = {
409 .fname = "xc3028-v27.fw", 410 .fname = "xc3028-v27.fw",
@@ -442,7 +443,8 @@ static int dvb_register(struct cx23885_tsport *port)
442 struct xc2028_config cfg = { 443 struct xc2028_config cfg = {
443 .i2c_adap = &dev->i2c_bus[1].i2c_adap, 444 .i2c_adap = &dev->i2c_bus[1].i2c_adap,
444 .i2c_addr = 0x64, 445 .i2c_addr = 0x64,
445 .callback = cx23885_xc3028_tuner_callback, 446 .video_dev = port,
447 .callback = cx23885_tuner_callback,
446 }; 448 };
447 static struct xc2028_ctrl ctl = { 449 static struct xc2028_ctrl ctl = {
448 .fname = "xc3028L-v36.fw", 450 .fname = "xc3028L-v36.fw",
@@ -470,7 +472,7 @@ static int dvb_register(struct cx23885_tsport *port)
470 if (port->dvb.frontend != NULL) 472 if (port->dvb.frontend != NULL)
471 dvb_attach(xc5000_attach, port->dvb.frontend, 473 dvb_attach(xc5000_attach, port->dvb.frontend,
472 &i2c_bus->i2c_adap, 474 &i2c_bus->i2c_adap,
473 &dvico_xc5000_tunerconfig, i2c_bus); 475 &dvico_xc5000_tunerconfig, port);
474 break; 476 break;
475 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: { 477 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: {
476 i2c_bus = &dev->i2c_bus[port->nr - 1]; 478 i2c_bus = &dev->i2c_bus[port->nr - 1];
@@ -484,7 +486,7 @@ static int dvb_register(struct cx23885_tsport *port)
484 .i2c_adap = &i2c_bus->i2c_adap, 486 .i2c_adap = &i2c_bus->i2c_adap,
485 .i2c_addr = 0x61, 487 .i2c_addr = 0x61,
486 .video_dev = port, 488 .video_dev = port,
487 .callback = cx23885_xc3028_tuner_callback, 489 .callback = cx23885_tuner_callback,
488 }; 490 };
489 static struct xc2028_ctrl ctl = { 491 static struct xc2028_ctrl ctl = {
490 .fname = "xc3028-v27.fw", 492 .fname = "xc3028-v27.fw",
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index 08b4c1390e16..db52d814a974 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -410,8 +410,7 @@ extern const unsigned int cx23885_bcount;
410extern struct cx23885_subid cx23885_subids[]; 410extern struct cx23885_subid cx23885_subids[];
411extern const unsigned int cx23885_idcount; 411extern const unsigned int cx23885_idcount;
412 412
413extern int cx23885_xc5000_tuner_callback(void *priv, int command, int arg); 413extern int cx23885_tuner_callback(void *priv, int command, int arg);
414extern int cx23885_xc3028_tuner_callback(void *priv, int command, int arg);
415extern void cx23885_card_list(struct cx23885_dev *dev); 414extern void cx23885_card_list(struct cx23885_dev *dev);
416extern int cx23885_ir_init(struct cx23885_dev *dev); 415extern int cx23885_ir_init(struct cx23885_dev *dev);
417extern void cx23885_gpio_setup(struct cx23885_dev *dev); 416extern void cx23885_gpio_setup(struct cx23885_dev *dev);