Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1 | /* Linux driver for devices based on the DiBcom DiB0700 USB bridge |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify it |
| 4 | * under the terms of the GNU General Public License as published by the Free |
| 5 | * Software Foundation, version 2. |
| 6 | * |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 7 | * Copyright (C) 2005-7 DiBcom, SA |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 8 | */ |
| 9 | #include "dib0700.h" |
| 10 | |
| 11 | #include "dib3000mc.h" |
Patrick Boettcher | 91bb9be | 2006-12-02 21:15:51 -0200 | [diff] [blame] | 12 | #include "dib7000m.h" |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 13 | #include "dib7000p.h" |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 14 | #include "mt2060.h" |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 15 | #include "mt2266.h" |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 16 | #include "tuner-xc2028.h" |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 17 | #include "xc5000.h" |
| 18 | #include "s5h1411.h" |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 19 | #include "dib0070.h" |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 20 | |
Patrick Boettcher | 7fb3fc0 | 2006-09-20 04:37:18 -0300 | [diff] [blame] | 21 | static int force_lna_activation; |
| 22 | module_param(force_lna_activation, int, 0644); |
| 23 | MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), " |
| 24 | "if applicable for the device (default: 0=automatic/off)."); |
| 25 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 26 | struct dib0700_adapter_state { |
| 27 | int (*set_param_save) (struct dvb_frontend *, struct dvb_frontend_parameters *); |
| 28 | }; |
| 29 | |
| 30 | /* Hauppauge Nova-T 500 (aka Bristol) |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 31 | * has a LNA on GPIO0 which is enabled by setting 1 */ |
| 32 | static struct mt2060_config bristol_mt2060_config[2] = { |
| 33 | { |
| 34 | .i2c_address = 0x60, |
Patrick Boettcher | 303cbea | 2006-09-19 12:51:56 -0300 | [diff] [blame] | 35 | .clock_out = 3, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 36 | }, { |
| 37 | .i2c_address = 0x61, |
| 38 | } |
| 39 | }; |
| 40 | |
| 41 | static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = { |
| 42 | .band_caps = BAND_VHF | BAND_UHF, |
Patrick Boettcher | 01b4bf3 | 2006-09-19 12:51:53 -0300 | [diff] [blame] | 43 | .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0), |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 44 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 45 | .agc1_max = 42598, |
| 46 | .agc1_min = 17694, |
| 47 | .agc2_max = 45875, |
| 48 | .agc2_min = 0, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 49 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 50 | .agc1_pt1 = 0, |
| 51 | .agc1_pt2 = 59, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 52 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 53 | .agc1_slope1 = 0, |
| 54 | .agc1_slope2 = 69, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 55 | |
| 56 | .agc2_pt1 = 0, |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 57 | .agc2_pt2 = 59, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 58 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 59 | .agc2_slope1 = 111, |
| 60 | .agc2_slope2 = 28, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | static struct dib3000mc_config bristol_dib3000mc_config[2] = { |
| 64 | { .agc = &bristol_dib3000p_mt2060_agc_config, |
| 65 | .max_time = 0x196, |
| 66 | .ln_adc_level = 0x1cc7, |
| 67 | .output_mpeg2_in_188_bytes = 1, |
| 68 | }, |
| 69 | { .agc = &bristol_dib3000p_mt2060_agc_config, |
| 70 | .max_time = 0x196, |
| 71 | .ln_adc_level = 0x1cc7, |
| 72 | .output_mpeg2_in_188_bytes = 1, |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | static int bristol_frontend_attach(struct dvb_usb_adapter *adap) |
| 77 | { |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 78 | struct dib0700_state *st = adap->dev->priv; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 79 | if (adap->id == 0) { |
| 80 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); |
| 81 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); |
| 82 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); |
| 83 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); |
| 84 | |
Patrick Boettcher | 7fb3fc0 | 2006-09-20 04:37:18 -0300 | [diff] [blame] | 85 | if (force_lna_activation) |
| 86 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 87 | else |
| 88 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 89 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 90 | if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) { |
| 91 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); |
| 92 | return -ENODEV; |
| 93 | } |
| 94 | } |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 95 | st->mt2060_if1[adap->id] = 1220; |
| 96 | return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, |
| 97 | (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 98 | } |
| 99 | |
Patrick Boettcher | 4a2b108 | 2008-01-25 07:32:58 -0300 | [diff] [blame] | 100 | static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval) |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 101 | { |
| 102 | struct i2c_msg msg[2] = { |
| 103 | { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 }, |
| 104 | { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 }, |
| 105 | }; |
| 106 | if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO; |
| 107 | return 0; |
| 108 | } |
| 109 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 110 | static int bristol_tuner_attach(struct dvb_usb_adapter *adap) |
| 111 | { |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 112 | struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 113 | struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 114 | s8 a; |
| 115 | int if1=1220; |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 116 | if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) && |
| 117 | adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) { |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 118 | if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a; |
| 119 | } |
| 120 | return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id], |
| 121 | if1) == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 122 | } |
| 123 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 124 | /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */ |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 125 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 126 | /* MT226x */ |
| 127 | static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = { |
| 128 | { |
| 129 | BAND_UHF, // band_caps |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 130 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 131 | /* 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, |
| 132 | * 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 */ |
| 133 | (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 134 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 135 | 1130, // inv_gain |
| 136 | 21, // time_stabiliz |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 137 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 138 | 0, // alpha_level |
| 139 | 118, // thlock |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 140 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 141 | 0, // wbd_inv |
| 142 | 3530, // wbd_ref |
| 143 | 1, // wbd_sel |
| 144 | 0, // wbd_alpha |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 145 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 146 | 65535, // agc1_max |
| 147 | 33770, // agc1_min |
| 148 | 65535, // agc2_max |
| 149 | 23592, // agc2_min |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 150 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 151 | 0, // agc1_pt1 |
| 152 | 62, // agc1_pt2 |
| 153 | 255, // agc1_pt3 |
| 154 | 64, // agc1_slope1 |
| 155 | 64, // agc1_slope2 |
| 156 | 132, // agc2_pt1 |
| 157 | 192, // agc2_pt2 |
| 158 | 80, // agc2_slope1 |
| 159 | 80, // agc2_slope2 |
| 160 | |
| 161 | 17, // alpha_mant |
| 162 | 27, // alpha_exp |
| 163 | 23, // beta_mant |
| 164 | 51, // beta_exp |
| 165 | |
| 166 | 1, // perform_agc_softsplit |
| 167 | }, { |
| 168 | BAND_VHF | BAND_LBAND, // band_caps |
| 169 | |
| 170 | /* 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, |
| 171 | * 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 */ |
| 172 | (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup |
| 173 | |
| 174 | 2372, // inv_gain |
| 175 | 21, // time_stabiliz |
| 176 | |
| 177 | 0, // alpha_level |
| 178 | 118, // thlock |
| 179 | |
| 180 | 0, // wbd_inv |
| 181 | 3530, // wbd_ref |
| 182 | 1, // wbd_sel |
| 183 | 0, // wbd_alpha |
| 184 | |
| 185 | 65535, // agc1_max |
| 186 | 0, // agc1_min |
| 187 | 65535, // agc2_max |
| 188 | 23592, // agc2_min |
| 189 | |
| 190 | 0, // agc1_pt1 |
| 191 | 128, // agc1_pt2 |
| 192 | 128, // agc1_pt3 |
| 193 | 128, // agc1_slope1 |
| 194 | 0, // agc1_slope2 |
| 195 | 128, // agc2_pt1 |
| 196 | 253, // agc2_pt2 |
| 197 | 81, // agc2_slope1 |
| 198 | 0, // agc2_slope2 |
| 199 | |
| 200 | 17, // alpha_mant |
| 201 | 27, // alpha_exp |
| 202 | 23, // beta_mant |
| 203 | 51, // beta_exp |
| 204 | |
| 205 | 1, // perform_agc_softsplit |
| 206 | } |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 207 | }; |
| 208 | |
| 209 | static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = { |
| 210 | 60000, 30000, // internal, sampling |
| 211 | 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass |
| 212 | 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo |
| 213 | (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k |
| 214 | 0, // ifreq |
| 215 | 20452225, // timf |
| 216 | }; |
| 217 | |
| 218 | static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = { |
| 219 | { .output_mpeg2_in_188_bytes = 1, |
| 220 | .hostbus_diversity = 1, |
| 221 | .tuner_is_baseband = 1, |
| 222 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 223 | .agc_config_count = 2, |
| 224 | .agc = stk7700d_7000p_mt2266_agc_config, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 225 | .bw = &stk7700d_mt2266_pll_config, |
| 226 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 227 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 228 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 229 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 230 | }, |
| 231 | { .output_mpeg2_in_188_bytes = 1, |
| 232 | .hostbus_diversity = 1, |
| 233 | .tuner_is_baseband = 1, |
| 234 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 235 | .agc_config_count = 2, |
| 236 | .agc = stk7700d_7000p_mt2266_agc_config, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 237 | .bw = &stk7700d_mt2266_pll_config, |
| 238 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 239 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 240 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 241 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 242 | } |
| 243 | }; |
| 244 | |
| 245 | static struct mt2266_config stk7700d_mt2266_config[2] = { |
| 246 | { .i2c_address = 0x60 |
| 247 | }, |
| 248 | { .i2c_address = 0x60 |
| 249 | } |
| 250 | }; |
| 251 | |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 252 | static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap) |
| 253 | { |
| 254 | if (adap->id == 0) { |
| 255 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 256 | msleep(10); |
| 257 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 258 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 259 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 260 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 261 | msleep(10); |
| 262 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 263 | msleep(10); |
| 264 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap,1,18,stk7700d_dib7000p_mt2266_config); |
| 265 | } |
| 266 | |
| 267 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1), |
| 268 | &stk7700d_dib7000p_mt2266_config[adap->id]); |
| 269 | |
| 270 | return adap->fe == NULL ? -ENODEV : 0; |
| 271 | } |
| 272 | |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 273 | static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap) |
| 274 | { |
| 275 | if (adap->id == 0) { |
| 276 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 277 | msleep(10); |
| 278 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 279 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 280 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 281 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 282 | msleep(10); |
| 283 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 284 | msleep(10); |
| 285 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 286 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap,2,18,stk7700d_dib7000p_mt2266_config); |
| 287 | } |
| 288 | |
| 289 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1), |
| 290 | &stk7700d_dib7000p_mt2266_config[adap->id]); |
| 291 | |
| 292 | return adap->fe == NULL ? -ENODEV : 0; |
| 293 | } |
| 294 | |
| 295 | static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) |
| 296 | { |
| 297 | struct i2c_adapter *tun_i2c; |
| 298 | tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
| 299 | return dvb_attach(mt2266_attach, adap->fe, tun_i2c, |
| 300 | &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;; |
| 301 | } |
| 302 | |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 303 | /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */ |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 304 | static struct dibx000_agc_config xc3028_agc_config = { |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 305 | BAND_VHF | BAND_UHF, /* band_caps */ |
| 306 | |
| 307 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, |
| 308 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 309 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ |
| 310 | (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | |
| 311 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ |
| 312 | |
| 313 | 712, /* inv_gain */ |
| 314 | 21, /* time_stabiliz */ |
| 315 | |
| 316 | 0, /* alpha_level */ |
| 317 | 118, /* thlock */ |
| 318 | |
| 319 | 0, /* wbd_inv */ |
| 320 | 2867, /* wbd_ref */ |
| 321 | 0, /* wbd_sel */ |
| 322 | 2, /* wbd_alpha */ |
| 323 | |
| 324 | 0, /* agc1_max */ |
| 325 | 0, /* agc1_min */ |
| 326 | 39718, /* agc2_max */ |
| 327 | 9930, /* agc2_min */ |
| 328 | 0, /* agc1_pt1 */ |
| 329 | 0, /* agc1_pt2 */ |
| 330 | 0, /* agc1_pt3 */ |
| 331 | 0, /* agc1_slope1 */ |
| 332 | 0, /* agc1_slope2 */ |
| 333 | 0, /* agc2_pt1 */ |
| 334 | 128, /* agc2_pt2 */ |
| 335 | 29, /* agc2_slope1 */ |
| 336 | 29, /* agc2_slope2 */ |
| 337 | |
| 338 | 17, /* alpha_mant */ |
| 339 | 27, /* alpha_exp */ |
| 340 | 23, /* beta_mant */ |
| 341 | 51, /* beta_exp */ |
| 342 | |
| 343 | 1, /* perform_agc_softsplit */ |
| 344 | }; |
| 345 | |
| 346 | /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */ |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 347 | static struct dibx000_bandwidth_config xc3028_bw_config = { |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 348 | 60000, 30000, /* internal, sampling */ |
| 349 | 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ |
| 350 | 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, |
| 351 | modulo */ |
| 352 | (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ |
| 353 | (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ |
| 354 | 20452225, /* timf */ |
| 355 | 30000000, /* xtal_hz */ |
| 356 | }; |
| 357 | |
| 358 | static struct dib7000p_config stk7700ph_dib7700_xc3028_config = { |
| 359 | .output_mpeg2_in_188_bytes = 1, |
| 360 | .tuner_is_baseband = 1, |
| 361 | |
| 362 | .agc_config_count = 1, |
| 363 | .agc = &xc3028_agc_config, |
| 364 | .bw = &xc3028_bw_config, |
| 365 | |
| 366 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 367 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 368 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 369 | }; |
| 370 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 371 | static int stk7700ph_xc3028_callback(void *ptr, int component, |
| 372 | int command, int arg) |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 373 | { |
| 374 | struct dvb_usb_adapter *adap = ptr; |
| 375 | |
| 376 | switch (command) { |
| 377 | case XC2028_TUNER_RESET: |
| 378 | /* Send the tuner in then out of reset */ |
| 379 | dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10); |
| 380 | dib7000p_set_gpio(adap->fe, 8, 0, 1); |
| 381 | break; |
| 382 | case XC2028_RESET_CLK: |
| 383 | break; |
| 384 | default: |
| 385 | err("%s: unknown command %d, arg %d\n", __func__, |
| 386 | command, arg); |
| 387 | return -EINVAL; |
| 388 | } |
| 389 | return 0; |
| 390 | } |
| 391 | |
| 392 | static struct xc2028_ctrl stk7700ph_xc3028_ctrl = { |
| 393 | .fname = XC2028_DEFAULT_FIRMWARE, |
| 394 | .max_len = 64, |
| 395 | .demod = XC3028_FE_DIBCOM52, |
| 396 | }; |
| 397 | |
| 398 | static struct xc2028_config stk7700ph_xc3028_config = { |
| 399 | .i2c_addr = 0x61, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 400 | .ctrl = &stk7700ph_xc3028_ctrl, |
| 401 | }; |
| 402 | |
| 403 | static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) |
| 404 | { |
| 405 | struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; |
| 406 | |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 407 | if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) && |
| 408 | desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX)) |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 409 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
| 410 | else |
| 411 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 412 | msleep(20); |
| 413 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 414 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 415 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 416 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 417 | msleep(10); |
| 418 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 419 | msleep(20); |
| 420 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 421 | msleep(10); |
| 422 | |
| 423 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
| 424 | &stk7700ph_dib7700_xc3028_config); |
| 425 | |
| 426 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, |
| 427 | &stk7700ph_dib7700_xc3028_config); |
| 428 | |
| 429 | return adap->fe == NULL ? -ENODEV : 0; |
| 430 | } |
| 431 | |
| 432 | static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) |
| 433 | { |
| 434 | struct i2c_adapter *tun_i2c; |
| 435 | |
| 436 | tun_i2c = dib7000p_get_i2c_master(adap->fe, |
| 437 | DIBX000_I2C_INTERFACE_TUNER, 1); |
| 438 | |
| 439 | stk7700ph_xc3028_config.i2c_adap = tun_i2c; |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 440 | |
| 441 | /* FIXME: generalize & move to common area */ |
| 442 | adap->fe->callback = stk7700ph_xc3028_callback; |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 443 | |
| 444 | return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config) |
| 445 | == NULL ? -ENODEV : 0; |
| 446 | } |
| 447 | |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 448 | #define DEFAULT_RC_INTERVAL 150 |
| 449 | |
| 450 | static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; |
| 451 | |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 452 | /* Number of keypresses to ignore before start repeating */ |
| 453 | #define RC_REPEAT_DELAY 2 |
| 454 | |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 455 | static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 456 | { |
| 457 | u8 key[4]; |
| 458 | int i; |
| 459 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; |
| 460 | struct dib0700_state *st = d->priv; |
| 461 | *event = 0; |
| 462 | *state = REMOTE_NO_KEY_PRESSED; |
| 463 | i=dib0700_ctrl_rd(d,rc_request,2,key,4); |
| 464 | if (i<=0) { |
Janne Grunau | 034d65e | 2007-07-31 08:48:40 -0300 | [diff] [blame] | 465 | err("RC Query Failed"); |
Janne Grunau | 89f4267 | 2007-07-31 19:45:13 -0300 | [diff] [blame] | 466 | return -1; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 467 | } |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 468 | |
| 469 | /* losing half of KEY_0 events from Philipps rc5 remotes.. */ |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 470 | if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 471 | |
| 472 | /* 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]); */ |
| 473 | |
| 474 | dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */ |
| 475 | |
| 476 | switch (dvb_usb_dib0700_ir_proto) { |
| 477 | case 0: { |
| 478 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
| 479 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && |
| 480 | (key[3] == 0xFF)) { |
| 481 | st->rc_counter++; |
| 482 | if (st->rc_counter > RC_REPEAT_DELAY) { |
| 483 | *event = d->last_event; |
| 484 | *state = REMOTE_KEY_PRESSED; |
| 485 | st->rc_counter = RC_REPEAT_DELAY; |
| 486 | } |
| 487 | return 0; |
| 488 | } |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 489 | for (i=0;i<d->props.rc_key_map_size; i++) { |
Janne Grunau | 89f4267 | 2007-07-31 19:45:13 -0300 | [diff] [blame] | 490 | if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) { |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 491 | st->rc_counter = 0; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 492 | *event = keymap[i].event; |
| 493 | *state = REMOTE_KEY_PRESSED; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 494 | d->last_event = keymap[i].event; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 495 | return 0; |
| 496 | } |
| 497 | } |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 498 | break; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 499 | } |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 500 | default: { |
| 501 | /* RC-5 protocol changes toggle bit on new keypress */ |
| 502 | for (i = 0; i < d->props.rc_key_map_size; i++) { |
| 503 | if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) { |
| 504 | if (d->last_event == keymap[i].event && |
| 505 | key[3-1] == st->rc_toggle) { |
| 506 | st->rc_counter++; |
| 507 | /* prevents unwanted double hits */ |
| 508 | if (st->rc_counter > RC_REPEAT_DELAY) { |
| 509 | *event = d->last_event; |
| 510 | *state = REMOTE_KEY_PRESSED; |
| 511 | st->rc_counter = RC_REPEAT_DELAY; |
| 512 | } |
| 513 | |
| 514 | return 0; |
| 515 | } |
| 516 | st->rc_counter = 0; |
| 517 | *event = keymap[i].event; |
| 518 | *state = REMOTE_KEY_PRESSED; |
| 519 | st->rc_toggle = key[3-1]; |
| 520 | d->last_event = keymap[i].event; |
| 521 | return 0; |
| 522 | } |
| 523 | } |
| 524 | break; |
| 525 | } |
| 526 | } |
| 527 | err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]); |
| 528 | d->last_event = 0; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 529 | return 0; |
| 530 | } |
| 531 | |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 532 | static struct dvb_usb_rc_key dib0700_rc_keys[] = { |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 533 | /* Key codes for the tiny Pinnacle remote*/ |
| 534 | { 0x07, 0x00, KEY_MUTE }, |
| 535 | { 0x07, 0x01, KEY_MENU }, // Pinnacle logo |
| 536 | { 0x07, 0x39, KEY_POWER }, |
| 537 | { 0x07, 0x03, KEY_VOLUMEUP }, |
| 538 | { 0x07, 0x09, KEY_VOLUMEDOWN }, |
| 539 | { 0x07, 0x06, KEY_CHANNELUP }, |
| 540 | { 0x07, 0x0c, KEY_CHANNELDOWN }, |
| 541 | { 0x07, 0x0f, KEY_1 }, |
| 542 | { 0x07, 0x15, KEY_2 }, |
| 543 | { 0x07, 0x10, KEY_3 }, |
| 544 | { 0x07, 0x18, KEY_4 }, |
| 545 | { 0x07, 0x1b, KEY_5 }, |
| 546 | { 0x07, 0x1e, KEY_6 }, |
| 547 | { 0x07, 0x11, KEY_7 }, |
| 548 | { 0x07, 0x21, KEY_8 }, |
| 549 | { 0x07, 0x12, KEY_9 }, |
| 550 | { 0x07, 0x27, KEY_0 }, |
| 551 | { 0x07, 0x24, KEY_SCREEN }, // 'Square' key |
| 552 | { 0x07, 0x2a, KEY_TEXT }, // 'T' key |
| 553 | { 0x07, 0x2d, KEY_REWIND }, |
| 554 | { 0x07, 0x30, KEY_PLAY }, |
| 555 | { 0x07, 0x33, KEY_FASTFORWARD }, |
| 556 | { 0x07, 0x36, KEY_RECORD }, |
| 557 | { 0x07, 0x3c, KEY_STOP }, |
| 558 | { 0x07, 0x3f, KEY_CANCEL }, // '?' key |
| 559 | /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */ |
| 560 | { 0xeb, 0x01, KEY_POWER }, |
| 561 | { 0xeb, 0x02, KEY_1 }, |
| 562 | { 0xeb, 0x03, KEY_2 }, |
| 563 | { 0xeb, 0x04, KEY_3 }, |
| 564 | { 0xeb, 0x05, KEY_4 }, |
| 565 | { 0xeb, 0x06, KEY_5 }, |
| 566 | { 0xeb, 0x07, KEY_6 }, |
| 567 | { 0xeb, 0x08, KEY_7 }, |
| 568 | { 0xeb, 0x09, KEY_8 }, |
| 569 | { 0xeb, 0x0a, KEY_9 }, |
| 570 | { 0xeb, 0x0b, KEY_VIDEO }, |
| 571 | { 0xeb, 0x0c, KEY_0 }, |
| 572 | { 0xeb, 0x0d, KEY_REFRESH }, |
| 573 | { 0xeb, 0x0f, KEY_EPG }, |
| 574 | { 0xeb, 0x10, KEY_UP }, |
| 575 | { 0xeb, 0x11, KEY_LEFT }, |
| 576 | { 0xeb, 0x12, KEY_OK }, |
| 577 | { 0xeb, 0x13, KEY_RIGHT }, |
| 578 | { 0xeb, 0x14, KEY_DOWN }, |
| 579 | { 0xeb, 0x16, KEY_INFO }, |
| 580 | { 0xeb, 0x17, KEY_RED }, |
| 581 | { 0xeb, 0x18, KEY_GREEN }, |
| 582 | { 0xeb, 0x19, KEY_YELLOW }, |
| 583 | { 0xeb, 0x1a, KEY_BLUE }, |
| 584 | { 0xeb, 0x1b, KEY_CHANNELUP }, |
| 585 | { 0xeb, 0x1c, KEY_VOLUMEUP }, |
Janne Grunau | 7161f27 | 2007-07-30 13:54:55 -0300 | [diff] [blame] | 586 | { 0xeb, 0x1d, KEY_MUTE }, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 587 | { 0xeb, 0x1e, KEY_VOLUMEDOWN }, |
| 588 | { 0xeb, 0x1f, KEY_CHANNELDOWN }, |
| 589 | { 0xeb, 0x40, KEY_PAUSE }, |
| 590 | { 0xeb, 0x41, KEY_HOME }, |
| 591 | { 0xeb, 0x42, KEY_MENU }, /* DVD Menu */ |
| 592 | { 0xeb, 0x43, KEY_SUBTITLE }, |
| 593 | { 0xeb, 0x44, KEY_TEXT }, /* Teletext */ |
| 594 | { 0xeb, 0x45, KEY_DELETE }, |
| 595 | { 0xeb, 0x46, KEY_TV }, |
| 596 | { 0xeb, 0x47, KEY_DVD }, |
| 597 | { 0xeb, 0x48, KEY_STOP }, |
| 598 | { 0xeb, 0x49, KEY_VIDEO }, |
| 599 | { 0xeb, 0x4a, KEY_AUDIO }, /* Music */ |
| 600 | { 0xeb, 0x4b, KEY_SCREEN }, /* Pic */ |
| 601 | { 0xeb, 0x4c, KEY_PLAY }, |
| 602 | { 0xeb, 0x4d, KEY_BACK }, |
| 603 | { 0xeb, 0x4e, KEY_REWIND }, |
| 604 | { 0xeb, 0x4f, KEY_FASTFORWARD }, |
| 605 | { 0xeb, 0x54, KEY_PREVIOUS }, |
| 606 | { 0xeb, 0x58, KEY_RECORD }, |
Janne Grunau | 7161f27 | 2007-07-30 13:54:55 -0300 | [diff] [blame] | 607 | { 0xeb, 0x5c, KEY_NEXT }, |
| 608 | |
| 609 | /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */ |
| 610 | { 0x1e, 0x00, KEY_0 }, |
| 611 | { 0x1e, 0x01, KEY_1 }, |
| 612 | { 0x1e, 0x02, KEY_2 }, |
| 613 | { 0x1e, 0x03, KEY_3 }, |
| 614 | { 0x1e, 0x04, KEY_4 }, |
| 615 | { 0x1e, 0x05, KEY_5 }, |
| 616 | { 0x1e, 0x06, KEY_6 }, |
| 617 | { 0x1e, 0x07, KEY_7 }, |
| 618 | { 0x1e, 0x08, KEY_8 }, |
| 619 | { 0x1e, 0x09, KEY_9 }, |
| 620 | { 0x1e, 0x0a, KEY_KPASTERISK }, |
| 621 | { 0x1e, 0x0b, KEY_RED }, |
| 622 | { 0x1e, 0x0c, KEY_RADIO }, |
| 623 | { 0x1e, 0x0d, KEY_MENU }, |
| 624 | { 0x1e, 0x0e, KEY_GRAVE }, /* # */ |
| 625 | { 0x1e, 0x0f, KEY_MUTE }, |
| 626 | { 0x1e, 0x10, KEY_VOLUMEUP }, |
| 627 | { 0x1e, 0x11, KEY_VOLUMEDOWN }, |
| 628 | { 0x1e, 0x12, KEY_CHANNEL }, |
| 629 | { 0x1e, 0x14, KEY_UP }, |
| 630 | { 0x1e, 0x15, KEY_DOWN }, |
| 631 | { 0x1e, 0x16, KEY_LEFT }, |
| 632 | { 0x1e, 0x17, KEY_RIGHT }, |
| 633 | { 0x1e, 0x18, KEY_VIDEO }, |
| 634 | { 0x1e, 0x19, KEY_AUDIO }, |
| 635 | { 0x1e, 0x1a, KEY_MEDIA }, |
| 636 | { 0x1e, 0x1b, KEY_EPG }, |
| 637 | { 0x1e, 0x1c, KEY_TV }, |
| 638 | { 0x1e, 0x1e, KEY_NEXT }, |
| 639 | { 0x1e, 0x1f, KEY_BACK }, |
| 640 | { 0x1e, 0x20, KEY_CHANNELUP }, |
| 641 | { 0x1e, 0x21, KEY_CHANNELDOWN }, |
| 642 | { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */ |
| 643 | { 0x1e, 0x25, KEY_OK }, |
| 644 | { 0x1e, 0x29, KEY_BLUE}, |
| 645 | { 0x1e, 0x2e, KEY_GREEN }, |
| 646 | { 0x1e, 0x30, KEY_PAUSE }, |
| 647 | { 0x1e, 0x32, KEY_REWIND }, |
| 648 | { 0x1e, 0x34, KEY_FASTFORWARD }, |
| 649 | { 0x1e, 0x35, KEY_PLAY }, |
| 650 | { 0x1e, 0x36, KEY_STOP }, |
| 651 | { 0x1e, 0x37, KEY_RECORD }, |
| 652 | { 0x1e, 0x38, KEY_YELLOW }, |
| 653 | { 0x1e, 0x3b, KEY_GOTO }, |
| 654 | { 0x1e, 0x3d, KEY_POWER }, |
Jaroslav Barton | 48e6a01 | 2007-11-10 19:17:45 -0300 | [diff] [blame] | 655 | |
| 656 | /* Key codes for the Leadtek Winfast DTV Dongle */ |
| 657 | { 0x00, 0x42, KEY_POWER }, |
| 658 | { 0x07, 0x7c, KEY_TUNER }, |
| 659 | { 0x0f, 0x4e, KEY_PRINT }, /* PREVIEW */ |
| 660 | { 0x08, 0x40, KEY_SCREEN }, /* full screen toggle*/ |
| 661 | { 0x0f, 0x71, KEY_DOT }, /* frequency */ |
| 662 | { 0x07, 0x43, KEY_0 }, |
| 663 | { 0x0c, 0x41, KEY_1 }, |
| 664 | { 0x04, 0x43, KEY_2 }, |
| 665 | { 0x0b, 0x7f, KEY_3 }, |
| 666 | { 0x0e, 0x41, KEY_4 }, |
| 667 | { 0x06, 0x43, KEY_5 }, |
| 668 | { 0x09, 0x7f, KEY_6 }, |
| 669 | { 0x0d, 0x7e, KEY_7 }, |
| 670 | { 0x05, 0x7c, KEY_8 }, |
| 671 | { 0x0a, 0x40, KEY_9 }, |
| 672 | { 0x0e, 0x4e, KEY_CLEAR }, |
| 673 | { 0x04, 0x7c, KEY_CHANNEL }, /* show channel number */ |
| 674 | { 0x0f, 0x41, KEY_LAST }, /* recall */ |
| 675 | { 0x03, 0x42, KEY_MUTE }, |
| 676 | { 0x06, 0x4c, KEY_RESERVED }, /* PIP button*/ |
| 677 | { 0x01, 0x72, KEY_SHUFFLE }, /* SNAPSHOT */ |
| 678 | { 0x0c, 0x4e, KEY_PLAYPAUSE }, /* TIMESHIFT */ |
| 679 | { 0x0b, 0x70, KEY_RECORD }, |
| 680 | { 0x03, 0x7d, KEY_VOLUMEUP }, |
| 681 | { 0x01, 0x7d, KEY_VOLUMEDOWN }, |
| 682 | { 0x02, 0x42, KEY_CHANNELUP }, |
| 683 | { 0x00, 0x7d, KEY_CHANNELDOWN }, |
Chris Rankin | 48aa739 | 2008-09-25 06:52:24 -0300 | [diff] [blame] | 684 | |
| 685 | /* Key codes for Nova-TD "credit card" remote control. */ |
| 686 | { 0x1d, 0x00, KEY_0 }, |
| 687 | { 0x1d, 0x01, KEY_1 }, |
| 688 | { 0x1d, 0x02, KEY_2 }, |
| 689 | { 0x1d, 0x03, KEY_3 }, |
| 690 | { 0x1d, 0x04, KEY_4 }, |
| 691 | { 0x1d, 0x05, KEY_5 }, |
| 692 | { 0x1d, 0x06, KEY_6 }, |
| 693 | { 0x1d, 0x07, KEY_7 }, |
| 694 | { 0x1d, 0x08, KEY_8 }, |
| 695 | { 0x1d, 0x09, KEY_9 }, |
| 696 | { 0x1d, 0x0a, KEY_TEXT }, |
| 697 | { 0x1d, 0x0d, KEY_MENU }, |
| 698 | { 0x1d, 0x0f, KEY_MUTE }, |
| 699 | { 0x1d, 0x10, KEY_VOLUMEUP }, |
| 700 | { 0x1d, 0x11, KEY_VOLUMEDOWN }, |
| 701 | { 0x1d, 0x12, KEY_CHANNEL }, |
| 702 | { 0x1d, 0x14, KEY_UP }, |
| 703 | { 0x1d, 0x15, KEY_DOWN }, |
| 704 | { 0x1d, 0x16, KEY_LEFT }, |
| 705 | { 0x1d, 0x17, KEY_RIGHT }, |
| 706 | { 0x1d, 0x1c, KEY_TV }, |
| 707 | { 0x1d, 0x1e, KEY_NEXT }, |
| 708 | { 0x1d, 0x1f, KEY_BACK }, |
| 709 | { 0x1d, 0x20, KEY_CHANNELUP }, |
| 710 | { 0x1d, 0x21, KEY_CHANNELDOWN }, |
| 711 | { 0x1d, 0x24, KEY_LAST }, |
| 712 | { 0x1d, 0x25, KEY_OK }, |
| 713 | { 0x1d, 0x30, KEY_PAUSE }, |
| 714 | { 0x1d, 0x32, KEY_REWIND }, |
| 715 | { 0x1d, 0x34, KEY_FASTFORWARD }, |
| 716 | { 0x1d, 0x35, KEY_PLAY }, |
| 717 | { 0x1d, 0x36, KEY_STOP }, |
| 718 | { 0x1d, 0x37, KEY_RECORD }, |
| 719 | { 0x1d, 0x3b, KEY_GOTO }, |
| 720 | { 0x1d, 0x3d, KEY_POWER }, |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 721 | }; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 722 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 723 | /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 724 | static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = { |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 725 | BAND_UHF | BAND_VHF, // band_caps |
| 726 | |
| 727 | /* 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, |
| 728 | * 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 */ |
| 729 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup |
| 730 | |
| 731 | 712, // inv_gain |
| 732 | 41, // time_stabiliz |
| 733 | |
| 734 | 0, // alpha_level |
| 735 | 118, // thlock |
| 736 | |
| 737 | 0, // wbd_inv |
| 738 | 4095, // wbd_ref |
| 739 | 0, // wbd_sel |
| 740 | 0, // wbd_alpha |
| 741 | |
| 742 | 42598, // agc1_max |
| 743 | 17694, // agc1_min |
| 744 | 45875, // agc2_max |
| 745 | 2621, // agc2_min |
| 746 | 0, // agc1_pt1 |
| 747 | 76, // agc1_pt2 |
| 748 | 139, // agc1_pt3 |
| 749 | 52, // agc1_slope1 |
| 750 | 59, // agc1_slope2 |
| 751 | 107, // agc2_pt1 |
| 752 | 172, // agc2_pt2 |
| 753 | 57, // agc2_slope1 |
| 754 | 70, // agc2_slope2 |
| 755 | |
| 756 | 21, // alpha_mant |
| 757 | 25, // alpha_exp |
| 758 | 28, // beta_mant |
| 759 | 48, // beta_exp |
| 760 | |
| 761 | 1, // perform_agc_softsplit |
| 762 | { 0, // split_min |
| 763 | 107, // split_max |
| 764 | 51800, // global_split_min |
| 765 | 24700 // global_split_max |
| 766 | }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 767 | }; |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 768 | |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 769 | static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = { |
| 770 | BAND_UHF | BAND_VHF, |
| 771 | |
| 772 | /* 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, |
| 773 | * 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 */ |
| 774 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup |
| 775 | |
| 776 | 712, // inv_gain |
| 777 | 41, // time_stabiliz |
| 778 | |
| 779 | 0, // alpha_level |
| 780 | 118, // thlock |
| 781 | |
| 782 | 0, // wbd_inv |
| 783 | 4095, // wbd_ref |
| 784 | 0, // wbd_sel |
| 785 | 0, // wbd_alpha |
| 786 | |
| 787 | 42598, // agc1_max |
| 788 | 16384, // agc1_min |
| 789 | 42598, // agc2_max |
| 790 | 0, // agc2_min |
| 791 | |
| 792 | 0, // agc1_pt1 |
| 793 | 137, // agc1_pt2 |
| 794 | 255, // agc1_pt3 |
| 795 | |
| 796 | 0, // agc1_slope1 |
| 797 | 255, // agc1_slope2 |
| 798 | |
| 799 | 0, // agc2_pt1 |
| 800 | 0, // agc2_pt2 |
| 801 | |
| 802 | 0, // agc2_slope1 |
| 803 | 41, // agc2_slope2 |
| 804 | |
| 805 | 15, // alpha_mant |
| 806 | 25, // alpha_exp |
| 807 | |
| 808 | 28, // beta_mant |
| 809 | 48, // beta_exp |
| 810 | |
| 811 | 0, // perform_agc_softsplit |
| 812 | }; |
| 813 | |
| 814 | static struct dibx000_bandwidth_config stk7700p_pll_config = { |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 815 | 60000, 30000, // internal, sampling |
| 816 | 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass |
| 817 | 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo |
| 818 | (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k |
| 819 | 60258167, // ifreq |
| 820 | 20452225, // timf |
Patrick Boettcher | 3db78e5 | 2007-07-31 08:19:28 -0300 | [diff] [blame] | 821 | 30000000, // xtal |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 822 | }; |
| 823 | |
| 824 | static struct dib7000m_config stk7700p_dib7000m_config = { |
| 825 | .dvbt_mode = 1, |
| 826 | .output_mpeg2_in_188_bytes = 1, |
| 827 | .quartz_direct = 1, |
| 828 | |
| 829 | .agc_config_count = 1, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 830 | .agc = &stk7700p_7000m_mt2060_agc_config, |
| 831 | .bw = &stk7700p_pll_config, |
| 832 | |
| 833 | .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, |
| 834 | .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, |
| 835 | .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, |
| 836 | }; |
| 837 | |
| 838 | static struct dib7000p_config stk7700p_dib7000p_config = { |
| 839 | .output_mpeg2_in_188_bytes = 1, |
| 840 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 841 | .agc_config_count = 1, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 842 | .agc = &stk7700p_7000p_mt2060_agc_config, |
| 843 | .bw = &stk7700p_pll_config, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 844 | |
| 845 | .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, |
| 846 | .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, |
| 847 | .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, |
| 848 | }; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 849 | |
| 850 | static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap) |
| 851 | { |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 852 | struct dib0700_state *st = adap->dev->priv; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 853 | /* unless there is no real power management in DVB - we leave the device on GPIO6 */ |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 854 | |
| 855 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 856 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50); |
| 857 | |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 858 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 859 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 860 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 861 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 862 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 863 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100); |
| 864 | |
| 865 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 866 | |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 867 | st->mt2060_if1[0] = 1220; |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 868 | |
| 869 | if (dib7000pc_detection(&adap->dev->i2c_adap)) { |
| 870 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config); |
| 871 | st->is_dib7000pc = 1; |
| 872 | } else |
| 873 | adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config); |
| 874 | |
| 875 | return adap->fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 876 | } |
| 877 | |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 878 | static struct mt2060_config stk7700p_mt2060_config = { |
| 879 | 0x60 |
| 880 | }; |
| 881 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 882 | static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap) |
| 883 | { |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 884 | struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 885 | struct dib0700_state *st = adap->dev->priv; |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 886 | struct i2c_adapter *tun_i2c; |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 887 | s8 a; |
| 888 | int if1=1220; |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 889 | if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) && |
| 890 | adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) { |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 891 | if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a; |
| 892 | } |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 893 | if (st->is_dib7000pc) |
| 894 | tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
| 895 | else |
| 896 | tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
| 897 | |
| 898 | return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config, |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 899 | if1) == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 900 | } |
| 901 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 902 | /* DIB7070 generic */ |
| 903 | static struct dibx000_agc_config dib7070_agc_config = { |
| 904 | BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, |
| 905 | /* 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, |
| 906 | * 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 */ |
| 907 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup |
| 908 | |
| 909 | 600, // inv_gain |
| 910 | 10, // time_stabiliz |
| 911 | |
| 912 | 0, // alpha_level |
| 913 | 118, // thlock |
| 914 | |
| 915 | 0, // wbd_inv |
| 916 | 3530, // wbd_ref |
| 917 | 1, // wbd_sel |
| 918 | 5, // wbd_alpha |
| 919 | |
| 920 | 65535, // agc1_max |
| 921 | 0, // agc1_min |
| 922 | |
| 923 | 65535, // agc2_max |
| 924 | 0, // agc2_min |
| 925 | |
| 926 | 0, // agc1_pt1 |
| 927 | 40, // agc1_pt2 |
| 928 | 183, // agc1_pt3 |
| 929 | 206, // agc1_slope1 |
| 930 | 255, // agc1_slope2 |
| 931 | 72, // agc2_pt1 |
| 932 | 152, // agc2_pt2 |
| 933 | 88, // agc2_slope1 |
| 934 | 90, // agc2_slope2 |
| 935 | |
| 936 | 17, // alpha_mant |
| 937 | 27, // alpha_exp |
| 938 | 23, // beta_mant |
| 939 | 51, // beta_exp |
| 940 | |
| 941 | 0, // perform_agc_softsplit |
| 942 | }; |
| 943 | |
| 944 | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) |
| 945 | { |
| 946 | return dib7000p_set_gpio(fe, 8, 0, !onoff); |
| 947 | } |
| 948 | |
| 949 | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) |
| 950 | { |
| 951 | return dib7000p_set_gpio(fe, 9, 0, onoff); |
| 952 | } |
| 953 | |
| 954 | static struct dib0070_config dib7070p_dib0070_config[2] = { |
| 955 | { |
| 956 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 957 | .reset = dib7070_tuner_reset, |
| 958 | .sleep = dib7070_tuner_sleep, |
| 959 | .clock_khz = 12000, |
| 960 | .clock_pad_drive = 4 |
| 961 | }, { |
| 962 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 963 | .reset = dib7070_tuner_reset, |
| 964 | .sleep = dib7070_tuner_sleep, |
| 965 | .clock_khz = 12000, |
| 966 | |
| 967 | } |
| 968 | }; |
| 969 | |
| 970 | static int dib7070_set_param_override(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) |
| 971 | { |
| 972 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 973 | struct dib0700_adapter_state *state = adap->priv; |
| 974 | |
| 975 | u16 offset; |
| 976 | u8 band = BAND_OF_FREQUENCY(fep->frequency/1000); |
| 977 | switch (band) { |
| 978 | case BAND_VHF: offset = 950; break; |
| 979 | case BAND_UHF: |
| 980 | default: offset = 550; break; |
| 981 | } |
| 982 | deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe)); |
| 983 | dib7000p_set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); |
| 984 | return state->set_param_save(fe, fep); |
| 985 | } |
| 986 | |
| 987 | static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) |
| 988 | { |
| 989 | struct dib0700_adapter_state *st = adap->priv; |
| 990 | struct i2c_adapter *tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
| 991 | |
| 992 | if (adap->id == 0) { |
| 993 | if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL) |
| 994 | return -ENODEV; |
| 995 | } else { |
| 996 | if (dvb_attach(dib0070_attach, adap->fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL) |
| 997 | return -ENODEV; |
| 998 | } |
| 999 | |
| 1000 | st->set_param_save = adap->fe->ops.tuner_ops.set_params; |
| 1001 | adap->fe->ops.tuner_ops.set_params = dib7070_set_param_override; |
| 1002 | return 0; |
| 1003 | } |
| 1004 | |
| 1005 | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { |
| 1006 | 60000, 15000, // internal, sampling |
| 1007 | 1, 20, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass |
| 1008 | 0, 0, 1, 1, 2, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo |
| 1009 | (3 << 14) | (1 << 12) | (524 << 0), // sad_cfg: refsel, sel, freq_15k |
| 1010 | (0 << 25) | 0, // ifreq = 0.000000 MHz |
| 1011 | 20452225, // timf |
| 1012 | 12000000, // xtal_hz |
| 1013 | }; |
| 1014 | |
| 1015 | static struct dib7000p_config dib7070p_dib7000p_config = { |
| 1016 | .output_mpeg2_in_188_bytes = 1, |
| 1017 | |
| 1018 | .agc_config_count = 1, |
| 1019 | .agc = &dib7070_agc_config, |
| 1020 | .bw = &dib7070_bw_config_12_mhz, |
Patrick Boettcher | 3cb2c39 | 2008-01-25 07:25:20 -0300 | [diff] [blame] | 1021 | .tuner_is_baseband = 1, |
| 1022 | .spur_protect = 1, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1023 | |
| 1024 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 1025 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 1026 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 1027 | |
| 1028 | .hostbus_diversity = 1, |
| 1029 | }; |
| 1030 | |
| 1031 | /* STK7070P */ |
| 1032 | static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) |
| 1033 | { |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 1034 | struct usb_device_descriptor *p = &adap->dev->udev->descriptor; |
| 1035 | if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) && |
| 1036 | p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) |
| 1037 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1038 | else |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 1039 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1040 | msleep(10); |
| 1041 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1042 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1043 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1044 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1045 | |
| 1046 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1047 | |
| 1048 | msleep(10); |
| 1049 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1050 | msleep(10); |
| 1051 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1052 | |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1053 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
| 1054 | &dib7070p_dib7000p_config); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1055 | |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1056 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, |
| 1057 | &dib7070p_dib7000p_config); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1058 | return adap->fe == NULL ? -ENODEV : 0; |
| 1059 | } |
| 1060 | |
| 1061 | /* STK7070PD */ |
| 1062 | static struct dib7000p_config stk7070pd_dib7000p_config[2] = { |
| 1063 | { |
| 1064 | .output_mpeg2_in_188_bytes = 1, |
| 1065 | |
| 1066 | .agc_config_count = 1, |
| 1067 | .agc = &dib7070_agc_config, |
| 1068 | .bw = &dib7070_bw_config_12_mhz, |
Patrick Boettcher | 3cb2c39 | 2008-01-25 07:25:20 -0300 | [diff] [blame] | 1069 | .tuner_is_baseband = 1, |
| 1070 | .spur_protect = 1, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1071 | |
| 1072 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 1073 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 1074 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 1075 | |
| 1076 | .hostbus_diversity = 1, |
| 1077 | }, { |
| 1078 | .output_mpeg2_in_188_bytes = 1, |
| 1079 | |
| 1080 | .agc_config_count = 1, |
| 1081 | .agc = &dib7070_agc_config, |
| 1082 | .bw = &dib7070_bw_config_12_mhz, |
Patrick Boettcher | 3cb2c39 | 2008-01-25 07:25:20 -0300 | [diff] [blame] | 1083 | .tuner_is_baseband = 1, |
| 1084 | .spur_protect = 1, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1085 | |
| 1086 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 1087 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 1088 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 1089 | |
| 1090 | .hostbus_diversity = 1, |
| 1091 | } |
| 1092 | }; |
| 1093 | |
| 1094 | static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) |
| 1095 | { |
| 1096 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1097 | msleep(10); |
| 1098 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1099 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1100 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1101 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1102 | |
| 1103 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1104 | |
| 1105 | msleep(10); |
| 1106 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1107 | msleep(10); |
| 1108 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1109 | |
| 1110 | dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config); |
| 1111 | |
| 1112 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]); |
| 1113 | return adap->fe == NULL ? -ENODEV : 0; |
| 1114 | } |
| 1115 | |
| 1116 | static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap) |
| 1117 | { |
| 1118 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]); |
| 1119 | return adap->fe == NULL ? -ENODEV : 0; |
| 1120 | } |
| 1121 | |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1122 | /* S5H1411 */ |
| 1123 | static struct s5h1411_config pinnacle_801e_config = { |
| 1124 | .output_mode = S5H1411_PARALLEL_OUTPUT, |
| 1125 | .gpio = S5H1411_GPIO_OFF, |
| 1126 | .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, |
| 1127 | .qam_if = S5H1411_IF_44000, |
| 1128 | .vsb_if = S5H1411_IF_44000, |
| 1129 | .inversion = S5H1411_INVERSION_OFF, |
| 1130 | .status_mode = S5H1411_DEMODLOCKING |
| 1131 | }; |
| 1132 | |
| 1133 | /* Pinnacle PCTV HD Pro 801e GPIOs map: |
| 1134 | GPIO0 - currently unknown |
| 1135 | GPIO1 - xc5000 tuner reset |
| 1136 | GPIO2 - CX25843 sleep |
| 1137 | GPIO3 - currently unknown |
| 1138 | GPIO4 - currently unknown |
| 1139 | GPIO6 - currently unknown |
| 1140 | GPIO7 - currently unknown |
| 1141 | GPIO9 - currently unknown |
| 1142 | GPIO10 - CX25843 reset |
| 1143 | */ |
| 1144 | static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap) |
| 1145 | { |
| 1146 | struct dib0700_state *st = adap->dev->priv; |
| 1147 | |
| 1148 | /* Make use of the new i2c functions from FW 1.20 */ |
| 1149 | st->fw_use_new_i2c_api = 1; |
| 1150 | |
| 1151 | /* The s5h1411 requires the dib0700 to not be in master mode */ |
| 1152 | st->disable_streaming_master_mode = 1; |
| 1153 | |
| 1154 | /* All msleep values taken from Windows USB trace */ |
| 1155 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); |
| 1156 | dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0); |
| 1157 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1158 | msleep(400); |
| 1159 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1160 | msleep(60); |
| 1161 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1162 | msleep(30); |
| 1163 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1164 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1165 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1166 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1167 | dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0); |
| 1168 | msleep(30); |
| 1169 | |
| 1170 | /* Put the CX25843 to sleep for now since we're in digital mode */ |
| 1171 | dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); |
| 1172 | |
| 1173 | /* GPIOs are initialized, do the attach */ |
| 1174 | adap->fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config, |
| 1175 | &adap->dev->i2c_adap); |
| 1176 | return adap->fe == NULL ? -ENODEV : 0; |
| 1177 | } |
| 1178 | |
Michael Krufky | 767f3b3 | 2008-09-25 09:47:07 -0300 | [diff] [blame] | 1179 | static int dib0700_xc5000_tuner_callback(void *priv, int component, |
| 1180 | int command, int arg) |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1181 | { |
| 1182 | struct dvb_usb_adapter *adap = priv; |
| 1183 | |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 1184 | if (command == XC5000_TUNER_RESET) { |
| 1185 | /* Reset the tuner */ |
| 1186 | dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); |
| 1187 | msleep(330); /* from Windows USB trace */ |
| 1188 | dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); |
| 1189 | msleep(330); /* from Windows USB trace */ |
| 1190 | } else { |
| 1191 | err("xc5000: unknown tuner callback command: %d\n", command); |
| 1192 | return -EINVAL; |
| 1193 | } |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1194 | |
| 1195 | return 0; |
| 1196 | } |
| 1197 | |
| 1198 | static struct xc5000_config s5h1411_xc5000_tunerconfig = { |
| 1199 | .i2c_address = 0x64, |
| 1200 | .if_khz = 5380, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1201 | }; |
| 1202 | |
| 1203 | static int xc5000_tuner_attach(struct dvb_usb_adapter *adap) |
| 1204 | { |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 1205 | /* FIXME: generalize & move to common area */ |
| 1206 | adap->fe->callback = dib0700_xc5000_tuner_callback; |
| 1207 | |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1208 | return dvb_attach(xc5000_attach, adap->fe, &adap->dev->i2c_adap, |
Michael Krufky | 767f3b3 | 2008-09-25 09:47:07 -0300 | [diff] [blame] | 1209 | &s5h1411_xc5000_tunerconfig) |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1210 | == NULL ? -ENODEV : 0; |
| 1211 | } |
| 1212 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1213 | /* DVB-USB and USB stuff follows */ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1214 | struct usb_device_id dib0700_usb_id_table[] = { |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1215 | /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1216 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) }, |
| 1217 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, |
| 1218 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, |
| 1219 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1220 | /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1221 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) }, |
| 1222 | { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) }, |
| 1223 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, |
| 1224 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1225 | /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1226 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, |
| 1227 | { USB_DEVICE(USB_VID_TERRATEC, |
| 1228 | USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, |
| 1229 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, |
| 1230 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1231 | /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1232 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, |
| 1233 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) }, |
| 1234 | { USB_DEVICE(USB_VID_PINNACLE, |
| 1235 | USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, |
| 1236 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) }, |
Joachim Steiger | fa3b877 | 2007-10-08 20:08:46 -0300 | [diff] [blame] | 1237 | /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1238 | { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) }, |
| 1239 | { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, |
| 1240 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) }, |
| 1241 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) }, |
| 1242 | /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, |
| 1243 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, |
| 1244 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) }, |
| 1245 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) }, |
| 1246 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) }, |
| 1247 | /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) }, |
| 1248 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) }, |
| 1249 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, |
Alexander Simon | dc88807 | 2008-03-29 21:37:54 -0300 | [diff] [blame] | 1250 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) }, |
Darryl Green | 5da4e2c | 2008-03-29 21:47:43 -0300 | [diff] [blame] | 1251 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, |
Michael Krufky | af2a887 | 2008-09-03 17:12:24 -0300 | [diff] [blame] | 1252 | /* 35 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK_52009) }, |
Michael Krufky | 9a0c04a | 2008-09-03 17:12:24 -0300 | [diff] [blame] | 1253 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) }, |
Finn Thain | 17a370b | 2008-09-06 13:42:47 -0300 | [diff] [blame] | 1254 | { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) }, |
Daniel Oliveira Nascimento | 8751aaa | 2008-09-07 12:39:44 -0300 | [diff] [blame] | 1255 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) }, |
Albert Comerma | 5769743 | 2008-09-07 12:43:33 -0300 | [diff] [blame] | 1256 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) }, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1257 | /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) }, |
Devin Heitmueller | d2fc3bf | 2008-09-25 06:22:23 -0300 | [diff] [blame] | 1258 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1259 | { 0 } /* Terminating entry */ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1260 | }; |
| 1261 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); |
| 1262 | |
| 1263 | #define DIB0700_DEFAULT_DEVICE_PROPERTIES \ |
| 1264 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, \ |
| 1265 | .usb_ctrl = DEVICE_SPECIFIC, \ |
Devin Heitmueller | bdc203e | 2008-09-06 13:45:27 -0300 | [diff] [blame] | 1266 | .firmware = "dvb-usb-dib0700-1.20.fw", \ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1267 | .download_firmware = dib0700_download_firmware, \ |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 1268 | .no_reconnect = 1, \ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1269 | .size_of_priv = sizeof(struct dib0700_state), \ |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 1270 | .i2c_algo = &dib0700_i2c_algo, \ |
| 1271 | .identify_state = dib0700_identify_state |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1272 | |
| 1273 | #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \ |
| 1274 | .streaming_ctrl = dib0700_streaming_ctrl, \ |
| 1275 | .stream = { \ |
| 1276 | .type = USB_BULK, \ |
| 1277 | .count = 4, \ |
| 1278 | .endpoint = ep, \ |
| 1279 | .u = { \ |
| 1280 | .bulk = { \ |
| 1281 | .buffersize = 39480, \ |
| 1282 | } \ |
| 1283 | } \ |
| 1284 | } |
| 1285 | |
| 1286 | struct dvb_usb_device_properties dib0700_devices[] = { |
| 1287 | { |
| 1288 | DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1289 | |
| 1290 | .num_adapters = 1, |
| 1291 | .adapter = { |
| 1292 | { |
| 1293 | .frontend_attach = stk7700p_frontend_attach, |
| 1294 | .tuner_attach = stk7700p_tuner_attach, |
| 1295 | |
| 1296 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1297 | }, |
| 1298 | }, |
| 1299 | |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 1300 | .num_device_descs = 8, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1301 | .devices = { |
| 1302 | { "DiBcom STK7700P reference design", |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 1303 | { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1304 | { NULL }, |
| 1305 | }, |
| 1306 | { "Hauppauge Nova-T Stick", |
Stefan Traby | f9aeba4 | 2006-11-12 13:02:51 -0300 | [diff] [blame] | 1307 | { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1308 | { NULL }, |
| 1309 | }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 1310 | { "AVerMedia AVerTV DVB-T Volar", |
Jose Carlos Garcia Sogo | ced8fec | 2006-11-14 05:01:47 -0300 | [diff] [blame] | 1311 | { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 1312 | { NULL }, |
| 1313 | }, |
| 1314 | { "Compro Videomate U500", |
Patrick Boettcher | 1f8ca4b | 2007-07-30 14:24:37 -0300 | [diff] [blame] | 1315 | { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 1316 | { NULL }, |
Henning Schroeer | 0ce215e | 2006-10-19 07:58:22 -0300 | [diff] [blame] | 1317 | }, |
| 1318 | { "Uniwill STK7700P based (Hama and others)", |
| 1319 | { &dib0700_usb_id_table[7], NULL }, |
| 1320 | { NULL }, |
Michael Krufky | 8637a87 | 2006-11-08 16:47:32 -0300 | [diff] [blame] | 1321 | }, |
| 1322 | { "Leadtek Winfast DTV Dongle (STK7700P based)", |
Darryl Green | 5da4e2c | 2008-03-29 21:47:43 -0300 | [diff] [blame] | 1323 | { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] }, |
Michael Krufky | 8637a87 | 2006-11-08 16:47:32 -0300 | [diff] [blame] | 1324 | { NULL }, |
Joachim Steiger | fa3b877 | 2007-10-08 20:08:46 -0300 | [diff] [blame] | 1325 | }, |
| 1326 | { "AVerMedia AVerTV DVB-T Express", |
| 1327 | { &dib0700_usb_id_table[20] }, |
| 1328 | { NULL }, |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 1329 | }, |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 1330 | { "Gigabyte U7000", |
| 1331 | { &dib0700_usb_id_table[21], NULL }, |
| 1332 | { NULL }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 1333 | } |
Darren Salt | b1139e3 | 2007-08-18 18:05:31 -0300 | [diff] [blame] | 1334 | }, |
| 1335 | |
| 1336 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 1337 | .rc_key_map = dib0700_rc_keys, |
| 1338 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
| 1339 | .rc_query = dib0700_rc_query |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1340 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1341 | |
| 1342 | .num_adapters = 2, |
| 1343 | .adapter = { |
| 1344 | { |
| 1345 | .frontend_attach = bristol_frontend_attach, |
| 1346 | .tuner_attach = bristol_tuner_attach, |
| 1347 | |
| 1348 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1349 | }, { |
| 1350 | .frontend_attach = bristol_frontend_attach, |
| 1351 | .tuner_attach = bristol_tuner_attach, |
| 1352 | |
| 1353 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
| 1354 | } |
| 1355 | }, |
| 1356 | |
| 1357 | .num_device_descs = 1, |
| 1358 | .devices = { |
| 1359 | { "Hauppauge Nova-T 500 Dual DVB-T", |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 1360 | { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1361 | { NULL }, |
| 1362 | }, |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 1363 | }, |
| 1364 | |
| 1365 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 1366 | .rc_key_map = dib0700_rc_keys, |
Patrick Boettcher | 8779737 | 2007-07-30 17:02:17 -0300 | [diff] [blame] | 1367 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 1368 | .rc_query = dib0700_rc_query |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 1369 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1370 | |
| 1371 | .num_adapters = 2, |
| 1372 | .adapter = { |
| 1373 | { |
| 1374 | .frontend_attach = stk7700d_frontend_attach, |
| 1375 | .tuner_attach = stk7700d_tuner_attach, |
| 1376 | |
| 1377 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1378 | }, { |
| 1379 | .frontend_attach = stk7700d_frontend_attach, |
| 1380 | .tuner_attach = stk7700d_tuner_attach, |
| 1381 | |
| 1382 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
| 1383 | } |
| 1384 | }, |
| 1385 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 1386 | .num_device_descs = 4, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 1387 | .devices = { |
| 1388 | { "Pinnacle PCTV 2000e", |
| 1389 | { &dib0700_usb_id_table[11], NULL }, |
| 1390 | { NULL }, |
| 1391 | }, |
| 1392 | { "Terratec Cinergy DT XS Diversity", |
| 1393 | { &dib0700_usb_id_table[12], NULL }, |
| 1394 | { NULL }, |
| 1395 | }, |
Darren Salt | faebb91 | 2007-08-18 18:04:00 -0300 | [diff] [blame] | 1396 | { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity", |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 1397 | { &dib0700_usb_id_table[13], NULL }, |
| 1398 | { NULL }, |
| 1399 | }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1400 | { "DiBcom STK7700D reference design", |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 1401 | { &dib0700_usb_id_table[14], NULL }, |
| 1402 | { NULL }, |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 1403 | } |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 1404 | }, |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 1405 | |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 1406 | .rc_interval = DEFAULT_RC_INTERVAL, |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 1407 | .rc_key_map = dib0700_rc_keys, |
Patrick Boettcher | 8779737 | 2007-07-30 17:02:17 -0300 | [diff] [blame] | 1408 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 1409 | .rc_query = dib0700_rc_query |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1410 | |
| 1411 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1412 | |
| 1413 | .num_adapters = 1, |
| 1414 | .adapter = { |
| 1415 | { |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 1416 | .frontend_attach = stk7700P2_frontend_attach, |
| 1417 | .tuner_attach = stk7700d_tuner_attach, |
| 1418 | |
| 1419 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1420 | }, |
| 1421 | }, |
| 1422 | |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1423 | .num_device_descs = 2, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 1424 | .devices = { |
| 1425 | { "ASUS My Cinema U3000 Mini DVBT Tuner", |
| 1426 | { &dib0700_usb_id_table[23], NULL }, |
| 1427 | { NULL }, |
| 1428 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1429 | { "Yuan EC372S", |
| 1430 | { &dib0700_usb_id_table[31], NULL }, |
| 1431 | { NULL }, |
| 1432 | } |
Chris Rankin | 48aa739 | 2008-09-25 06:52:24 -0300 | [diff] [blame] | 1433 | }, |
| 1434 | |
| 1435 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 1436 | .rc_key_map = dib0700_rc_keys, |
| 1437 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
| 1438 | .rc_query = dib0700_rc_query |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 1439 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1440 | |
| 1441 | .num_adapters = 1, |
| 1442 | .adapter = { |
| 1443 | { |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1444 | .frontend_attach = stk7070p_frontend_attach, |
| 1445 | .tuner_attach = dib7070p_tuner_attach, |
| 1446 | |
| 1447 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1448 | |
| 1449 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 1450 | }, |
| 1451 | }, |
| 1452 | |
Alexander Simon | dc88807 | 2008-03-29 21:37:54 -0300 | [diff] [blame] | 1453 | .num_device_descs = 9, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1454 | .devices = { |
| 1455 | { "DiBcom STK7070P reference design", |
| 1456 | { &dib0700_usb_id_table[15], NULL }, |
| 1457 | { NULL }, |
| 1458 | }, |
| 1459 | { "Pinnacle PCTV DVB-T Flash Stick", |
| 1460 | { &dib0700_usb_id_table[16], NULL }, |
| 1461 | { NULL }, |
| 1462 | }, |
Yousef Lamlum | 7999a81 | 2008-01-25 05:51:48 -0300 | [diff] [blame] | 1463 | { "Artec T14BR DVB-T", |
| 1464 | { &dib0700_usb_id_table[22], NULL }, |
| 1465 | { NULL }, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 1466 | }, |
| 1467 | { "ASUS My Cinema U3100 Mini DVBT Tuner", |
| 1468 | { &dib0700_usb_id_table[24], NULL }, |
| 1469 | { NULL }, |
| 1470 | }, |
Tim Taubert | c7637b1 | 2008-01-25 06:16:36 -0300 | [diff] [blame] | 1471 | { "Hauppauge Nova-T Stick", |
| 1472 | { &dib0700_usb_id_table[25], NULL }, |
| 1473 | { NULL }, |
| 1474 | }, |
Darren Salt | 13b83b5 | 2008-01-25 06:20:02 -0300 | [diff] [blame] | 1475 | { "Hauppauge Nova-T MyTV.t", |
| 1476 | { &dib0700_usb_id_table[26], NULL }, |
| 1477 | { NULL }, |
| 1478 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1479 | { "Pinnacle PCTV 72e", |
| 1480 | { &dib0700_usb_id_table[29], NULL }, |
| 1481 | { NULL }, |
| 1482 | }, |
| 1483 | { "Pinnacle PCTV 73e", |
| 1484 | { &dib0700_usb_id_table[30], NULL }, |
| 1485 | { NULL }, |
| 1486 | }, |
Alexander Simon | dc88807 | 2008-03-29 21:37:54 -0300 | [diff] [blame] | 1487 | { "Terratec Cinergy T USB XXS", |
| 1488 | { &dib0700_usb_id_table[33], NULL }, |
| 1489 | { NULL }, |
| 1490 | }, |
Tim Taubert | c7637b1 | 2008-01-25 06:16:36 -0300 | [diff] [blame] | 1491 | }, |
| 1492 | |
| 1493 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 1494 | .rc_key_map = dib0700_rc_keys, |
| 1495 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
| 1496 | .rc_query = dib0700_rc_query |
| 1497 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1498 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1499 | |
| 1500 | .num_adapters = 2, |
| 1501 | .adapter = { |
| 1502 | { |
| 1503 | .frontend_attach = stk7070pd_frontend_attach0, |
| 1504 | .tuner_attach = dib7070p_tuner_attach, |
| 1505 | |
| 1506 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1507 | |
| 1508 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 1509 | }, { |
| 1510 | .frontend_attach = stk7070pd_frontend_attach1, |
| 1511 | .tuner_attach = dib7070p_tuner_attach, |
| 1512 | |
| 1513 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
| 1514 | |
| 1515 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 1516 | } |
| 1517 | }, |
| 1518 | |
Michael Krufky | 9a0c04a | 2008-09-03 17:12:24 -0300 | [diff] [blame] | 1519 | .num_device_descs = 4, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1520 | .devices = { |
| 1521 | { "DiBcom STK7070PD reference design", |
| 1522 | { &dib0700_usb_id_table[17], NULL }, |
| 1523 | { NULL }, |
| 1524 | }, |
| 1525 | { "Pinnacle PCTV Dual DVB-T Diversity Stick", |
| 1526 | { &dib0700_usb_id_table[18], NULL }, |
| 1527 | { NULL }, |
Michael Krufky | d01eb2d | 2008-07-03 23:43:36 -0300 | [diff] [blame] | 1528 | }, |
| 1529 | { "Hauppauge Nova-TD Stick (52009)", |
| 1530 | { &dib0700_usb_id_table[35], NULL }, |
| 1531 | { NULL }, |
Michael Krufky | 9a0c04a | 2008-09-03 17:12:24 -0300 | [diff] [blame] | 1532 | }, |
| 1533 | { "Hauppauge Nova-TD-500 (84xxx)", |
| 1534 | { &dib0700_usb_id_table[36], NULL }, |
| 1535 | { NULL }, |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 1536 | } |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1537 | } |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1538 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1539 | |
| 1540 | .num_adapters = 1, |
| 1541 | .adapter = { |
| 1542 | { |
| 1543 | .frontend_attach = stk7700ph_frontend_attach, |
| 1544 | .tuner_attach = stk7700ph_tuner_attach, |
| 1545 | |
| 1546 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1547 | |
| 1548 | .size_of_priv = sizeof(struct |
| 1549 | dib0700_adapter_state), |
| 1550 | }, |
| 1551 | }, |
| 1552 | |
Daniel Oliveira Nascimento | 8751aaa | 2008-09-07 12:39:44 -0300 | [diff] [blame] | 1553 | .num_device_descs = 5, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1554 | .devices = { |
| 1555 | { "Terratec Cinergy HT USB XE", |
| 1556 | { &dib0700_usb_id_table[27], NULL }, |
| 1557 | { NULL }, |
| 1558 | }, |
| 1559 | { "Pinnacle Expresscard 320cx", |
| 1560 | { &dib0700_usb_id_table[28], NULL }, |
| 1561 | { NULL }, |
| 1562 | }, |
| 1563 | { "Terratec Cinergy HT Express", |
| 1564 | { &dib0700_usb_id_table[32], NULL }, |
| 1565 | { NULL }, |
| 1566 | }, |
Finn Thain | 17a370b | 2008-09-06 13:42:47 -0300 | [diff] [blame] | 1567 | { "Gigabyte U8000-RH", |
| 1568 | { &dib0700_usb_id_table[37], NULL }, |
| 1569 | { NULL }, |
| 1570 | }, |
Daniel Oliveira Nascimento | 8751aaa | 2008-09-07 12:39:44 -0300 | [diff] [blame] | 1571 | { "YUAN High-Tech STK7700PH", |
| 1572 | { &dib0700_usb_id_table[38], NULL }, |
| 1573 | { NULL }, |
| 1574 | }, |
Albert Comerma | 5769743 | 2008-09-07 12:43:33 -0300 | [diff] [blame] | 1575 | { "Asus My Cinema-U3000Hybrid", |
| 1576 | { &dib0700_usb_id_table[39], NULL }, |
| 1577 | { NULL }, |
| 1578 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1579 | }, |
| 1580 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 1581 | .rc_key_map = dib0700_rc_keys, |
| 1582 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
| 1583 | .rc_query = dib0700_rc_query |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1584 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 1585 | .num_adapters = 1, |
| 1586 | .adapter = { |
| 1587 | { |
| 1588 | .frontend_attach = s5h1411_frontend_attach, |
| 1589 | .tuner_attach = xc5000_tuner_attach, |
| 1590 | |
| 1591 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 1592 | |
| 1593 | .size_of_priv = sizeof(struct |
| 1594 | dib0700_adapter_state), |
| 1595 | }, |
| 1596 | }, |
| 1597 | |
Devin Heitmueller | d2fc3bf | 2008-09-25 06:22:23 -0300 | [diff] [blame] | 1598 | .num_device_descs = 2, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1599 | .devices = { |
| 1600 | { "Pinnacle PCTV HD Pro USB Stick", |
| 1601 | { &dib0700_usb_id_table[40], NULL }, |
| 1602 | { NULL }, |
| 1603 | }, |
Devin Heitmueller | d2fc3bf | 2008-09-25 06:22:23 -0300 | [diff] [blame] | 1604 | { "Pinnacle PCTV HD USB Stick", |
| 1605 | { &dib0700_usb_id_table[41], NULL }, |
| 1606 | { NULL }, |
| 1607 | }, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 1608 | }, |
| 1609 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 1610 | .rc_key_map = dib0700_rc_keys, |
| 1611 | .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
| 1612 | .rc_query = dib0700_rc_query |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1613 | }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 1614 | }; |
| 1615 | |
| 1616 | int dib0700_device_count = ARRAY_SIZE(dib0700_devices); |