/*
* tm6000-stds.c - driver for TM5600/TM6000/TM6010 USB video capture devices
*
* Copyright (C) 2007 Mauro Carvalho Chehab <mchehab@redhat.com>
*
* 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/module.h>
#include <linux/kernel.h>
#include "tm6000.h"
#include "tm6000-regs.h"
struct tm6000_reg_settings {
unsigned char req;
unsigned char reg;
unsigned char value;
};
enum tm6000_audio_std {
BG_NICAM,
BTSC,
BG_A2,
DK_NICAM,
EIAJ,
FM_RADIO,
I_NICAM,
KOREA_A2,
L_NICAM,
};
struct tm6000_std_tv_settings {
v4l2_std_id id;
enum tm6000_audio_std audio_default_std;
struct tm6000_reg_settings sif[12];
struct tm6000_reg_settings nosif[12];
struct tm6000_reg_settings common[26];
};
struct tm6000_std_settings {
v4l2_std_id id;
enum tm6000_audio_std audio_default_std;
struct tm6000_reg_settings common[37];
};
static struct tm6000_std_tv_settings tv_stds[] = {
{
.id = V4L2_STD_PAL_M,
.audio_default_std = BTSC,
.sif = {
{TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2},
{TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8},
{TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3},
{TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08},
{TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1},
{TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0},
{TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2},
{TM6010_REQ08_RED_GAIN_SEL, 0xe8},
{TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62},
{TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe},
{TM6010_REQ07_RFE_POWER_DOWN, 0xcb},
{0, 0, 0},
},
.nosif = {
{TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0},
{TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8},
{TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3},
{TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f},
{TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1},
{TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0},
{TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2},
{TM6010_REQ08_RED_GAIN_SEL, 0xe8},
{TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60},
{TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc},
{TM6010_REQ07_RFE_POWER_DOWN, 0x8b},
{0, 0, 0},
},
.common = {
{TM6010_REQ07_R3F_RESET, 0x01},
{TM6010_REQ07_R00_VIDEO_CONTROL0, 0x04},
{TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e},
{TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f},
{TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00},
{TM6010_REQ07_R07_OUTPUT_CONTROL, 0x31},
{TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e},
{TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x83},
{TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x0a},
{TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe0},
{TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c},
{TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc},
{TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc},
{TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd},
{TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88},
{TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x20},
{TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61},
{TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c},
{TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c},
{TM6010_REQ07_R82_COMB_FILTER_CONFIG