aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2014-08-03 21:35:03 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-09-21 18:59:57 -0400
commitac7a24fb7560217381d996aae68eda57bbce462a (patch)
tree0f8e2be9330c57ab44a545a33dd91c87fcbde327
parentf80f2ae2135966dcd21020dcdca066d3fe5f06df (diff)
[media] em28xx: convert tda18212 tuner to I2C client
Used tda18212 tuner is implemented as a I2C driver. Use em28xx tuner I2C client for tda18212 driver. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/em28xx/em28xx-dvb.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 06457934a48c..9682c52d67d1 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -373,7 +373,6 @@ static struct tda18271_config kworld_ub435q_v2_config = {
373}; 373};
374 374
375static struct tda18212_config kworld_ub435q_v3_config = { 375static struct tda18212_config kworld_ub435q_v3_config = {
376 .i2c_address = 0x60,
377 .if_atsc_vsb = 3600, 376 .if_atsc_vsb = 3600,
378 .if_atsc_qam = 3600, 377 .if_atsc_qam = 3600,
379}; 378};
@@ -1437,6 +1436,15 @@ static int em28xx_dvb_init(struct em28xx *dev)
1437 } 1436 }
1438 break; 1437 break;
1439 case EM2874_BOARD_KWORLD_UB435Q_V3: 1438 case EM2874_BOARD_KWORLD_UB435Q_V3:
1439 {
1440 struct i2c_client *client;
1441 struct i2c_adapter *adapter = &dev->i2c_adap[dev->def_i2c_bus];
1442 struct i2c_board_info board_info = {
1443 .type = "tda18212",
1444 .addr = 0x60,
1445 .platform_data = &kworld_ub435q_v3_config,
1446 };
1447
1440 dvb->fe[0] = dvb_attach(lgdt3305_attach, 1448 dvb->fe[0] = dvb_attach(lgdt3305_attach,
1441 &em2874_lgdt3305_nogate_dev, 1449 &em2874_lgdt3305_nogate_dev,
1442 &dev->i2c_adap[dev->def_i2c_bus]); 1450 &dev->i2c_adap[dev->def_i2c_bus]);
@@ -1445,14 +1453,26 @@ static int em28xx_dvb_init(struct em28xx *dev)
1445 goto out_free; 1453 goto out_free;
1446 } 1454 }
1447 1455
1448 /* Attach the demodulator. */ 1456 /* attach tuner */
1449 if (!dvb_attach(tda18212_attach, dvb->fe[0], 1457 kworld_ub435q_v3_config.fe = dvb->fe[0];
1450 &dev->i2c_adap[dev->def_i2c_bus], 1458 request_module("tda18212");
1451 &kworld_ub435q_v3_config)) { 1459 client = i2c_new_device(adapter, &board_info);
1452 result = -EINVAL; 1460 if (client == NULL || client->dev.driver == NULL) {
1461 dvb_frontend_detach(dvb->fe[0]);
1462 result = -ENODEV;
1453 goto out_free; 1463 goto out_free;
1454 } 1464 }
1465
1466 if (!try_module_get(client->dev.driver->owner)) {
1467 i2c_unregister_device(client);
1468 dvb_frontend_detach(dvb->fe[0]);
1469 result = -ENODEV;
1470 goto out_free;
1471 }
1472
1473 dvb->i2c_client_tuner = client;
1455 break; 1474 break;
1475 }
1456 case EM2874_BOARD_PCTV_HD_MINI_80E: 1476 case EM2874_BOARD_PCTV_HD_MINI_80E:
1457 dvb->fe[0] = dvb_attach(drx39xxj_attach, &dev->i2c_adap[dev->def_i2c_bus]); 1477 dvb->fe[0] = dvb_attach(drx39xxj_attach, &dev->i2c_adap[dev->def_i2c_bus]);
1458 if (dvb->fe[0] != NULL) { 1478 if (dvb->fe[0] != NULL) {