Path: blob/master/drivers/media/dvb/dvb-usb/dib0700_devices.c
15111 views
/* Linux driver for devices based on the DiBcom DiB0700 USB bridge1*2* This program is free software; you can redistribute it and/or modify it3* under the terms of the GNU General Public License as published by the Free4* Software Foundation, version 2.5*6* Copyright (C) 2005-9 DiBcom, SA et al7*/8#include "dib0700.h"910#include "dib3000mc.h"11#include "dib7000m.h"12#include "dib7000p.h"13#include "dib8000.h"14#include "dib9000.h"15#include "mt2060.h"16#include "mt2266.h"17#include "tuner-xc2028.h"18#include "xc5000.h"19#include "s5h1411.h"20#include "dib0070.h"21#include "dib0090.h"22#include "lgdt3305.h"23#include "mxl5007t.h"2425static int force_lna_activation;26module_param(force_lna_activation, int, 0644);27MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "28"if applicable for the device (default: 0=automatic/off).");2930struct dib0700_adapter_state {31int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *);32const struct firmware *frontend_firmware;33};3435/* Hauppauge Nova-T 500 (aka Bristol)36* has a LNA on GPIO0 which is enabled by setting 1 */37static struct mt2060_config bristol_mt2060_config[2] = {38{39.i2c_address = 0x60,40.clock_out = 3,41}, {42.i2c_address = 0x61,43}44};454647static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {48.band_caps = BAND_VHF | BAND_UHF,49.setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),5051.agc1_max = 42598,52.agc1_min = 17694,53.agc2_max = 45875,54.agc2_min = 0,5556.agc1_pt1 = 0,57.agc1_pt2 = 59,5859.agc1_slope1 = 0,60.agc1_slope2 = 69,6162.agc2_pt1 = 0,63.agc2_pt2 = 59,6465.agc2_slope1 = 111,66.agc2_slope2 = 28,67};6869static struct dib3000mc_config bristol_dib3000mc_config[2] = {70{ .agc = &bristol_dib3000p_mt2060_agc_config,71.max_time = 0x196,72.ln_adc_level = 0x1cc7,73.output_mpeg2_in_188_bytes = 1,74},75{ .agc = &bristol_dib3000p_mt2060_agc_config,76.max_time = 0x196,77.ln_adc_level = 0x1cc7,78.output_mpeg2_in_188_bytes = 1,79}80};8182static int bristol_frontend_attach(struct dvb_usb_adapter *adap)83{84struct dib0700_state *st = adap->dev->priv;85if (adap->id == 0) {86dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);87dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);88dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);89dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);9091if (force_lna_activation)92dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);93else94dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);9596if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {97dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);98return -ENODEV;99}100}101st->mt2060_if1[adap->id] = 1220;102return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,103(10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;104}105106static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval)107{108struct i2c_msg msg[2] = {109{ .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 },110{ .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 },111};112if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO;113return 0;114}115116static int bristol_tuner_attach(struct dvb_usb_adapter *adap)117{118struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;119struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);120s8 a;121int if1=1220;122if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&123adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {124if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;125}126return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],127if1) == NULL ? -ENODEV : 0;128}129130/* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */131132/* MT226x */133static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {134{135BAND_UHF,136137/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,138* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */139(0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)140| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),1411421130,14321,1441450,146118,1471480,1493530,1501,1510,15215365535,15433770,15565535,15623592,1571580,15962,160255,16164,16264,163132,164192,16580,16680,16716817,16927,17023,17151,1721731,174}, {175BAND_VHF | BAND_LBAND,176177/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,178* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */179(0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8)180| (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),1811822372,18321,1841850,186118,1871880,1893530,1901,1910,19219365535,1940,19565535,19623592,1971980,199128,200128,201128,2020,203128,204253,20581,2060,20720817,20927,21023,21151,2122131,214}215};216217static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {21860000, 30000,2191, 8, 3, 1, 0,2200, 0, 1, 1, 2,221(3 << 14) | (1 << 12) | (524 << 0),2220,22320452225,224};225226static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {227{ .output_mpeg2_in_188_bytes = 1,228.hostbus_diversity = 1,229.tuner_is_baseband = 1,230231.agc_config_count = 2,232.agc = stk7700d_7000p_mt2266_agc_config,233.bw = &stk7700d_mt2266_pll_config,234235.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,236.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,237.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,238},239{ .output_mpeg2_in_188_bytes = 1,240.hostbus_diversity = 1,241.tuner_is_baseband = 1,242243.agc_config_count = 2,244.agc = stk7700d_7000p_mt2266_agc_config,245.bw = &stk7700d_mt2266_pll_config,246247.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,248.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,249.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,250}251};252253static struct mt2266_config stk7700d_mt2266_config[2] = {254{ .i2c_address = 0x60255},256{ .i2c_address = 0x60257}258};259260static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)261{262if (adap->id == 0) {263dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);264msleep(10);265dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);266dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);267dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);268dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);269msleep(10);270dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);271msleep(10);272if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,273stk7700d_dib7000p_mt2266_config)274!= 0) {275err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);276return -ENODEV;277}278}279280adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),281&stk7700d_dib7000p_mt2266_config[adap->id]);282283return adap->fe == NULL ? -ENODEV : 0;284}285286static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)287{288if (adap->id == 0) {289dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);290msleep(10);291dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);292dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);293dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);294dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);295msleep(10);296dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);297msleep(10);298dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);299if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,300stk7700d_dib7000p_mt2266_config)301!= 0) {302err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);303return -ENODEV;304}305}306307adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),308&stk7700d_dib7000p_mt2266_config[adap->id]);309310return adap->fe == NULL ? -ENODEV : 0;311}312313static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)314{315struct i2c_adapter *tun_i2c;316tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);317return dvb_attach(mt2266_attach, adap->fe, tun_i2c,318&stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;319}320321/* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */322static struct dibx000_agc_config xc3028_agc_config = {323BAND_VHF | BAND_UHF, /* band_caps */324325/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,326* P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,327* P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */328(0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |329(3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */330331712, /* inv_gain */33221, /* time_stabiliz */3333340, /* alpha_level */335118, /* thlock */3363370, /* wbd_inv */3382867, /* wbd_ref */3390, /* wbd_sel */3402, /* wbd_alpha */3413420, /* agc1_max */3430, /* agc1_min */34439718, /* agc2_max */3459930, /* agc2_min */3460, /* agc1_pt1 */3470, /* agc1_pt2 */3480, /* agc1_pt3 */3490, /* agc1_slope1 */3500, /* agc1_slope2 */3510, /* agc2_pt1 */352128, /* agc2_pt2 */35329, /* agc2_slope1 */35429, /* agc2_slope2 */35535617, /* alpha_mant */35727, /* alpha_exp */35823, /* beta_mant */35951, /* beta_exp */3603611, /* perform_agc_softsplit */362};363364/* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */365static struct dibx000_bandwidth_config xc3028_bw_config = {36660000, 30000, /* internal, sampling */3671, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */3680, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,369modulo */370(3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */371(1 << 25) | 5816102, /* ifreq = 5.200000 MHz */37220452225, /* timf */37330000000, /* xtal_hz */374};375376static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {377.output_mpeg2_in_188_bytes = 1,378.tuner_is_baseband = 1,379380.agc_config_count = 1,381.agc = &xc3028_agc_config,382.bw = &xc3028_bw_config,383384.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,385.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,386.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,387};388389static int stk7700ph_xc3028_callback(void *ptr, int component,390int command, int arg)391{392struct dvb_usb_adapter *adap = ptr;393394switch (command) {395case XC2028_TUNER_RESET:396/* Send the tuner in then out of reset */397dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10);398dib7000p_set_gpio(adap->fe, 8, 0, 1);399break;400case XC2028_RESET_CLK:401break;402default:403err("%s: unknown command %d, arg %d\n", __func__,404command, arg);405return -EINVAL;406}407return 0;408}409410static struct xc2028_ctrl stk7700ph_xc3028_ctrl = {411.fname = XC2028_DEFAULT_FIRMWARE,412.max_len = 64,413.demod = XC3028_FE_DIBCOM52,414};415416static struct xc2028_config stk7700ph_xc3028_config = {417.i2c_addr = 0x61,418.ctrl = &stk7700ph_xc3028_ctrl,419};420421static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)422{423struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;424425if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&426desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))427dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);428else429dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);430msleep(20);431dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);432dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);433dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);434dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);435msleep(10);436dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);437msleep(20);438dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);439msleep(10);440441if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,442&stk7700ph_dib7700_xc3028_config) != 0) {443err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",444__func__);445return -ENODEV;446}447448adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,449&stk7700ph_dib7700_xc3028_config);450451return adap->fe == NULL ? -ENODEV : 0;452}453454static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap)455{456struct i2c_adapter *tun_i2c;457458tun_i2c = dib7000p_get_i2c_master(adap->fe,459DIBX000_I2C_INTERFACE_TUNER, 1);460461stk7700ph_xc3028_config.i2c_adap = tun_i2c;462463/* FIXME: generalize & move to common area */464adap->fe->callback = stk7700ph_xc3028_callback;465466return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config)467== NULL ? -ENODEV : 0;468}469470#define DEFAULT_RC_INTERVAL 50471472static u8 rc_request[] = { REQUEST_POLL_RC, 0 };473474/* Number of keypresses to ignore before start repeating */475#define RC_REPEAT_DELAY 6476477/*478* This function is used only when firmware is < 1.20 version. Newer479* firmwares use bulk mode, with functions implemented at dib0700_core,480* at dib0700_rc_urb_completion()481*/482static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)483{484u8 key[4];485u32 keycode;486u8 toggle;487int i;488struct dib0700_state *st = d->priv;489490if (st->fw_version >= 0x10200) {491/* For 1.20 firmware , We need to keep the RC polling492callback so we can reuse the input device setup in493dvb-usb-remote.c. However, the actual work is being done494in the bulk URB completion handler. */495return 0;496}497498i = dib0700_ctrl_rd(d, rc_request, 2, key, 4);499if (i <= 0) {500err("RC Query Failed");501return -1;502}503504/* losing half of KEY_0 events from Philipps rc5 remotes.. */505if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0)506return 0;507508/* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */509510dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */511512d->last_event = 0;513switch (d->props.rc.core.protocol) {514case RC_TYPE_NEC:515/* NEC protocol sends repeat code as 0 0 0 FF */516if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&517(key[3] == 0xff))518keycode = d->last_event;519else {520keycode = key[3-2] << 8 | key[3-3];521d->last_event = keycode;522}523524rc_keydown(d->rc_dev, keycode, 0);525break;526default:527/* RC-5 protocol changes toggle bit on new keypress */528keycode = key[3-2] << 8 | key[3-3];529toggle = key[3-1];530rc_keydown(d->rc_dev, keycode, toggle);531532break;533}534return 0;535}536537/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */538static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {539BAND_UHF | BAND_VHF,540541/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,542* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */543(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)544| (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),545546712,54741,5485490,550118,5515520,5534095,5540,5550,55655742598,55817694,55945875,5602621,5610,56276,563139,56452,56559,566107,567172,56857,56970,57057121,57225,57328,57448,5755761,577{ 0,578107,57951800,58024700581},582};583584static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {585BAND_UHF | BAND_VHF,586587/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,588* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */589(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)590| (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),591592712,59341,5945950,596118,5975980,5994095,6000,6010,60260342598,60416384,60542598,6060,6076080,609137,610255,6116120,613255,6146150,6160,6176180,61941,62062115,62225,62362428,62548,6266270,628};629630static struct dibx000_bandwidth_config stk7700p_pll_config = {63160000, 30000,6321, 8, 3, 1, 0,6330, 0, 1, 1, 0,634(3 << 14) | (1 << 12) | (524 << 0),63560258167,63620452225,63730000000,638};639640static struct dib7000m_config stk7700p_dib7000m_config = {641.dvbt_mode = 1,642.output_mpeg2_in_188_bytes = 1,643.quartz_direct = 1,644645.agc_config_count = 1,646.agc = &stk7700p_7000m_mt2060_agc_config,647.bw = &stk7700p_pll_config,648649.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,650.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,651.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,652};653654static struct dib7000p_config stk7700p_dib7000p_config = {655.output_mpeg2_in_188_bytes = 1,656657.agc_config_count = 1,658.agc = &stk7700p_7000p_mt2060_agc_config,659.bw = &stk7700p_pll_config,660661.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,662.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,663.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,664};665666static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)667{668struct dib0700_state *st = adap->dev->priv;669/* unless there is no real power management in DVB - we leave the device on GPIO6 */670671dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);672dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);673674dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);675dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);676677dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);678dib0700_ctrl_clock(adap->dev, 72, 1);679dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);680681dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);682683st->mt2060_if1[0] = 1220;684685if (dib7000pc_detection(&adap->dev->i2c_adap)) {686adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);687st->is_dib7000pc = 1;688} else689adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);690691return adap->fe == NULL ? -ENODEV : 0;692}693694static struct mt2060_config stk7700p_mt2060_config = {6950x60696};697698static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)699{700struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap;701struct dib0700_state *st = adap->dev->priv;702struct i2c_adapter *tun_i2c;703s8 a;704int if1=1220;705if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&706adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {707if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;708}709if (st->is_dib7000pc)710tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);711else712tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);713714return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,715if1) == NULL ? -ENODEV : 0;716}717718/* DIB7070 generic */719static struct dibx000_agc_config dib7070_agc_config = {720BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,721/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=5, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,722* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */723(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)724| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),725726600,72710,7287290,730118,7317320,7333530,7341,7355,73673765535,7380,73974065535,7410,7427430,74440,745183,746206,747255,74872,749152,75088,75190,75275317,75427,75523,75651,7577580,759};760761static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)762{763deb_info("reset: %d", onoff);764return dib7000p_set_gpio(fe, 8, 0, !onoff);765}766767static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)768{769deb_info("sleep: %d", onoff);770return dib7000p_set_gpio(fe, 9, 0, onoff);771}772773static struct dib0070_config dib7070p_dib0070_config[2] = {774{775.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,776.reset = dib7070_tuner_reset,777.sleep = dib7070_tuner_sleep,778.clock_khz = 12000,779.clock_pad_drive = 4,780.charge_pump = 2,781}, {782.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,783.reset = dib7070_tuner_reset,784.sleep = dib7070_tuner_sleep,785.clock_khz = 12000,786.charge_pump = 2,787}788};789790static struct dib0070_config dib7770p_dib0070_config = {791.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,792.reset = dib7070_tuner_reset,793.sleep = dib7070_tuner_sleep,794.clock_khz = 12000,795.clock_pad_drive = 0,796.flip_chip = 1,797.charge_pump = 2,798};799800static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)801{802struct dvb_usb_adapter *adap = fe->dvb->priv;803struct dib0700_adapter_state *state = adap->priv;804805u16 offset;806u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);807switch (band) {808case BAND_VHF: offset = 950; break;809case BAND_UHF:810default: offset = 550; break;811}812deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));813dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));814return state->set_param_save(fe, fep);815}816817static int dib7770_set_param_override(struct dvb_frontend *fe,818struct dvb_frontend_parameters *fep)819{820struct dvb_usb_adapter *adap = fe->dvb->priv;821struct dib0700_adapter_state *state = adap->priv;822823u16 offset;824u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);825switch (band) {826case BAND_VHF:827dib7000p_set_gpio(fe, 0, 0, 1);828offset = 850;829break;830case BAND_UHF:831default:832dib7000p_set_gpio(fe, 0, 0, 0);833offset = 250;834break;835}836deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe));837dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));838return state->set_param_save(fe, fep);839}840841static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap)842{843struct dib0700_adapter_state *st = adap->priv;844struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe,845DIBX000_I2C_INTERFACE_TUNER, 1);846847if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,848&dib7770p_dib0070_config) == NULL)849return -ENODEV;850851st->set_param_save = adap->fe->ops.tuner_ops.set_params;852adap->fe->ops.tuner_ops.set_params = dib7770_set_param_override;853return 0;854}855856static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap)857{858struct dib0700_adapter_state *st = adap->priv;859struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);860861if (adap->id == 0) {862if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL)863return -ENODEV;864} else {865if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL)866return -ENODEV;867}868869st->set_param_save = adap->fe->ops.tuner_ops.set_params;870adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override;871return 0;872}873874static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index,875u16 pid, int onoff)876{877struct dib0700_state *st = adapter->dev->priv;878if (st->is_dib7000pc)879return dib7000p_pid_filter(adapter->fe, index, pid, onoff);880return dib7000m_pid_filter(adapter->fe, index, pid, onoff);881}882883static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)884{885struct dib0700_state *st = adapter->dev->priv;886if (st->is_dib7000pc)887return dib7000p_pid_filter_ctrl(adapter->fe, onoff);888return dib7000m_pid_filter_ctrl(adapter->fe, onoff);889}890891static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)892{893return dib7000p_pid_filter(adapter->fe, index, pid, onoff);894}895896static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)897{898return dib7000p_pid_filter_ctrl(adapter->fe, onoff);899}900901static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = {90260000, 15000,9031, 20, 3, 1, 0,9040, 0, 1, 1, 2,905(3 << 14) | (1 << 12) | (524 << 0),906(0 << 25) | 0,90720452225,90812000000,909};910911static struct dib7000p_config dib7070p_dib7000p_config = {912.output_mpeg2_in_188_bytes = 1,913914.agc_config_count = 1,915.agc = &dib7070_agc_config,916.bw = &dib7070_bw_config_12_mhz,917.tuner_is_baseband = 1,918.spur_protect = 1,919920.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,921.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,922.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,923924.hostbus_diversity = 1,925};926927/* STK7070P */928static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)929{930struct usb_device_descriptor *p = &adap->dev->udev->descriptor;931if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&932p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))933dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);934else935dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);936msleep(10);937dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);938dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);939dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);940dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);941942dib0700_ctrl_clock(adap->dev, 72, 1);943944msleep(10);945dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);946msleep(10);947dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);948949if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,950&dib7070p_dib7000p_config) != 0) {951err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",952__func__);953return -ENODEV;954}955956adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,957&dib7070p_dib7000p_config);958return adap->fe == NULL ? -ENODEV : 0;959}960961/* STK7770P */962static struct dib7000p_config dib7770p_dib7000p_config = {963.output_mpeg2_in_188_bytes = 1,964965.agc_config_count = 1,966.agc = &dib7070_agc_config,967.bw = &dib7070_bw_config_12_mhz,968.tuner_is_baseband = 1,969.spur_protect = 1,970971.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,972.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,973.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,974975.hostbus_diversity = 1,976.enable_current_mirror = 1,977.disable_sample_and_hold = 0,978};979980static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap)981{982struct usb_device_descriptor *p = &adap->dev->udev->descriptor;983if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&984p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))985dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);986else987dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);988msleep(10);989dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);990dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);991dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);992dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);993994dib0700_ctrl_clock(adap->dev, 72, 1);995996msleep(10);997dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);998msleep(10);999dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);10001001if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,1002&dib7770p_dib7000p_config) != 0) {1003err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",1004__func__);1005return -ENODEV;1006}10071008adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,1009&dib7770p_dib7000p_config);1010return adap->fe == NULL ? -ENODEV : 0;1011}10121013/* DIB807x generic */1014static struct dibx000_agc_config dib807x_agc_config[2] = {1015{1016BAND_VHF,1017/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,1018* P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,1019* P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0,1020* P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,1021* P_agc_write=0 */1022(0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) |1023(0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |1024(0 << 0), /* setup*/10251026600, /* inv_gain*/102710, /* time_stabiliz*/102810290, /* alpha_level*/1030118, /* thlock*/103110320, /* wbd_inv*/10333530, /* wbd_ref*/10341, /* wbd_sel*/10355, /* wbd_alpha*/1036103765535, /* agc1_max*/10380, /* agc1_min*/1039104065535, /* agc2_max*/10410, /* agc2_min*/104210430, /* agc1_pt1*/104440, /* agc1_pt2*/1045183, /* agc1_pt3*/1046206, /* agc1_slope1*/1047255, /* agc1_slope2*/104872, /* agc2_pt1*/1049152, /* agc2_pt2*/105088, /* agc2_slope1*/105190, /* agc2_slope2*/1052105317, /* alpha_mant*/105427, /* alpha_exp*/105523, /* beta_mant*/105651, /* beta_exp*/105710580, /* perform_agc_softsplit*/1059}, {1060BAND_UHF,1061/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0,1062* P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0,1063* P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,1064* P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5,1065* P_agc_write=0 */1066(0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) |1067(0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) |1068(0 << 0), /* setup */10691070600, /* inv_gain*/107110, /* time_stabiliz*/107210730, /* alpha_level*/1074118, /* thlock*/107510760, /* wbd_inv*/10773530, /* wbd_ref*/10781, /* wbd_sel*/10795, /* wbd_alpha*/1080108165535, /* agc1_max*/10820, /* agc1_min*/1083108465535, /* agc2_max*/10850, /* agc2_min*/108610870, /* agc1_pt1*/108840, /* agc1_pt2*/1089183, /* agc1_pt3*/1090206, /* agc1_slope1*/1091255, /* agc1_slope2*/109272, /* agc2_pt1*/1093152, /* agc2_pt2*/109488, /* agc2_slope1*/109590, /* agc2_slope2*/1096109717, /* alpha_mant*/109827, /* alpha_exp*/109923, /* beta_mant*/110051, /* beta_exp*/110111020, /* perform_agc_softsplit*/1103}1104};11051106static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = {110760000, 15000, /* internal, sampling*/11081, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/11090, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core,1110ADClkSrc, modulo */1111(3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/1112(0 << 25) | 0, /* ifreq = 0.000000 MHz*/111318179755, /* timf*/111412000000, /* xtal_hz*/1115};11161117static struct dib8000_config dib807x_dib8000_config[2] = {1118{1119.output_mpeg2_in_188_bytes = 1,11201121.agc_config_count = 2,1122.agc = dib807x_agc_config,1123.pll = &dib807x_bw_config_12_mhz,1124.tuner_is_baseband = 1,11251126.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,1127.gpio_val = DIB8000_GPIO_DEFAULT_VALUES,1128.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,11291130.hostbus_diversity = 1,1131.div_cfg = 1,1132.agc_control = &dib0070_ctrl_agc_filter,1133.output_mode = OUTMODE_MPEG2_FIFO,1134.drives = 0x2d98,1135}, {1136.output_mpeg2_in_188_bytes = 1,11371138.agc_config_count = 2,1139.agc = dib807x_agc_config,1140.pll = &dib807x_bw_config_12_mhz,1141.tuner_is_baseband = 1,11421143.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,1144.gpio_val = DIB8000_GPIO_DEFAULT_VALUES,1145.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,11461147.hostbus_diversity = 1,1148.agc_control = &dib0070_ctrl_agc_filter,1149.output_mode = OUTMODE_MPEG2_FIFO,1150.drives = 0x2d98,1151}1152};11531154static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff)1155{1156return dib8000_set_gpio(fe, 5, 0, !onoff);1157}11581159static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff)1160{1161return dib8000_set_gpio(fe, 0, 0, onoff);1162}11631164static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = {1165{ 240, 7},1166{ 0xffff, 6},1167};11681169static struct dib0070_config dib807x_dib0070_config[2] = {1170{1171.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,1172.reset = dib80xx_tuner_reset,1173.sleep = dib80xx_tuner_sleep,1174.clock_khz = 12000,1175.clock_pad_drive = 4,1176.vga_filter = 1,1177.force_crystal_mode = 1,1178.enable_third_order_filter = 1,1179.charge_pump = 0,1180.wbd_gain = dib8070_wbd_gain_cfg,1181.osc_buffer_state = 0,1182.freq_offset_khz_uhf = -100,1183.freq_offset_khz_vhf = -100,1184}, {1185.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,1186.reset = dib80xx_tuner_reset,1187.sleep = dib80xx_tuner_sleep,1188.clock_khz = 12000,1189.clock_pad_drive = 2,1190.vga_filter = 1,1191.force_crystal_mode = 1,1192.enable_third_order_filter = 1,1193.charge_pump = 0,1194.wbd_gain = dib8070_wbd_gain_cfg,1195.osc_buffer_state = 0,1196.freq_offset_khz_uhf = -25,1197.freq_offset_khz_vhf = -25,1198}1199};12001201static int dib807x_set_param_override(struct dvb_frontend *fe,1202struct dvb_frontend_parameters *fep)1203{1204struct dvb_usb_adapter *adap = fe->dvb->priv;1205struct dib0700_adapter_state *state = adap->priv;12061207u16 offset = dib0070_wbd_offset(fe);1208u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);1209switch (band) {1210case BAND_VHF:1211offset += 750;1212break;1213case BAND_UHF: /* fall-thru wanted */1214default:1215offset += 250; break;1216}1217deb_info("WBD for DiB8000: %d\n", offset);1218dib8000_set_wbd_ref(fe, offset);12191220return state->set_param_save(fe, fep);1221}12221223static int dib807x_tuner_attach(struct dvb_usb_adapter *adap)1224{1225struct dib0700_adapter_state *st = adap->priv;1226struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe,1227DIBX000_I2C_INTERFACE_TUNER, 1);12281229if (adap->id == 0) {1230if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,1231&dib807x_dib0070_config[0]) == NULL)1232return -ENODEV;1233} else {1234if (dvb_attach(dib0070_attach, adap->fe, tun_i2c,1235&dib807x_dib0070_config[1]) == NULL)1236return -ENODEV;1237}12381239st->set_param_save = adap->fe->ops.tuner_ops.set_params;1240adap->fe->ops.tuner_ops.set_params = dib807x_set_param_override;1241return 0;1242}12431244static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index,1245u16 pid, int onoff)1246{1247return dib8000_pid_filter(adapter->fe, index, pid, onoff);1248}12491250static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter,1251int onoff)1252{1253return dib8000_pid_filter_ctrl(adapter->fe, onoff);1254}12551256/* STK807x */1257static int stk807x_frontend_attach(struct dvb_usb_adapter *adap)1258{1259dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);1260msleep(10);1261dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);1262dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);1263dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);12641265dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);12661267dib0700_ctrl_clock(adap->dev, 72, 1);12681269msleep(10);1270dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);1271msleep(10);1272dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);12731274dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,12750x80);12761277adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,1278&dib807x_dib8000_config[0]);12791280return adap->fe == NULL ? -ENODEV : 0;1281}12821283/* STK807xPVR */1284static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap)1285{1286dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);1287msleep(30);1288dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);1289msleep(500);1290dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);1291dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);1292dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);12931294dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);12951296dib0700_ctrl_clock(adap->dev, 72, 1);12971298msleep(10);1299dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);1300msleep(10);1301dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);13021303/* initialize IC 0 */1304dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80);13051306adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80,1307&dib807x_dib8000_config[0]);13081309return adap->fe == NULL ? -ENODEV : 0;1310}13111312static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap)1313{1314/* initialize IC 1 */1315dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82);13161317adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82,1318&dib807x_dib8000_config[1]);13191320return adap->fe == NULL ? -ENODEV : 0;1321}13221323/* STK8096GP */1324struct dibx000_agc_config dib8090_agc_config[2] = {1325{1326BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND,1327/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,1328* P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,1329* P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */1330(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)1331| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),13321333787,133410,133513360,1337118,133813390,13403530,13411,13425,1343134465535,13450,1346134765535,13480,134913500,135132,1352114,1353143,1354144,1355114,1356227,1357116,1358117,1359136028,136126,136231,136351,136413650,1366},1367{1368BAND_CBAND,1369/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1,1370* P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,1371* P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */1372(0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8)1373| (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),13741375787,137610,137713780,1379118,138013810,13823530,13831,13845,138513860,13870,1388138965535,13900,139113920,139332,1394114,1395143,1396144,1397114,1398227,1399116,1400117,1401140228,140326,140431,140551,140614070,1408}1409};14101411static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = {141254000, 13500,14131, 18, 3, 1, 0,14140, 0, 1, 1, 2,1415(3 << 14) | (1 << 12) | (599 << 0),1416(0 << 25) | 0,141720199727,141812000000,1419};14201421static int dib8090_get_adc_power(struct dvb_frontend *fe)1422{1423return dib8000_get_adc_power(fe, 1);1424}14251426static struct dib8000_config dib809x_dib8000_config[2] = {1427{1428.output_mpeg2_in_188_bytes = 1,14291430.agc_config_count = 2,1431.agc = dib8090_agc_config,1432.agc_control = dib0090_dcc_freq,1433.pll = &dib8090_pll_config_12mhz,1434.tuner_is_baseband = 1,14351436.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,1437.gpio_val = DIB8000_GPIO_DEFAULT_VALUES,1438.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,14391440.hostbus_diversity = 1,1441.div_cfg = 0x31,1442.output_mode = OUTMODE_MPEG2_FIFO,1443.drives = 0x2d98,1444.diversity_delay = 48,1445.refclksel = 3,1446}, {1447.output_mpeg2_in_188_bytes = 1,14481449.agc_config_count = 2,1450.agc = dib8090_agc_config,1451.agc_control = dib0090_dcc_freq,1452.pll = &dib8090_pll_config_12mhz,1453.tuner_is_baseband = 1,14541455.gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS,1456.gpio_val = DIB8000_GPIO_DEFAULT_VALUES,1457.gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS,14581459.hostbus_diversity = 1,1460.div_cfg = 0x31,1461.output_mode = OUTMODE_DIVERSITY,1462.drives = 0x2d08,1463.diversity_delay = 1,1464.refclksel = 3,1465}1466};14671468static struct dib0090_wbd_slope dib8090_wbd_table[] = {1469/* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */1470{ 120, 0, 500, 0, 500, 4 }, /* CBAND */1471{ 170, 0, 450, 0, 450, 4 }, /* CBAND */1472{ 380, 48, 373, 28, 259, 6 }, /* VHF */1473{ 860, 34, 700, 36, 616, 6 }, /* high UHF */1474{ 0xFFFF, 34, 700, 36, 616, 6 }, /* default */1475};14761477static struct dib0090_config dib809x_dib0090_config = {1478.io.pll_bypass = 1,1479.io.pll_range = 1,1480.io.pll_prediv = 1,1481.io.pll_loopdiv = 20,1482.io.adc_clock_ratio = 8,1483.io.pll_int_loop_filt = 0,1484.io.clock_khz = 12000,1485.reset = dib80xx_tuner_reset,1486.sleep = dib80xx_tuner_sleep,1487.clkouttobamse = 1,1488.analog_output = 1,1489.i2c_address = DEFAULT_DIB0090_I2C_ADDRESS,1490.use_pwm_agc = 1,1491.clkoutdrive = 1,1492.get_adc_power = dib8090_get_adc_power,1493.freq_offset_khz_uhf = -63,1494.freq_offset_khz_vhf = -143,1495.wbd = dib8090_wbd_table,1496.fref_clock_ratio = 6,1497};14981499static int dib8096_set_param_override(struct dvb_frontend *fe,1500struct dvb_frontend_parameters *fep)1501{1502struct dvb_usb_adapter *adap = fe->dvb->priv;1503struct dib0700_adapter_state *state = adap->priv;1504u8 band = BAND_OF_FREQUENCY(fep->frequency/1000);1505u16 target;1506int ret = 0;1507enum frontend_tune_state tune_state = CT_SHUTDOWN;1508u16 ltgain, rf_gain_limit;15091510ret = state->set_param_save(fe, fep);1511if (ret < 0)1512return ret;15131514target = (dib0090_get_wbd_offset(fe) * 8 * 18 / 33 + 1) / 2;1515dib8000_set_wbd_ref(fe, target);151615171518if (band == BAND_CBAND) {1519deb_info("tuning in CBAND - soft-AGC startup\n");1520dib0090_set_tune_state(fe, CT_AGC_START);1521do {1522ret = dib0090_gain_control(fe);1523msleep(ret);1524tune_state = dib0090_get_tune_state(fe);1525if (tune_state == CT_AGC_STEP_0)1526dib8000_set_gpio(fe, 6, 0, 1);1527else if (tune_state == CT_AGC_STEP_1) {1528dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain);1529if (rf_gain_limit == 0)1530dib8000_set_gpio(fe, 6, 0, 0);1531}1532} while (tune_state < CT_AGC_STOP);1533dib0090_pwm_gain_reset(fe);1534dib8000_pwm_agc_reset(fe);1535dib8000_set_tune_state(fe, CT_DEMOD_START);1536} else {1537deb_info("not tuning in CBAND - standard AGC startup\n");1538dib0090_pwm_gain_reset(fe);1539}15401541return 0;1542}15431544static int dib809x_tuner_attach(struct dvb_usb_adapter *adap)1545{1546struct dib0700_adapter_state *st = adap->priv;1547struct i2c_adapter *tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);15481549if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)1550return -ENODEV;15511552st->set_param_save = adap->fe->ops.tuner_ops.set_params;1553adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;1554return 0;1555}15561557static int stk809x_frontend_attach(struct dvb_usb_adapter *adap)1558{1559dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);1560msleep(10);1561dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);1562dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);1563dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);15641565dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);15661567dib0700_ctrl_clock(adap->dev, 72, 1);15681569msleep(10);1570dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);1571msleep(10);1572dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);15731574dib8000_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80);15751576adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);15771578return adap->fe == NULL ? -ENODEV : 0;1579}15801581static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap)1582{1583struct dib0700_adapter_state *st = adap->priv;1584struct i2c_adapter *tun_i2c;1585struct dvb_frontend *fe_slave = dib8000_get_slave_frontend(adap->fe, 1);15861587if (fe_slave) {1588tun_i2c = dib8000_get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1);1589if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL)1590return -ENODEV;1591fe_slave->dvb = adap->fe->dvb;1592fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override;1593}1594tun_i2c = dib8000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);1595if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &dib809x_dib0090_config) == NULL)1596return -ENODEV;15971598st->set_param_save = adap->fe->ops.tuner_ops.set_params;1599adap->fe->ops.tuner_ops.set_params = dib8096_set_param_override;16001601return 0;1602}16031604static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap)1605{1606struct dvb_frontend *fe_slave;16071608dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);1609msleep(20);1610dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);1611msleep(1000);1612dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);1613dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);1614dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);16151616dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);16171618dib0700_ctrl_clock(adap->dev, 72, 1);16191620msleep(20);1621dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);1622msleep(20);1623dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);16241625dib8000_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80);16261627adap->fe = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]);1628if (adap->fe == NULL)1629return -ENODEV;16301631fe_slave = dvb_attach(dib8000_attach, &adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]);1632dib8000_set_slave_frontend(adap->fe, fe_slave);16331634return fe_slave == NULL ? -ENODEV : 0;1635}16361637/* STK9090M */1638static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff)1639{1640return dib9000_fw_pid_filter(adapter->fe, index, pid, onoff);1641}16421643static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff)1644{1645return dib9000_fw_pid_filter_ctrl(adapter->fe, onoff);1646}16471648static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff)1649{1650return dib9000_set_gpio(fe, 5, 0, !onoff);1651}16521653static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff)1654{1655return dib9000_set_gpio(fe, 0, 0, onoff);1656}16571658static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len)1659{1660u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 };1661u8 rb[2];1662struct i2c_msg msg[2] = {1663{.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2},1664{.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2},1665};1666u8 index_data;16671668dibx000_i2c_set_speed(i2c, 250);16691670if (i2c_transfer(i2c, msg, 2) != 2)1671return -EIO;16721673switch (rb[0] << 8 | rb[1]) {1674case 0:1675deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n");1676return -EIO;1677case 1:1678deb_info("Found DiB0170 rev2");1679break;1680case 2:1681deb_info("Found DiB0190 rev2");1682break;1683default:1684deb_info("DiB01x0 not found");1685return -EIO;1686}16871688for (index_data = 0; index_data < len; index_data += 2) {1689wb[2] = (data[index_data + 1] >> 8) & 0xff;1690wb[3] = (data[index_data + 1]) & 0xff;16911692if (data[index_data] == 0) {1693wb[0] = (data[index_data] >> 8) & 0xff;1694wb[1] = (data[index_data]) & 0xff;1695msg[0].len = 2;1696if (i2c_transfer(i2c, msg, 2) != 2)1697return -EIO;1698wb[2] |= rb[0];1699wb[3] |= rb[1] & ~(3 << 4);1700}17011702wb[0] = (data[index_data] >> 8)&0xff;1703wb[1] = (data[index_data])&0xff;1704msg[0].len = 4;1705if (i2c_transfer(i2c, &msg[0], 1) != 1)1706return -EIO;1707}1708return 0;1709}17101711static struct dib9000_config stk9090m_config = {1712.output_mpeg2_in_188_bytes = 1,1713.output_mode = OUTMODE_MPEG2_FIFO,1714.vcxo_timer = 279620,1715.timing_frequency = 20452225,1716.demod_clock_khz = 60000,1717.xtal_clock_khz = 30000,1718.if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),1719.subband = {17202,1721{1722{ 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */1723{ 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */1724{ 0 },1725},1726},1727.gpio_function = {1728{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },1729{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },1730},1731};17321733static struct dib9000_config nim9090md_config[2] = {1734{1735.output_mpeg2_in_188_bytes = 1,1736.output_mode = OUTMODE_MPEG2_FIFO,1737.vcxo_timer = 279620,1738.timing_frequency = 20452225,1739.demod_clock_khz = 60000,1740.xtal_clock_khz = 30000,1741.if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),1742}, {1743.output_mpeg2_in_188_bytes = 1,1744.output_mode = OUTMODE_DIVERSITY,1745.vcxo_timer = 279620,1746.timing_frequency = 20452225,1747.demod_clock_khz = 60000,1748.xtal_clock_khz = 30000,1749.if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0),1750.subband = {17512,1752{1753{ 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */1754{ 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */1755{ 0 },1756},1757},1758.gpio_function = {1759{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 },1760{ .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 },1761},1762}1763};17641765static struct dib0090_config dib9090_dib0090_config = {1766.io.pll_bypass = 0,1767.io.pll_range = 1,1768.io.pll_prediv = 1,1769.io.pll_loopdiv = 8,1770.io.adc_clock_ratio = 8,1771.io.pll_int_loop_filt = 0,1772.io.clock_khz = 30000,1773.reset = dib90x0_tuner_reset,1774.sleep = dib90x0_tuner_sleep,1775.clkouttobamse = 0,1776.analog_output = 0,1777.use_pwm_agc = 0,1778.clkoutdrive = 0,1779.freq_offset_khz_uhf = 0,1780.freq_offset_khz_vhf = 0,1781};17821783static struct dib0090_config nim9090md_dib0090_config[2] = {1784{1785.io.pll_bypass = 0,1786.io.pll_range = 1,1787.io.pll_prediv = 1,1788.io.pll_loopdiv = 8,1789.io.adc_clock_ratio = 8,1790.io.pll_int_loop_filt = 0,1791.io.clock_khz = 30000,1792.reset = dib90x0_tuner_reset,1793.sleep = dib90x0_tuner_sleep,1794.clkouttobamse = 1,1795.analog_output = 0,1796.use_pwm_agc = 0,1797.clkoutdrive = 0,1798.freq_offset_khz_uhf = 0,1799.freq_offset_khz_vhf = 0,1800}, {1801.io.pll_bypass = 0,1802.io.pll_range = 1,1803.io.pll_prediv = 1,1804.io.pll_loopdiv = 8,1805.io.adc_clock_ratio = 8,1806.io.pll_int_loop_filt = 0,1807.io.clock_khz = 30000,1808.reset = dib90x0_tuner_reset,1809.sleep = dib90x0_tuner_sleep,1810.clkouttobamse = 0,1811.analog_output = 0,1812.use_pwm_agc = 0,1813.clkoutdrive = 0,1814.freq_offset_khz_uhf = 0,1815.freq_offset_khz_vhf = 0,1816}1817};181818191820static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap)1821{1822struct dib0700_adapter_state *state = adap->priv;1823struct dib0700_state *st = adap->dev->priv;1824u32 fw_version;18251826/* Make use of the new i2c functions from FW 1.20 */1827dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);1828if (fw_version >= 0x10200)1829st->fw_use_new_i2c_api = 1;1830dib0700_set_i2c_speed(adap->dev, 340);18311832dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);1833msleep(20);1834dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);1835dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);1836dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);1837dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);18381839dib0700_ctrl_clock(adap->dev, 72, 1);18401841msleep(20);1842dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);1843msleep(20);1844dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);18451846dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80);18471848if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {1849deb_info("%s: Upload failed. (file not found?)\n", __func__);1850return -ENODEV;1851} else {1852deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);1853}1854stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size;1855stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data;18561857adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config);18581859return adap->fe == NULL ? -ENODEV : 0;1860}18611862static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)1863{1864struct dib0700_adapter_state *state = adap->priv;1865struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe);1866u16 data_dib190[10] = {18671, 0x1374,18682, 0x01a2,18697, 0x0020,18700, 0x00ef,18718, 0x0486,1872};18731874if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &dib9090_dib0090_config) == NULL)1875return -ENODEV;1876i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);1877if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)1878return -ENODEV;1879dib0700_set_i2c_speed(adap->dev, 2000);1880if (dib9000_firmware_post_pll_init(adap->fe) < 0)1881return -ENODEV;1882release_firmware(state->frontend_firmware);1883return 0;1884}18851886static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap)1887{1888struct dib0700_adapter_state *state = adap->priv;1889struct dib0700_state *st = adap->dev->priv;1890struct i2c_adapter *i2c;1891struct dvb_frontend *fe_slave;1892u32 fw_version;18931894/* Make use of the new i2c functions from FW 1.20 */1895dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL);1896if (fw_version >= 0x10200)1897st->fw_use_new_i2c_api = 1;1898dib0700_set_i2c_speed(adap->dev, 340);18991900dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);1901msleep(20);1902dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);1903dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);1904dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);1905dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);19061907dib0700_ctrl_clock(adap->dev, 72, 1);19081909msleep(20);1910dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);1911msleep(20);1912dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);19131914if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) {1915deb_info("%s: Upload failed. (file not found?)\n", __func__);1916return -EIO;1917} else {1918deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size);1919}1920nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size;1921nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data;1922nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size;1923nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data;19241925dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80);1926adap->fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]);19271928if (adap->fe == NULL)1929return -ENODEV;19301931i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0);1932dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82);19331934fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]);1935dib9000_set_slave_frontend(adap->fe, fe_slave);19361937return fe_slave == NULL ? -ENODEV : 0;1938}19391940static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)1941{1942struct dib0700_adapter_state *state = adap->priv;1943struct i2c_adapter *i2c;1944struct dvb_frontend *fe_slave;1945u16 data_dib190[10] = {19461, 0x5374,19472, 0x01ae,19487, 0x0020,19490, 0x00ef,19508, 0x0406,1951};1952i2c = dib9000_get_tuner_interface(adap->fe);1953if (dvb_attach(dib0090_fw_register, adap->fe, i2c, &nim9090md_dib0090_config[0]) == NULL)1954return -ENODEV;1955i2c = dib9000_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);1956if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)1957return -ENODEV;1958dib0700_set_i2c_speed(adap->dev, 2000);1959if (dib9000_firmware_post_pll_init(adap->fe) < 0)1960return -ENODEV;19611962fe_slave = dib9000_get_slave_frontend(adap->fe, 1);1963if (fe_slave != NULL) {1964i2c = dib9000_get_component_bus_interface(adap->fe);1965dib9000_set_i2c_adapter(fe_slave, i2c);19661967i2c = dib9000_get_tuner_interface(fe_slave);1968if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL)1969return -ENODEV;1970fe_slave->dvb = adap->fe->dvb;1971dib9000_fw_set_component_bus_speed(adap->fe, 2000);1972if (dib9000_firmware_post_pll_init(fe_slave) < 0)1973return -ENODEV;1974}1975release_firmware(state->frontend_firmware);19761977return 0;1978}19791980/* NIM7090 */1981struct dib7090p_best_adc {1982u32 timf;1983u32 pll_loopdiv;1984u32 pll_prediv;1985};19861987static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dib7090p_best_adc *adc)1988{1989u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1;19901991u16 xtal = 12000;1992u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */1993u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */1994u32 fdem_max = 76000;1995u32 fdem_min = 69500;1996u32 fcp = 0, fs = 0, fdem = 0;1997u32 harmonic_id = 0;19981999adc->pll_loopdiv = loopdiv;2000adc->pll_prediv = prediv;2001adc->timf = 0;20022003deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min);20042005/* Find Min and Max prediv */2006while ((xtal/max_prediv) >= fcp_min)2007max_prediv++;20082009max_prediv--;2010min_prediv = max_prediv;2011while ((xtal/min_prediv) <= fcp_max) {2012min_prediv--;2013if (min_prediv == 1)2014break;2015}2016deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv);20172018min_prediv = 2;20192020for (prediv = min_prediv ; prediv < max_prediv; prediv++) {2021fcp = xtal / prediv;2022if (fcp > fcp_min && fcp < fcp_max) {2023for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) {2024fdem = ((xtal/prediv) * loopdiv);2025fs = fdem / 4;2026/* test min/max system restrictions */20272028if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) {2029spur = 0;2030/* test fs harmonics positions */2031for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) {2032if (((fs*harmonic_id) >= ((fe->dtv_property_cache.frequency/1000) - (fe->dtv_property_cache.bandwidth_hz/2000))) && ((fs*harmonic_id) <= ((fe->dtv_property_cache.frequency/1000) + (fe->dtv_property_cache.bandwidth_hz/2000)))) {2033spur = 1;2034break;2035}2036}20372038if (!spur) {2039adc->pll_loopdiv = loopdiv;2040adc->pll_prediv = prediv;2041adc->timf = 2396745143UL/fdem*(1 << 9);2042adc->timf += ((2396745143UL%fdem) << 9)/fdem;2043deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf);2044break;2045}2046}2047}2048}2049if (!spur)2050break;2051}205220532054if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0)2055return -EINVAL;2056else2057return 0;2058}20592060static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)2061{2062struct dvb_usb_adapter *adap = fe->dvb->priv;2063struct dib0700_adapter_state *state = adap->priv;2064struct dibx000_bandwidth_config pll;2065u16 target;2066struct dib7090p_best_adc adc;2067int ret;20682069ret = state->set_param_save(fe, fep);2070if (ret < 0)2071return ret;20722073memset(&pll, 0, sizeof(struct dibx000_bandwidth_config));2074dib0090_pwm_gain_reset(fe);2075target = (dib0090_get_wbd_offset(fe) * 8 + 1) / 2;2076dib7000p_set_wbd_ref(fe, target);20772078if (dib7090p_get_best_sampling(fe, &adc) == 0) {2079pll.pll_ratio = adc.pll_loopdiv;2080pll.pll_prediv = adc.pll_prediv;20812082dib7000p_update_pll(fe, &pll);2083dib7000p_ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf);2084}2085return 0;2086}20872088static struct dib0090_wbd_slope dib7090_wbd_table[] = {2089{ 380, 81, 850, 64, 540, 4},2090{ 860, 51, 866, 21, 375, 4},2091{1700, 0, 250, 0, 100, 6},2092{2600, 0, 250, 0, 100, 6},2093{ 0xFFFF, 0, 0, 0, 0, 0},2094};20952096struct dibx000_agc_config dib7090_agc_config[2] = {2097{2098.band_caps = BAND_UHF,2099/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,2100* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */2101.setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),21022103.inv_gain = 687,2104.time_stabiliz = 10,21052106.alpha_level = 0,2107.thlock = 118,21082109.wbd_inv = 0,2110.wbd_ref = 1200,2111.wbd_sel = 3,2112.wbd_alpha = 5,21132114.agc1_max = 65535,2115.agc1_min = 0,21162117.agc2_max = 65535,2118.agc2_min = 0,21192120.agc1_pt1 = 0,2121.agc1_pt2 = 32,2122.agc1_pt3 = 114,2123.agc1_slope1 = 143,2124.agc1_slope2 = 144,2125.agc2_pt1 = 114,2126.agc2_pt2 = 227,2127.agc2_slope1 = 116,2128.agc2_slope2 = 117,21292130.alpha_mant = 18,2131.alpha_exp = 0,2132.beta_mant = 20,2133.beta_exp = 59,21342135.perform_agc_softsplit = 0,2136} , {2137.band_caps = BAND_FM | BAND_VHF | BAND_CBAND,2138/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, P_agc_inv_pwm2=0,2139* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */2140.setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0),21412142.inv_gain = 732,2143.time_stabiliz = 10,21442145.alpha_level = 0,2146.thlock = 118,21472148.wbd_inv = 0,2149.wbd_ref = 1200,2150.wbd_sel = 3,2151.wbd_alpha = 5,21522153.agc1_max = 65535,2154.agc1_min = 0,21552156.agc2_max = 65535,2157.agc2_min = 0,21582159.agc1_pt1 = 0,2160.agc1_pt2 = 0,2161.agc1_pt3 = 98,2162.agc1_slope1 = 0,2163.agc1_slope2 = 167,2164.agc2_pt1 = 98,2165.agc2_pt2 = 255,2166.agc2_slope1 = 104,2167.agc2_slope2 = 0,21682169.alpha_mant = 18,2170.alpha_exp = 0,2171.beta_mant = 20,2172.beta_exp = 59,21732174.perform_agc_softsplit = 0,2175}2176};21772178static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = {217960000, 15000,21801, 5, 0, 0, 0,21810, 0, 1, 1, 2,2182(3 << 14) | (1 << 12) | (524 << 0),2183(0 << 25) | 0,218420452225,218515000000,2186};21872188static struct dib7000p_config nim7090_dib7000p_config = {2189.output_mpeg2_in_188_bytes = 1,2190.hostbus_diversity = 1,2191.tuner_is_baseband = 1,2192.update_lna = NULL,21932194.agc_config_count = 2,2195.agc = dib7090_agc_config,21962197.bw = &dib7090_clock_config_12_mhz,21982199.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,2200.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,2201.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,22022203.pwm_freq_div = 0,22042205.agc_control = dib7090_agc_restart,22062207.spur_protect = 0,2208.disable_sample_and_hold = 0,2209.enable_current_mirror = 0,2210.diversity_delay = 0,22112212.output_mode = OUTMODE_MPEG2_FIFO,2213.enMpegOutput = 1,2214};22152216static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {2217{2218.output_mpeg2_in_188_bytes = 1,2219.hostbus_diversity = 1,2220.tuner_is_baseband = 1,2221.update_lna = NULL,22222223.agc_config_count = 2,2224.agc = dib7090_agc_config,22252226.bw = &dib7090_clock_config_12_mhz,22272228.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,2229.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,2230.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,22312232.pwm_freq_div = 0,22332234.agc_control = dib7090_agc_restart,22352236.spur_protect = 0,2237.disable_sample_and_hold = 0,2238.enable_current_mirror = 0,2239.diversity_delay = 0,22402241.output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,2242.default_i2c_addr = 0x90,2243.enMpegOutput = 1,2244}, {2245.output_mpeg2_in_188_bytes = 1,2246.hostbus_diversity = 1,2247.tuner_is_baseband = 1,2248.update_lna = NULL,22492250.agc_config_count = 2,2251.agc = dib7090_agc_config,22522253.bw = &dib7090_clock_config_12_mhz,22542255.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,2256.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,2257.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,22582259.pwm_freq_div = 0,22602261.agc_control = dib7090_agc_restart,22622263.spur_protect = 0,2264.disable_sample_and_hold = 0,2265.enable_current_mirror = 0,2266.diversity_delay = 0,22672268.output_mode = OUTMODE_MPEG2_PAR_GATED_CLK,2269.default_i2c_addr = 0x92,2270.enMpegOutput = 0,2271}2272};22732274static const struct dib0090_config nim7090_dib0090_config = {2275.io.clock_khz = 12000,2276.io.pll_bypass = 0,2277.io.pll_range = 0,2278.io.pll_prediv = 3,2279.io.pll_loopdiv = 6,2280.io.adc_clock_ratio = 0,2281.io.pll_int_loop_filt = 0,2282.reset = dib7090_tuner_sleep,2283.sleep = dib7090_tuner_sleep,22842285.freq_offset_khz_uhf = 0,2286.freq_offset_khz_vhf = 0,22872288.get_adc_power = dib7090_get_adc_power,22892290.clkouttobamse = 1,2291.analog_output = 0,22922293.wbd_vhf_offset = 0,2294.wbd_cband_offset = 0,2295.use_pwm_agc = 1,2296.clkoutdrive = 0,22972298.fref_clock_ratio = 0,22992300.wbd = dib7090_wbd_table,23012302.ls_cfg_pad_drv = 0,2303.data_tx_drv = 0,2304.low_if = NULL,2305.in_soc = 1,2306};23072308static const struct dib0090_config tfe7090pvr_dib0090_config[2] = {2309{2310.io.clock_khz = 12000,2311.io.pll_bypass = 0,2312.io.pll_range = 0,2313.io.pll_prediv = 3,2314.io.pll_loopdiv = 6,2315.io.adc_clock_ratio = 0,2316.io.pll_int_loop_filt = 0,2317.reset = dib7090_tuner_sleep,2318.sleep = dib7090_tuner_sleep,23192320.freq_offset_khz_uhf = 50,2321.freq_offset_khz_vhf = 70,23222323.get_adc_power = dib7090_get_adc_power,23242325.clkouttobamse = 1,2326.analog_output = 0,23272328.wbd_vhf_offset = 0,2329.wbd_cband_offset = 0,2330.use_pwm_agc = 1,2331.clkoutdrive = 0,23322333.fref_clock_ratio = 0,23342335.wbd = dib7090_wbd_table,23362337.ls_cfg_pad_drv = 0,2338.data_tx_drv = 0,2339.low_if = NULL,2340.in_soc = 1,2341}, {2342.io.clock_khz = 12000,2343.io.pll_bypass = 0,2344.io.pll_range = 0,2345.io.pll_prediv = 3,2346.io.pll_loopdiv = 6,2347.io.adc_clock_ratio = 0,2348.io.pll_int_loop_filt = 0,2349.reset = dib7090_tuner_sleep,2350.sleep = dib7090_tuner_sleep,23512352.freq_offset_khz_uhf = -50,2353.freq_offset_khz_vhf = -70,23542355.get_adc_power = dib7090_get_adc_power,23562357.clkouttobamse = 1,2358.analog_output = 0,23592360.wbd_vhf_offset = 0,2361.wbd_cband_offset = 0,2362.use_pwm_agc = 1,2363.clkoutdrive = 0,23642365.fref_clock_ratio = 0,23662367.wbd = dib7090_wbd_table,23682369.ls_cfg_pad_drv = 0,2370.data_tx_drv = 0,2371.low_if = NULL,2372.in_soc = 1,2373}2374};23752376static int nim7090_frontend_attach(struct dvb_usb_adapter *adap)2377{2378dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);2379msleep(20);2380dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);2381dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);2382dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);2383dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);23842385msleep(20);2386dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);2387msleep(20);2388dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);23892390if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) {2391err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);2392return -ENODEV;2393}2394adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config);23952396return adap->fe == NULL ? -ENODEV : 0;2397}23982399static int nim7090_tuner_attach(struct dvb_usb_adapter *adap)2400{2401struct dib0700_adapter_state *st = adap->priv;2402struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);24032404if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &nim7090_dib0090_config) == NULL)2405return -ENODEV;24062407dib7000p_set_gpio(adap->fe, 8, 0, 1);24082409st->set_param_save = adap->fe->ops.tuner_ops.set_params;2410adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;2411return 0;2412}24132414static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap)2415{2416struct dib0700_state *st = adap->dev->priv;24172418/* The TFE7090 requires the dib0700 to not be in master mode */2419st->disable_streaming_master_mode = 1;24202421dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);2422msleep(20);2423dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);2424dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);2425dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);2426dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);24272428msleep(20);2429dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);2430msleep(20);2431dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);24322433/* initialize IC 0 */2434if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) {2435err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);2436return -ENODEV;2437}24382439dib0700_set_i2c_speed(adap->dev, 340);2440adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]);2441if (adap->fe == NULL)2442return -ENODEV;24432444dib7090_slave_reset(adap->fe);24452446return 0;2447}24482449static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap)2450{2451struct i2c_adapter *i2c;24522453if (adap->dev->adapter[0].fe == NULL) {2454err("the master dib7090 has to be initialized first");2455return -ENODEV; /* the master device has not been initialized */2456}24572458i2c = dib7000p_get_i2c_master(adap->dev->adapter[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1);2459if (dib7000p_i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) {2460err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__);2461return -ENODEV;2462}24632464adap->fe = dvb_attach(dib7000p_attach, i2c, 0x92, &tfe7090pvr_dib7000p_config[1]);2465dib0700_set_i2c_speed(adap->dev, 200);24662467return adap->fe == NULL ? -ENODEV : 0;2468}24692470static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap)2471{2472struct dib0700_adapter_state *st = adap->priv;2473struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);24742475if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL)2476return -ENODEV;24772478dib7000p_set_gpio(adap->fe, 8, 0, 1);24792480st->set_param_save = adap->fe->ops.tuner_ops.set_params;2481adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;2482return 0;2483}24842485static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)2486{2487struct dib0700_adapter_state *st = adap->priv;2488struct i2c_adapter *tun_i2c = dib7090_get_i2c_tuner(adap->fe);24892490if (dvb_attach(dib0090_register, adap->fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL)2491return -ENODEV;24922493dib7000p_set_gpio(adap->fe, 8, 0, 1);24942495st->set_param_save = adap->fe->ops.tuner_ops.set_params;2496adap->fe->ops.tuner_ops.set_params = dib7090_agc_startup;2497return 0;2498}24992500/* STK7070PD */2501static struct dib7000p_config stk7070pd_dib7000p_config[2] = {2502{2503.output_mpeg2_in_188_bytes = 1,25042505.agc_config_count = 1,2506.agc = &dib7070_agc_config,2507.bw = &dib7070_bw_config_12_mhz,2508.tuner_is_baseband = 1,2509.spur_protect = 1,25102511.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,2512.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,2513.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,25142515.hostbus_diversity = 1,2516}, {2517.output_mpeg2_in_188_bytes = 1,25182519.agc_config_count = 1,2520.agc = &dib7070_agc_config,2521.bw = &dib7070_bw_config_12_mhz,2522.tuner_is_baseband = 1,2523.spur_protect = 1,25242525.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,2526.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,2527.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,25282529.hostbus_diversity = 1,2530}2531};25322533static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)2534{2535dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);2536msleep(10);2537dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);2538dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);2539dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);2540dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);25412542dib0700_ctrl_clock(adap->dev, 72, 1);25432544msleep(10);2545dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);2546msleep(10);2547dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);25482549if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,2550stk7070pd_dib7000p_config) != 0) {2551err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",2552__func__);2553return -ENODEV;2554}25552556adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);2557return adap->fe == NULL ? -ENODEV : 0;2558}25592560static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap)2561{2562adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]);2563return adap->fe == NULL ? -ENODEV : 0;2564}25652566/* S5H1411 */2567static struct s5h1411_config pinnacle_801e_config = {2568.output_mode = S5H1411_PARALLEL_OUTPUT,2569.gpio = S5H1411_GPIO_OFF,2570.mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,2571.qam_if = S5H1411_IF_44000,2572.vsb_if = S5H1411_IF_44000,2573.inversion = S5H1411_INVERSION_OFF,2574.status_mode = S5H1411_DEMODLOCKING2575};25762577/* Pinnacle PCTV HD Pro 801e GPIOs map:2578GPIO0 - currently unknown2579GPIO1 - xc5000 tuner reset2580GPIO2 - CX25843 sleep2581GPIO3 - currently unknown2582GPIO4 - currently unknown2583GPIO6 - currently unknown2584GPIO7 - currently unknown2585GPIO9 - currently unknown2586GPIO10 - CX25843 reset2587*/2588static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap)2589{2590struct dib0700_state *st = adap->dev->priv;25912592/* Make use of the new i2c functions from FW 1.20 */2593st->fw_use_new_i2c_api = 1;25942595/* The s5h1411 requires the dib0700 to not be in master mode */2596st->disable_streaming_master_mode = 1;25972598/* All msleep values taken from Windows USB trace */2599dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);2600dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0);2601dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);2602msleep(400);2603dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);2604msleep(60);2605dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);2606msleep(30);2607dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);2608dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);2609dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);2610dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);2611dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0);2612msleep(30);26132614/* Put the CX25843 to sleep for now since we're in digital mode */2615dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);26162617/* GPIOs are initialized, do the attach */2618adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config,2619&adap->dev->i2c_adap);2620return adap->fe == NULL ? -ENODEV : 0;2621}26222623static int dib0700_xc5000_tuner_callback(void *priv, int component,2624int command, int arg)2625{2626struct dvb_usb_adapter *adap = priv;26272628if (command == XC5000_TUNER_RESET) {2629/* Reset the tuner */2630dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0);2631msleep(10);2632dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1);2633msleep(10);2634} else {2635err("xc5000: unknown tuner callback command: %d\n", command);2636return -EINVAL;2637}26382639return 0;2640}26412642static struct xc5000_config s5h1411_xc5000_tunerconfig = {2643.i2c_address = 0x64,2644.if_khz = 5380,2645};26462647static int xc5000_tuner_attach(struct dvb_usb_adapter *adap)2648{2649/* FIXME: generalize & move to common area */2650adap->fe->callback = dib0700_xc5000_tuner_callback;26512652return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap,2653&s5h1411_xc5000_tunerconfig)2654== NULL ? -ENODEV : 0;2655}26562657static struct lgdt3305_config hcw_lgdt3305_config = {2658.i2c_addr = 0x0e,2659.mpeg_mode = LGDT3305_MPEG_PARALLEL,2660.tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE,2661.tpvalid_polarity = LGDT3305_TP_VALID_LOW,2662.deny_i2c_rptr = 0,2663.spectral_inversion = 1,2664.qam_if_khz = 6000,2665.vsb_if_khz = 6000,2666.usref_8vsb = 0x0500,2667};26682669static struct mxl5007t_config hcw_mxl5007t_config = {2670.xtal_freq_hz = MxL_XTAL_25_MHZ,2671.if_freq_hz = MxL_IF_6_MHZ,2672.invert_if = 1,2673};26742675/* TIGER-ATSC map:2676GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled)2677GPIO1 - ANT_SEL (H: VPA, L: MCX)2678GPIO4 - SCL22679GPIO6 - EN_TUNER2680GPIO7 - SDA22681GPIO10 - DEM_RST26822683MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB2684*/2685static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap)2686{2687struct dib0700_state *st = adap->dev->priv;26882689/* Make use of the new i2c functions from FW 1.20 */2690st->fw_use_new_i2c_api = 1;26912692st->disable_streaming_master_mode = 1;26932694/* fe power enable */2695dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);2696msleep(30);2697dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);2698msleep(30);26992700/* demod reset */2701dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);2702msleep(30);2703dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);2704msleep(30);2705dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);2706msleep(30);27072708adap->fe = dvb_attach(lgdt3305_attach,2709&hcw_lgdt3305_config,2710&adap->dev->i2c_adap);27112712return adap->fe == NULL ? -ENODEV : 0;2713}27142715static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap)2716{2717return dvb_attach(mxl5007t_attach, adap->fe,2718&adap->dev->i2c_adap, 0x60,2719&hcw_mxl5007t_config) == NULL ? -ENODEV : 0;2720}272127222723/* DVB-USB and USB stuff follows */2724struct usb_device_id dib0700_usb_id_table[] = {2725/* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },2726{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) },2727{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },2728{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },2729{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },2730/* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },2731{ USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) },2732{ USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) },2733{ USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) },2734{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) },2735/* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) },2736{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },2737{ USB_DEVICE(USB_VID_TERRATEC,2738USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },2739{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },2740{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },2741/* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) },2742{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) },2743{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) },2744{ USB_DEVICE(USB_VID_PINNACLE,2745USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) },2746{ USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) },2747/* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) },2748{ USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) },2749{ USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) },2750{ USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) },2751{ USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) },2752/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) },2753{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) },2754{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) },2755{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) },2756{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) },2757/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) },2758{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) },2759{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) },2760{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) },2761{ USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) },2762/* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) },2763{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) },2764{ USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) },2765{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) },2766{ USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) },2767/* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) },2768{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) },2769{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) },2770{ USB_DEVICE(USB_VID_TERRATEC,2771USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) },2772{ USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) },2773/* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) },2774{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) },2775{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) },2776{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) },2777{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) },2778/* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) },2779{ USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) },2780{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) },2781{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) },2782{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) },2783/* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) },2784{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) },2785{ USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) },2786{ USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) },2787{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) },2788/* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) },2789{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) },2790{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) },2791{ USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) },2792{ USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) },2793/* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) },2794{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) },2795{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) },2796{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) },2797{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) },2798/* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) },2799{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) },2800{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) },2801{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) },2802{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) },2803/* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },2804{ 0 } /* Terminating entry */2805};2806MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);28072808#define DIB0700_DEFAULT_DEVICE_PROPERTIES \2809.caps = DVB_USB_IS_AN_I2C_ADAPTER, \2810.usb_ctrl = DEVICE_SPECIFIC, \2811.firmware = "dvb-usb-dib0700-1.20.fw", \2812.download_firmware = dib0700_download_firmware, \2813.no_reconnect = 1, \2814.size_of_priv = sizeof(struct dib0700_state), \2815.i2c_algo = &dib0700_i2c_algo, \2816.identify_state = dib0700_identify_state28172818#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \2819.streaming_ctrl = dib0700_streaming_ctrl, \2820.stream = { \2821.type = USB_BULK, \2822.count = 4, \2823.endpoint = ep, \2824.u = { \2825.bulk = { \2826.buffersize = 39480, \2827} \2828} \2829}28302831struct dvb_usb_device_properties dib0700_devices[] = {2832{2833DIB0700_DEFAULT_DEVICE_PROPERTIES,28342835.num_adapters = 1,2836.adapter = {2837{2838.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,2839.pid_filter_count = 32,2840.pid_filter = stk7700p_pid_filter,2841.pid_filter_ctrl = stk7700p_pid_filter_ctrl,2842.frontend_attach = stk7700p_frontend_attach,2843.tuner_attach = stk7700p_tuner_attach,28442845DIB0700_DEFAULT_STREAMING_CONFIG(0x02),2846},2847},28482849.num_device_descs = 8,2850.devices = {2851{ "DiBcom STK7700P reference design",2852{ &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] },2853{ NULL },2854},2855{ "Hauppauge Nova-T Stick",2856{ &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL },2857{ NULL },2858},2859{ "AVerMedia AVerTV DVB-T Volar",2860{ &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] },2861{ NULL },2862},2863{ "Compro Videomate U500",2864{ &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] },2865{ NULL },2866},2867{ "Uniwill STK7700P based (Hama and others)",2868{ &dib0700_usb_id_table[7], NULL },2869{ NULL },2870},2871{ "Leadtek Winfast DTV Dongle (STK7700P based)",2872{ &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] },2873{ NULL },2874},2875{ "AVerMedia AVerTV DVB-T Express",2876{ &dib0700_usb_id_table[20] },2877{ NULL },2878},2879{ "Gigabyte U7000",2880{ &dib0700_usb_id_table[21], NULL },2881{ NULL },2882}2883},28842885.rc.core = {2886.rc_interval = DEFAULT_RC_INTERVAL,2887.rc_codes = RC_MAP_DIB0700_RC5_TABLE,2888.rc_query = dib0700_rc_query_old_firmware,2889.allowed_protos = RC_TYPE_RC5 |2890RC_TYPE_RC6 |2891RC_TYPE_NEC,2892.change_protocol = dib0700_change_protocol,2893},2894}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,28952896.num_adapters = 2,2897.adapter = {2898{2899.frontend_attach = bristol_frontend_attach,2900.tuner_attach = bristol_tuner_attach,29012902DIB0700_DEFAULT_STREAMING_CONFIG(0x02),2903}, {2904.frontend_attach = bristol_frontend_attach,2905.tuner_attach = bristol_tuner_attach,29062907DIB0700_DEFAULT_STREAMING_CONFIG(0x03),2908}2909},29102911.num_device_descs = 1,2912.devices = {2913{ "Hauppauge Nova-T 500 Dual DVB-T",2914{ &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL },2915{ NULL },2916},2917},29182919.rc.core = {2920.rc_interval = DEFAULT_RC_INTERVAL,2921.rc_codes = RC_MAP_DIB0700_RC5_TABLE,2922.rc_query = dib0700_rc_query_old_firmware,2923.allowed_protos = RC_TYPE_RC5 |2924RC_TYPE_RC6 |2925RC_TYPE_NEC,2926.change_protocol = dib0700_change_protocol,2927},2928}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,29292930.num_adapters = 2,2931.adapter = {2932{2933.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,2934.pid_filter_count = 32,2935.pid_filter = stk70x0p_pid_filter,2936.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,2937.frontend_attach = stk7700d_frontend_attach,2938.tuner_attach = stk7700d_tuner_attach,29392940DIB0700_DEFAULT_STREAMING_CONFIG(0x02),2941}, {2942.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,2943.pid_filter_count = 32,2944.pid_filter = stk70x0p_pid_filter,2945.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,2946.frontend_attach = stk7700d_frontend_attach,2947.tuner_attach = stk7700d_tuner_attach,29482949DIB0700_DEFAULT_STREAMING_CONFIG(0x03),2950}2951},29522953.num_device_descs = 5,2954.devices = {2955{ "Pinnacle PCTV 2000e",2956{ &dib0700_usb_id_table[11], NULL },2957{ NULL },2958},2959{ "Terratec Cinergy DT XS Diversity",2960{ &dib0700_usb_id_table[12], NULL },2961{ NULL },2962},2963{ "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity",2964{ &dib0700_usb_id_table[13], NULL },2965{ NULL },2966},2967{ "DiBcom STK7700D reference design",2968{ &dib0700_usb_id_table[14], NULL },2969{ NULL },2970},2971{ "YUAN High-Tech DiBcom STK7700D",2972{ &dib0700_usb_id_table[55], NULL },2973{ NULL },2974},29752976},29772978.rc.core = {2979.rc_interval = DEFAULT_RC_INTERVAL,2980.rc_codes = RC_MAP_DIB0700_RC5_TABLE,2981.rc_query = dib0700_rc_query_old_firmware,2982.allowed_protos = RC_TYPE_RC5 |2983RC_TYPE_RC6 |2984RC_TYPE_NEC,2985.change_protocol = dib0700_change_protocol,2986},2987}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,29882989.num_adapters = 1,2990.adapter = {2991{2992.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,2993.pid_filter_count = 32,2994.pid_filter = stk70x0p_pid_filter,2995.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,2996.frontend_attach = stk7700P2_frontend_attach,2997.tuner_attach = stk7700d_tuner_attach,29982999DIB0700_DEFAULT_STREAMING_CONFIG(0x02),3000},3001},30023003.num_device_descs = 3,3004.devices = {3005{ "ASUS My Cinema U3000 Mini DVBT Tuner",3006{ &dib0700_usb_id_table[23], NULL },3007{ NULL },3008},3009{ "Yuan EC372S",3010{ &dib0700_usb_id_table[31], NULL },3011{ NULL },3012},3013{ "Terratec Cinergy T Express",3014{ &dib0700_usb_id_table[42], NULL },3015{ NULL },3016}3017},30183019.rc.core = {3020.rc_interval = DEFAULT_RC_INTERVAL,3021.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3022.module_name = "dib0700",3023.rc_query = dib0700_rc_query_old_firmware,3024.allowed_protos = RC_TYPE_RC5 |3025RC_TYPE_RC6 |3026RC_TYPE_NEC,3027.change_protocol = dib0700_change_protocol,3028},3029}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,30303031.num_adapters = 1,3032.adapter = {3033{3034.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3035.pid_filter_count = 32,3036.pid_filter = stk70x0p_pid_filter,3037.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3038.frontend_attach = stk7070p_frontend_attach,3039.tuner_attach = dib7070p_tuner_attach,30403041DIB0700_DEFAULT_STREAMING_CONFIG(0x02),30423043.size_of_priv = sizeof(struct dib0700_adapter_state),3044},3045},30463047.num_device_descs = 11,3048.devices = {3049{ "DiBcom STK7070P reference design",3050{ &dib0700_usb_id_table[15], NULL },3051{ NULL },3052},3053{ "Pinnacle PCTV DVB-T Flash Stick",3054{ &dib0700_usb_id_table[16], NULL },3055{ NULL },3056},3057{ "Artec T14BR DVB-T",3058{ &dib0700_usb_id_table[22], NULL },3059{ NULL },3060},3061{ "ASUS My Cinema U3100 Mini DVBT Tuner",3062{ &dib0700_usb_id_table[24], NULL },3063{ NULL },3064},3065{ "Hauppauge Nova-T Stick",3066{ &dib0700_usb_id_table[25], NULL },3067{ NULL },3068},3069{ "Hauppauge Nova-T MyTV.t",3070{ &dib0700_usb_id_table[26], NULL },3071{ NULL },3072},3073{ "Pinnacle PCTV 72e",3074{ &dib0700_usb_id_table[29], NULL },3075{ NULL },3076},3077{ "Pinnacle PCTV 73e",3078{ &dib0700_usb_id_table[30], NULL },3079{ NULL },3080},3081{ "Elgato EyeTV DTT",3082{ &dib0700_usb_id_table[49], NULL },3083{ NULL },3084},3085{ "Yuan PD378S",3086{ &dib0700_usb_id_table[45], NULL },3087{ NULL },3088},3089{ "Elgato EyeTV Dtt Dlx PD378S",3090{ &dib0700_usb_id_table[50], NULL },3091{ NULL },3092},3093},30943095.rc.core = {3096.rc_interval = DEFAULT_RC_INTERVAL,3097.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3098.module_name = "dib0700",3099.rc_query = dib0700_rc_query_old_firmware,3100.allowed_protos = RC_TYPE_RC5 |3101RC_TYPE_RC6 |3102RC_TYPE_NEC,3103.change_protocol = dib0700_change_protocol,3104},3105}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,31063107.num_adapters = 1,3108.adapter = {3109{3110.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3111.pid_filter_count = 32,3112.pid_filter = stk70x0p_pid_filter,3113.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3114.frontend_attach = stk7070p_frontend_attach,3115.tuner_attach = dib7070p_tuner_attach,31163117DIB0700_DEFAULT_STREAMING_CONFIG(0x02),31183119.size_of_priv = sizeof(struct dib0700_adapter_state),3120},3121},31223123.num_device_descs = 3,3124.devices = {3125{ "Pinnacle PCTV 73A",3126{ &dib0700_usb_id_table[56], NULL },3127{ NULL },3128},3129{ "Pinnacle PCTV 73e SE",3130{ &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL },3131{ NULL },3132},3133{ "Pinnacle PCTV 282e",3134{ &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL },3135{ NULL },3136},3137},31383139.rc.core = {3140.rc_interval = DEFAULT_RC_INTERVAL,3141.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3142.module_name = "dib0700",3143.rc_query = dib0700_rc_query_old_firmware,3144.allowed_protos = RC_TYPE_RC5 |3145RC_TYPE_RC6 |3146RC_TYPE_NEC,3147.change_protocol = dib0700_change_protocol,3148},3149}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,31503151.num_adapters = 2,3152.adapter = {3153{3154.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3155.pid_filter_count = 32,3156.pid_filter = stk70x0p_pid_filter,3157.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3158.frontend_attach = stk7070pd_frontend_attach0,3159.tuner_attach = dib7070p_tuner_attach,31603161DIB0700_DEFAULT_STREAMING_CONFIG(0x02),31623163.size_of_priv = sizeof(struct dib0700_adapter_state),3164}, {3165.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3166.pid_filter_count = 32,3167.pid_filter = stk70x0p_pid_filter,3168.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3169.frontend_attach = stk7070pd_frontend_attach1,3170.tuner_attach = dib7070p_tuner_attach,31713172DIB0700_DEFAULT_STREAMING_CONFIG(0x03),31733174.size_of_priv = sizeof(struct dib0700_adapter_state),3175}3176},31773178.num_device_descs = 6,3179.devices = {3180{ "DiBcom STK7070PD reference design",3181{ &dib0700_usb_id_table[17], NULL },3182{ NULL },3183},3184{ "Pinnacle PCTV Dual DVB-T Diversity Stick",3185{ &dib0700_usb_id_table[18], NULL },3186{ NULL },3187},3188{ "Hauppauge Nova-TD Stick (52009)",3189{ &dib0700_usb_id_table[35], NULL },3190{ NULL },3191},3192{ "Hauppauge Nova-TD-500 (84xxx)",3193{ &dib0700_usb_id_table[36], NULL },3194{ NULL },3195},3196{ "Terratec Cinergy DT USB XS Diversity/ T5",3197{ &dib0700_usb_id_table[43],3198&dib0700_usb_id_table[53], NULL},3199{ NULL },3200},3201{ "Sony PlayTV",3202{ &dib0700_usb_id_table[44], NULL },3203{ NULL },3204},3205},32063207.rc.core = {3208.rc_interval = DEFAULT_RC_INTERVAL,3209.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3210.module_name = "dib0700",3211.rc_query = dib0700_rc_query_old_firmware,3212.allowed_protos = RC_TYPE_RC5 |3213RC_TYPE_RC6 |3214RC_TYPE_NEC,3215.change_protocol = dib0700_change_protocol,3216},3217}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,32183219.num_adapters = 2,3220.adapter = {3221{3222.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3223.pid_filter_count = 32,3224.pid_filter = stk70x0p_pid_filter,3225.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3226.frontend_attach = stk7070pd_frontend_attach0,3227.tuner_attach = dib7070p_tuner_attach,32283229DIB0700_DEFAULT_STREAMING_CONFIG(0x02),32303231.size_of_priv = sizeof(struct dib0700_adapter_state),3232}, {3233.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3234.pid_filter_count = 32,3235.pid_filter = stk70x0p_pid_filter,3236.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3237.frontend_attach = stk7070pd_frontend_attach1,3238.tuner_attach = dib7070p_tuner_attach,32393240DIB0700_DEFAULT_STREAMING_CONFIG(0x03),32413242.size_of_priv = sizeof(struct dib0700_adapter_state),3243}3244},32453246.num_device_descs = 1,3247.devices = {3248{ "Elgato EyeTV Diversity",3249{ &dib0700_usb_id_table[68], NULL },3250{ NULL },3251},3252},32533254.rc.core = {3255.rc_interval = DEFAULT_RC_INTERVAL,3256.rc_codes = RC_MAP_DIB0700_NEC_TABLE,3257.module_name = "dib0700",3258.rc_query = dib0700_rc_query_old_firmware,3259.allowed_protos = RC_TYPE_RC5 |3260RC_TYPE_RC6 |3261RC_TYPE_NEC,3262.change_protocol = dib0700_change_protocol,3263},3264}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,32653266.num_adapters = 1,3267.adapter = {3268{3269.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3270.pid_filter_count = 32,3271.pid_filter = stk70x0p_pid_filter,3272.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3273.frontend_attach = stk7700ph_frontend_attach,3274.tuner_attach = stk7700ph_tuner_attach,32753276DIB0700_DEFAULT_STREAMING_CONFIG(0x02),32773278.size_of_priv = sizeof(struct3279dib0700_adapter_state),3280},3281},32823283.num_device_descs = 9,3284.devices = {3285{ "Terratec Cinergy HT USB XE",3286{ &dib0700_usb_id_table[27], NULL },3287{ NULL },3288},3289{ "Pinnacle Expresscard 320cx",3290{ &dib0700_usb_id_table[28], NULL },3291{ NULL },3292},3293{ "Terratec Cinergy HT Express",3294{ &dib0700_usb_id_table[32], NULL },3295{ NULL },3296},3297{ "Gigabyte U8000-RH",3298{ &dib0700_usb_id_table[37], NULL },3299{ NULL },3300},3301{ "YUAN High-Tech STK7700PH",3302{ &dib0700_usb_id_table[38], NULL },3303{ NULL },3304},3305{ "Asus My Cinema-U3000Hybrid",3306{ &dib0700_usb_id_table[39], NULL },3307{ NULL },3308},3309{ "YUAN High-Tech MC770",3310{ &dib0700_usb_id_table[48], NULL },3311{ NULL },3312},3313{ "Leadtek WinFast DTV Dongle H",3314{ &dib0700_usb_id_table[51], NULL },3315{ NULL },3316},3317{ "YUAN High-Tech STK7700D",3318{ &dib0700_usb_id_table[54], NULL },3319{ NULL },3320},3321},33223323.rc.core = {3324.rc_interval = DEFAULT_RC_INTERVAL,3325.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3326.module_name = "dib0700",3327.rc_query = dib0700_rc_query_old_firmware,3328.allowed_protos = RC_TYPE_RC5 |3329RC_TYPE_RC6 |3330RC_TYPE_NEC,3331.change_protocol = dib0700_change_protocol,3332},3333}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3334.num_adapters = 1,3335.adapter = {3336{3337.frontend_attach = s5h1411_frontend_attach,3338.tuner_attach = xc5000_tuner_attach,33393340DIB0700_DEFAULT_STREAMING_CONFIG(0x02),33413342.size_of_priv = sizeof(struct3343dib0700_adapter_state),3344},3345},33463347.num_device_descs = 2,3348.devices = {3349{ "Pinnacle PCTV HD Pro USB Stick",3350{ &dib0700_usb_id_table[40], NULL },3351{ NULL },3352},3353{ "Pinnacle PCTV HD USB Stick",3354{ &dib0700_usb_id_table[41], NULL },3355{ NULL },3356},3357},33583359.rc.core = {3360.rc_interval = DEFAULT_RC_INTERVAL,3361.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3362.module_name = "dib0700",3363.rc_query = dib0700_rc_query_old_firmware,3364.allowed_protos = RC_TYPE_RC5 |3365RC_TYPE_RC6 |3366RC_TYPE_NEC,3367.change_protocol = dib0700_change_protocol,3368},3369}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3370.num_adapters = 1,3371.adapter = {3372{3373.frontend_attach = lgdt3305_frontend_attach,3374.tuner_attach = mxl5007t_tuner_attach,33753376DIB0700_DEFAULT_STREAMING_CONFIG(0x02),33773378.size_of_priv = sizeof(struct3379dib0700_adapter_state),3380},3381},33823383.num_device_descs = 2,3384.devices = {3385{ "Hauppauge ATSC MiniCard (B200)",3386{ &dib0700_usb_id_table[46], NULL },3387{ NULL },3388},3389{ "Hauppauge ATSC MiniCard (B210)",3390{ &dib0700_usb_id_table[47], NULL },3391{ NULL },3392},3393},3394}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,33953396.num_adapters = 1,3397.adapter = {3398{3399.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3400.pid_filter_count = 32,3401.pid_filter = stk70x0p_pid_filter,3402.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3403.frontend_attach = stk7770p_frontend_attach,3404.tuner_attach = dib7770p_tuner_attach,34053406DIB0700_DEFAULT_STREAMING_CONFIG(0x02),34073408.size_of_priv =3409sizeof(struct dib0700_adapter_state),3410},3411},34123413.num_device_descs = 4,3414.devices = {3415{ "DiBcom STK7770P reference design",3416{ &dib0700_usb_id_table[59], NULL },3417{ NULL },3418},3419{ "Terratec Cinergy T USB XXS (HD)/ T3",3420{ &dib0700_usb_id_table[33],3421&dib0700_usb_id_table[52],3422&dib0700_usb_id_table[60], NULL},3423{ NULL },3424},3425{ "TechniSat AirStar TeleStick 2",3426{ &dib0700_usb_id_table[74], NULL },3427{ NULL },3428},3429{ "Medion CTX1921 DVB-T USB",3430{ &dib0700_usb_id_table[75], NULL },3431{ NULL },3432},3433},34343435.rc.core = {3436.rc_interval = DEFAULT_RC_INTERVAL,3437.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3438.module_name = "dib0700",3439.rc_query = dib0700_rc_query_old_firmware,3440.allowed_protos = RC_TYPE_RC5 |3441RC_TYPE_RC6 |3442RC_TYPE_NEC,3443.change_protocol = dib0700_change_protocol,3444},3445}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3446.num_adapters = 1,3447.adapter = {3448{3449.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3450.pid_filter_count = 32,3451.pid_filter = stk80xx_pid_filter,3452.pid_filter_ctrl = stk80xx_pid_filter_ctrl,3453.frontend_attach = stk807x_frontend_attach,3454.tuner_attach = dib807x_tuner_attach,34553456DIB0700_DEFAULT_STREAMING_CONFIG(0x02),34573458.size_of_priv =3459sizeof(struct dib0700_adapter_state),3460},3461},34623463.num_device_descs = 3,3464.devices = {3465{ "DiBcom STK807xP reference design",3466{ &dib0700_usb_id_table[62], NULL },3467{ NULL },3468},3469{ "Prolink Pixelview SBTVD",3470{ &dib0700_usb_id_table[63], NULL },3471{ NULL },3472},3473{ "EvolutePC TVWay+",3474{ &dib0700_usb_id_table[64], NULL },3475{ NULL },3476},3477},34783479.rc.core = {3480.rc_interval = DEFAULT_RC_INTERVAL,3481.rc_codes = RC_MAP_DIB0700_NEC_TABLE,3482.module_name = "dib0700",3483.rc_query = dib0700_rc_query_old_firmware,3484.allowed_protos = RC_TYPE_RC5 |3485RC_TYPE_RC6 |3486RC_TYPE_NEC,3487.change_protocol = dib0700_change_protocol,3488},3489}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3490.num_adapters = 2,3491.adapter = {3492{3493.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3494.pid_filter_count = 32,3495.pid_filter = stk80xx_pid_filter,3496.pid_filter_ctrl = stk80xx_pid_filter_ctrl,3497.frontend_attach = stk807xpvr_frontend_attach0,3498.tuner_attach = dib807x_tuner_attach,34993500DIB0700_DEFAULT_STREAMING_CONFIG(0x02),35013502.size_of_priv =3503sizeof(struct dib0700_adapter_state),3504},3505{3506.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3507.pid_filter_count = 32,3508.pid_filter = stk80xx_pid_filter,3509.pid_filter_ctrl = stk80xx_pid_filter_ctrl,3510.frontend_attach = stk807xpvr_frontend_attach1,3511.tuner_attach = dib807x_tuner_attach,35123513DIB0700_DEFAULT_STREAMING_CONFIG(0x03),35143515.size_of_priv =3516sizeof(struct dib0700_adapter_state),3517},3518},35193520.num_device_descs = 1,3521.devices = {3522{ "DiBcom STK807xPVR reference design",3523{ &dib0700_usb_id_table[61], NULL },3524{ NULL },3525},3526},35273528.rc.core = {3529.rc_interval = DEFAULT_RC_INTERVAL,3530.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3531.module_name = "dib0700",3532.rc_query = dib0700_rc_query_old_firmware,3533.allowed_protos = RC_TYPE_RC5 |3534RC_TYPE_RC6 |3535RC_TYPE_NEC,3536.change_protocol = dib0700_change_protocol,3537},3538}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3539.num_adapters = 1,3540.adapter = {3541{3542.caps = DVB_USB_ADAP_HAS_PID_FILTER |3543DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3544.pid_filter_count = 32,3545.pid_filter = stk80xx_pid_filter,3546.pid_filter_ctrl = stk80xx_pid_filter_ctrl,3547.frontend_attach = stk809x_frontend_attach,3548.tuner_attach = dib809x_tuner_attach,35493550DIB0700_DEFAULT_STREAMING_CONFIG(0x02),35513552.size_of_priv =3553sizeof(struct dib0700_adapter_state),3554},3555},35563557.num_device_descs = 1,3558.devices = {3559{ "DiBcom STK8096GP reference design",3560{ &dib0700_usb_id_table[67], NULL },3561{ NULL },3562},3563},35643565.rc.core = {3566.rc_interval = DEFAULT_RC_INTERVAL,3567.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3568.module_name = "dib0700",3569.rc_query = dib0700_rc_query_old_firmware,3570.allowed_protos = RC_TYPE_RC5 |3571RC_TYPE_RC6 |3572RC_TYPE_NEC,3573.change_protocol = dib0700_change_protocol,3574},3575}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3576.num_adapters = 1,3577.adapter = {3578{3579.caps = DVB_USB_ADAP_HAS_PID_FILTER |3580DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3581.pid_filter_count = 32,3582.pid_filter = dib90x0_pid_filter,3583.pid_filter_ctrl = dib90x0_pid_filter_ctrl,3584.frontend_attach = stk9090m_frontend_attach,3585.tuner_attach = dib9090_tuner_attach,35863587DIB0700_DEFAULT_STREAMING_CONFIG(0x02),35883589.size_of_priv =3590sizeof(struct dib0700_adapter_state),3591},3592},35933594.num_device_descs = 1,3595.devices = {3596{ "DiBcom STK9090M reference design",3597{ &dib0700_usb_id_table[69], NULL },3598{ NULL },3599},3600},36013602.rc.core = {3603.rc_interval = DEFAULT_RC_INTERVAL,3604.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3605.module_name = "dib0700",3606.rc_query = dib0700_rc_query_old_firmware,3607.allowed_protos = RC_TYPE_RC5 |3608RC_TYPE_RC6 |3609RC_TYPE_NEC,3610.change_protocol = dib0700_change_protocol,3611},3612}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3613.num_adapters = 1,3614.adapter = {3615{3616.caps = DVB_USB_ADAP_HAS_PID_FILTER |3617DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3618.pid_filter_count = 32,3619.pid_filter = stk80xx_pid_filter,3620.pid_filter_ctrl = stk80xx_pid_filter_ctrl,3621.frontend_attach = nim8096md_frontend_attach,3622.tuner_attach = nim8096md_tuner_attach,36233624DIB0700_DEFAULT_STREAMING_CONFIG(0x02),36253626.size_of_priv =3627sizeof(struct dib0700_adapter_state),3628},3629},36303631.num_device_descs = 1,3632.devices = {3633{ "DiBcom NIM8096MD reference design",3634{ &dib0700_usb_id_table[70], NULL },3635{ NULL },3636},3637},36383639.rc.core = {3640.rc_interval = DEFAULT_RC_INTERVAL,3641.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3642.module_name = "dib0700",3643.rc_query = dib0700_rc_query_old_firmware,3644.allowed_protos = RC_TYPE_RC5 |3645RC_TYPE_RC6 |3646RC_TYPE_NEC,3647.change_protocol = dib0700_change_protocol,3648},3649}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3650.num_adapters = 1,3651.adapter = {3652{3653.caps = DVB_USB_ADAP_HAS_PID_FILTER |3654DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3655.pid_filter_count = 32,3656.pid_filter = dib90x0_pid_filter,3657.pid_filter_ctrl = dib90x0_pid_filter_ctrl,3658.frontend_attach = nim9090md_frontend_attach,3659.tuner_attach = nim9090md_tuner_attach,36603661DIB0700_DEFAULT_STREAMING_CONFIG(0x02),36623663.size_of_priv =3664sizeof(struct dib0700_adapter_state),3665},3666},36673668.num_device_descs = 1,3669.devices = {3670{ "DiBcom NIM9090MD reference design",3671{ &dib0700_usb_id_table[71], NULL },3672{ NULL },3673},3674},36753676.rc.core = {3677.rc_interval = DEFAULT_RC_INTERVAL,3678.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3679.module_name = "dib0700",3680.rc_query = dib0700_rc_query_old_firmware,3681.allowed_protos = RC_TYPE_RC5 |3682RC_TYPE_RC6 |3683RC_TYPE_NEC,3684.change_protocol = dib0700_change_protocol,3685},3686}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3687.num_adapters = 1,3688.adapter = {3689{3690.caps = DVB_USB_ADAP_HAS_PID_FILTER |3691DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3692.pid_filter_count = 32,3693.pid_filter = stk70x0p_pid_filter,3694.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3695.frontend_attach = nim7090_frontend_attach,3696.tuner_attach = nim7090_tuner_attach,36973698DIB0700_DEFAULT_STREAMING_CONFIG(0x02),36993700.size_of_priv =3701sizeof(struct dib0700_adapter_state),3702},3703},37043705.num_device_descs = 1,3706.devices = {3707{ "DiBcom NIM7090 reference design",3708{ &dib0700_usb_id_table[72], NULL },3709{ NULL },3710},3711},37123713.rc.core = {3714.rc_interval = DEFAULT_RC_INTERVAL,3715.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3716.module_name = "dib0700",3717.rc_query = dib0700_rc_query_old_firmware,3718.allowed_protos = RC_TYPE_RC5 |3719RC_TYPE_RC6 |3720RC_TYPE_NEC,3721.change_protocol = dib0700_change_protocol,3722},3723}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,3724.num_adapters = 2,3725.adapter = {3726{3727.caps = DVB_USB_ADAP_HAS_PID_FILTER |3728DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3729.pid_filter_count = 32,3730.pid_filter = stk70x0p_pid_filter,3731.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3732.frontend_attach = tfe7090pvr_frontend0_attach,3733.tuner_attach = tfe7090pvr_tuner0_attach,37343735DIB0700_DEFAULT_STREAMING_CONFIG(0x03),37363737.size_of_priv =3738sizeof(struct dib0700_adapter_state),3739},3740{3741.caps = DVB_USB_ADAP_HAS_PID_FILTER |3742DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,3743.pid_filter_count = 32,3744.pid_filter = stk70x0p_pid_filter,3745.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,3746.frontend_attach = tfe7090pvr_frontend1_attach,3747.tuner_attach = tfe7090pvr_tuner1_attach,37483749DIB0700_DEFAULT_STREAMING_CONFIG(0x02),37503751.size_of_priv =3752sizeof(struct dib0700_adapter_state),3753},3754},37553756.num_device_descs = 1,3757.devices = {3758{ "DiBcom TFE7090PVR reference design",3759{ &dib0700_usb_id_table[73], NULL },3760{ NULL },3761},3762},37633764.rc.core = {3765.rc_interval = DEFAULT_RC_INTERVAL,3766.rc_codes = RC_MAP_DIB0700_RC5_TABLE,3767.module_name = "dib0700",3768.rc_query = dib0700_rc_query_old_firmware,3769.allowed_protos = RC_TYPE_RC5 |3770RC_TYPE_RC6 |3771RC_TYPE_NEC,3772.change_protocol = dib0700_change_protocol,3773},3774},3775};37763777int dib0700_device_count = ARRAY_SIZE(dib0700_devices);377837793780