2009-09-14 20:42:41 +08:00
|
|
|
/*
|
2010-10-20 17:35:54 +08:00
|
|
|
* tm6000-cards.c - driver for TM5600/TM6000/TM6010 USB video capture devices
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org>
|
|
|
|
*
|
|
|
|
* 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 version 2
|
|
|
|
*
|
|
|
|
* 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.
|
2009-09-14 20:42:41 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/usb.h>
|
2010-03-30 01:52:33 +08:00
|
|
|
#include <linux/slab.h>
|
2009-09-14 20:42:41 +08:00
|
|
|
#include <media/v4l2-common.h>
|
|
|
|
#include <media/tuner.h>
|
2015-11-10 22:01:44 +08:00
|
|
|
#include <media/i2c/tvaudio.h>
|
2009-09-15 03:37:13 +08:00
|
|
|
#include <media/i2c-addr.h>
|
2010-06-21 04:16:52 +08:00
|
|
|
#include <media/rc-map.h>
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
#include "tm6000.h"
|
2007-07-19 22:09:58 +08:00
|
|
|
#include "tm6000-regs.h"
|
2007-10-24 20:22:08 +08:00
|
|
|
#include "tuner-xc2028.h"
|
2010-02-04 05:48:24 +08:00
|
|
|
#include "xc5000.h"
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2007-06-28 04:01:50 +08:00
|
|
|
#define TM6000_BOARD_UNKNOWN 0
|
|
|
|
#define TM5600_BOARD_GENERIC 1
|
|
|
|
#define TM6000_BOARD_GENERIC 2
|
2008-01-08 22:19:22 +08:00
|
|
|
#define TM6010_BOARD_GENERIC 3
|
|
|
|
#define TM5600_BOARD_10MOONS_UT821 4
|
|
|
|
#define TM5600_BOARD_10MOONS_UT330 5
|
|
|
|
#define TM6000_BOARD_ADSTECH_DUAL_TV 6
|
|
|
|
#define TM6000_BOARD_FREECOM_AND_SIMILAR 7
|
|
|
|
#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 8
|
2008-10-25 19:56:22 +08:00
|
|
|
#define TM6010_BOARD_HAUPPAUGE_900H 9
|
2010-02-08 18:48:22 +08:00
|
|
|
#define TM6010_BOARD_BEHOLD_WANDER 10
|
|
|
|
#define TM6010_BOARD_BEHOLD_VOYAGER 11
|
2010-02-08 18:50:02 +08:00
|
|
|
#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12
|
2010-03-11 01:57:57 +08:00
|
|
|
#define TM6010_BOARD_TWINHAN_TU501 13
|
2011-02-02 23:15:52 +08:00
|
|
|
#define TM6010_BOARD_BEHOLD_WANDER_LITE 14
|
|
|
|
#define TM6010_BOARD_BEHOLD_VOYAGER_LITE 15
|
2011-02-03 12:59:29 +08:00
|
|
|
#define TM5600_BOARD_TERRATEC_GRABSTER 16
|
2007-06-28 04:01:50 +08:00
|
|
|
|
2011-04-21 05:43:24 +08:00
|
|
|
#define is_generic(model) ((model == TM6000_BOARD_UNKNOWN) || \
|
|
|
|
(model == TM5600_BOARD_GENERIC) || \
|
|
|
|
(model == TM6000_BOARD_GENERIC) || \
|
|
|
|
(model == TM6010_BOARD_GENERIC))
|
|
|
|
|
2009-09-14 20:42:41 +08:00
|
|
|
#define TM6000_MAXBOARDS 16
|
|
|
|
static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
|
|
|
|
|
|
|
|
module_param_array(card, int, NULL, 0444);
|
|
|
|
|
2007-10-01 17:45:22 +08:00
|
|
|
static unsigned long tm6000_devused;
|
|
|
|
|
2007-07-19 22:09:58 +08:00
|
|
|
|
2009-09-14 20:42:41 +08:00
|
|
|
struct tm6000_board {
|
|
|
|
char *name;
|
2011-04-21 05:43:24 +08:00
|
|
|
char eename[16]; /* EEPROM name */
|
|
|
|
unsigned eename_size; /* size of EEPROM name */
|
|
|
|
unsigned eename_pos; /* Position where it appears at ROM */
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
struct tm6000_capabilities caps;
|
|
|
|
|
2008-01-08 22:19:22 +08:00
|
|
|
enum tm6000_devtype type; /* variant of the chipset */
|
2009-09-14 20:42:41 +08:00
|
|
|
int tuner_type; /* type of the tuner */
|
|
|
|
int tuner_addr; /* tuner address */
|
2007-07-24 19:06:45 +08:00
|
|
|
int demod_addr; /* demodulator address */
|
2010-03-30 00:51:10 +08:00
|
|
|
|
|
|
|
struct tm6000_gpio gpio;
|
2010-06-21 04:16:52 +08:00
|
|
|
|
2011-05-10 03:53:51 +08:00
|
|
|
struct tm6000_input vinput[3];
|
|
|
|
struct tm6000_input rinput;
|
2011-05-10 03:53:54 +08:00
|
|
|
|
2010-06-21 04:16:52 +08:00
|
|
|
char *ir_codes;
|
2009-09-14 20:42:41 +08:00
|
|
|
};
|
|
|
|
|
2011-08-04 15:14:01 +08:00
|
|
|
static struct tm6000_board tm6000_boards[] = {
|
2009-09-14 20:42:41 +08:00
|
|
|
[TM6000_BOARD_UNKNOWN] = {
|
|
|
|
.name = "Unknown tm6000 video grabber",
|
|
|
|
.caps = {
|
2011-05-10 03:53:54 +08:00
|
|
|
.has_tuner = 1,
|
|
|
|
.has_eeprom = 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6000_GPIO_1,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
|
|
|
[TM5600_BOARD_GENERIC] = {
|
|
|
|
.name = "Generic tm5600 board",
|
2008-01-08 22:19:22 +08:00
|
|
|
.type = TM5600,
|
2009-09-14 20:42:41 +08:00
|
|
|
.tuner_type = TUNER_XC2028,
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc2 >> 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
2011-05-10 03:53:54 +08:00
|
|
|
.has_eeprom = 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6000_GPIO_1,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
|
|
|
[TM6000_BOARD_GENERIC] = {
|
|
|
|
.name = "Generic tm6000 board",
|
|
|
|
.tuner_type = TUNER_XC2028,
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc2 >> 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
2011-05-10 03:53:54 +08:00
|
|
|
.has_eeprom = 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6000_GPIO_1,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
2008-01-08 22:19:22 +08:00
|
|
|
[TM6010_BOARD_GENERIC] = {
|
|
|
|
.name = "Generic tm6010 board",
|
|
|
|
.type = TM6010,
|
|
|
|
.tuner_type = TUNER_XC2028,
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc2 >> 1,
|
2010-03-30 00:51:12 +08:00
|
|
|
.demod_addr = 0x1e >> 1,
|
2008-01-08 22:19:22 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
2010-03-30 00:51:12 +08:00
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 1,
|
2008-01-08 22:19:22 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
2010-03-30 00:51:12 +08:00
|
|
|
.tuner_reset = TM6010_GPIO_2,
|
|
|
|
.tuner_on = TM6010_GPIO_3,
|
|
|
|
.demod_reset = TM6010_GPIO_1,
|
|
|
|
.demod_on = TM6010_GPIO_4,
|
|
|
|
.power_led = TM6010_GPIO_7,
|
|
|
|
.dvb_led = TM6010_GPIO_5,
|
|
|
|
.ir = TM6010_GPIO_0,
|
2010-03-30 00:51:10 +08:00
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2008-01-08 22:19:22 +08:00
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
[TM5600_BOARD_10MOONS_UT821] = {
|
|
|
|
.name = "10Moons UT 821",
|
|
|
|
.tuner_type = TUNER_XC2028,
|
2011-04-21 05:43:24 +08:00
|
|
|
.eename = { '1', '0', 'M', 'O', 'O', 'N', 'S', '5', '6', '0', '0', 0xff, 0x45, 0x5b},
|
|
|
|
.eename_size = 14,
|
|
|
|
.eename_pos = 0x14,
|
2008-01-08 22:19:22 +08:00
|
|
|
.type = TM5600,
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc2 >> 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6000_GPIO_1,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
2007-07-24 19:06:45 +08:00
|
|
|
[TM5600_BOARD_10MOONS_UT330] = {
|
2009-09-14 20:42:41 +08:00
|
|
|
.name = "10Moons UT 330",
|
2007-07-24 19:06:45 +08:00
|
|
|
.tuner_type = TUNER_PHILIPS_FQ1216AME_MK4,
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc8 >> 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
2007-07-24 19:06:45 +08:00
|
|
|
.has_dvb = 0,
|
|
|
|
.has_zl10353 = 0,
|
2009-09-14 20:42:41 +08:00
|
|
|
.has_eeprom = 1,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
|
|
|
[TM6000_BOARD_ADSTECH_DUAL_TV] = {
|
|
|
|
.name = "ADSTECH Dual TV USB",
|
|
|
|
.tuner_type = TUNER_XC2028,
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc8 >> 1,
|
2009-09-14 20:42:41 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_tda9874 = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
},
|
2007-06-28 04:01:50 +08:00
|
|
|
[TM6000_BOARD_FREECOM_AND_SIMILAR] = {
|
|
|
|
.name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual",
|
2007-09-25 04:01:49 +08:00
|
|
|
.tuner_type = TUNER_XC2028, /* has a XC3028 */
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
2007-09-25 04:01:49 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 0,
|
|
|
|
.has_remote = 1,
|
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6000_GPIO_4,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2007-09-25 04:01:49 +08:00
|
|
|
},
|
|
|
|
[TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = {
|
|
|
|
.name = "ADSTECH Mini Dual TV USB",
|
|
|
|
.tuner_type = TUNER_XC2028, /* has a XC3028 */
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc8 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
2007-06-28 04:01:50 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 0,
|
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6000_GPIO_4,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2007-06-28 04:01:50 +08:00
|
|
|
},
|
2008-10-25 19:56:22 +08:00
|
|
|
[TM6010_BOARD_HAUPPAUGE_900H] = {
|
2010-03-11 01:57:57 +08:00
|
|
|
.name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick",
|
2011-04-21 05:43:24 +08:00
|
|
|
.eename = { 'H', 0, 'V', 0, 'R', 0, '9', 0, '0', 0, '0', 0, 'H', 0 },
|
|
|
|
.eename_size = 14,
|
|
|
|
.eename_pos = 0x42,
|
2008-10-25 19:56:22 +08:00
|
|
|
.tuner_type = TUNER_XC2028, /* has a XC3028 */
|
2009-09-15 10:13:53 +08:00
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
2008-10-25 19:56:22 +08:00
|
|
|
.type = TM6010,
|
2011-11-30 23:58:51 +08:00
|
|
|
.ir_codes = RC_MAP_HAUPPAUGE,
|
2008-10-25 19:56:22 +08:00
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
2010-03-30 00:51:11 +08:00
|
|
|
.has_remote = 1,
|
2008-10-25 19:56:22 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6010_GPIO_2,
|
2010-03-30 00:51:11 +08:00
|
|
|
.tuner_on = TM6010_GPIO_3,
|
|
|
|
.demod_reset = TM6010_GPIO_1,
|
|
|
|
.demod_on = TM6010_GPIO_4,
|
|
|
|
.power_led = TM6010_GPIO_7,
|
|
|
|
.dvb_led = TM6010_GPIO_5,
|
|
|
|
.ir = TM6010_GPIO_0,
|
2010-03-30 00:51:10 +08:00
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2008-10-25 19:56:22 +08:00
|
|
|
},
|
2009-11-10 12:37:43 +08:00
|
|
|
[TM6010_BOARD_BEHOLD_WANDER] = {
|
|
|
|
.name = "Beholder Wander DVB-T/TV/FM USB2.0",
|
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
|
|
|
.type = TM6010,
|
|
|
|
.caps = {
|
2011-03-18 08:08:55 +08:00
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 1,
|
2011-08-04 15:14:01 +08:00
|
|
|
.has_radio = 1,
|
2009-11-10 12:37:43 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
2010-05-05 06:53:50 +08:00
|
|
|
.tuner_reset = TM6010_GPIO_0,
|
|
|
|
.demod_reset = TM6010_GPIO_1,
|
|
|
|
.power_led = TM6010_GPIO_6,
|
2010-03-30 00:51:10 +08:00
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.rinput = {
|
|
|
|
.type = TM6000_INPUT_RADIO,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
},
|
2009-11-10 12:37:43 +08:00
|
|
|
},
|
|
|
|
[TM6010_BOARD_BEHOLD_VOYAGER] = {
|
|
|
|
.name = "Beholder Voyager TV/FM USB2.0",
|
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.type = TM6010,
|
|
|
|
.caps = {
|
2011-03-18 08:08:55 +08:00
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 0,
|
|
|
|
.has_zl10353 = 0,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 1,
|
2011-05-10 03:53:49 +08:00
|
|
|
.has_radio = 1,
|
2009-11-10 12:37:43 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
2010-05-05 06:53:50 +08:00
|
|
|
.tuner_reset = TM6010_GPIO_0,
|
|
|
|
.power_led = TM6010_GPIO_6,
|
2010-03-30 00:51:10 +08:00
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.rinput = {
|
|
|
|
.type = TM6000_INPUT_RADIO,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
},
|
2009-11-10 12:37:43 +08:00
|
|
|
},
|
2010-02-08 18:50:02 +08:00
|
|
|
[TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
|
2010-03-11 01:57:57 +08:00
|
|
|
.name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick",
|
|
|
|
.tuner_type = TUNER_XC2028, /* has a XC3028 */
|
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
|
|
|
.type = TM6010,
|
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 1,
|
2011-08-04 15:14:18 +08:00
|
|
|
.has_radio = 1,
|
2010-03-11 01:57:57 +08:00
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6010_GPIO_2,
|
2010-03-30 00:51:11 +08:00
|
|
|
.tuner_on = TM6010_GPIO_3,
|
|
|
|
.demod_reset = TM6010_GPIO_1,
|
|
|
|
.demod_on = TM6010_GPIO_4,
|
|
|
|
.power_led = TM6010_GPIO_7,
|
|
|
|
.dvb_led = TM6010_GPIO_5,
|
|
|
|
.ir = TM6010_GPIO_0,
|
2010-03-30 00:51:10 +08:00
|
|
|
},
|
2010-06-21 04:16:52 +08:00
|
|
|
.ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2011-08-04 15:14:18 +08:00
|
|
|
.rinput = {
|
|
|
|
.type = TM6000_INPUT_RADIO,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
},
|
2010-03-11 01:57:57 +08:00
|
|
|
},
|
2011-02-03 12:59:29 +08:00
|
|
|
[TM5600_BOARD_TERRATEC_GRABSTER] = {
|
|
|
|
.name = "Terratec Grabster AV 150/250 MX",
|
|
|
|
.type = TM5600,
|
|
|
|
.tuner_type = TUNER_ABSENT,
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2011-02-03 12:59:29 +08:00
|
|
|
},
|
2010-03-11 01:57:57 +08:00
|
|
|
[TM6010_BOARD_TWINHAN_TU501] = {
|
|
|
|
.name = "Twinhan TU501(704D1)",
|
2010-02-08 18:50:02 +08:00
|
|
|
.tuner_type = TUNER_XC2028, /* has a XC3028 */
|
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
|
|
|
.type = TM6010,
|
|
|
|
.caps = {
|
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 1,
|
|
|
|
},
|
2010-03-30 00:51:10 +08:00
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6010_GPIO_2,
|
2010-03-30 00:51:11 +08:00
|
|
|
.tuner_on = TM6010_GPIO_3,
|
|
|
|
.demod_reset = TM6010_GPIO_1,
|
|
|
|
.demod_on = TM6010_GPIO_4,
|
|
|
|
.power_led = TM6010_GPIO_7,
|
|
|
|
.dvb_led = TM6010_GPIO_5,
|
|
|
|
.ir = TM6010_GPIO_0,
|
2010-03-30 00:51:10 +08:00
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_COMPOSITE1,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_A,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
}, {
|
|
|
|
.type = TM6000_INPUT_SVIDEO,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_AB,
|
|
|
|
.amux = TM6000_AMUX_ADC2,
|
|
|
|
},
|
|
|
|
},
|
2011-02-02 23:15:52 +08:00
|
|
|
},
|
|
|
|
[TM6010_BOARD_BEHOLD_WANDER_LITE] = {
|
|
|
|
.name = "Beholder Wander Lite DVB-T/TV/FM USB2.0",
|
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.demod_addr = 0x1e >> 1,
|
|
|
|
.type = TM6010,
|
|
|
|
.caps = {
|
2011-03-18 08:08:55 +08:00
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 1,
|
|
|
|
.has_zl10353 = 1,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 0,
|
2011-05-10 03:53:49 +08:00
|
|
|
.has_radio = 1,
|
2011-02-02 23:15:52 +08:00
|
|
|
},
|
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6010_GPIO_0,
|
|
|
|
.demod_reset = TM6010_GPIO_1,
|
|
|
|
.power_led = TM6010_GPIO_6,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.rinput = {
|
|
|
|
.type = TM6000_INPUT_RADIO,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
},
|
2011-02-02 23:15:52 +08:00
|
|
|
},
|
|
|
|
[TM6010_BOARD_BEHOLD_VOYAGER_LITE] = {
|
|
|
|
.name = "Beholder Voyager Lite TV/FM USB2.0",
|
|
|
|
.tuner_type = TUNER_XC5000,
|
|
|
|
.tuner_addr = 0xc2 >> 1,
|
|
|
|
.type = TM6010,
|
|
|
|
.caps = {
|
2011-03-18 08:08:55 +08:00
|
|
|
.has_tuner = 1,
|
|
|
|
.has_dvb = 0,
|
|
|
|
.has_zl10353 = 0,
|
|
|
|
.has_eeprom = 1,
|
|
|
|
.has_remote = 0,
|
2011-05-10 03:53:49 +08:00
|
|
|
.has_radio = 1,
|
2011-02-02 23:15:52 +08:00
|
|
|
},
|
|
|
|
.gpio = {
|
|
|
|
.tuner_reset = TM6010_GPIO_0,
|
|
|
|
.power_led = TM6010_GPIO_6,
|
|
|
|
},
|
2011-05-10 03:53:51 +08:00
|
|
|
.vinput = { {
|
|
|
|
.type = TM6000_INPUT_TV,
|
|
|
|
.vmux = TM6000_VMUX_VIDEO_B,
|
|
|
|
.amux = TM6000_AMUX_SIF1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
.rinput = {
|
|
|
|
.type = TM6000_INPUT_RADIO,
|
|
|
|
.amux = TM6000_AMUX_ADC1,
|
|
|
|
},
|
2011-02-03 12:59:29 +08:00
|
|
|
},
|
2009-09-14 20:42:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* table of devices that work with this driver */
|
2017-08-13 16:54:43 +08:00
|
|
|
static const struct usb_device_id tm6000_id_table[] = {
|
2011-04-21 05:43:24 +08:00
|
|
|
{ USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_GENERIC },
|
2008-01-08 22:19:22 +08:00
|
|
|
{ USB_DEVICE(0x6000, 0x0002), .driver_info = TM6010_BOARD_GENERIC },
|
2009-09-14 20:42:41 +08:00
|
|
|
{ USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV },
|
2007-07-19 22:09:58 +08:00
|
|
|
{ USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR },
|
2007-09-25 04:01:49 +08:00
|
|
|
{ USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV },
|
2008-10-25 19:56:22 +08:00
|
|
|
{ USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
|
2010-03-11 01:57:57 +08:00
|
|
|
{ USB_DEVICE(0x2040, 0x6601), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
|
|
|
|
{ USB_DEVICE(0x2040, 0x6610), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
|
|
|
|
{ USB_DEVICE(0x2040, 0x6611), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
|
2009-11-10 12:37:43 +08:00
|
|
|
{ USB_DEVICE(0x6000, 0xdec0), .driver_info = TM6010_BOARD_BEHOLD_WANDER },
|
|
|
|
{ USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER },
|
2010-02-08 18:50:02 +08:00
|
|
|
{ USB_DEVICE(0x0ccd, 0x0086), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
|
2010-03-11 01:57:57 +08:00
|
|
|
{ USB_DEVICE(0x0ccd, 0x00A5), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
|
2011-02-03 12:59:29 +08:00
|
|
|
{ USB_DEVICE(0x0ccd, 0x0079), .driver_info = TM5600_BOARD_TERRATEC_GRABSTER },
|
2010-03-11 01:57:57 +08:00
|
|
|
{ USB_DEVICE(0x13d3, 0x3240), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
|
|
|
|
{ USB_DEVICE(0x13d3, 0x3241), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
|
|
|
|
{ USB_DEVICE(0x13d3, 0x3243), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
|
|
|
|
{ USB_DEVICE(0x13d3, 0x3264), .driver_info = TM6010_BOARD_TWINHAN_TU501 },
|
2011-02-02 23:15:52 +08:00
|
|
|
{ USB_DEVICE(0x6000, 0xdec2), .driver_info = TM6010_BOARD_BEHOLD_WANDER_LITE },
|
|
|
|
{ USB_DEVICE(0x6000, 0xdec3), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER_LITE },
|
2011-08-04 15:14:01 +08:00
|
|
|
{ }
|
2009-09-14 20:42:41 +08:00
|
|
|
};
|
2011-12-01 00:26:10 +08:00
|
|
|
MODULE_DEVICE_TABLE(usb, tm6000_id_table);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2010-12-22 16:57:46 +08:00
|
|
|
/* Control power led for show some activity */
|
|
|
|
void tm6000_flash_led(struct tm6000_core *dev, u8 state)
|
|
|
|
{
|
|
|
|
/* Power LED unconfigured */
|
|
|
|
if (!dev->gpio.power_led)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ON Power LED */
|
|
|
|
if (state) {
|
|
|
|
switch (dev->model) {
|
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
|
|
|
case TM6010_BOARD_TWINHAN_TU501:
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.power_led, 0x00);
|
|
|
|
break;
|
|
|
|
case TM6010_BOARD_BEHOLD_WANDER:
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER:
|
2011-02-02 23:15:52 +08:00
|
|
|
case TM6010_BOARD_BEHOLD_WANDER_LITE:
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
|
2010-12-22 16:57:46 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.power_led, 0x01);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* OFF Power LED */
|
|
|
|
else {
|
|
|
|
switch (dev->model) {
|
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
|
|
|
case TM6010_BOARD_TWINHAN_TU501:
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.power_led, 0x01);
|
|
|
|
break;
|
|
|
|
case TM6010_BOARD_BEHOLD_WANDER:
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER:
|
2011-02-02 23:15:52 +08:00
|
|
|
case TM6010_BOARD_BEHOLD_WANDER_LITE:
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
|
2010-12-22 16:57:46 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.power_led, 0x00);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-05 06:53:50 +08:00
|
|
|
/* Tuner callback to provide the proper gpio changes needed for xc5000 */
|
|
|
|
int tm6000_xc5000_callback(void *ptr, int component, int command, int arg)
|
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
struct tm6000_core *dev = ptr;
|
|
|
|
|
|
|
|
if (dev->tuner_type != TUNER_XC5000)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (command) {
|
|
|
|
case XC5000_TUNER_RESET:
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x01);
|
|
|
|
msleep(15);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x00);
|
|
|
|
msleep(15);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x01);
|
|
|
|
break;
|
|
|
|
}
|
2010-10-20 17:36:18 +08:00
|
|
|
return rc;
|
2010-05-05 06:53:50 +08:00
|
|
|
}
|
2010-05-30 20:19:04 +08:00
|
|
|
EXPORT_SYMBOL_GPL(tm6000_xc5000_callback);
|
2010-05-05 06:53:50 +08:00
|
|
|
|
2009-09-15 04:16:32 +08:00
|
|
|
/* Tuner callback to provide the proper gpio changes needed for xc2028 */
|
|
|
|
|
2010-02-06 06:57:06 +08:00
|
|
|
int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
|
2009-09-15 04:16:32 +08:00
|
|
|
{
|
2010-04-28 05:57:00 +08:00
|
|
|
int rc = 0;
|
2009-09-15 04:16:32 +08:00
|
|
|
struct tm6000_core *dev = ptr;
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
if (dev->tuner_type != TUNER_XC2028)
|
2009-09-15 04:16:32 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (command) {
|
|
|
|
case XC2028_RESET_CLK:
|
2010-06-21 04:16:52 +08:00
|
|
|
tm6000_ir_wait(dev, 0);
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
|
2009-09-15 04:16:32 +08:00
|
|
|
0x02, arg);
|
|
|
|
msleep(10);
|
2010-05-18 15:23:29 +08:00
|
|
|
rc = tm6000_i2c_reset(dev, 10);
|
2009-09-15 04:16:32 +08:00
|
|
|
break;
|
|
|
|
case XC2028_TUNER_RESET:
|
|
|
|
/* Reset codes during load firmware */
|
|
|
|
switch (arg) {
|
|
|
|
case 0:
|
2010-02-16 01:37:17 +08:00
|
|
|
/* newer tuner can faster reset */
|
|
|
|
switch (dev->model) {
|
2010-04-25 14:50:57 +08:00
|
|
|
case TM5600_BOARD_10MOONS_UT821:
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x01);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
0x300, 0x01);
|
|
|
|
msleep(10);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x00);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
0x300, 0x00);
|
|
|
|
msleep(10);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x01);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
0x300, 0x01);
|
|
|
|
break;
|
2010-03-11 01:57:57 +08:00
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
2010-02-16 01:37:17 +08:00
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
2010-03-11 01:57:57 +08:00
|
|
|
case TM6010_BOARD_TWINHAN_TU501:
|
2010-02-16 01:37:17 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
2010-03-30 00:51:10 +08:00
|
|
|
dev->gpio.tuner_reset, 0x01);
|
2010-02-16 01:37:17 +08:00
|
|
|
msleep(60);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
2010-03-30 00:51:10 +08:00
|
|
|
dev->gpio.tuner_reset, 0x00);
|
2010-02-16 01:37:17 +08:00
|
|
|
msleep(75);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
2010-03-30 00:51:10 +08:00
|
|
|
dev->gpio.tuner_reset, 0x01);
|
2010-02-16 01:37:17 +08:00
|
|
|
msleep(60);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
2010-03-30 00:51:10 +08:00
|
|
|
dev->gpio.tuner_reset, 0x00);
|
2010-02-16 01:37:17 +08:00
|
|
|
msleep(130);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
2010-03-30 00:51:10 +08:00
|
|
|
dev->gpio.tuner_reset, 0x01);
|
2010-02-16 01:37:17 +08:00
|
|
|
msleep(130);
|
|
|
|
break;
|
|
|
|
}
|
2010-06-21 04:16:52 +08:00
|
|
|
|
|
|
|
tm6000_ir_wait(dev, 1);
|
2009-09-15 04:16:32 +08:00
|
|
|
break;
|
|
|
|
case 1:
|
2010-04-28 05:57:00 +08:00
|
|
|
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
|
2009-09-15 04:16:32 +08:00
|
|
|
0x02, 0x01);
|
|
|
|
msleep(10);
|
|
|
|
break;
|
|
|
|
case 2:
|
2010-05-18 15:23:29 +08:00
|
|
|
rc = tm6000_i2c_reset(dev, 100);
|
2009-09-15 04:16:32 +08:00
|
|
|
break;
|
|
|
|
}
|
2011-08-04 15:14:03 +08:00
|
|
|
break;
|
|
|
|
case XC2028_I2C_FLUSH:
|
|
|
|
tm6000_set_reg(dev, REQ_50_SET_START, 0, 0);
|
|
|
|
tm6000_set_reg(dev, REQ_51_SET_STOP, 0, 0);
|
|
|
|
break;
|
2009-09-15 04:16:32 +08:00
|
|
|
}
|
2010-04-28 05:57:00 +08:00
|
|
|
return rc;
|
2009-09-15 04:16:32 +08:00
|
|
|
}
|
2010-05-30 20:19:04 +08:00
|
|
|
EXPORT_SYMBOL_GPL(tm6000_tuner_callback);
|
2009-09-15 04:16:32 +08:00
|
|
|
|
2010-02-08 18:43:41 +08:00
|
|
|
int tm6000_cards_setup(struct tm6000_core *dev)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Board-specific initialization sequence. Handles all GPIO
|
|
|
|
* initialization sequences that are board-specific.
|
|
|
|
* Up to now, all found devices use GPIO1 and GPIO4 at the same way.
|
|
|
|
* Probably, they're all based on some reference device. Due to that,
|
|
|
|
* there's a common routine at the end to handle those GPIO's. Devices
|
|
|
|
* that use different pinups or init sequences can just return at
|
|
|
|
* the board-specific session.
|
|
|
|
*/
|
|
|
|
switch (dev->model) {
|
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
2010-03-11 01:57:57 +08:00
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
|
|
|
case TM6010_BOARD_TWINHAN_TU501:
|
2010-03-30 00:51:12 +08:00
|
|
|
case TM6010_BOARD_GENERIC:
|
2010-02-08 18:43:41 +08:00
|
|
|
/* Turn xceive 3028 on */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.tuner_on, 0x01);
|
2010-03-11 01:57:57 +08:00
|
|
|
msleep(15);
|
2010-02-16 01:37:18 +08:00
|
|
|
/* Turn zarlink zl10353 on */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_on, 0x00);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
/* Reset zarlink zl10353 */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_reset, 0x00);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(50);
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_reset, 0x01);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
/* Turn zarlink zl10353 off */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_on, 0x01);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
/* ir ? */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.ir, 0x01);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
/* Power led on (blue) */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.power_led, 0x00);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
/* DVB led off (orange) */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.dvb_led, 0x01);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
/* Turn zarlink zl10353 on */
|
2010-03-30 00:51:11 +08:00
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_on, 0x00);
|
2010-02-16 01:37:18 +08:00
|
|
|
msleep(15);
|
|
|
|
break;
|
2010-05-05 06:53:50 +08:00
|
|
|
case TM6010_BOARD_BEHOLD_WANDER:
|
2011-02-02 23:15:52 +08:00
|
|
|
case TM6010_BOARD_BEHOLD_WANDER_LITE:
|
2010-05-05 06:53:50 +08:00
|
|
|
/* Power led on (blue) */
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.power_led, 0x01);
|
|
|
|
msleep(15);
|
|
|
|
/* Reset zarlink zl10353 */
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_reset, 0x00);
|
|
|
|
msleep(50);
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.demod_reset, 0x01);
|
|
|
|
msleep(15);
|
|
|
|
break;
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER:
|
2011-02-02 23:15:52 +08:00
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
|
2010-05-05 06:53:50 +08:00
|
|
|
/* Power led on (blue) */
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->gpio.power_led, 0x01);
|
|
|
|
msleep(15);
|
|
|
|
break;
|
2010-02-08 18:43:41 +08:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Default initialization. Most of the devices seem to use GPIO1
|
|
|
|
* and GPIO4.on the same way, so, this handles the common sequence
|
|
|
|
* used by most devices.
|
|
|
|
* If a device uses a different sequence or different GPIO pins for
|
|
|
|
* reset, just add the code at the board-specific part
|
|
|
|
*/
|
|
|
|
|
2010-05-05 06:53:50 +08:00
|
|
|
if (dev->gpio.tuner_reset) {
|
2011-08-04 15:14:01 +08:00
|
|
|
int rc;
|
|
|
|
int i;
|
|
|
|
|
2010-05-05 06:53:50 +08:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x00);
|
|
|
|
if (rc < 0) {
|
|
|
|
printk(KERN_ERR "Error %i doing tuner reset\n", rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2010-02-08 18:43:41 +08:00
|
|
|
|
2010-05-05 06:53:50 +08:00
|
|
|
msleep(10); /* Just to be conservative */
|
|
|
|
rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.tuner_reset, 0x01);
|
|
|
|
if (rc < 0) {
|
|
|
|
printk(KERN_ERR "Error %i doing tuner reset\n", rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2010-02-08 18:43:41 +08:00
|
|
|
}
|
2010-05-05 06:53:50 +08:00
|
|
|
} else {
|
|
|
|
printk(KERN_ERR "Tuner reset is not configured\n");
|
|
|
|
return -1;
|
2010-02-08 18:43:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
msleep(50);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
static void tm6000_config_tuner(struct tm6000_core *dev)
|
2007-10-24 20:22:08 +08:00
|
|
|
{
|
2010-04-28 05:57:00 +08:00
|
|
|
struct tuner_setup tun_setup;
|
2009-09-15 03:37:13 +08:00
|
|
|
|
|
|
|
/* Load tuner module */
|
|
|
|
v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
|
2010-09-24 21:16:44 +08:00
|
|
|
"tuner", dev->tuner_addr, NULL);
|
2009-09-15 03:37:13 +08:00
|
|
|
|
|
|
|
memset(&tun_setup, 0, sizeof(tun_setup));
|
2010-04-28 05:57:00 +08:00
|
|
|
tun_setup.type = dev->tuner_type;
|
|
|
|
tun_setup.addr = dev->tuner_addr;
|
2010-05-05 06:53:50 +08:00
|
|
|
|
|
|
|
tun_setup.mode_mask = 0;
|
|
|
|
if (dev->caps.has_tuner)
|
|
|
|
tun_setup.mode_mask |= (T_ANALOG_TV | T_RADIO);
|
|
|
|
|
|
|
|
switch (dev->tuner_type) {
|
|
|
|
case TUNER_XC2028:
|
2010-05-11 00:22:50 +08:00
|
|
|
tun_setup.tuner_callback = tm6000_tuner_callback;
|
2010-05-05 06:53:50 +08:00
|
|
|
break;
|
|
|
|
case TUNER_XC5000:
|
|
|
|
tun_setup.tuner_callback = tm6000_xc5000_callback;
|
|
|
|
break;
|
|
|
|
}
|
2009-09-15 03:37:13 +08:00
|
|
|
|
|
|
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
|
2007-11-02 22:23:14 +08:00
|
|
|
|
2010-05-05 06:53:50 +08:00
|
|
|
switch (dev->tuner_type) {
|
|
|
|
case TUNER_XC2028: {
|
2010-04-28 05:57:00 +08:00
|
|
|
struct v4l2_priv_tun_config xc2028_cfg;
|
|
|
|
struct xc2028_ctrl ctl;
|
2008-10-25 19:56:22 +08:00
|
|
|
|
2009-09-15 03:37:13 +08:00
|
|
|
memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
|
2010-04-28 05:57:00 +08:00
|
|
|
memset(&ctl, 0, sizeof(ctl));
|
2008-01-08 22:19:22 +08:00
|
|
|
|
2010-02-06 06:57:07 +08:00
|
|
|
ctl.demod = XC3028_FE_ZARLINK456;
|
2011-05-10 03:53:56 +08:00
|
|
|
|
2007-11-02 22:23:14 +08:00
|
|
|
xc2028_cfg.tuner = TUNER_XC2028;
|
|
|
|
xc2028_cfg.priv = &ctl;
|
2007-10-24 20:22:08 +08:00
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
switch (dev->model) {
|
2008-10-25 19:56:22 +08:00
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
2010-02-08 18:50:02 +08:00
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
2010-03-11 01:57:57 +08:00
|
|
|
case TM6010_BOARD_TWINHAN_TU501:
|
2011-12-17 01:15:07 +08:00
|
|
|
ctl.max_len = 80;
|
2008-10-25 19:56:22 +08:00
|
|
|
ctl.fname = "xc3028L-v36.fw";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (dev->dev_type == TM6010)
|
|
|
|
ctl.fname = "xc3028-v27.fw";
|
|
|
|
else
|
2010-04-23 23:43:42 +08:00
|
|
|
ctl.fname = "xc3028-v24.fw";
|
2008-10-25 19:56:22 +08:00
|
|
|
}
|
|
|
|
|
2007-11-02 22:23:14 +08:00
|
|
|
printk(KERN_INFO "Setting firmware parameters for xc2028\n");
|
2009-09-15 03:37:13 +08:00
|
|
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config,
|
|
|
|
&xc2028_cfg);
|
2010-05-05 06:53:50 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TUNER_XC5000:
|
|
|
|
{
|
|
|
|
struct v4l2_priv_tun_config xc5000_cfg;
|
|
|
|
struct xc5000_config ctl = {
|
|
|
|
.i2c_address = dev->tuner_addr,
|
|
|
|
.if_khz = 4570,
|
2011-02-18 09:11:05 +08:00
|
|
|
.radio_input = XC5000_RADIO_FM1_MONO,
|
2010-05-05 06:53:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
xc5000_cfg.tuner = TUNER_XC5000;
|
|
|
|
xc5000_cfg.priv = &ctl;
|
|
|
|
|
|
|
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config,
|
|
|
|
&xc5000_cfg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk(KERN_INFO "Unknown tuner type. Tuner is not configured.\n");
|
|
|
|
break;
|
2007-11-02 22:23:14 +08:00
|
|
|
}
|
2007-10-24 20:22:08 +08:00
|
|
|
}
|
|
|
|
|
2011-04-21 05:43:24 +08:00
|
|
|
static int fill_board_specific_data(struct tm6000_core *dev)
|
2009-09-14 20:42:41 +08:00
|
|
|
{
|
2011-04-21 05:43:24 +08:00
|
|
|
int rc;
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2008-01-08 22:19:22 +08:00
|
|
|
dev->dev_type = tm6000_boards[dev->model].type;
|
2009-09-14 20:42:41 +08:00
|
|
|
dev->tuner_type = tm6000_boards[dev->model].tuner_type;
|
|
|
|
dev->tuner_addr = tm6000_boards[dev->model].tuner_addr;
|
2010-03-30 00:51:10 +08:00
|
|
|
|
|
|
|
dev->gpio = tm6000_boards[dev->model].gpio;
|
2007-07-24 19:06:45 +08:00
|
|
|
|
2010-06-21 04:16:52 +08:00
|
|
|
dev->ir_codes = tm6000_boards[dev->model].ir_codes;
|
|
|
|
|
2007-07-24 19:06:45 +08:00
|
|
|
dev->demod_addr = tm6000_boards[dev->model].demod_addr;
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
dev->caps = tm6000_boards[dev->model].caps;
|
|
|
|
|
2011-05-10 03:53:51 +08:00
|
|
|
dev->vinput[0] = tm6000_boards[dev->model].vinput[0];
|
|
|
|
dev->vinput[1] = tm6000_boards[dev->model].vinput[1];
|
|
|
|
dev->vinput[2] = tm6000_boards[dev->model].vinput[2];
|
|
|
|
dev->rinput = tm6000_boards[dev->model].rinput;
|
|
|
|
|
2011-09-01 13:43:04 +08:00
|
|
|
/* setup per-model quirks */
|
|
|
|
switch (dev->model) {
|
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
2011-12-17 01:15:07 +08:00
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
2011-09-01 13:43:04 +08:00
|
|
|
dev->quirks |= TM6000_QUIRK_NO_USB_DELAY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-09-14 20:42:41 +08:00
|
|
|
/* initialize hardware */
|
2010-04-28 05:57:00 +08:00
|
|
|
rc = tm6000_init(dev);
|
|
|
|
if (rc < 0)
|
2011-04-21 05:43:24 +08:00
|
|
|
return rc;
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2011-06-14 02:11:47 +08:00
|
|
|
return v4l2_device_register(&dev->udev->dev, &dev->v4l2_dev);
|
2011-04-21 05:43:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void use_alternative_detection_method(struct tm6000_core *dev)
|
|
|
|
{
|
|
|
|
int i, model = -1;
|
|
|
|
|
|
|
|
if (!dev->eedata_size)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(tm6000_boards); i++) {
|
|
|
|
if (!tm6000_boards[i].eename_size)
|
|
|
|
continue;
|
|
|
|
if (dev->eedata_size < tm6000_boards[i].eename_pos +
|
|
|
|
tm6000_boards[i].eename_size)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!memcmp(&dev->eedata[tm6000_boards[i].eename_pos],
|
|
|
|
tm6000_boards[i].eename,
|
|
|
|
tm6000_boards[i].eename_size)) {
|
|
|
|
model = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (model < 0) {
|
|
|
|
printk(KERN_INFO "Device has eeprom but is currently unknown\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev->model = model;
|
|
|
|
|
|
|
|
printk(KERN_INFO "Device identified via eeprom as %s (type = %d)\n",
|
|
|
|
tm6000_boards[model].name, model);
|
|
|
|
}
|
|
|
|
|
2011-12-01 01:54:05 +08:00
|
|
|
#if defined(CONFIG_MODULES) && defined(MODULE)
|
|
|
|
static void request_module_async(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct tm6000_core *dev = container_of(work, struct tm6000_core,
|
|
|
|
request_module_wk);
|
|
|
|
|
|
|
|
request_module("tm6000-alsa");
|
|
|
|
|
|
|
|
if (dev->caps.has_dvb)
|
|
|
|
request_module("tm6000-dvb");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void request_modules(struct tm6000_core *dev)
|
|
|
|
{
|
|
|
|
INIT_WORK(&dev->request_module_wk, request_module_async);
|
|
|
|
schedule_work(&dev->request_module_wk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void flush_request_modules(struct tm6000_core *dev)
|
|
|
|
{
|
2012-08-21 05:51:24 +08:00
|
|
|
flush_work(&dev->request_module_wk);
|
2011-12-01 01:54:05 +08:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define request_modules(dev)
|
|
|
|
#define flush_request_modules(dev)
|
|
|
|
#endif /* CONFIG_MODULES */
|
|
|
|
|
2011-04-21 05:43:24 +08:00
|
|
|
static int tm6000_init_dev(struct tm6000_core *dev)
|
|
|
|
{
|
|
|
|
struct v4l2_frequency f;
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
mutex_init(&dev->lock);
|
|
|
|
mutex_lock(&dev->lock);
|
|
|
|
|
|
|
|
if (!is_generic(dev->model)) {
|
|
|
|
rc = fill_board_specific_data(dev);
|
|
|
|
if (rc < 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* register i2c bus */
|
|
|
|
rc = tm6000_i2c_register(dev);
|
|
|
|
if (rc < 0)
|
|
|
|
goto err;
|
|
|
|
} else {
|
|
|
|
/* register i2c bus */
|
|
|
|
rc = tm6000_i2c_register(dev);
|
|
|
|
if (rc < 0)
|
|
|
|
goto err;
|
|
|
|
|
|
|
|
use_alternative_detection_method(dev);
|
|
|
|
|
|
|
|
rc = fill_board_specific_data(dev);
|
|
|
|
if (rc < 0)
|
|
|
|
goto err;
|
|
|
|
}
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2007-11-02 22:23:14 +08:00
|
|
|
/* Default values for STD and resolutions */
|
|
|
|
dev->width = 720;
|
|
|
|
dev->height = 480;
|
2013-06-03 16:36:44 +08:00
|
|
|
dev->norm = V4L2_STD_NTSC_M;
|
2007-10-24 20:22:08 +08:00
|
|
|
|
2007-11-02 22:23:14 +08:00
|
|
|
/* Configure tuner */
|
2010-04-28 05:57:00 +08:00
|
|
|
tm6000_config_tuner(dev);
|
2007-10-24 20:22:08 +08:00
|
|
|
|
2007-11-02 22:23:14 +08:00
|
|
|
/* Set video standard */
|
2014-04-29 03:53:01 +08:00
|
|
|
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_std, dev->norm);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2007-11-02 22:23:14 +08:00
|
|
|
/* Set tuner frequency - also loads firmware on xc2028/xc3028 */
|
2009-09-14 20:42:41 +08:00
|
|
|
f.tuner = 0;
|
|
|
|
f.type = V4L2_TUNER_ANALOG_TV;
|
|
|
|
f.frequency = 3092; /* 193.25 MHz */
|
|
|
|
dev->freq = f.frequency;
|
2009-09-15 03:37:13 +08:00
|
|
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f);
|
|
|
|
|
|
|
|
if (dev->caps.has_tda9874)
|
|
|
|
v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
|
2010-09-24 21:16:44 +08:00
|
|
|
"tvaudio", I2C_ADDR_TDA9874, NULL);
|
2007-11-02 22:23:14 +08:00
|
|
|
|
2010-02-12 14:51:43 +08:00
|
|
|
/* register and initialize V4L2 */
|
2010-04-28 05:57:00 +08:00
|
|
|
rc = tm6000_v4l2_register(dev);
|
|
|
|
if (rc < 0)
|
2010-02-12 14:51:43 +08:00
|
|
|
goto err;
|
|
|
|
|
2010-05-11 00:22:51 +08:00
|
|
|
tm6000_add_into_devlist(dev);
|
|
|
|
tm6000_init_extension(dev);
|
|
|
|
|
2010-06-21 04:16:52 +08:00
|
|
|
tm6000_ir_init(dev);
|
|
|
|
|
2011-12-01 01:54:05 +08:00
|
|
|
request_modules(dev);
|
|
|
|
|
2010-02-12 14:52:46 +08:00
|
|
|
mutex_unlock(&dev->lock);
|
2010-02-06 06:57:02 +08:00
|
|
|
return 0;
|
2009-09-15 03:37:13 +08:00
|
|
|
|
2009-09-14 20:42:41 +08:00
|
|
|
err:
|
|
|
|
mutex_unlock(&dev->lock);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */
|
|
|
|
#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03))
|
|
|
|
|
2010-04-26 22:24:18 +08:00
|
|
|
static void get_max_endpoint(struct usb_device *udev,
|
|
|
|
struct usb_host_interface *alt,
|
|
|
|
char *msgtype,
|
|
|
|
struct usb_host_endpoint *curr_e,
|
|
|
|
struct tm6000_endpoint *tm_ep)
|
2009-09-14 20:42:41 +08:00
|
|
|
{
|
|
|
|
u16 tmp = le16_to_cpu(curr_e->desc.wMaxPacketSize);
|
|
|
|
unsigned int size = tmp & 0x7ff;
|
|
|
|
|
2010-04-26 22:24:18 +08:00
|
|
|
if (udev->speed == USB_SPEED_HIGH)
|
2010-05-30 00:52:46 +08:00
|
|
|
size = size * hb_mult(tmp);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2010-04-26 22:24:18 +08:00
|
|
|
if (size > tm_ep->maxsize) {
|
|
|
|
tm_ep->endp = curr_e;
|
|
|
|
tm_ep->maxsize = size;
|
|
|
|
tm_ep->bInterfaceNumber = alt->desc.bInterfaceNumber;
|
|
|
|
tm_ep->bAlternateSetting = alt->desc.bAlternateSetting;
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_INFO "tm6000: %s endpoint: 0x%02x (max size=%u bytes)\n",
|
2009-09-14 20:42:41 +08:00
|
|
|
msgtype, curr_e->desc.bEndpointAddress,
|
|
|
|
size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tm6000_usb_probe()
|
|
|
|
* checks for supported devices
|
|
|
|
*/
|
|
|
|
static int tm6000_usb_probe(struct usb_interface *interface,
|
|
|
|
const struct usb_device_id *id)
|
|
|
|
{
|
|
|
|
struct usb_device *usbdev;
|
|
|
|
struct tm6000_core *dev = NULL;
|
2010-04-28 05:57:00 +08:00
|
|
|
int i, rc = 0;
|
|
|
|
int nr = 0;
|
2009-09-14 20:42:41 +08:00
|
|
|
char *speed;
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
usbdev = usb_get_dev(interface_to_usbdev(interface));
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
/* Selects the proper interface */
|
2010-04-28 05:57:00 +08:00
|
|
|
rc = usb_set_interface(usbdev, 0, 1);
|
|
|
|
if (rc < 0)
|
2009-09-14 20:42:41 +08:00
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* Check to see next free device and mark as used */
|
2010-04-28 05:57:00 +08:00
|
|
|
nr = find_first_zero_bit(&tm6000_devused, TM6000_MAXBOARDS);
|
2009-09-14 20:42:41 +08:00
|
|
|
if (nr >= TM6000_MAXBOARDS) {
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_ERR "tm6000: Supports only %i tm60xx boards.\n", TM6000_MAXBOARDS);
|
2009-09-14 20:42:41 +08:00
|
|
|
usb_put_dev(usbdev);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create and initialize dev struct */
|
|
|
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
|
|
|
if (dev == NULL) {
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_ERR "tm6000" ": out of memory!\n");
|
2009-09-14 20:42:41 +08:00
|
|
|
usb_put_dev(usbdev);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
spin_lock_init(&dev->slock);
|
2011-08-04 15:14:10 +08:00
|
|
|
mutex_init(&dev->usb_lock);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
/* Increment usage count */
|
2011-08-04 15:14:11 +08:00
|
|
|
set_bit(nr, &tm6000_devused);
|
2007-06-18 04:12:32 +08:00
|
|
|
snprintf(dev->name, 29, "tm6000 #%d", nr);
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
dev->model = id->driver_info;
|
2011-08-04 15:14:01 +08:00
|
|
|
if (card[nr] < ARRAY_SIZE(tm6000_boards))
|
2010-04-28 05:57:00 +08:00
|
|
|
dev->model = card[nr];
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
dev->udev = usbdev;
|
|
|
|
dev->devno = nr;
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
switch (usbdev->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";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get endpoints */
|
|
|
|
for (i = 0; i < interface->num_altsetting; i++) {
|
|
|
|
int ep;
|
|
|
|
|
|
|
|
for (ep = 0; ep < interface->altsetting[i].desc.bNumEndpoints; ep++) {
|
|
|
|
struct usb_host_endpoint *e;
|
|
|
|
int dir_out;
|
|
|
|
|
|
|
|
e = &interface->altsetting[i].endpoint[ep];
|
|
|
|
|
|
|
|
dir_out = ((e->desc.bEndpointAddress &
|
|
|
|
USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_INFO "tm6000: alt %d, interface %i, class %i\n",
|
2009-09-14 20:42:41 +08:00
|
|
|
i,
|
|
|
|
interface->altsetting[i].desc.bInterfaceNumber,
|
|
|
|
interface->altsetting[i].desc.bInterfaceClass);
|
|
|
|
|
|
|
|
switch (e->desc.bmAttributes) {
|
|
|
|
case USB_ENDPOINT_XFER_BULK:
|
|
|
|
if (!dir_out) {
|
2010-04-26 22:24:18 +08:00
|
|
|
get_max_endpoint(usbdev,
|
|
|
|
&interface->altsetting[i],
|
|
|
|
"Bulk IN", e,
|
|
|
|
&dev->bulk_in);
|
2009-09-14 20:42:41 +08:00
|
|
|
} else {
|
2010-04-26 22:24:18 +08:00
|
|
|
get_max_endpoint(usbdev,
|
|
|
|
&interface->altsetting[i],
|
|
|
|
"Bulk OUT", e,
|
|
|
|
&dev->bulk_out);
|
2009-09-14 20:42:41 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case USB_ENDPOINT_XFER_ISOC:
|
|
|
|
if (!dir_out) {
|
2010-04-26 22:24:18 +08:00
|
|
|
get_max_endpoint(usbdev,
|
|
|
|
&interface->altsetting[i],
|
|
|
|
"ISOC IN", e,
|
|
|
|
&dev->isoc_in);
|
2009-09-14 20:42:41 +08:00
|
|
|
} else {
|
2010-04-26 22:24:18 +08:00
|
|
|
get_max_endpoint(usbdev,
|
|
|
|
&interface->altsetting[i],
|
|
|
|
"ISOC OUT", e,
|
|
|
|
&dev->isoc_out);
|
2009-09-14 20:42:41 +08:00
|
|
|
}
|
|
|
|
break;
|
2010-06-21 04:16:52 +08:00
|
|
|
case USB_ENDPOINT_XFER_INT:
|
|
|
|
if (!dir_out) {
|
|
|
|
get_max_endpoint(usbdev,
|
|
|
|
&interface->altsetting[i],
|
|
|
|
"INT IN", e,
|
|
|
|
&dev->int_in);
|
|
|
|
} else {
|
|
|
|
get_max_endpoint(usbdev,
|
|
|
|
&interface->altsetting[i],
|
|
|
|
"INT OUT", e,
|
|
|
|
&dev->int_out);
|
|
|
|
}
|
|
|
|
break;
|
2009-09-14 20:42:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_INFO "tm6000: New video device @ %s Mbps (%04x:%04x, ifnum %d)\n",
|
2009-09-14 20:42:41 +08:00
|
|
|
speed,
|
|
|
|
le16_to_cpu(dev->udev->descriptor.idVendor),
|
|
|
|
le16_to_cpu(dev->udev->descriptor.idProduct),
|
|
|
|
interface->altsetting->desc.bInterfaceNumber);
|
|
|
|
|
|
|
|
/* check if the the device has the iso in endpoint at the correct place */
|
2010-04-26 22:24:18 +08:00
|
|
|
if (!dev->isoc_in.endp) {
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_ERR "tm6000: probing error: no IN ISOC endpoint!\n");
|
|
|
|
rc = -ENODEV;
|
2009-09-14 20:42:41 +08:00
|
|
|
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* save our data pointer in this interface device */
|
|
|
|
usb_set_intfdata(interface, dev);
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_INFO "tm6000: Found %s\n", tm6000_boards[dev->model].name);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
rc = tm6000_init_dev(dev);
|
|
|
|
if (rc < 0)
|
2009-09-14 20:42:41 +08:00
|
|
|
goto err;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_ERR "tm6000: Error %d while registering\n", rc);
|
2009-09-15 03:37:13 +08:00
|
|
|
|
2011-08-04 15:14:11 +08:00
|
|
|
clear_bit(nr, &tm6000_devused);
|
2009-09-14 20:42:41 +08:00
|
|
|
usb_put_dev(usbdev);
|
|
|
|
|
|
|
|
kfree(dev);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* tm6000_usb_disconnect()
|
|
|
|
* called when the device gets diconencted
|
|
|
|
* video device will be unregistered on v4l2_close in case it is still open
|
|
|
|
*/
|
|
|
|
static void tm6000_usb_disconnect(struct usb_interface *interface)
|
|
|
|
{
|
|
|
|
struct tm6000_core *dev = usb_get_intfdata(interface);
|
|
|
|
usb_set_intfdata(interface, NULL);
|
|
|
|
|
|
|
|
if (!dev)
|
|
|
|
return;
|
|
|
|
|
2010-04-28 05:57:00 +08:00
|
|
|
printk(KERN_INFO "tm6000: disconnecting %s\n", dev->name);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2011-12-01 01:54:05 +08:00
|
|
|
flush_request_modules(dev);
|
|
|
|
|
2010-06-21 04:16:52 +08:00
|
|
|
tm6000_ir_fini(dev);
|
|
|
|
|
2010-05-24 02:29:25 +08:00
|
|
|
if (dev->gpio.power_led) {
|
|
|
|
switch (dev->model) {
|
|
|
|
case TM6010_BOARD_HAUPPAUGE_900H:
|
|
|
|
case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
|
|
|
|
case TM6010_BOARD_TWINHAN_TU501:
|
|
|
|
/* Power led off */
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.power_led, 0x01);
|
|
|
|
msleep(15);
|
|
|
|
break;
|
|
|
|
case TM6010_BOARD_BEHOLD_WANDER:
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER:
|
2011-02-02 23:15:52 +08:00
|
|
|
case TM6010_BOARD_BEHOLD_WANDER_LITE:
|
|
|
|
case TM6010_BOARD_BEHOLD_VOYAGER_LITE:
|
2010-05-24 02:29:25 +08:00
|
|
|
/* Power led off */
|
|
|
|
tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
|
|
|
|
dev->gpio.power_led, 0x00);
|
|
|
|
msleep(15);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-09-14 20:42:41 +08:00
|
|
|
tm6000_v4l2_unregister(dev);
|
|
|
|
|
2007-06-17 10:21:48 +08:00
|
|
|
tm6000_i2c_unregister(dev);
|
|
|
|
|
2009-09-15 03:37:13 +08:00
|
|
|
v4l2_device_unregister(&dev->v4l2_dev);
|
|
|
|
|
2009-09-14 20:42:41 +08:00
|
|
|
dev->state |= DEV_DISCONNECTED;
|
|
|
|
|
2007-06-17 10:21:48 +08:00
|
|
|
usb_put_dev(dev->udev);
|
|
|
|
|
2010-05-11 00:22:51 +08:00
|
|
|
tm6000_close_extension(dev);
|
2010-05-30 20:19:04 +08:00
|
|
|
tm6000_remove_from_devlist(dev);
|
2010-05-11 00:22:51 +08:00
|
|
|
|
2011-08-04 15:14:11 +08:00
|
|
|
clear_bit(dev->devno, &tm6000_devused);
|
2007-06-15 04:19:59 +08:00
|
|
|
kfree(dev);
|
2009-09-14 20:42:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_driver tm6000_usb_driver = {
|
|
|
|
.name = "tm6000",
|
|
|
|
.probe = tm6000_usb_probe,
|
|
|
|
.disconnect = tm6000_usb_disconnect,
|
|
|
|
.id_table = tm6000_id_table,
|
|
|
|
};
|
|
|
|
|
2011-11-19 01:46:12 +08:00
|
|
|
module_usb_driver(tm6000_usb_driver);
|
2009-09-14 20:42:41 +08:00
|
|
|
|
2010-02-22 17:32:15 +08:00
|
|
|
MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000/TM6010 USB2 adapter");
|
2009-09-14 20:42:41 +08:00
|
|
|
MODULE_AUTHOR("Mauro Carvalho Chehab");
|
|
|
|
MODULE_LICENSE("GPL");
|