2009-03-04 01:37:50 +08:00
|
|
|
/*
|
2009-03-05 04:49:01 +08:00
|
|
|
cx231xx-cards.c - driver for Conexant Cx23100/101/102
|
|
|
|
USB video capture devices
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
|
2009-03-05 04:49:01 +08:00
|
|
|
Based on em28xx driver
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
2014-11-01 19:09:44 +08:00
|
|
|
#include "cx231xx.h"
|
2009-03-04 01:37:50 +08:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/module.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2009-03-04 01:37:50 +08:00
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <media/tuner.h>
|
|
|
|
#include <media/tveeprom.h>
|
|
|
|
#include <media/v4l2-common.h>
|
|
|
|
|
2015-11-14 05:40:07 +08:00
|
|
|
#include <media/drv-intf/cx25840.h>
|
2010-09-03 21:50:24 +08:00
|
|
|
#include "dvb-usb-ids.h"
|
2009-03-04 01:37:50 +08:00
|
|
|
#include "xc5000.h"
|
2010-09-29 22:07:08 +08:00
|
|
|
#include "tda18271.h"
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
static int tuner = -1;
|
|
|
|
module_param(tuner, int, 0444);
|
|
|
|
MODULE_PARM_DESC(tuner, "tuner type");
|
|
|
|
|
2010-07-07 05:12:25 +08:00
|
|
|
static int transfer_mode = 1;
|
|
|
|
module_param(transfer_mode, int, 0444);
|
|
|
|
MODULE_PARM_DESC(transfer_mode, "transfer mode (1-ISO or 0-BULK)");
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
static unsigned int disable_ir;
|
|
|
|
module_param(disable_ir, int, 0444);
|
|
|
|
MODULE_PARM_DESC(disable_ir, "disable infrared remote support");
|
|
|
|
|
|
|
|
/* Bitmask marking allocated devices from 0 to CX231XX_MAXBOARDS */
|
|
|
|
static unsigned long cx231xx_devused;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset sequences for analog/digital modes
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct cx231xx_reg_seq RDE250_XCV_TUNER[] = {
|
2009-03-03 17:14:34 +08:00
|
|
|
{0x03, 0x01, 10},
|
|
|
|
{0x03, 0x00, 30},
|
|
|
|
{0x03, 0x01, 10},
|
|
|
|
{-1, -1, -1},
|
2009-03-04 01:37:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Board definitions
|
|
|
|
*/
|
|
|
|
struct cx231xx_board cx231xx_boards[] = {
|
|
|
|
[CX231XX_BOARD_UNKNOWN] = {
|
2009-03-11 08:16:26 +08:00
|
|
|
.name = "Unknown CX231xx video grabber",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2010-07-07 05:12:25 +08:00
|
|
|
[CX231XX_BOARD_CNXT_CARRAERA] = {
|
|
|
|
.name = "Conexant Hybrid TV - CARRAERA",
|
2009-03-11 08:16:26 +08:00
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0x61,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2009-03-11 08:16:26 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.demod_i2c_master = I2C_2,
|
2009-03-11 08:16:26 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x02,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2010-07-07 05:12:25 +08:00
|
|
|
[CX231XX_BOARD_CNXT_SHELBY] = {
|
|
|
|
.name = "Conexant Hybrid TV - SHELBY",
|
2009-03-11 08:16:26 +08:00
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0x61,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2009-03-11 08:16:26 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.demod_i2c_master = I2C_2,
|
2009-03-11 08:16:26 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x32,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2009-12-14 04:06:10 +08:00
|
|
|
.gpio = NULL,
|
2009-03-11 08:16:26 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2010-07-07 05:12:25 +08:00
|
|
|
[CX231XX_BOARD_CNXT_RDE_253S] = {
|
|
|
|
.name = "Conexant Hybrid TV - RDE253S",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-07 05:12:25 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x1c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.demod_i2c_master = I2C_2,
|
2010-07-07 05:12:25 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x02,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[CX231XX_BOARD_CNXT_RDU_253S] = {
|
|
|
|
.name = "Conexant Hybrid TV - RDU253S",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-07 05:12:25 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x1c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.demod_i2c_master = I2C_2,
|
2010-07-07 05:12:25 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x02,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[CX231XX_BOARD_CNXT_VIDEO_GRABBER] = {
|
|
|
|
.name = "Conexant VIDEO GRABBER",
|
2010-08-19 05:04:04 +08:00
|
|
|
.tuner_type = TUNER_ABSENT,
|
2010-07-07 05:12:25 +08:00
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-07 05:12:25 +08:00
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x1c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.norm = V4L2_STD_PAL,
|
2011-02-01 09:12:15 +08:00
|
|
|
.no_alt_vanc = 1,
|
|
|
|
.external_av = 1,
|
2013-02-08 00:22:06 +08:00
|
|
|
/* Actually, it has a 417, but it isn't working correctly.
|
|
|
|
* So set to 0 for now until someone can manage to get this
|
|
|
|
* to work reliably. */
|
|
|
|
.has_417 = 0,
|
2010-07-07 05:12:25 +08:00
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[CX231XX_BOARD_CNXT_RDE_250] = {
|
|
|
|
.name = "Conexant Hybrid TV - rde 250",
|
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0x61,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-07 05:12:25 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.demod_i2c_master = I2C_2,
|
2010-07-07 05:12:25 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x02,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
[CX231XX_BOARD_CNXT_RDU_250] = {
|
|
|
|
.name = "Conexant Hybrid TV - RDU 250",
|
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0x61,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-07 05:12:25 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.demod_i2c_master = I2C_2,
|
2010-07-07 05:12:25 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x32,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2010-07-07 05:23:53 +08:00
|
|
|
[CX231XX_BOARD_HAUPPAUGE_EXETER] = {
|
|
|
|
.name = "Hauppauge EXETER",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-07 05:23:53 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_1,
|
2015-11-14 06:54:55 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_1,
|
2010-07-07 05:23:53 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x0e,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-07-07 05:23:53 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-07-07 05:23:53 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-07-07 05:23:53 +08:00
|
|
|
} },
|
|
|
|
},
|
2010-07-31 11:49:01 +08:00
|
|
|
[CX231XX_BOARD_HAUPPAUGE_USBLIVE2] = {
|
|
|
|
.name = "Hauppauge USB Live 2",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
2010-08-19 04:50:07 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
2010-07-31 11:49:01 +08:00
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
2011-02-01 09:12:15 +08:00
|
|
|
.no_alt_vanc = 1,
|
|
|
|
.external_av = 1,
|
2010-07-31 11:49:01 +08:00
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-07-31 11:49:01 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-07-31 11:49:01 +08:00
|
|
|
} },
|
|
|
|
},
|
2011-04-12 06:57:15 +08:00
|
|
|
[CX231XX_BOARD_KWORLD_UB430_USB_HYBRID] = {
|
|
|
|
.name = "Kworld UB430 USB Hybrid",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x11, /* According with PV cxPolaris.inf file */
|
|
|
|
.tuner_sif_gpio = -1,
|
|
|
|
.tuner_scl_gpio = -1,
|
|
|
|
.tuner_sda_gpio = -1,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:20:58 +08:00
|
|
|
.tuner_i2c_master = I2C_2,
|
2014-10-02 13:21:02 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.ir_i2c_master = I2C_2,
|
2011-04-12 06:57:15 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x10,
|
|
|
|
.norm = V4L2_STD_PAL_M,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2013-08-17 08:29:02 +08:00
|
|
|
[CX231XX_BOARD_KWORLD_UB445_USB_HYBRID] = {
|
|
|
|
.name = "Kworld UB445 USB Hybrid",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x11, /* According with PV cxPolaris.inf file */
|
|
|
|
.tuner_sif_gpio = -1,
|
|
|
|
.tuner_scl_gpio = -1,
|
|
|
|
.tuner_sda_gpio = -1,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:20:58 +08:00
|
|
|
.tuner_i2c_master = I2C_2,
|
2014-10-02 13:21:02 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.ir_i2c_master = I2C_2,
|
2013-08-17 08:29:02 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x10,
|
|
|
|
.norm = V4L2_STD_NTSC_M,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2010-09-27 07:44:31 +08:00
|
|
|
[CX231XX_BOARD_PV_PLAYTV_USB_HYBRID] = {
|
|
|
|
.name = "Pixelview PlayTV USB Hybrid",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
2016-09-04 21:06:39 +08:00
|
|
|
.agc_analog_digital_select_gpio = 0x1c,
|
2010-09-27 07:44:31 +08:00
|
|
|
.tuner_sif_gpio = -1,
|
|
|
|
.tuner_scl_gpio = -1,
|
|
|
|
.tuner_sda_gpio = -1,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:20:58 +08:00
|
|
|
.tuner_i2c_master = I2C_2,
|
2014-10-02 13:21:02 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
2014-10-02 13:20:58 +08:00
|
|
|
.ir_i2c_master = I2C_2,
|
2010-12-18 01:47:27 +08:00
|
|
|
.rc_map_name = RC_MAP_PIXELVIEW_002T,
|
2010-09-28 10:44:27 +08:00
|
|
|
.has_dvb = 1,
|
2010-09-27 07:44:31 +08:00
|
|
|
.demod_addr = 0x10,
|
|
|
|
.norm = V4L2_STD_PAL_M,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-09-27 07:44:31 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-09-27 07:44:31 +08:00
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
2011-01-26 04:38:52 +08:00
|
|
|
.gpio = NULL,
|
2010-09-27 07:44:31 +08:00
|
|
|
} },
|
|
|
|
},
|
2011-02-01 09:18:21 +08:00
|
|
|
[CX231XX_BOARD_PV_XCAPTURE_USB] = {
|
|
|
|
.name = "Pixelview Xcapture USB",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
.no_alt_vanc = 1,
|
|
|
|
.external_av = 1,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2011-05-18 00:46:36 +08:00
|
|
|
|
|
|
|
[CX231XX_BOARD_ICONBIT_U100] = {
|
|
|
|
.name = "Iconbit Analog Stick U100 FM",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x1C,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2011-06-09 02:54:19 +08:00
|
|
|
[CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL] = {
|
|
|
|
.name = "Hauppauge WinTV USB2 FM (PAL)",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2011-06-09 02:54:19 +08:00
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
|
|
|
[CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC] = {
|
|
|
|
.name = "Hauppauge WinTV USB2 FM (NTSC)",
|
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2011-06-09 02:54:19 +08:00
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2012-11-29 01:29:16 +08:00
|
|
|
[CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2] = {
|
|
|
|
.name = "Elgato Video Capture V2",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
.no_alt_vanc = 1,
|
|
|
|
.external_av = 1,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2013-03-02 06:53:30 +08:00
|
|
|
[CX231XX_BOARD_OTG102] = {
|
|
|
|
.name = "Geniatech OTG102",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
2014-11-01 19:09:44 +08:00
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
2013-03-02 06:53:30 +08:00
|
|
|
/* According with PV CxPlrCAP.inf file */
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
.no_alt_vanc = 1,
|
|
|
|
.external_av = 1,
|
|
|
|
/*.has_417 = 1, */
|
|
|
|
/* This board is believed to have a hardware encoding chip
|
|
|
|
* supporting mpeg1/2/4, but as the 417 is apparently not
|
|
|
|
* working for the reference board it is not here either. */
|
|
|
|
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2014-07-23 04:12:15 +08:00
|
|
|
[CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx] = {
|
2014-08-31 19:35:08 +08:00
|
|
|
.name = "Hauppauge WinTV 930C-HD (1113xx) / HVR-900H (111xxx) / PCTV QuatroStick 521e",
|
2014-07-23 04:12:15 +08:00
|
|
|
.tuner_type = TUNER_NXP_TDA18271,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2015-11-14 06:54:55 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
2014-07-23 04:12:15 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x0e,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
2014-07-23 04:12:16 +08:00
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
|
|
|
[CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx] = {
|
2014-08-31 19:35:09 +08:00
|
|
|
.name = "Hauppauge WinTV 930C-HD (1114xx) / HVR-901H (1114xx) / PCTV QuatroStick 522e",
|
2014-07-23 04:12:16 +08:00
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
2014-10-02 13:21:02 +08:00
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2015-11-14 06:54:55 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
2014-07-23 04:12:16 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x0e,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
|
2015-02-28 23:25:24 +08:00
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
|
|
|
[CX231XX_BOARD_HAUPPAUGE_955Q] = {
|
|
|
|
.name = "Hauppauge WinTV-HVR-955Q (111401)",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.tuner_addr = 0x60,
|
|
|
|
.tuner_gpio = RDE250_XCV_TUNER,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
2015-11-14 06:54:55 +08:00
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
2015-02-28 23:25:24 +08:00
|
|
|
.has_dvb = 1,
|
|
|
|
.demod_addr = 0x0e,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
|
2014-07-23 04:12:15 +08:00
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_3_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2015-05-20 15:51:29 +08:00
|
|
|
[CX231XX_BOARD_TERRATEC_GRABBY] = {
|
|
|
|
.name = "Terratec Grabby",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.decoder = CX231XX_AVDECODER,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.demod_xfer_mode = 0,
|
|
|
|
.ctl_pin_status_mask = 0xFFFFFFC4,
|
|
|
|
.agc_analog_digital_select_gpio = 0x0c,
|
|
|
|
.gpio_pin_status_mask = 0x4001000,
|
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
.no_alt_vanc = 1,
|
|
|
|
.external_av = 1,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
.gpio = NULL,
|
|
|
|
} },
|
|
|
|
},
|
2017-01-30 02:03:51 +08:00
|
|
|
[CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD] = {
|
|
|
|
.name = "Evromedia USB Full Hybrid Full HD",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.demod_addr = 0x64, /* 0xc8 >> 1 */
|
|
|
|
.demod_i2c_master = I2C_1_MUX_3,
|
|
|
|
.has_dvb = 1,
|
2017-10-28 21:38:19 +08:00
|
|
|
.decoder = CX231XX_AVDECODER,
|
2017-01-30 02:03:51 +08:00
|
|
|
.norm = V4L2_STD_PAL,
|
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.tuner_addr = 0x60, /* 0xc0 >> 1 */
|
|
|
|
.tuner_i2c_master = I2C_2,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = 0,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_SVIDEO,
|
|
|
|
.vmux = CX231XX_VIN_1_1 |
|
|
|
|
(CX231XX_VIN_1_2 << 8) |
|
|
|
|
CX25840_SVIDEO_ON,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
} },
|
|
|
|
},
|
2017-04-22 23:47:13 +08:00
|
|
|
[CX231XX_BOARD_ASTROMETA_T2HYBRID] = {
|
|
|
|
.name = "Astrometa T2hybrid",
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
|
|
|
.has_dvb = 1,
|
2017-10-28 21:38:20 +08:00
|
|
|
.decoder = CX231XX_AVDECODER,
|
2017-04-22 23:47:13 +08:00
|
|
|
.output_mode = OUT_MODE_VIP11,
|
|
|
|
.agc_analog_digital_select_gpio = 0x01,
|
|
|
|
.ctl_pin_status_mask = 0xffffffc4,
|
|
|
|
.demod_addr = 0x18, /* 0x30 >> 1 */
|
|
|
|
.demod_i2c_master = I2C_1_MUX_1,
|
|
|
|
.gpio_pin_status_mask = 0xa,
|
|
|
|
.norm = V4L2_STD_NTSC,
|
|
|
|
.tuner_addr = 0x3a, /* 0x74 >> 1 */
|
|
|
|
.tuner_i2c_master = I2C_1_MUX_3,
|
|
|
|
.tuner_scl_gpio = 0x1a,
|
|
|
|
.tuner_sda_gpio = 0x1b,
|
|
|
|
.tuner_sif_gpio = 0x05,
|
|
|
|
.input = {{
|
|
|
|
.type = CX231XX_VMUX_TELEVISION,
|
|
|
|
.vmux = CX231XX_VIN_1_1,
|
|
|
|
.amux = CX231XX_AMUX_VIDEO,
|
|
|
|
}, {
|
|
|
|
.type = CX231XX_VMUX_COMPOSITE1,
|
|
|
|
.vmux = CX231XX_VIN_2_1,
|
|
|
|
.amux = CX231XX_AMUX_LINE_IN,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2009-03-04 01:37:50 +08:00
|
|
|
};
|
|
|
|
const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
|
|
|
|
|
|
|
|
/* table of devices that work with this driver */
|
2009-03-03 17:14:34 +08:00
|
|
|
struct usb_device_id cx231xx_id_table[] = {
|
2014-01-05 06:44:34 +08:00
|
|
|
{USB_DEVICE(0x1D19, 0x6109),
|
|
|
|
.driver_info = CX231XX_BOARD_PV_XCAPTURE_USB},
|
2009-03-14 05:35:14 +08:00
|
|
|
{USB_DEVICE(0x0572, 0x5A3C),
|
2009-03-03 17:14:34 +08:00
|
|
|
.driver_info = CX231XX_BOARD_UNKNOWN},
|
|
|
|
{USB_DEVICE(0x0572, 0x58A2),
|
2010-07-07 05:12:25 +08:00
|
|
|
.driver_info = CX231XX_BOARD_CNXT_CARRAERA},
|
2009-03-14 05:35:14 +08:00
|
|
|
{USB_DEVICE(0x0572, 0x58A1),
|
2010-07-07 05:12:25 +08:00
|
|
|
.driver_info = CX231XX_BOARD_CNXT_SHELBY},
|
|
|
|
{USB_DEVICE(0x0572, 0x58A4),
|
|
|
|
.driver_info = CX231XX_BOARD_CNXT_RDE_253S},
|
|
|
|
{USB_DEVICE(0x0572, 0x58A5),
|
|
|
|
.driver_info = CX231XX_BOARD_CNXT_RDU_253S},
|
|
|
|
{USB_DEVICE(0x0572, 0x58A6),
|
|
|
|
.driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER},
|
|
|
|
{USB_DEVICE(0x0572, 0x589E),
|
|
|
|
.driver_info = CX231XX_BOARD_CNXT_RDE_250},
|
|
|
|
{USB_DEVICE(0x0572, 0x58A0),
|
2009-03-03 17:14:34 +08:00
|
|
|
.driver_info = CX231XX_BOARD_CNXT_RDU_250},
|
2011-06-09 02:54:19 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xb110),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL},
|
|
|
|
{USB_DEVICE(0x2040, 0xb111),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC},
|
2010-07-07 05:23:53 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xb120),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
|
2015-02-28 23:25:24 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xb123),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_955Q},
|
2014-07-23 04:12:15 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xb130),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx},
|
2014-07-23 04:12:16 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xb131),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx},
|
2014-08-31 19:35:08 +08:00
|
|
|
/* Hauppauge WinTV-HVR-900-H */
|
|
|
|
{USB_DEVICE(0x2040, 0xb138),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx},
|
2014-08-31 19:35:09 +08:00
|
|
|
/* Hauppauge WinTV-HVR-901-H */
|
|
|
|
{USB_DEVICE(0x2040, 0xb139),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx},
|
2010-07-07 05:25:19 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xb140),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_EXETER},
|
2010-07-31 11:49:01 +08:00
|
|
|
{USB_DEVICE(0x2040, 0xc200),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_USBLIVE2},
|
2014-07-23 04:12:17 +08:00
|
|
|
/* PCTV QuatroStick 521e */
|
|
|
|
{USB_DEVICE(0x2013, 0x0259),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx},
|
2014-07-23 04:12:18 +08:00
|
|
|
/* PCTV QuatroStick 522e */
|
|
|
|
{USB_DEVICE(0x2013, 0x025e),
|
|
|
|
.driver_info = CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx},
|
2010-09-27 07:44:31 +08:00
|
|
|
{USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000, 0x4001),
|
|
|
|
.driver_info = CX231XX_BOARD_PV_PLAYTV_USB_HYBRID},
|
2011-02-01 09:18:21 +08:00
|
|
|
{USB_DEVICE(USB_VID_PIXELVIEW, 0x5014),
|
|
|
|
.driver_info = CX231XX_BOARD_PV_XCAPTURE_USB},
|
2011-04-12 06:57:15 +08:00
|
|
|
{USB_DEVICE(0x1b80, 0xe424),
|
|
|
|
.driver_info = CX231XX_BOARD_KWORLD_UB430_USB_HYBRID},
|
2013-08-17 08:29:02 +08:00
|
|
|
{USB_DEVICE(0x1b80, 0xe421),
|
|
|
|
.driver_info = CX231XX_BOARD_KWORLD_UB445_USB_HYBRID},
|
2011-05-18 00:46:36 +08:00
|
|
|
{USB_DEVICE(0x1f4d, 0x0237),
|
|
|
|
.driver_info = CX231XX_BOARD_ICONBIT_U100},
|
2012-11-29 01:29:16 +08:00
|
|
|
{USB_DEVICE(0x0fd9, 0x0037),
|
|
|
|
.driver_info = CX231XX_BOARD_ELGATO_VIDEO_CAPTURE_V2},
|
2013-03-02 06:53:30 +08:00
|
|
|
{USB_DEVICE(0x1f4d, 0x0102),
|
|
|
|
.driver_info = CX231XX_BOARD_OTG102},
|
2015-05-20 15:51:29 +08:00
|
|
|
{USB_DEVICE(USB_VID_TERRATEC, 0x00a6),
|
|
|
|
.driver_info = CX231XX_BOARD_TERRATEC_GRABBY},
|
2017-01-30 02:03:51 +08:00
|
|
|
{USB_DEVICE(0x1b80, 0xd3b2),
|
|
|
|
.driver_info = CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD},
|
2017-04-22 23:47:13 +08:00
|
|
|
{USB_DEVICE(0x15f4, 0x0135),
|
|
|
|
.driver_info = CX231XX_BOARD_ASTROMETA_T2HYBRID},
|
2009-03-03 17:14:34 +08:00
|
|
|
{},
|
2009-03-04 01:37:50 +08:00
|
|
|
};
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
MODULE_DEVICE_TABLE(usb, cx231xx_id_table);
|
|
|
|
|
|
|
|
/* cx231xx_tuner_callback
|
|
|
|
* will be used to reset XC5000 tuner using GPIO pin
|
|
|
|
*/
|
|
|
|
|
|
|
|
int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
|
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
struct cx231xx *dev = ptr;
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
if (dev->tuner_type == TUNER_XC5000) {
|
|
|
|
if (command == XC5000_TUNER_RESET) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Tuner CB: RESET: cmd %d : tuner type %d\n",
|
|
|
|
command, dev->tuner_type);
|
2009-03-03 17:14:34 +08:00
|
|
|
cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit,
|
|
|
|
1);
|
|
|
|
msleep(10);
|
|
|
|
cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit,
|
|
|
|
0);
|
|
|
|
msleep(330);
|
|
|
|
cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit,
|
|
|
|
1);
|
|
|
|
msleep(10);
|
|
|
|
}
|
2010-09-29 22:07:08 +08:00
|
|
|
} else if (dev->tuner_type == TUNER_NXP_TDA18271) {
|
|
|
|
switch (command) {
|
|
|
|
case TDA18271_CALLBACK_CMD_AGC_ENABLE:
|
|
|
|
if (dev->model == CX231XX_BOARD_PV_PLAYTV_USB_HYBRID)
|
|
|
|
rc = cx231xx_set_agc_analog_digital_mux_select(dev, arg);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
rc = -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
2009-03-03 17:14:34 +08:00
|
|
|
}
|
2009-03-04 01:37:50 +08:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(cx231xx_tuner_callback);
|
|
|
|
|
2012-10-28 01:02:49 +08:00
|
|
|
static void cx231xx_reset_out(struct cx231xx *dev)
|
2010-07-07 05:12:25 +08:00
|
|
|
{
|
|
|
|
cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
|
|
|
|
msleep(200);
|
|
|
|
cx231xx_set_gpio_value(dev, CX23417_RESET, 0);
|
|
|
|
msleep(200);
|
|
|
|
cx231xx_set_gpio_value(dev, CX23417_RESET, 1);
|
|
|
|
}
|
2012-10-28 01:02:49 +08:00
|
|
|
|
|
|
|
static void cx231xx_enable_OSC(struct cx231xx *dev)
|
2010-07-07 05:12:25 +08:00
|
|
|
{
|
|
|
|
cx231xx_set_gpio_value(dev, CX23417_OSC_EN, 1);
|
|
|
|
}
|
2012-10-28 01:02:49 +08:00
|
|
|
|
|
|
|
static void cx231xx_sleep_s5h1432(struct cx231xx *dev)
|
2010-07-07 05:12:25 +08:00
|
|
|
{
|
|
|
|
cx231xx_set_gpio_value(dev, SLEEP_S5H1432, 0);
|
|
|
|
}
|
|
|
|
|
2009-03-05 04:49:01 +08:00
|
|
|
static inline void cx231xx_set_model(struct cx231xx *dev)
|
2009-03-04 01:37:50 +08:00
|
|
|
{
|
2012-10-24 02:57:05 +08:00
|
|
|
dev->board = cx231xx_boards[dev->model];
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Since cx231xx_pre_card_setup() requires a proper dev->model,
|
|
|
|
* this won't work for boards with generic PCI IDs
|
|
|
|
*/
|
|
|
|
void cx231xx_pre_card_setup(struct cx231xx *dev)
|
|
|
|
{
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(dev->dev, "Identified as %s (card=%d)\n",
|
2014-11-01 19:59:03 +08:00
|
|
|
dev->board.name, dev->model);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2017-04-22 23:47:13 +08:00
|
|
|
if (CX231XX_BOARD_ASTROMETA_T2HYBRID == dev->model) {
|
|
|
|
/* turn on demodulator chip */
|
|
|
|
cx231xx_set_gpio_value(dev, 0x03, 0x01);
|
|
|
|
}
|
|
|
|
|
2009-03-11 08:16:26 +08:00
|
|
|
/* set the direction for GPIO pins */
|
2010-09-11 22:37:51 +08:00
|
|
|
if (dev->board.tuner_gpio) {
|
|
|
|
cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1);
|
|
|
|
cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1);
|
2010-09-27 07:48:38 +08:00
|
|
|
}
|
|
|
|
if (dev->board.tuner_sif_gpio >= 0)
|
2010-09-11 22:37:51 +08:00
|
|
|
cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2010-09-27 07:48:38 +08:00
|
|
|
/* request some modules if any required */
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
/* set the mode to Analog mode initially */
|
2009-03-04 01:37:50 +08:00
|
|
|
cx231xx_set_mode(dev, CX231XX_ANALOG_MODE);
|
|
|
|
|
|
|
|
/* Unlock device */
|
|
|
|
/* cx231xx_set_mode(dev, CX231XX_SUSPEND); */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cx231xx_config_tuner(struct cx231xx *dev)
|
|
|
|
{
|
2009-03-03 17:14:34 +08:00
|
|
|
struct tuner_setup tun_setup;
|
|
|
|
struct v4l2_frequency f;
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
if (dev->tuner_type == TUNER_ABSENT)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
|
|
|
|
tun_setup.type = dev->tuner_type;
|
|
|
|
tun_setup.addr = dev->tuner_addr;
|
|
|
|
tun_setup.tuner_callback = cx231xx_tuner_callback;
|
|
|
|
|
2009-03-21 10:33:48 +08:00
|
|
|
tuner_call(dev, tuner, s_type_addr, &tun_setup);
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
#if 0
|
2009-03-03 17:14:34 +08:00
|
|
|
if (tun_setup.type == TUNER_XC5000) {
|
2009-03-04 01:37:50 +08:00
|
|
|
static struct xc2028_ctrl ctrl = {
|
|
|
|
.fname = XC5000_DEFAULT_FIRMWARE,
|
|
|
|
.max_len = 64,
|
2009-03-03 17:14:34 +08:00
|
|
|
.demod = 0;
|
2009-03-04 01:37:50 +08:00
|
|
|
};
|
|
|
|
struct v4l2_priv_tun_config cfg = {
|
|
|
|
.tuner = dev->tuner_type,
|
|
|
|
.priv = &ctrl,
|
|
|
|
};
|
2009-03-21 10:33:48 +08:00
|
|
|
tuner_call(dev, tuner, s_config, &cfg);
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* configure tuner */
|
|
|
|
f.tuner = 0;
|
|
|
|
f.type = V4L2_TUNER_ANALOG_TV;
|
2009-03-03 17:14:34 +08:00
|
|
|
f.frequency = 9076; /* just a magic number */
|
2009-03-04 01:37:50 +08:00
|
|
|
dev->ctl_freq = f.frequency;
|
2009-03-21 10:33:48 +08:00
|
|
|
call_all(dev, tuner, s_frequency, &f);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2009-03-21 10:33:48 +08:00
|
|
|
}
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2014-10-02 13:20:54 +08:00
|
|
|
static int read_eeprom(struct cx231xx *dev, struct i2c_client *client,
|
|
|
|
u8 *eedata, int len)
|
2014-07-23 04:12:15 +08:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
u8 start_offset = 0;
|
|
|
|
int len_todo = len;
|
|
|
|
u8 *eedata_cur = eedata;
|
|
|
|
int i;
|
2014-10-02 13:20:54 +08:00
|
|
|
struct i2c_msg msg_write = { .addr = client->addr, .flags = 0,
|
2014-07-23 04:12:15 +08:00
|
|
|
.buf = &start_offset, .len = 1 };
|
2014-10-02 13:20:54 +08:00
|
|
|
struct i2c_msg msg_read = { .addr = client->addr, .flags = I2C_M_RD };
|
2014-07-23 04:12:15 +08:00
|
|
|
|
|
|
|
/* start reading at offset 0 */
|
2014-10-02 13:20:54 +08:00
|
|
|
ret = i2c_transfer(client->adapter, &msg_write, 1);
|
2014-07-28 03:27:30 +08:00
|
|
|
if (ret < 0) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev, "Can't read eeprom\n");
|
2014-07-28 03:27:30 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2014-07-23 04:12:15 +08:00
|
|
|
|
|
|
|
while (len_todo > 0) {
|
|
|
|
msg_read.len = (len_todo > 64) ? 64 : len_todo;
|
|
|
|
msg_read.buf = eedata_cur;
|
|
|
|
|
2014-10-02 13:20:54 +08:00
|
|
|
ret = i2c_transfer(client->adapter, &msg_read, 1);
|
2014-07-28 03:27:30 +08:00
|
|
|
if (ret < 0) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev, "Can't read eeprom\n");
|
2014-07-28 03:27:30 +08:00
|
|
|
return ret;
|
|
|
|
}
|
2014-07-23 04:12:15 +08:00
|
|
|
eedata_cur += msg_read.len;
|
|
|
|
len_todo -= msg_read.len;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i + 15 < len; i += 16)
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(dev->dev, "i2c eeprom %02x: %*ph\n",
|
2014-11-02 18:21:44 +08:00
|
|
|
i, 16, &eedata[i]);
|
2014-07-23 04:12:15 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
void cx231xx_card_setup(struct cx231xx *dev)
|
|
|
|
{
|
2009-03-21 10:33:48 +08:00
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
cx231xx_set_model(dev);
|
|
|
|
|
|
|
|
dev->tuner_type = cx231xx_boards[dev->model].tuner_type;
|
|
|
|
if (cx231xx_boards[dev->model].tuner_addr)
|
|
|
|
dev->tuner_addr = cx231xx_boards[dev->model].tuner_addr;
|
|
|
|
|
|
|
|
/* request some modules */
|
2009-03-03 17:14:34 +08:00
|
|
|
if (dev->board.decoder == CX231XX_AVDECODER) {
|
2009-04-01 14:57:53 +08:00
|
|
|
dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
|
2014-10-02 13:20:59 +08:00
|
|
|
cx231xx_get_i2c_adap(dev, I2C_0),
|
2010-09-24 21:16:44 +08:00
|
|
|
"cx25840", 0x88 >> 1, NULL);
|
2009-03-21 10:33:48 +08:00
|
|
|
if (dev->sd_cx25840 == NULL)
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"cx25840 subdev registration failure\n");
|
2009-03-30 06:20:26 +08:00
|
|
|
cx25840_call(dev, core, load_fw);
|
2009-03-21 10:33:48 +08:00
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
}
|
2009-03-21 10:33:48 +08:00
|
|
|
|
2010-07-09 04:05:30 +08:00
|
|
|
/* Initialize the tuner */
|
|
|
|
if (dev->board.tuner_type != TUNER_ABSENT) {
|
2014-10-02 13:20:59 +08:00
|
|
|
struct i2c_adapter *tuner_i2c = cx231xx_get_i2c_adap(dev,
|
|
|
|
dev->board.tuner_i2c_master);
|
2010-07-09 04:05:30 +08:00
|
|
|
dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev,
|
2014-10-02 13:20:59 +08:00
|
|
|
tuner_i2c,
|
2010-09-24 21:16:44 +08:00
|
|
|
"tuner",
|
2010-07-09 04:05:30 +08:00
|
|
|
dev->tuner_addr, NULL);
|
|
|
|
if (dev->sd_tuner == NULL)
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"tuner subdev registration failure\n");
|
2010-07-09 04:05:30 +08:00
|
|
|
else
|
2010-07-07 05:12:25 +08:00
|
|
|
cx231xx_config_tuner(dev);
|
2009-03-03 17:14:34 +08:00
|
|
|
}
|
2014-07-23 04:12:15 +08:00
|
|
|
|
|
|
|
switch (dev->model) {
|
|
|
|
case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx:
|
2014-07-23 04:12:16 +08:00
|
|
|
case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
|
2015-02-28 23:25:24 +08:00
|
|
|
case CX231XX_BOARD_HAUPPAUGE_955Q:
|
2014-07-23 04:12:15 +08:00
|
|
|
{
|
2015-06-06 16:02:32 +08:00
|
|
|
struct eeprom {
|
|
|
|
struct tveeprom tvee;
|
|
|
|
u8 eeprom[256];
|
|
|
|
struct i2c_client client;
|
|
|
|
};
|
|
|
|
struct eeprom *e = kzalloc(sizeof(*e), GFP_KERNEL);
|
|
|
|
|
|
|
|
if (e == NULL) {
|
|
|
|
dev_err(dev->dev,
|
|
|
|
"failed to allocate memory to read eeprom\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
e->client.adapter = cx231xx_get_i2c_adap(dev, I2C_1_MUX_1);
|
|
|
|
e->client.addr = 0xa0 >> 1;
|
2014-07-23 04:12:15 +08:00
|
|
|
|
2015-06-06 16:02:32 +08:00
|
|
|
read_eeprom(dev, &e->client, e->eeprom, sizeof(e->eeprom));
|
2017-03-03 18:28:29 +08:00
|
|
|
tveeprom_hauppauge_analog(&e->tvee, e->eeprom + 0xc0);
|
2015-06-06 16:02:32 +08:00
|
|
|
kfree(e);
|
2014-07-23 04:12:15 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cx231xx_config()
|
|
|
|
* inits registers with sane defaults
|
|
|
|
*/
|
|
|
|
int cx231xx_config(struct cx231xx *dev)
|
|
|
|
{
|
2009-03-03 17:14:34 +08:00
|
|
|
/* TBD need to add cx231xx specific code */
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cx231xx_config_i2c()
|
|
|
|
* configure i2c attached devices
|
|
|
|
*/
|
|
|
|
void cx231xx_config_i2c(struct cx231xx *dev)
|
|
|
|
{
|
2009-04-02 22:26:22 +08:00
|
|
|
/* u32 input = INPUT(dev->video_input)->vmux; */
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2009-03-21 10:33:48 +08:00
|
|
|
call_all(dev, video, s_stream, 1);
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
2015-01-01 22:37:17 +08:00
|
|
|
static void cx231xx_unregister_media_device(struct cx231xx *dev)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
|
|
|
if (dev->media_dev) {
|
|
|
|
media_device_unregister(dev->media_dev);
|
2015-12-12 06:57:08 +08:00
|
|
|
media_device_cleanup(dev->media_dev);
|
2015-01-01 22:37:17 +08:00
|
|
|
kfree(dev->media_dev);
|
|
|
|
dev->media_dev = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
/*
|
|
|
|
* cx231xx_realease_resources()
|
|
|
|
* unregisters the v4l2,i2c and usb devices
|
|
|
|
* called when the device gets disconected or at module unload
|
|
|
|
*/
|
|
|
|
void cx231xx_release_resources(struct cx231xx *dev)
|
|
|
|
{
|
2016-09-05 17:55:59 +08:00
|
|
|
cx231xx_ir_exit(dev);
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
cx231xx_release_analog_resources(dev);
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
cx231xx_remove_from_devlist(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2010-10-24 00:28:33 +08:00
|
|
|
/* Release I2C buses */
|
2009-03-03 17:14:34 +08:00
|
|
|
cx231xx_dev_uninit(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
[media] cx231xx: Fix unregister logic
There are several weirdness at the unregister logic.
First of all, IR has a poll thread. This thread needs to be
removed, as it uses some resources associated to the main driver.
So, the driver needs to explicitly unregister the I2C client for
ir-kbd-i2c.
If, for some reason, the driver needs to wait for a close()
to happen, not all memories will be freed, because the free
logic were in the wrong place.
Also, v4l2_device_unregister() seems to be called too early,
as devices are still using it.
Finally, even with the device disconnected, there is one
USB function call that will still try to talk with it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-10 19:20:01 +08:00
|
|
|
/* delete v4l2 device */
|
|
|
|
v4l2_device_unregister(&dev->v4l2_dev);
|
2010-10-24 00:28:33 +08:00
|
|
|
|
2015-09-05 03:07:03 +08:00
|
|
|
cx231xx_unregister_media_device(dev);
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
usb_put_dev(dev->udev);
|
|
|
|
|
|
|
|
/* Mark device as unused */
|
2012-01-10 19:33:47 +08:00
|
|
|
clear_bit(dev->devno, &cx231xx_devused);
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
2015-12-28 19:55:49 +08:00
|
|
|
static int cx231xx_media_device_init(struct cx231xx *dev,
|
2015-12-12 06:57:08 +08:00
|
|
|
struct usb_device *udev)
|
2015-01-01 22:37:17 +08:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
|
|
|
struct media_device *mdev;
|
|
|
|
|
2016-02-22 23:10:49 +08:00
|
|
|
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
|
2015-01-01 22:37:17 +08:00
|
|
|
if (!mdev)
|
2015-12-28 19:55:49 +08:00
|
|
|
return -ENOMEM;
|
2015-01-01 22:37:17 +08:00
|
|
|
|
2016-02-22 23:10:49 +08:00
|
|
|
media_device_usb_init(mdev, udev, dev->board.name);
|
|
|
|
|
2015-01-01 22:37:17 +08:00
|
|
|
dev->media_dev = mdev;
|
|
|
|
#endif
|
2015-12-28 19:55:49 +08:00
|
|
|
return 0;
|
2015-01-01 22:37:17 +08:00
|
|
|
}
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
/*
|
|
|
|
* cx231xx_init_dev()
|
|
|
|
* allocates and inits the device structs, registers i2c bus and v4l device
|
|
|
|
*/
|
2012-01-07 20:52:40 +08:00
|
|
|
static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
|
2009-03-03 17:14:34 +08:00
|
|
|
int minor)
|
2009-03-04 01:37:50 +08:00
|
|
|
{
|
|
|
|
int retval = -ENOMEM;
|
|
|
|
unsigned int maxh, maxw;
|
|
|
|
|
|
|
|
dev->udev = udev;
|
|
|
|
mutex_init(&dev->lock);
|
|
|
|
mutex_init(&dev->ctrl_urb_lock);
|
2009-03-03 17:14:34 +08:00
|
|
|
mutex_init(&dev->gpio_i2c_lock);
|
2010-07-07 05:12:25 +08:00
|
|
|
mutex_init(&dev->i2c_lock);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
spin_lock_init(&dev->video_mode.slock);
|
|
|
|
spin_lock_init(&dev->vbi_mode.slock);
|
|
|
|
spin_lock_init(&dev->sliced_cc_mode.slock);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
init_waitqueue_head(&dev->open);
|
|
|
|
init_waitqueue_head(&dev->wait_frame);
|
|
|
|
init_waitqueue_head(&dev->wait_stream);
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
dev->cx231xx_read_ctrl_reg = cx231xx_read_ctrl_reg;
|
|
|
|
dev->cx231xx_write_ctrl_reg = cx231xx_write_ctrl_reg;
|
|
|
|
dev->cx231xx_send_usb_command = cx231xx_send_usb_command;
|
|
|
|
dev->cx231xx_gpio_i2c_read = cx231xx_gpio_i2c_read;
|
|
|
|
dev->cx231xx_gpio_i2c_write = cx231xx_gpio_i2c_write;
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
/* Query cx231xx to find what pcb config it is related to */
|
2014-07-28 03:27:32 +08:00
|
|
|
retval = initialize_cx231xx(dev);
|
|
|
|
if (retval < 0) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev, "Failed to read PCB config\n");
|
2014-07-28 03:27:32 +08:00
|
|
|
return retval;
|
|
|
|
}
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2010-07-07 05:12:25 +08:00
|
|
|
/*To workaround error number=-71 on EP0 for VideoGrabber,
|
|
|
|
need set alt here.*/
|
2010-07-31 11:49:01 +08:00
|
|
|
if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER ||
|
|
|
|
dev->model == CX231XX_BOARD_HAUPPAUGE_USBLIVE2) {
|
2010-07-07 05:12:25 +08:00
|
|
|
cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
|
|
|
|
cx231xx_set_alt_setting(dev, INDEX_VANC, 1);
|
|
|
|
}
|
2009-03-03 17:14:34 +08:00
|
|
|
/* Cx231xx pre card setup */
|
2009-03-04 01:37:50 +08:00
|
|
|
cx231xx_pre_card_setup(dev);
|
|
|
|
|
2013-10-08 05:06:04 +08:00
|
|
|
retval = cx231xx_config(dev);
|
|
|
|
if (retval) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev, "error configuring device\n");
|
2009-03-04 01:37:50 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
/* set default norm */
|
2009-03-04 01:37:50 +08:00
|
|
|
dev->norm = dev->board.norm;
|
|
|
|
|
|
|
|
/* register i2c bus */
|
2013-10-08 05:06:04 +08:00
|
|
|
retval = cx231xx_dev_init(dev);
|
|
|
|
if (retval) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"%s: cx231xx_i2c_register - errCode [%d]!\n",
|
|
|
|
__func__, retval);
|
2013-10-08 05:06:04 +08:00
|
|
|
goto err_dev_init;
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Do board specific init */
|
|
|
|
cx231xx_card_setup(dev);
|
|
|
|
|
|
|
|
/* configure the device */
|
|
|
|
cx231xx_config_i2c(dev);
|
|
|
|
|
|
|
|
maxw = norm_maxw(dev);
|
|
|
|
maxh = norm_maxh(dev);
|
|
|
|
|
|
|
|
/* set default image size */
|
|
|
|
dev->width = maxw;
|
|
|
|
dev->height = maxh;
|
|
|
|
dev->interlaced = 0;
|
|
|
|
dev->video_input = 0;
|
|
|
|
|
2013-10-08 05:06:04 +08:00
|
|
|
retval = cx231xx_config(dev);
|
|
|
|
if (retval) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev, "%s: cx231xx_config - errCode [%d]!\n",
|
|
|
|
__func__, retval);
|
2013-10-08 05:06:04 +08:00
|
|
|
goto err_dev_init;
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* init video dma queues */
|
|
|
|
INIT_LIST_HEAD(&dev->video_mode.vidq.active);
|
|
|
|
INIT_LIST_HEAD(&dev->video_mode.vidq.queued);
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
/* init vbi dma queues */
|
2009-03-04 01:37:50 +08:00
|
|
|
INIT_LIST_HEAD(&dev->vbi_mode.vidq.active);
|
|
|
|
INIT_LIST_HEAD(&dev->vbi_mode.vidq.queued);
|
|
|
|
|
|
|
|
/* Reset other chips required if they are tied up with GPIO pins */
|
2009-03-03 17:14:34 +08:00
|
|
|
cx231xx_add_into_devlist(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2011-02-01 09:12:15 +08:00
|
|
|
if (dev->board.has_417) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(dev->dev, "attach 417 %d\n", dev->model);
|
2010-07-07 05:12:25 +08:00
|
|
|
if (cx231xx_417_register(dev) < 0) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2010-07-07 05:12:25 +08:00
|
|
|
"%s() Failed to register 417 on VID_B\n",
|
2014-11-02 18:45:56 +08:00
|
|
|
__func__);
|
2010-07-07 05:12:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
retval = cx231xx_register_analog_devices(dev);
|
2015-01-01 22:37:17 +08:00
|
|
|
if (retval)
|
2013-10-08 05:06:04 +08:00
|
|
|
goto err_analog;
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2010-10-24 00:28:33 +08:00
|
|
|
cx231xx_ir_init(dev);
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
cx231xx_init_extension(dev);
|
|
|
|
|
|
|
|
return 0;
|
2013-10-08 05:06:04 +08:00
|
|
|
err_analog:
|
2015-01-01 22:37:17 +08:00
|
|
|
cx231xx_unregister_media_device(dev);
|
|
|
|
cx231xx_release_analog_resources(dev);
|
2013-10-08 05:06:04 +08:00
|
|
|
cx231xx_remove_from_devlist(dev);
|
|
|
|
err_dev_init:
|
|
|
|
cx231xx_dev_uninit(dev);
|
|
|
|
return retval;
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_MODULES) && defined(MODULE)
|
|
|
|
static void request_module_async(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct cx231xx *dev = container_of(work,
|
2009-03-03 17:14:34 +08:00
|
|
|
struct cx231xx, request_module_wk);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
if (dev->has_alsa_audio)
|
|
|
|
request_module("cx231xx-alsa");
|
|
|
|
|
|
|
|
if (dev->board.has_dvb)
|
|
|
|
request_module("cx231xx-dvb");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void request_modules(struct cx231xx *dev)
|
|
|
|
{
|
|
|
|
INIT_WORK(&dev->request_module_wk, request_module_async);
|
|
|
|
schedule_work(&dev->request_module_wk);
|
|
|
|
}
|
2010-12-24 23:14:20 +08:00
|
|
|
|
|
|
|
static void flush_request_modules(struct cx231xx *dev)
|
|
|
|
{
|
2012-08-21 05:51:24 +08:00
|
|
|
flush_work(&dev->request_module_wk);
|
2010-12-24 23:14:20 +08:00
|
|
|
}
|
2009-03-04 01:37:50 +08:00
|
|
|
#else
|
|
|
|
#define request_modules(dev)
|
2010-12-24 23:14:20 +08:00
|
|
|
#define flush_request_modules(dev)
|
2009-03-04 01:37:50 +08:00
|
|
|
#endif /* CONFIG_MODULES */
|
|
|
|
|
2014-07-28 03:27:31 +08:00
|
|
|
static int cx231xx_init_v4l2(struct cx231xx *dev,
|
|
|
|
struct usb_device *udev,
|
|
|
|
struct usb_interface *interface,
|
|
|
|
int isoc_pipe)
|
|
|
|
{
|
|
|
|
struct usb_interface *uif;
|
|
|
|
int i, idx;
|
|
|
|
|
|
|
|
/* Video Init */
|
|
|
|
|
|
|
|
/* compute alternate max packet sizes for video */
|
|
|
|
idx = dev->current_pcb_config.hs_config_info[0].interface_info.video_index + 1;
|
|
|
|
if (idx >= dev->max_iad_interface_count) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Video PCB interface #%d doesn't exist\n", idx);
|
2014-07-28 03:27:31 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
uif = udev->actconfig->interface[idx];
|
|
|
|
|
2017-03-13 20:53:56 +08:00
|
|
|
if (uif->altsetting[0].desc.bNumEndpoints < isoc_pipe + 1)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2014-07-28 03:27:31 +08:00
|
|
|
dev->video_mode.end_point_addr = uif->altsetting[0].endpoint[isoc_pipe].desc.bEndpointAddress;
|
|
|
|
dev->video_mode.num_alt = uif->num_altsetting;
|
|
|
|
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"video EndPoint Addr 0x%x, Alternate settings: %i\n",
|
|
|
|
dev->video_mode.end_point_addr,
|
|
|
|
dev->video_mode.num_alt);
|
2014-07-28 03:27:31 +08:00
|
|
|
|
|
|
|
dev->video_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->video_mode.num_alt, GFP_KERNEL);
|
2014-11-01 19:59:03 +08:00
|
|
|
if (dev->video_mode.alt_max_pkt_size == NULL)
|
2014-07-28 03:27:31 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
for (i = 0; i < dev->video_mode.num_alt; i++) {
|
2017-03-13 20:53:56 +08:00
|
|
|
u16 tmp;
|
|
|
|
|
|
|
|
if (uif->altsetting[i].desc.bNumEndpoints < isoc_pipe + 1)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize);
|
2014-07-28 03:27:31 +08:00
|
|
|
dev->video_mode.alt_max_pkt_size[i] = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Alternate setting %i, max size= %i\n", i,
|
|
|
|
dev->video_mode.alt_max_pkt_size[i]);
|
2014-07-28 03:27:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* VBI Init */
|
|
|
|
|
|
|
|
idx = dev->current_pcb_config.hs_config_info[0].interface_info.vanc_index + 1;
|
|
|
|
if (idx >= dev->max_iad_interface_count) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"VBI PCB interface #%d doesn't exist\n", idx);
|
2014-07-28 03:27:31 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
uif = udev->actconfig->interface[idx];
|
|
|
|
|
2017-03-13 20:53:56 +08:00
|
|
|
if (uif->altsetting[0].desc.bNumEndpoints < isoc_pipe + 1)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2014-07-28 03:27:31 +08:00
|
|
|
dev->vbi_mode.end_point_addr =
|
|
|
|
uif->altsetting[0].endpoint[isoc_pipe].desc.
|
|
|
|
bEndpointAddress;
|
|
|
|
|
|
|
|
dev->vbi_mode.num_alt = uif->num_altsetting;
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"VBI EndPoint Addr 0x%x, Alternate settings: %i\n",
|
|
|
|
dev->vbi_mode.end_point_addr,
|
|
|
|
dev->vbi_mode.num_alt);
|
2014-07-28 03:27:31 +08:00
|
|
|
|
|
|
|
/* compute alternate max packet sizes for vbi */
|
|
|
|
dev->vbi_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->vbi_mode.num_alt, GFP_KERNEL);
|
2014-11-01 19:59:03 +08:00
|
|
|
if (dev->vbi_mode.alt_max_pkt_size == NULL)
|
2014-07-28 03:27:31 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
for (i = 0; i < dev->vbi_mode.num_alt; i++) {
|
2017-03-13 20:53:56 +08:00
|
|
|
u16 tmp;
|
|
|
|
|
|
|
|
if (uif->altsetting[i].desc.bNumEndpoints < isoc_pipe + 1)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
|
2014-07-28 03:27:31 +08:00
|
|
|
desc.wMaxPacketSize);
|
|
|
|
dev->vbi_mode.alt_max_pkt_size[i] =
|
|
|
|
(tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Alternate setting %i, max size= %i\n", i,
|
|
|
|
dev->vbi_mode.alt_max_pkt_size[i]);
|
2014-07-28 03:27:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Sliced CC VBI init */
|
|
|
|
|
|
|
|
/* compute alternate max packet sizes for sliced CC */
|
|
|
|
idx = dev->current_pcb_config.hs_config_info[0].interface_info.hanc_index + 1;
|
|
|
|
if (idx >= dev->max_iad_interface_count) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Sliced CC PCB interface #%d doesn't exist\n", idx);
|
2014-07-28 03:27:31 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
uif = udev->actconfig->interface[idx];
|
|
|
|
|
2017-03-13 20:53:56 +08:00
|
|
|
if (uif->altsetting[0].desc.bNumEndpoints < isoc_pipe + 1)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2014-07-28 03:27:31 +08:00
|
|
|
dev->sliced_cc_mode.end_point_addr =
|
|
|
|
uif->altsetting[0].endpoint[isoc_pipe].desc.
|
|
|
|
bEndpointAddress;
|
|
|
|
|
|
|
|
dev->sliced_cc_mode.num_alt = uif->num_altsetting;
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"sliced CC EndPoint Addr 0x%x, Alternate settings: %i\n",
|
|
|
|
dev->sliced_cc_mode.end_point_addr,
|
|
|
|
dev->sliced_cc_mode.num_alt);
|
2014-07-28 03:27:31 +08:00
|
|
|
dev->sliced_cc_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->sliced_cc_mode.num_alt, GFP_KERNEL);
|
2014-11-01 19:59:03 +08:00
|
|
|
if (dev->sliced_cc_mode.alt_max_pkt_size == NULL)
|
2014-07-28 03:27:31 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
for (i = 0; i < dev->sliced_cc_mode.num_alt; i++) {
|
2017-03-13 20:53:56 +08:00
|
|
|
u16 tmp;
|
|
|
|
|
|
|
|
if (uif->altsetting[i].desc.bNumEndpoints < isoc_pipe + 1)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].
|
2014-07-28 03:27:31 +08:00
|
|
|
desc.wMaxPacketSize);
|
|
|
|
dev->sliced_cc_mode.alt_max_pkt_size[i] =
|
|
|
|
(tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Alternate setting %i, max size= %i\n", i,
|
|
|
|
dev->sliced_cc_mode.alt_max_pkt_size[i]);
|
2014-07-28 03:27:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
/*
|
|
|
|
* cx231xx_usb_probe()
|
|
|
|
* checks for supported devices
|
|
|
|
*/
|
|
|
|
static int cx231xx_usb_probe(struct usb_interface *interface,
|
2009-03-03 17:14:34 +08:00
|
|
|
const struct usb_device_id *id)
|
2009-03-04 01:37:50 +08:00
|
|
|
{
|
|
|
|
struct usb_device *udev;
|
2014-11-03 17:07:38 +08:00
|
|
|
struct device *d = &interface->dev;
|
2009-03-04 01:37:50 +08:00
|
|
|
struct usb_interface *uif;
|
|
|
|
struct cx231xx *dev = NULL;
|
|
|
|
int retval = -ENODEV;
|
2009-03-13 05:38:40 +08:00
|
|
|
int nr = 0, ifnum;
|
2009-03-04 01:37:50 +08:00
|
|
|
int i, isoc_pipe = 0;
|
|
|
|
char *speed;
|
2014-07-28 03:27:28 +08:00
|
|
|
u8 idx;
|
2009-03-03 17:14:34 +08:00
|
|
|
struct usb_interface_assoc_descriptor *assoc_desc;
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
ifnum = interface->altsetting[0].desc.bInterfaceNumber;
|
|
|
|
|
2011-01-30 09:10:56 +08:00
|
|
|
/*
|
|
|
|
* Interface number 0 - IR interface (handled by mceusb driver)
|
|
|
|
* Interface number 1 - AV interface (handled by this driver)
|
|
|
|
*/
|
|
|
|
if (ifnum != 1)
|
|
|
|
return -ENODEV;
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2011-01-30 09:10:56 +08:00
|
|
|
/* Check to see next free device and mark as used */
|
2012-01-10 19:33:47 +08:00
|
|
|
do {
|
|
|
|
nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
|
|
|
|
if (nr >= CX231XX_MAXBOARDS) {
|
|
|
|
/* No free device slots */
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(d,
|
2014-11-02 18:21:44 +08:00
|
|
|
"Supports only %i devices.\n",
|
|
|
|
CX231XX_MAXBOARDS);
|
2012-01-10 19:33:47 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
} while (test_and_set_bit(nr, &cx231xx_devused));
|
2010-07-07 05:12:25 +08:00
|
|
|
|
2015-01-17 06:55:26 +08:00
|
|
|
udev = usb_get_dev(interface_to_usbdev(interface));
|
|
|
|
|
2011-01-30 09:10:56 +08:00
|
|
|
/* allocate memory for our device state and initialize it */
|
2014-07-28 03:27:29 +08:00
|
|
|
dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL);
|
2011-01-30 09:10:56 +08:00
|
|
|
if (dev == NULL) {
|
2015-01-17 06:55:26 +08:00
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_if;
|
2011-01-30 09:10:56 +08:00
|
|
|
}
|
2010-07-07 05:12:25 +08:00
|
|
|
|
2011-01-30 09:10:56 +08:00
|
|
|
snprintf(dev->name, 29, "cx231xx #%d", nr);
|
|
|
|
dev->devno = nr;
|
|
|
|
dev->model = id->driver_info;
|
|
|
|
dev->video_mode.alt = -1;
|
2014-11-03 17:07:38 +08:00
|
|
|
dev->dev = d;
|
2011-01-30 09:10:56 +08:00
|
|
|
|
2015-01-01 22:37:17 +08:00
|
|
|
cx231xx_set_model(dev);
|
|
|
|
|
2011-01-30 09:10:56 +08:00
|
|
|
dev->interface_count++;
|
|
|
|
/* reset gpio dir and value */
|
|
|
|
dev->gpio_dir = 0;
|
|
|
|
dev->gpio_val = 0;
|
|
|
|
dev->xc_fw_load_done = 0;
|
|
|
|
dev->has_alsa_audio = 1;
|
|
|
|
dev->power_mode = -1;
|
|
|
|
atomic_set(&dev->devlist_count, 0);
|
|
|
|
|
|
|
|
/* 0 - vbi ; 1 -sliced cc mode */
|
|
|
|
dev->vbi_or_sliced_cc_mode = 0;
|
|
|
|
|
|
|
|
/* get maximum no.of IAD interfaces */
|
2014-07-28 03:27:27 +08:00
|
|
|
dev->max_iad_interface_count = udev->config->desc.bNumInterfaces;
|
2011-01-30 09:10:56 +08:00
|
|
|
|
|
|
|
/* init CIR module TBD */
|
|
|
|
|
|
|
|
/*mode_tv: digital=1 or analog=0*/
|
|
|
|
dev->mode_tv = 0;
|
|
|
|
|
|
|
|
dev->USE_ISO = transfer_mode;
|
|
|
|
|
|
|
|
switch (udev->speed) {
|
|
|
|
case USB_SPEED_LOW:
|
|
|
|
speed = "1.5";
|
|
|
|
break;
|
|
|
|
case USB_SPEED_UNKNOWN:
|
|
|
|
case USB_SPEED_FULL:
|
|
|
|
speed = "12";
|
|
|
|
break;
|
|
|
|
case USB_SPEED_HIGH:
|
|
|
|
speed = "480";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
speed = "unknown";
|
|
|
|
}
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(d,
|
2014-11-02 18:21:44 +08:00
|
|
|
"New device %s %s @ %s Mbps (%04x:%04x) with %d interfaces\n",
|
|
|
|
udev->manufacturer ? udev->manufacturer : "",
|
|
|
|
udev->product ? udev->product : "",
|
|
|
|
speed,
|
|
|
|
le16_to_cpu(udev->descriptor.idVendor),
|
|
|
|
le16_to_cpu(udev->descriptor.idProduct),
|
|
|
|
dev->max_iad_interface_count);
|
2011-01-30 09:10:56 +08:00
|
|
|
|
|
|
|
/* increment interface count */
|
|
|
|
dev->interface_count++;
|
|
|
|
|
|
|
|
/* get device number */
|
|
|
|
nr = dev->devno;
|
|
|
|
|
|
|
|
assoc_desc = udev->actconfig->intf_assoc[0];
|
2017-09-21 16:40:18 +08:00
|
|
|
if (!assoc_desc || assoc_desc->bFirstInterface != ifnum) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(d, "Not found matching IAD interface\n");
|
2013-10-08 05:06:04 +08:00
|
|
|
retval = -ENODEV;
|
|
|
|
goto err_if;
|
2010-10-19 08:10:46 +08:00
|
|
|
}
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(d, "registering interface %d\n", ifnum);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
/* save our data pointer in this interface device */
|
[media] cx231xx: fix crash after load/unload/load of module
The following sequence of commands was triggering a kernel crash in
cdev_get():
modprobe cx231xx
rmmod cx231xx
modprobe cx231xx
v4l2grab -n 1
The problem was that cx231xx_usb_disconnect() was not doing anything
because the test:
if (!dev->udev)
return;
was reached (i.e, dev->udev was NULL).
This is due to the fact that the 'dev' pointer placed as intfdata into
the usb_interface structure had the wrong value, because
cx231xx_probe() was doing the usb_set_intfdata() on the wrong
usb_interface structure. For some reason, cx231xx_probe() was doing
the following:
static int cx231xx_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_interface *lif = NULL;
[...]
/* store the current interface */
lif = interface;
[...]
/* store the interface 0 back */
lif = udev->actconfig->interface[0];
[...]
usb_set_intfdata(lif, dev);
[...]
retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
[...]
}
So, the usb_set_intfdata() was done on udev->actconfig->interface[0]
and not on the 'interface' passed as argument to the ->probe() and
->disconnect() hooks. Later on, v4l2_device_register() was
initializing the intfdata of the correct usb_interface structure as a
pointer to the v4l2_device structure.
Upon unregistration, the ->disconnect() hook was getting the intfdata
of the usb_interface passed as argument... and casted it to a 'struct
cx231xx *' while it was in fact a 'struct v4l2_device *'.
The correct fix seems to just be to set the intfdata on the proper
interface from the beginning. Now, loading/unloading/reloading the
driver allows to use the device properly.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-07 20:52:38 +08:00
|
|
|
usb_set_intfdata(interface, dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2015-12-12 06:57:08 +08:00
|
|
|
/* Initialize the media controller */
|
2015-12-28 19:55:49 +08:00
|
|
|
retval = cx231xx_media_device_init(dev, udev);
|
|
|
|
if (retval) {
|
|
|
|
dev_err(d, "cx231xx_media_device_init failed\n");
|
|
|
|
goto err_media_init;
|
|
|
|
}
|
2015-01-01 22:37:17 +08:00
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
/* Create v4l2 device */
|
2015-02-18 23:02:09 +08:00
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
2015-01-01 22:37:17 +08:00
|
|
|
dev->v4l2_dev.mdev = dev->media_dev;
|
2015-02-18 23:02:09 +08:00
|
|
|
#endif
|
2009-04-01 19:39:29 +08:00
|
|
|
retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
|
2009-03-22 18:52:02 +08:00
|
|
|
if (retval) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(d, "v4l2_device_register failed\n");
|
2013-10-08 05:06:04 +08:00
|
|
|
goto err_v4l2;
|
2009-03-22 18:52:02 +08:00
|
|
|
}
|
2014-07-28 03:27:31 +08:00
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
/* allocate device struct */
|
2012-01-07 20:52:40 +08:00
|
|
|
retval = cx231xx_init_dev(dev, udev, nr);
|
2013-10-08 05:06:04 +08:00
|
|
|
if (retval)
|
|
|
|
goto err_init;
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2014-07-28 03:27:31 +08:00
|
|
|
retval = cx231xx_init_v4l2(dev, udev, interface, isoc_pipe);
|
|
|
|
if (retval)
|
2014-07-28 03:27:28 +08:00
|
|
|
goto err_init;
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
if (dev->current_pcb_config.ts1_source != 0xff) {
|
|
|
|
/* compute alternate max packet sizes for TS1 */
|
2014-07-28 03:27:28 +08:00
|
|
|
idx = dev->current_pcb_config.hs_config_info[0].interface_info.ts1_index + 1;
|
|
|
|
if (idx >= dev->max_iad_interface_count) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_err(d, "TS1 PCB interface #%d doesn't exist\n",
|
|
|
|
idx);
|
2014-07-28 03:27:28 +08:00
|
|
|
retval = -ENODEV;
|
2014-07-28 03:27:29 +08:00
|
|
|
goto err_video_alt;
|
2014-07-28 03:27:28 +08:00
|
|
|
}
|
|
|
|
uif = udev->actconfig->interface[idx];
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2017-03-13 20:53:56 +08:00
|
|
|
if (uif->altsetting[0].desc.bNumEndpoints < isoc_pipe + 1) {
|
|
|
|
retval = -ENODEV;
|
|
|
|
goto err_video_alt;
|
|
|
|
}
|
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
dev->ts1_mode.end_point_addr =
|
2013-02-08 02:28:53 +08:00
|
|
|
uif->altsetting[0].endpoint[isoc_pipe].
|
|
|
|
desc.bEndpointAddress;
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
dev->ts1_mode.num_alt = uif->num_altsetting;
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_info(d,
|
2014-11-02 18:21:44 +08:00
|
|
|
"TS EndPoint Addr 0x%x, Alternate settings: %i\n",
|
|
|
|
dev->ts1_mode.end_point_addr,
|
|
|
|
dev->ts1_mode.num_alt);
|
2009-03-03 17:14:34 +08:00
|
|
|
|
2014-07-28 03:27:29 +08:00
|
|
|
dev->ts1_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->ts1_mode.num_alt, GFP_KERNEL);
|
2009-03-22 18:52:02 +08:00
|
|
|
if (dev->ts1_mode.alt_max_pkt_size == NULL) {
|
2013-10-08 05:06:04 +08:00
|
|
|
retval = -ENOMEM;
|
2014-07-28 03:27:29 +08:00
|
|
|
goto err_video_alt;
|
2009-03-03 17:14:34 +08:00
|
|
|
}
|
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
for (i = 0; i < dev->ts1_mode.num_alt; i++) {
|
2017-03-13 20:53:56 +08:00
|
|
|
u16 tmp;
|
|
|
|
|
|
|
|
if (uif->altsetting[i].desc.bNumEndpoints < isoc_pipe + 1) {
|
|
|
|
retval = -ENODEV;
|
|
|
|
goto err_video_alt;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = le16_to_cpu(uif->altsetting[i].
|
2009-03-03 17:14:34 +08:00
|
|
|
endpoint[isoc_pipe].desc.
|
|
|
|
wMaxPacketSize);
|
2009-03-22 18:52:02 +08:00
|
|
|
dev->ts1_mode.alt_max_pkt_size[i] =
|
|
|
|
(tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_dbg(d, "Alternate setting %i, max size= %i\n",
|
|
|
|
i, dev->ts1_mode.alt_max_pkt_size[i]);
|
2009-03-03 17:14:34 +08:00
|
|
|
}
|
|
|
|
}
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2010-07-07 05:12:25 +08:00
|
|
|
if (dev->model == CX231XX_BOARD_CNXT_VIDEO_GRABBER) {
|
|
|
|
cx231xx_enable_OSC(dev);
|
|
|
|
cx231xx_reset_out(dev);
|
|
|
|
cx231xx_set_alt_setting(dev, INDEX_VIDEO, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dev->model == CX231XX_BOARD_CNXT_RDE_253S)
|
|
|
|
cx231xx_sleep_s5h1432(dev);
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
/* load other modules required */
|
2009-03-22 18:52:02 +08:00
|
|
|
request_modules(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
2015-12-12 06:57:08 +08:00
|
|
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
2016-02-12 08:39:52 +08:00
|
|
|
/* Init entities at the Media Controller */
|
|
|
|
cx231xx_v4l2_create_entities(dev);
|
|
|
|
|
2016-02-12 03:31:48 +08:00
|
|
|
retval = v4l2_mc_create_media_graph(dev->media_dev);
|
|
|
|
if (!retval)
|
|
|
|
retval = media_device_register(dev->media_dev);
|
2015-12-12 06:57:08 +08:00
|
|
|
#endif
|
|
|
|
if (retval < 0)
|
|
|
|
cx231xx_release_resources(dev);
|
2015-09-05 03:07:03 +08:00
|
|
|
return retval;
|
2015-12-12 06:57:08 +08:00
|
|
|
|
2013-10-08 05:06:04 +08:00
|
|
|
err_video_alt:
|
|
|
|
/* cx231xx_uninit_dev: */
|
|
|
|
cx231xx_close_extension(dev);
|
|
|
|
cx231xx_ir_exit(dev);
|
|
|
|
cx231xx_release_analog_resources(dev);
|
|
|
|
cx231xx_417_unregister(dev);
|
|
|
|
cx231xx_remove_from_devlist(dev);
|
|
|
|
cx231xx_dev_uninit(dev);
|
|
|
|
err_init:
|
|
|
|
v4l2_device_unregister(&dev->v4l2_dev);
|
|
|
|
err_v4l2:
|
2015-12-28 19:55:49 +08:00
|
|
|
cx231xx_unregister_media_device(dev);
|
|
|
|
err_media_init:
|
2013-10-08 05:06:04 +08:00
|
|
|
usb_set_intfdata(interface, NULL);
|
|
|
|
err_if:
|
|
|
|
usb_put_dev(udev);
|
2015-02-02 20:52:26 +08:00
|
|
|
clear_bit(nr, &cx231xx_devused);
|
2013-10-08 05:06:04 +08:00
|
|
|
return retval;
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* cx231xx_usb_disconnect()
|
|
|
|
* called when the device gets diconencted
|
|
|
|
* video device will be unregistered on v4l2_close in case it is still open
|
|
|
|
*/
|
|
|
|
static void cx231xx_usb_disconnect(struct usb_interface *interface)
|
|
|
|
{
|
|
|
|
struct cx231xx *dev;
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
dev = usb_get_intfdata(interface);
|
2009-03-04 01:37:50 +08:00
|
|
|
usb_set_intfdata(interface, NULL);
|
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
|
2009-03-22 18:52:02 +08:00
|
|
|
if (!dev->udev)
|
|
|
|
return;
|
|
|
|
|
2012-01-10 19:48:50 +08:00
|
|
|
dev->state |= DEV_DISCONNECTED;
|
2010-12-24 23:14:20 +08:00
|
|
|
|
|
|
|
flush_request_modules(dev);
|
2009-03-21 10:33:48 +08:00
|
|
|
|
2009-03-04 01:37:50 +08:00
|
|
|
/* wait until all current v4l2 io is finished then deallocate
|
|
|
|
resources */
|
|
|
|
mutex_lock(&dev->lock);
|
|
|
|
|
|
|
|
wake_up_interruptible_all(&dev->open);
|
|
|
|
|
|
|
|
if (dev->users) {
|
2014-11-03 17:07:38 +08:00
|
|
|
dev_warn(dev->dev,
|
2014-11-02 18:21:44 +08:00
|
|
|
"device %s is open! Deregistration and memory deallocation are deferred on close.\n",
|
2015-03-10 00:34:13 +08:00
|
|
|
video_device_node_name(&dev->vdev));
|
2009-03-04 01:37:50 +08:00
|
|
|
|
[media] cx231xx: Fix unregister logic
There are several weirdness at the unregister logic.
First of all, IR has a poll thread. This thread needs to be
removed, as it uses some resources associated to the main driver.
So, the driver needs to explicitly unregister the I2C client for
ir-kbd-i2c.
If, for some reason, the driver needs to wait for a close()
to happen, not all memories will be freed, because the free
logic were in the wrong place.
Also, v4l2_device_unregister() seems to be called too early,
as devices are still using it.
Finally, even with the device disconnected, there is one
USB function call that will still try to talk with it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-10 19:20:01 +08:00
|
|
|
/* Even having users, it is safe to remove the RC i2c driver */
|
|
|
|
cx231xx_ir_exit(dev);
|
|
|
|
|
2010-07-07 05:12:25 +08:00
|
|
|
if (dev->USE_ISO)
|
|
|
|
cx231xx_uninit_isoc(dev);
|
|
|
|
else
|
|
|
|
cx231xx_uninit_bulk(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
wake_up_interruptible(&dev->wait_frame);
|
|
|
|
wake_up_interruptible(&dev->wait_stream);
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
2009-03-03 17:14:34 +08:00
|
|
|
cx231xx_close_extension(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
|
|
|
|
mutex_unlock(&dev->lock);
|
|
|
|
|
[media] cx231xx: Fix unregister logic
There are several weirdness at the unregister logic.
First of all, IR has a poll thread. This thread needs to be
removed, as it uses some resources associated to the main driver.
So, the driver needs to explicitly unregister the I2C client for
ir-kbd-i2c.
If, for some reason, the driver needs to wait for a close()
to happen, not all memories will be freed, because the free
logic were in the wrong place.
Also, v4l2_device_unregister() seems to be called too early,
as devices are still using it.
Finally, even with the device disconnected, there is one
USB function call that will still try to talk with it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-10 19:20:01 +08:00
|
|
|
if (!dev->users)
|
|
|
|
cx231xx_release_resources(dev);
|
2009-03-04 01:37:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_driver cx231xx_usb_driver = {
|
|
|
|
.name = "cx231xx",
|
|
|
|
.probe = cx231xx_usb_probe,
|
|
|
|
.disconnect = cx231xx_usb_disconnect,
|
|
|
|
.id_table = cx231xx_id_table,
|
|
|
|
};
|
|
|
|
|
2011-11-19 01:46:12 +08:00
|
|
|
module_usb_driver(cx231xx_usb_driver);
|