/*
* 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.
*
* 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.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/usb.h>
#include <linux/version.h>
#include <linux/slab.h>
#include <media/v4l2-common.h>
#include <media/tuner.h>
#include <media/tvaudio.h>
#include <media/i2c-addr.h>
#include <media/rc-map.h>
#include "tm6000.h"
#include "tm6000-regs.h"
#include "tuner-xc2028.h"
#include "xc5000.h"
#define TM6000_BOARD_UNKNOWN 0
#define TM5600_BOARD_GENERIC 1
#define TM6000_BOARD_GENERIC 2
#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
#define TM6010_BOARD_HAUPPAUGE_900H 9
#define TM6010_BOARD_BEHOLD_WANDER 10
#define TM6010_BOARD_BEHOLD_VOYAGER 11
#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12
#define TM6010_BOARD_TWINHAN_TU501 13
#define TM6010_BOARD_BEHOLD_WANDER_LITE 14
#define TM6010_BOARD_BEHOLD_VOYAGER_LITE 15
#define TM5600_BOARD_TERRATEC_GRABSTER 16
#define TM6000_MAXBOARDS 16
static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
module_param_array(card, int, NULL, 0444);
static unsigned long tm6000_devused;
struct tm6000_board {
char *name;
struct tm6000_capabilities caps;
enum tm6000_inaudio aradio;
enum tm6000_inaudio avideo;
enum tm6000_devtype type; /* variant of the chipset */
int tuner_type; /* type of the tuner */
int tuner_addr; /* tuner address */
int demod_addr; /* demodulator address */
struct tm6000_gpio gpio;
char *ir_codes;
};
struct tm6000_board tm6000_boards[] = {
[TM6000_BOARD_UNKNOWN] = {
.name = "Unknown tm6000 video grabber",
.caps = {
.has_tuner = 1,
},
.gpio = {
.tuner_reset = TM6000_GPIO_1,
},
},
[TM5600_BOARD_GENERIC] = {
.name = "Generic tm5600 board",
.type = TM5600,
.tuner_type = TUNER_XC2028,
.tuner_addr = 0xc2 >> 1,
.caps = {
.has_tuner = 1,
},
.gpio = {
.tuner_reset = TM6000_GPIO_1,
},
},
[TM6000_BOARD_GENERIC] = {
.name = "Generic tm6000 board",
.tuner_type = TUNER_XC2028,
.tuner_addr = 0xc2 >> 1,
.caps = {
.has_tuner = 1,
.has_dvb = 1,
},
.gpio = {
.tuner_reset = TM6000_GPIO_1,
},
},
[TM6010_BOARD_GENERIC] = {
.name = "Generic tm6010 board",
.type = TM6010,
.tuner_type = TUNER_XC2028,
.tuner_addr = 0xc2 >> 1,
.demod_addr = 0x1e >> 1,
.caps = {
.has_tuner = 1,
.has_dvb = 1,
.has_zl10353 = 1,
.has_eeprom = 1,
.has_remote = 1,
},
.gpio = {
.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,
},
},
[TM5600_BOARD_10MOONS_UT821] = {
.name = "10Moons UT 821",
.tuner_type = TUNER_XC2028,
.type = TM5600,
.tuner_addr = 0xc2 >> 1,
.caps = {
.has_tuner = 1,
.has_eeprom = 1,