summaryrefslogtreecommitdiff
path: root/drivers/media/usb/cx231xx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 22:34:37 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 22:34:37 +0300
commit3036bc45364f98515a2c446d7fac2c34dcfbeff4 (patch)
treef565c03254413b779981ee5e9ed81b19d5b62c78 /drivers/media/usb/cx231xx
parentc90fca951e90ba470a3dc6087667edffcf8db21b (diff)
parent48a8bbc7ca494709522621929f8407ab823d73fc (diff)
downloadlinux-3036bc45364f98515a2c446d7fac2c34dcfbeff4.tar.xz
Merge tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - remove of atomisp driver from staging, as nobody would have time to dedicate huge efforts to fix all the problems there. Also, we have a feeling that the driver may not even run the way it is. - move Zoran driver to staging, in order to be either fixed to use VB2 and the proper media kAPIs or to be removed - remove videobuf-dvb driver, with is unused for a while - some V4L2 documentation fixes/improvements - new sensor drivers: imx258 and ov7251 - a new driver was added to allow using I2C transparent drivers - several improvements at the ddbridge driver - several improvements at the ISDB pt1 driver, making it more coherent with the DVB framework - added a new platform driver for MIPI CSI-2 RX: cadence - now, all media drivers can be compiled on x86 with COMPILE_TEST - almost all media drivers now build on non-x86 architectures with COMPILE_TEST - lots of other random stuff: cleanups, support for new board models, bug fixes, etc * tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (464 commits) media: omap2: fix compile-testing with FB_OMAP2=m media: media/radio/Kconfig: add back RADIO_ISA media: v4l2-ioctl.c: fix missing unlock in __video_do_ioctl() media: pxa_camera: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power media: arch: sh: migor: Fix TW9910 PDN gpio media: staging: tegra-vde: Reset VDE regardless of memory client resetting failure media: marvel-ccic: mmp: select VIDEOBUF2_VMALLOC/DMA_CONTIG media: marvel-ccic: allow ccic and mmp drivers to coexist media: uvcvideo: Prevent setting unavailable flags media: ddbridge: conditionally enable fast TS for stv0910-equipped bridges media: dvb-frontends/stv0910: make TS speed configurable media: ddbridge/mci: add identifiers to function definition arguments media: ddbridge/mci: protect against out-of-bounds array access in stop() media: rc: ensure input/lirc device can be opened after register media: rc: nuvoton: Keep device enabled during reg init media: rc: nuvoton: Keep track of users on CIR enable/disable media: rc: nuvoton: Tweak the interrupt enabling dance media: uvcvideo: Support realtek's UVC 1.5 device media: uvcvideo: Fix driver reference counting media: gspca_zc3xx: Enable short exposure times for OV7648 ...
Diffstat (limited to 'drivers/media/usb/cx231xx')
-rw-r--r--drivers/media/usb/cx231xx/Kconfig5
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-417.c1
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-cards.c9
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-dvb.c382
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c2
-rw-r--r--drivers/media/usb/cx231xx/cx231xx.h3
6 files changed, 112 insertions, 290 deletions
diff --git a/drivers/media/usb/cx231xx/Kconfig b/drivers/media/usb/cx231xx/Kconfig
index 6276d9b2198b..0f13192634c7 100644
--- a/drivers/media/usb/cx231xx/Kconfig
+++ b/drivers/media/usb/cx231xx/Kconfig
@@ -1,13 +1,11 @@
config VIDEO_CX231XX
tristate "Conexant cx231xx USB video capture support"
- depends on VIDEO_DEV && I2C
+ depends on VIDEO_DEV && I2C && I2C_MUX
select VIDEO_TUNER
select VIDEO_TVEEPROM
- depends on RC_CORE
select VIDEOBUF_VMALLOC
select VIDEO_CX25840
select VIDEO_CX2341X
- select I2C_MUX
---help---
This is a video4linux driver for Conexant 231xx USB based TV cards.
@@ -42,7 +40,6 @@ config VIDEO_CX231XX_ALSA
config VIDEO_CX231XX_DVB
tristate "DVB/ATSC Support for Cx231xx based TV cards"
depends on VIDEO_CX231XX && DVB_CORE
- select VIDEOBUF_DVB
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MB86A20S if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index b80e6857e2eb..2f3b0564d676 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -29,6 +29,7 @@
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
+#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index c76b2101193c..a431a998d58f 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -715,7 +715,7 @@ struct cx231xx_board cx231xx_boards[] = {
.tuner_i2c_master = I2C_1_MUX_3,
.demod_i2c_master = I2C_1_MUX_3,
.has_dvb = 1,
- .demod_addr = 0x0e,
+ .demod_addr = 0x64, /* 0xc8 >> 1 */
.norm = V4L2_STD_PAL,
.input = {{
@@ -754,7 +754,7 @@ struct cx231xx_board cx231xx_boards[] = {
.tuner_i2c_master = I2C_1_MUX_3,
.demod_i2c_master = I2C_1_MUX_3,
.has_dvb = 1,
- .demod_addr = 0x0e,
+ .demod_addr = 0x64, /* 0xc8 >> 1 */
.norm = V4L2_STD_PAL,
.input = {{
@@ -793,7 +793,7 @@ struct cx231xx_board cx231xx_boards[] = {
.tuner_i2c_master = I2C_1_MUX_3,
.demod_i2c_master = I2C_1_MUX_3,
.has_dvb = 1,
- .demod_addr = 0x0e,
+ .demod_addr = 0x59, /* 0xb2 >> 1 */
.norm = V4L2_STD_NTSC,
.input = {{
@@ -1024,6 +1024,9 @@ struct usb_device_id cx231xx_id_table[] = {
.driver_info = CX231XX_BOARD_CNXT_RDE_250},
{USB_DEVICE(0x0572, 0x58A0),
.driver_info = CX231XX_BOARD_CNXT_RDU_250},
+ /* AverMedia DVD EZMaker 7 */
+ {USB_DEVICE(0x07ca, 0xc039),
+ .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
{USB_DEVICE(0x2040, 0xb110),
.driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL},
{USB_DEVICE(0x2040, 0xb111),
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 67ed66712d05..89357cb08b1a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -23,8 +23,12 @@
#include <linux/kernel.h>
#include <linux/slab.h>
+#include <media/dvbdev.h>
+#include <media/dmxdev.h>
+#include <media/dvb_demux.h>
+#include <media/dvb_net.h>
+#include <media/dvb_frontend.h>
#include <media/v4l2-common.h>
-#include <media/videobuf-vmalloc.h>
#include <media/tuner.h>
#include "xc5000.h"
@@ -156,10 +160,8 @@ static struct tda18271_config pv_tda18271_config = {
};
static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = {
- .i2c_addr = 0x59,
.qam_if_khz = 4000,
.vsb_if_khz = 3250,
- .deny_i2c_rptr = 1,
.spectral_inversion = 1,
.mpeg_mode = LGDT3306A_MPEG_SERIAL,
.tpclk_edge = LGDT3306A_TPCLK_RISING_EDGE,
@@ -600,7 +602,6 @@ fail_adapter:
static void unregister_dvb(struct cx231xx_dvb *dvb)
{
- struct i2c_client *client;
dvb_net_release(&dvb->net);
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
@@ -613,23 +614,15 @@ static void unregister_dvb(struct cx231xx_dvb *dvb)
dvb_frontend_detach(dvb->frontend[1]);
dvb_frontend_detach(dvb->frontend[0]);
dvb_unregister_adapter(&dvb->adapter);
+
/* remove I2C tuner */
- client = dvb->i2c_client_tuner;
- if (client) {
- module_put(client->dev.driver->owner);
- i2c_unregister_device(client);
- }
- /* remove I2C demod */
- client = dvb->i2c_client_demod[1];
- if (client) {
- module_put(client->dev.driver->owner);
- i2c_unregister_device(client);
- }
- client = dvb->i2c_client_demod[0];
- if (client) {
- module_put(client->dev.driver->owner);
- i2c_unregister_device(client);
- }
+ dvb_module_release(dvb->i2c_client_tuner);
+ dvb->i2c_client_tuner = NULL;
+ /* remove I2C demod(s) */
+ dvb_module_release(dvb->i2c_client_demod[1]);
+ dvb->i2c_client_demod[1] = NULL;
+ dvb_module_release(dvb->i2c_client_demod[0]);
+ dvb->i2c_client_demod[0] = NULL;
}
static int dvb_init(struct cx231xx *dev)
@@ -638,6 +631,8 @@ static int dvb_init(struct cx231xx *dev)
struct cx231xx_dvb *dvb;
struct i2c_adapter *tuner_i2c;
struct i2c_adapter *demod_i2c;
+ struct i2c_client *client;
+ struct i2c_adapter *adapter;
if (!dev->board.has_dvb) {
/* This device does not support the extension */
@@ -728,7 +723,7 @@ static int dvb_init(struct cx231xx *dev)
dvb->frontend[0]->callback = cx231xx_tuner_callback;
if (!dvb_attach(tda18271_attach, dev->dvb->frontend[0],
- 0x60, tuner_i2c,
+ dev->board.tuner_addr, tuner_i2c,
&cnxt_rde253s_tunerconfig)) {
result = -EINVAL;
goto out_free;
@@ -752,7 +747,7 @@ static int dvb_init(struct cx231xx *dev)
dvb->frontend[0]->callback = cx231xx_tuner_callback;
if (!dvb_attach(tda18271_attach, dev->dvb->frontend[0],
- 0x60, tuner_i2c,
+ dev->board.tuner_addr, tuner_i2c,
&cnxt_rde253s_tunerconfig)) {
result = -EINVAL;
goto out_free;
@@ -779,41 +774,27 @@ static int dvb_init(struct cx231xx *dev)
dvb->frontend[0]->callback = cx231xx_tuner_callback;
dvb_attach(tda18271_attach, dev->dvb->frontend[0],
- 0x60, tuner_i2c,
+ dev->board.tuner_addr, tuner_i2c,
&hcw_tda18271_config);
break;
case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx:
{
- struct i2c_client *client;
- struct i2c_board_info info;
- struct si2165_platform_data si2165_pdata;
+ struct si2165_platform_data si2165_pdata = {};
/* attach demod */
- memset(&si2165_pdata, 0, sizeof(si2165_pdata));
si2165_pdata.fe = &dev->dvb->frontend[0];
si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL;
si2165_pdata.ref_freq_hz = 16000000;
- memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "si2165", I2C_NAME_SIZE);
- info.addr = 0x64;
- info.platform_data = &si2165_pdata;
- request_module(info.type);
- client = i2c_new_device(demod_i2c, &info);
- if (!client || !client->dev.driver || !dev->dvb->frontend[0]) {
- dev_err(dev->dev,
- "Failed to attach SI2165 front end\n");
- result = -EINVAL;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2165", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &si2165_pdata);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dvb->i2c_client_demod[0] = client;
dev->dvb->frontend[0]->ops.i2c_gate_ctrl = NULL;
@@ -822,8 +803,7 @@ static int dvb_init(struct cx231xx *dev)
dvb->frontend[0]->callback = cx231xx_tuner_callback;
dvb_attach(tda18271_attach, dev->dvb->frontend[0],
- 0x60,
- tuner_i2c,
+ dev->board.tuner_addr, tuner_i2c,
&hcw_tda18271_config);
dev->cx231xx_reset_analog_tuner = NULL;
@@ -831,74 +811,45 @@ static int dvb_init(struct cx231xx *dev)
}
case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
{
- struct i2c_client *client;
- struct i2c_board_info info;
- struct si2165_platform_data si2165_pdata;
- struct si2157_config si2157_config;
+ struct si2165_platform_data si2165_pdata = {};
+ struct si2157_config si2157_config = {};
/* attach demod */
- memset(&si2165_pdata, 0, sizeof(si2165_pdata));
si2165_pdata.fe = &dev->dvb->frontend[0];
si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT;
si2165_pdata.ref_freq_hz = 24000000;
- memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "si2165", I2C_NAME_SIZE);
- info.addr = 0x64;
- info.platform_data = &si2165_pdata;
- request_module(info.type);
- client = i2c_new_device(demod_i2c, &info);
- if (!client || !client->dev.driver || !dev->dvb->frontend[0]) {
- dev_err(dev->dev,
- "Failed to attach SI2165 front end\n");
- result = -EINVAL;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2165", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &si2165_pdata);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dvb->i2c_client_demod[0] = client;
- memset(&info, 0, sizeof(struct i2c_board_info));
-
dev->dvb->frontend[0]->ops.i2c_gate_ctrl = NULL;
/* define general-purpose callback pointer */
dvb->frontend[0]->callback = cx231xx_tuner_callback;
/* attach tuner */
- memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dev->dvb->frontend[0];
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
si2157_config.mdev = dev->media_dev;
#endif
si2157_config.if_port = 1;
si2157_config.inversion = true;
- strlcpy(info.type, "si2157", I2C_NAME_SIZE);
- info.addr = 0x60;
- info.platform_data = &si2157_config;
- request_module("si2157");
-
- client = i2c_new_device(
- tuner_i2c,
- &info);
- if (client == NULL || client->dev.driver == NULL) {
- dvb_frontend_detach(dev->dvb->frontend[0]);
- result = -ENODEV;
- goto out_free;
- }
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
- dvb_frontend_detach(dev->dvb->frontend[0]);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2157", NULL, tuner_i2c,
+ dev->board.tuner_addr,
+ &si2157_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dev->cx231xx_reset_analog_tuner = NULL;
dev->dvb->i2c_client_tuner = client;
@@ -906,23 +857,22 @@ static int dvb_init(struct cx231xx *dev)
}
case CX231XX_BOARD_HAUPPAUGE_955Q:
{
- struct i2c_client *client;
- struct i2c_board_info info;
- struct si2157_config si2157_config;
-
- memset(&info, 0, sizeof(struct i2c_board_info));
+ struct si2157_config si2157_config = {};
+ struct lgdt3306a_config lgdt3306a_config = {};
- dev->dvb->frontend[0] = dvb_attach(lgdt3306a_attach,
- &hauppauge_955q_lgdt3306a_config,
- demod_i2c
- );
+ lgdt3306a_config = hauppauge_955q_lgdt3306a_config;
+ lgdt3306a_config.fe = &dev->dvb->frontend[0];
+ lgdt3306a_config.i2c_adapter = &adapter;
- if (!dev->dvb->frontend[0]) {
- dev_err(dev->dev,
- "Failed to attach LGDT3306A frontend.\n");
- result = -EINVAL;
+ /* perform probe/init/attach */
+ client = dvb_module_probe("lgdt3306a", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &lgdt3306a_config);
+ if (!client) {
+ result = -ENODEV;
goto out_free;
}
+ dvb->i2c_client_demod[0] = client;
dev->dvb->frontend[0]->ops.i2c_gate_ctrl = NULL;
@@ -930,34 +880,21 @@ static int dvb_init(struct cx231xx *dev)
dvb->frontend[0]->callback = cx231xx_tuner_callback;
/* attach tuner */
- memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dev->dvb->frontend[0];
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
si2157_config.mdev = dev->media_dev;
#endif
si2157_config.if_port = 1;
si2157_config.inversion = true;
- strlcpy(info.type, "si2157", I2C_NAME_SIZE);
- info.addr = 0x60;
- info.platform_data = &si2157_config;
- request_module("si2157");
-
- client = i2c_new_device(
- tuner_i2c,
- &info);
- if (client == NULL || client->dev.driver == NULL) {
- dvb_frontend_detach(dev->dvb->frontend[0]);
- result = -ENODEV;
- goto out_free;
- }
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
- dvb_frontend_detach(dev->dvb->frontend[0]);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2157", NULL, tuner_i2c,
+ dev->board.tuner_addr,
+ &si2157_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dev->cx231xx_reset_analog_tuner = NULL;
dev->dvb->i2c_client_tuner = client;
@@ -985,7 +922,7 @@ static int dvb_init(struct cx231xx *dev)
dvb->frontend[0]->callback = cx231xx_tuner_callback;
dvb_attach(tda18271_attach, dev->dvb->frontend[0],
- 0x60, tuner_i2c,
+ dev->board.tuner_addr, tuner_i2c,
&pv_tda18271_config);
break;
@@ -993,9 +930,6 @@ static int dvb_init(struct cx231xx *dev)
{
struct si2157_config si2157_config = {};
struct si2168_config si2168_config = {};
- struct i2c_board_info info = {};
- struct i2c_client *client;
- struct i2c_adapter *adapter;
/* attach demodulator chip */
si2168_config.ts_mode = SI2168_TS_SERIAL; /* from *.inf file */
@@ -1003,24 +937,14 @@ static int dvb_init(struct cx231xx *dev)
si2168_config.i2c_adapter = &adapter;
si2168_config.ts_clock_inv = true;
- strlcpy(info.type, "si2168", sizeof(info.type));
- info.addr = dev->board.demod_addr;
- info.platform_data = &si2168_config;
-
- request_module(info.type);
- client = i2c_new_device(demod_i2c, &info);
-
- if (client == NULL || client->dev.driver == NULL) {
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2168", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &si2168_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
- result = -ENODEV;
- goto out_free;
- }
-
dvb->i2c_client_demod[0] = client;
/* attach tuner chip */
@@ -1031,37 +955,20 @@ static int dvb_init(struct cx231xx *dev)
si2157_config.if_port = 1;
si2157_config.inversion = false;
- memset(&info, 0, sizeof(info));
- strlcpy(info.type, "si2157", sizeof(info.type));
- info.addr = dev->board.tuner_addr;
- info.platform_data = &si2157_config;
-
- request_module(info.type);
- client = i2c_new_device(tuner_i2c, &info);
-
- if (client == NULL || client->dev.driver == NULL) {
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
- result = -ENODEV;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2157", NULL, tuner_i2c,
+ dev->board.tuner_addr,
+ &si2157_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dev->cx231xx_reset_analog_tuner = NULL;
dev->dvb->i2c_client_tuner = client;
break;
}
case CX231XX_BOARD_ASTROMETA_T2HYBRID:
{
- struct i2c_client *client;
- struct i2c_board_info info = {};
struct mn88473_config mn88473_config = {};
/* attach demodulator chip */
@@ -1069,24 +976,14 @@ static int dvb_init(struct cx231xx *dev)
mn88473_config.xtal = 25000000;
mn88473_config.fe = &dev->dvb->frontend[0];
- strlcpy(info.type, "mn88473", sizeof(info.type));
- info.addr = dev->board.demod_addr;
- info.platform_data = &mn88473_config;
-
- request_module(info.type);
- client = i2c_new_device(demod_i2c, &info);
-
- if (client == NULL || client->dev.driver == NULL) {
- result = -ENODEV;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("mn88473", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &mn88473_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dvb->i2c_client_demod[0] = client;
/* define general-purpose callback pointer */
@@ -1100,9 +997,6 @@ static int dvb_init(struct cx231xx *dev)
}
case CX231XX_BOARD_HAUPPAUGE_935C:
{
- struct i2c_client *client;
- struct i2c_adapter *adapter;
- struct i2c_board_info info = {};
struct si2157_config si2157_config = {};
struct si2168_config si2168_config = {};
@@ -1112,25 +1006,14 @@ static int dvb_init(struct cx231xx *dev)
si2168_config.i2c_adapter = &adapter;
si2168_config.ts_clock_inv = true;
- strlcpy(info.type, "si2168", sizeof(info.type));
- info.addr = dev->board.demod_addr;
- info.platform_data = &si2168_config;
-
- request_module(info.type);
- client = i2c_new_device(demod_i2c, &info);
- if (client == NULL || client->dev.driver == NULL) {
- result = -ENODEV;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- dev_err(dev->dev,
- "Failed to attach %s frontend.\n", info.type);
- i2c_unregister_device(client);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2168", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &si2168_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dvb->i2c_client_demod[0] = client;
dev->dvb->frontend[0]->ops.i2c_gate_ctrl = NULL;
@@ -1145,40 +1028,21 @@ static int dvb_init(struct cx231xx *dev)
si2157_config.if_port = 1;
si2157_config.inversion = true;
- memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "si2157", I2C_NAME_SIZE);
- info.addr = dev->board.tuner_addr;
- info.platform_data = &si2157_config;
- request_module("si2157");
-
- client = i2c_new_device(adapter, &info);
- if (client == NULL || client->dev.driver == NULL) {
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
- result = -ENODEV;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- dev_err(dev->dev,
- "Failed to obtain %s tuner.\n", info.type);
- i2c_unregister_device(client);
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2157", NULL, tuner_i2c,
+ dev->board.tuner_addr,
+ &si2157_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dev->cx231xx_reset_analog_tuner = NULL;
dev->dvb->i2c_client_tuner = client;
break;
}
case CX231XX_BOARD_HAUPPAUGE_975:
{
- struct i2c_client *client;
- struct i2c_adapter *adapter;
struct i2c_adapter *adapter2;
- struct i2c_board_info info = {};
struct si2157_config si2157_config = {};
struct lgdt3306a_config lgdt3306a_config = {};
struct si2168_config si2168_config = {};
@@ -1187,27 +1051,15 @@ static int dvb_init(struct cx231xx *dev)
lgdt3306a_config = hauppauge_955q_lgdt3306a_config;
lgdt3306a_config.fe = &dev->dvb->frontend[0];
lgdt3306a_config.i2c_adapter = &adapter;
- lgdt3306a_config.deny_i2c_rptr = 0;
-
- strlcpy(info.type, "lgdt3306a", sizeof(info.type));
- info.addr = dev->board.demod_addr;
- info.platform_data = &lgdt3306a_config;
-
- request_module(info.type);
- client = i2c_new_device(demod_i2c, &info);
- if (client == NULL || client->dev.driver == NULL) {
- result = -ENODEV;
- goto out_free;
- }
- if (!try_module_get(client->dev.driver->owner)) {
- dev_err(dev->dev,
- "Failed to attach %s frontend.\n", info.type);
- i2c_unregister_device(client);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("lgdt3306a", NULL, demod_i2c,
+ dev->board.demod_addr,
+ &lgdt3306a_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dvb->i2c_client_demod[0] = client;
/* attach second demodulator chip */
@@ -1216,30 +1068,14 @@ static int dvb_init(struct cx231xx *dev)
si2168_config.i2c_adapter = &adapter2;
si2168_config.ts_clock_inv = true;
- memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "si2168", sizeof(info.type));
- info.addr = dev->board.demod_addr2;
- info.platform_data = &si2168_config;
-
- request_module(info.type);
- client = i2c_new_device(adapter, &info);
- if (client == NULL || client->dev.driver == NULL) {
- dev_err(dev->dev,
- "Failed to attach %s frontend.\n", info.type);
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
- result = -ENODEV;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2168", NULL, adapter,
+ dev->board.demod_addr2,
+ &si2168_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dvb->i2c_client_demod[1] = client;
dvb->frontend[1]->id = 1;
@@ -1255,34 +1091,14 @@ static int dvb_init(struct cx231xx *dev)
si2157_config.if_port = 1;
si2157_config.inversion = true;
- memset(&info, 0, sizeof(struct i2c_board_info));
- strlcpy(info.type, "si2157", I2C_NAME_SIZE);
- info.addr = dev->board.tuner_addr;
- info.platform_data = &si2157_config;
- request_module("si2157");
-
- client = i2c_new_device(adapter, &info);
- if (client == NULL || client->dev.driver == NULL) {
- module_put(dvb->i2c_client_demod[1]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[1]);
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
- result = -ENODEV;
- goto out_free;
- }
-
- if (!try_module_get(client->dev.driver->owner)) {
- dev_err(dev->dev,
- "Failed to obtain %s tuner.\n", info.type);
- i2c_unregister_device(client);
- module_put(dvb->i2c_client_demod[1]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[1]);
- module_put(dvb->i2c_client_demod[0]->dev.driver->owner);
- i2c_unregister_device(dvb->i2c_client_demod[0]);
+ /* perform probe/init/attach */
+ client = dvb_module_probe("si2157", NULL, adapter,
+ dev->board.tuner_addr,
+ &si2157_config);
+ if (!client) {
result = -ENODEV;
goto out_free;
}
-
dev->cx231xx_reset_analog_tuner = NULL;
dvb->i2c_client_tuner = client;
@@ -1321,6 +1137,14 @@ ret:
return result;
out_free:
+ /* remove I2C tuner */
+ dvb_module_release(dvb->i2c_client_tuner);
+ dvb->i2c_client_tuner = NULL;
+ /* remove I2C demod(s) */
+ dvb_module_release(dvb->i2c_client_demod[1]);
+ dvb->i2c_client_demod[1] = NULL;
+ dvb_module_release(dvb->i2c_client_demod[0]);
+ dvb->i2c_client_demod[0] = NULL;
kfree(dvb);
dev->dvb = NULL;
goto ret;
diff --git a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c
index 5bc74149fcb9..746c34ab0ec8 100644
--- a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c
+++ b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c
@@ -769,7 +769,7 @@ int initialize_cx231xx(struct cx231xx *dev)
break;
default:
dev_err(dev->dev,
- "bad senario!!!!!\nconfig_info=%x\n",
+ "bad scenario!!!!!\nconfig_info=%x\n",
config_info & SELFPOWER_MASK);
return -ENODEV;
}
diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
index 6ffa4bd96484..fa640bf20111 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -38,7 +38,6 @@
#include <media/v4l2-fh.h>
#include <media/rc-core.h>
#include <media/i2c/ir-kbd-i2c.h>
-#include <media/videobuf-dvb.h>
#include "cx231xx-reg.h"
#include "cx231xx-pcb-cfg.h"
@@ -546,8 +545,6 @@ struct cx231xx_tsport {
int nr;
int sram_chno;
- struct videobuf_dvb_frontends frontends;
-
/* dma queues */
u32 ts_packet_size;