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 | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 7 | * Copyright (C) 2005-9 DiBcom, SA et al |
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 | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 14 | #include "dib8000.h" |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 15 | #include "dib9000.h" |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 16 | #include "mt2060.h" |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 17 | #include "mt2266.h" |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 18 | #include "tuner-xc2028.h" |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 19 | #include "xc5000.h" |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 20 | #include "xc4000.h" |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 21 | #include "s5h1411.h" |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 22 | #include "dib0070.h" |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 23 | #include "dib0090.h" |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 24 | #include "lgdt3305.h" |
| 25 | #include "mxl5007t.h" |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 26 | |
Patrick Boettcher | 7fb3fc0 | 2006-09-20 04:37:18 -0300 | [diff] [blame] | 27 | static int force_lna_activation; |
| 28 | module_param(force_lna_activation, int, 0644); |
| 29 | MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), " |
| 30 | "if applicable for the device (default: 0=automatic/off)."); |
| 31 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 32 | struct dib0700_adapter_state { |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 33 | int (*set_param_save) (struct dvb_frontend *); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 34 | const struct firmware *frontend_firmware; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 35 | struct dib7000p_ops dib7000p_ops; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 36 | struct dib8000_ops dib8000_ops; |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /* Hauppauge Nova-T 500 (aka Bristol) |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 40 | * has a LNA on GPIO0 which is enabled by setting 1 */ |
| 41 | static struct mt2060_config bristol_mt2060_config[2] = { |
| 42 | { |
| 43 | .i2c_address = 0x60, |
Patrick Boettcher | 303cbea | 2006-09-19 12:51:56 -0300 | [diff] [blame] | 44 | .clock_out = 3, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 45 | }, { |
| 46 | .i2c_address = 0x61, |
| 47 | } |
| 48 | }; |
| 49 | |
Devin Heitmueller | 99afb98 | 2008-11-15 07:13:07 -0300 | [diff] [blame] | 50 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 51 | static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = { |
| 52 | .band_caps = BAND_VHF | BAND_UHF, |
Patrick Boettcher | 01b4bf3 | 2006-09-19 12:51:53 -0300 | [diff] [blame] | 53 | .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] | 54 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 55 | .agc1_max = 42598, |
| 56 | .agc1_min = 17694, |
| 57 | .agc2_max = 45875, |
| 58 | .agc2_min = 0, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 59 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 60 | .agc1_pt1 = 0, |
| 61 | .agc1_pt2 = 59, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 62 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 63 | .agc1_slope1 = 0, |
| 64 | .agc1_slope2 = 69, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 65 | |
| 66 | .agc2_pt1 = 0, |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 67 | .agc2_pt2 = 59, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 68 | |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 69 | .agc2_slope1 = 111, |
| 70 | .agc2_slope2 = 28, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | static struct dib3000mc_config bristol_dib3000mc_config[2] = { |
| 74 | { .agc = &bristol_dib3000p_mt2060_agc_config, |
| 75 | .max_time = 0x196, |
| 76 | .ln_adc_level = 0x1cc7, |
| 77 | .output_mpeg2_in_188_bytes = 1, |
| 78 | }, |
| 79 | { .agc = &bristol_dib3000p_mt2060_agc_config, |
| 80 | .max_time = 0x196, |
| 81 | .ln_adc_level = 0x1cc7, |
| 82 | .output_mpeg2_in_188_bytes = 1, |
| 83 | } |
| 84 | }; |
| 85 | |
| 86 | static int bristol_frontend_attach(struct dvb_usb_adapter *adap) |
| 87 | { |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 88 | struct dib0700_state *st = adap->dev->priv; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 89 | if (adap->id == 0) { |
| 90 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); |
| 91 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); |
| 92 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); |
| 93 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); |
| 94 | |
Patrick Boettcher | 7fb3fc0 | 2006-09-20 04:37:18 -0300 | [diff] [blame] | 95 | if (force_lna_activation) |
| 96 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 97 | else |
| 98 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 99 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 100 | if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) { |
| 101 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); |
| 102 | return -ENODEV; |
| 103 | } |
| 104 | } |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 105 | st->mt2060_if1[adap->id] = 1220; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 106 | return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 107 | (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 108 | } |
| 109 | |
Patrick Boettcher | 4a2b108 | 2008-01-25 07:32:58 -0300 | [diff] [blame] | 110 | static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval) |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 111 | { |
| 112 | struct i2c_msg msg[2] = { |
| 113 | { .addr = 0x50, .flags = 0, .buf = &adrs, .len = 1 }, |
| 114 | { .addr = 0x50, .flags = I2C_M_RD, .buf = pval, .len = 1 }, |
| 115 | }; |
| 116 | if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO; |
| 117 | return 0; |
| 118 | } |
| 119 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 120 | static int bristol_tuner_attach(struct dvb_usb_adapter *adap) |
| 121 | { |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 122 | struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 123 | struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1); |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 124 | s8 a; |
| 125 | int if1=1220; |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 126 | if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) && |
| 127 | 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] | 128 | if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a; |
| 129 | } |
Michael Krufky | 9a9677a | 2011-09-13 01:32:11 -0300 | [diff] [blame] | 130 | return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, |
| 131 | &bristol_mt2060_config[adap->id], if1) == NULL ? |
| 132 | -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 133 | } |
| 134 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 135 | /* STK7700D: Pinnacle/Terratec/Hauppauge Dual DVB-T Diversity */ |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 136 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 137 | /* MT226x */ |
| 138 | static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = { |
| 139 | { |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 140 | BAND_UHF, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 141 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 142 | /* 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, |
| 143 | * 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 */ |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 144 | (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) |
| 145 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 146 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 147 | 1130, |
| 148 | 21, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 149 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 150 | 0, |
| 151 | 118, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 152 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 153 | 0, |
| 154 | 3530, |
| 155 | 1, |
| 156 | 0, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 157 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 158 | 65535, |
| 159 | 33770, |
| 160 | 65535, |
| 161 | 23592, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 162 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 163 | 0, |
| 164 | 62, |
| 165 | 255, |
| 166 | 64, |
| 167 | 64, |
| 168 | 132, |
| 169 | 192, |
| 170 | 80, |
| 171 | 80, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 172 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 173 | 17, |
| 174 | 27, |
| 175 | 23, |
| 176 | 51, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 177 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 178 | 1, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 179 | }, { |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 180 | BAND_VHF | BAND_LBAND, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 181 | |
| 182 | /* 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, |
| 183 | * 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 */ |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 184 | (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) |
| 185 | | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 186 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 187 | 2372, |
| 188 | 21, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 189 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 190 | 0, |
| 191 | 118, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 192 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 193 | 0, |
| 194 | 3530, |
| 195 | 1, |
| 196 | 0, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 197 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 198 | 65535, |
| 199 | 0, |
| 200 | 65535, |
| 201 | 23592, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 202 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 203 | 0, |
| 204 | 128, |
| 205 | 128, |
| 206 | 128, |
| 207 | 0, |
| 208 | 128, |
| 209 | 253, |
| 210 | 81, |
| 211 | 0, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 212 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 213 | 17, |
| 214 | 27, |
| 215 | 23, |
| 216 | 51, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 217 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 218 | 1, |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 219 | } |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = { |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 223 | 60000, 30000, |
| 224 | 1, 8, 3, 1, 0, |
| 225 | 0, 0, 1, 1, 2, |
| 226 | (3 << 14) | (1 << 12) | (524 << 0), |
| 227 | 0, |
| 228 | 20452225, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = { |
| 232 | { .output_mpeg2_in_188_bytes = 1, |
| 233 | .hostbus_diversity = 1, |
| 234 | .tuner_is_baseband = 1, |
| 235 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 236 | .agc_config_count = 2, |
| 237 | .agc = stk7700d_7000p_mt2266_agc_config, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 238 | .bw = &stk7700d_mt2266_pll_config, |
| 239 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 240 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 241 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 242 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 243 | }, |
| 244 | { .output_mpeg2_in_188_bytes = 1, |
| 245 | .hostbus_diversity = 1, |
| 246 | .tuner_is_baseband = 1, |
| 247 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 248 | .agc_config_count = 2, |
| 249 | .agc = stk7700d_7000p_mt2266_agc_config, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 250 | .bw = &stk7700d_mt2266_pll_config, |
| 251 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 252 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 253 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 254 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 255 | } |
| 256 | }; |
| 257 | |
| 258 | static struct mt2266_config stk7700d_mt2266_config[2] = { |
| 259 | { .i2c_address = 0x60 |
| 260 | }, |
| 261 | { .i2c_address = 0x60 |
| 262 | } |
| 263 | }; |
| 264 | |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 265 | static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap) |
| 266 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 267 | struct dib0700_adapter_state *state = adap->priv; |
| 268 | |
| 269 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 270 | return -ENODEV; |
| 271 | |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 272 | if (adap->id == 0) { |
| 273 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 274 | msleep(10); |
| 275 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 276 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 277 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 278 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 279 | msleep(10); |
| 280 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 281 | msleep(10); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 282 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 283 | stk7700d_dib7000p_mt2266_config) |
| 284 | != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 285 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__); |
| 286 | dvb_detach(&state->dib7000p_ops); |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 287 | return -ENODEV; |
| 288 | } |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 289 | } |
| 290 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 291 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, |
Michael Krufky | 2a77631 | 2011-09-16 09:26:59 -0300 | [diff] [blame] | 292 | 0x80 + (adap->id << 1), |
| 293 | &stk7700d_dib7000p_mt2266_config[adap->id]); |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 294 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 295 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 296 | } |
| 297 | |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 298 | static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap) |
| 299 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 300 | struct dib0700_adapter_state *state = adap->priv; |
| 301 | |
| 302 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 303 | return -ENODEV; |
| 304 | |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 305 | if (adap->id == 0) { |
| 306 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 307 | msleep(10); |
| 308 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 309 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 310 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 311 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 312 | msleep(10); |
| 313 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 314 | msleep(10); |
| 315 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 316 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 317 | stk7700d_dib7000p_mt2266_config) |
| 318 | != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 319 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__); |
| 320 | dvb_detach(&state->dib7000p_ops); |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 321 | return -ENODEV; |
| 322 | } |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 323 | } |
| 324 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 325 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, |
Michael Krufky | 2a77631 | 2011-09-16 09:26:59 -0300 | [diff] [blame] | 326 | 0x80 + (adap->id << 1), |
| 327 | &stk7700d_dib7000p_mt2266_config[adap->id]); |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 328 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 329 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) |
| 333 | { |
| 334 | struct i2c_adapter *tun_i2c; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 335 | struct dib0700_adapter_state *state = adap->priv; |
| 336 | |
| 337 | tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, |
| 338 | DIBX000_I2C_INTERFACE_TUNER, 1); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 339 | return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c, |
Joe Perches | 1ebcad7 | 2009-07-02 15:57:09 -0300 | [diff] [blame] | 340 | &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 341 | } |
| 342 | |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 343 | /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */ |
Harvey Harrison | b1721d0 | 2008-04-25 19:03:08 -0700 | [diff] [blame] | 344 | static struct dibx000_agc_config xc3028_agc_config = { |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 345 | BAND_VHF | BAND_UHF, /* band_caps */ |
| 346 | |
| 347 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, |
| 348 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 349 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ |
| 350 | (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | |
| 351 | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ |
| 352 | |
| 353 | 712, /* inv_gain */ |
| 354 | 21, /* time_stabiliz */ |
| 355 | |
| 356 | 0, /* alpha_level */ |
| 357 | 118, /* thlock */ |
| 358 | |
| 359 | 0, /* wbd_inv */ |
| 360 | 2867, /* wbd_ref */ |
| 361 | 0, /* wbd_sel */ |
| 362 | 2, /* wbd_alpha */ |
| 363 | |
| 364 | 0, /* agc1_max */ |
| 365 | 0, /* agc1_min */ |
| 366 | 39718, /* agc2_max */ |
| 367 | 9930, /* agc2_min */ |
| 368 | 0, /* agc1_pt1 */ |
| 369 | 0, /* agc1_pt2 */ |
| 370 | 0, /* agc1_pt3 */ |
| 371 | 0, /* agc1_slope1 */ |
| 372 | 0, /* agc1_slope2 */ |
| 373 | 0, /* agc2_pt1 */ |
| 374 | 128, /* agc2_pt2 */ |
| 375 | 29, /* agc2_slope1 */ |
| 376 | 29, /* agc2_slope2 */ |
| 377 | |
| 378 | 17, /* alpha_mant */ |
| 379 | 27, /* alpha_exp */ |
| 380 | 23, /* beta_mant */ |
| 381 | 51, /* beta_exp */ |
| 382 | |
| 383 | 1, /* perform_agc_softsplit */ |
| 384 | }; |
| 385 | |
| 386 | /* 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] | 387 | static struct dibx000_bandwidth_config xc3028_bw_config = { |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 388 | 60000, 30000, /* internal, sampling */ |
| 389 | 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ |
| 390 | 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, |
| 391 | modulo */ |
| 392 | (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ |
| 393 | (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ |
| 394 | 20452225, /* timf */ |
| 395 | 30000000, /* xtal_hz */ |
| 396 | }; |
| 397 | |
| 398 | static struct dib7000p_config stk7700ph_dib7700_xc3028_config = { |
| 399 | .output_mpeg2_in_188_bytes = 1, |
| 400 | .tuner_is_baseband = 1, |
| 401 | |
| 402 | .agc_config_count = 1, |
| 403 | .agc = &xc3028_agc_config, |
| 404 | .bw = &xc3028_bw_config, |
| 405 | |
| 406 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 407 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 408 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 409 | }; |
| 410 | |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 411 | static int stk7700ph_xc3028_callback(void *ptr, int component, |
| 412 | int command, int arg) |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 413 | { |
| 414 | struct dvb_usb_adapter *adap = ptr; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 415 | struct dib0700_adapter_state *state = adap->priv; |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 416 | |
| 417 | switch (command) { |
| 418 | case XC2028_TUNER_RESET: |
| 419 | /* Send the tuner in then out of reset */ |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 420 | state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0); |
| 421 | msleep(10); |
| 422 | state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 423 | break; |
| 424 | case XC2028_RESET_CLK: |
| 425 | break; |
| 426 | default: |
| 427 | err("%s: unknown command %d, arg %d\n", __func__, |
| 428 | command, arg); |
| 429 | return -EINVAL; |
| 430 | } |
| 431 | return 0; |
| 432 | } |
| 433 | |
| 434 | static struct xc2028_ctrl stk7700ph_xc3028_ctrl = { |
| 435 | .fname = XC2028_DEFAULT_FIRMWARE, |
| 436 | .max_len = 64, |
| 437 | .demod = XC3028_FE_DIBCOM52, |
| 438 | }; |
| 439 | |
| 440 | static struct xc2028_config stk7700ph_xc3028_config = { |
| 441 | .i2c_addr = 0x61, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 442 | .ctrl = &stk7700ph_xc3028_ctrl, |
| 443 | }; |
| 444 | |
| 445 | static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) |
| 446 | { |
| 447 | struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 448 | struct dib0700_adapter_state *state = adap->priv; |
| 449 | |
| 450 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 451 | return -ENODEV; |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 452 | |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 453 | if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) && |
| 454 | desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX)) |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 455 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 456 | else |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 457 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 458 | msleep(20); |
| 459 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 460 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 461 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 462 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 463 | msleep(10); |
| 464 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 465 | msleep(20); |
| 466 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 467 | msleep(10); |
| 468 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 469 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 470 | &stk7700ph_dib7700_xc3028_config) != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 471 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 472 | __func__); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 473 | dvb_detach(&state->dib7000p_ops); |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 474 | return -ENODEV; |
| 475 | } |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 476 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 477 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 478 | &stk7700ph_dib7700_xc3028_config); |
| 479 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 480 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) |
| 484 | { |
| 485 | struct i2c_adapter *tun_i2c; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 486 | struct dib0700_adapter_state *state = adap->priv; |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 487 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 488 | tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 489 | DIBX000_I2C_INTERFACE_TUNER, 1); |
| 490 | |
| 491 | stk7700ph_xc3028_config.i2c_adap = tun_i2c; |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame] | 492 | |
| 493 | /* FIXME: generalize & move to common area */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 494 | adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback; |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 495 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 496 | return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config) |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 497 | == NULL ? -ENODEV : 0; |
| 498 | } |
| 499 | |
Devin Heitmueller | 4b330be | 2008-12-01 06:51:14 -0300 | [diff] [blame] | 500 | #define DEFAULT_RC_INTERVAL 50 |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 501 | |
| 502 | static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; |
| 503 | |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 504 | /* Number of keypresses to ignore before start repeating */ |
Devin Heitmueller | 4b330be | 2008-12-01 06:51:14 -0300 | [diff] [blame] | 505 | #define RC_REPEAT_DELAY 6 |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 506 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 507 | /* |
| 508 | * This function is used only when firmware is < 1.20 version. Newer |
| 509 | * firmwares use bulk mode, with functions implemented at dib0700_core, |
| 510 | * at dib0700_rc_urb_completion() |
| 511 | */ |
| 512 | static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 513 | { |
| 514 | u8 key[4]; |
David Härdeman | 120703f | 2014-04-03 20:31:30 -0300 | [diff] [blame^] | 515 | enum rc_type protocol; |
| 516 | u32 scancode; |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 517 | u8 toggle; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 518 | int i; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 519 | struct dib0700_state *st = d->priv; |
Devin Heitmueller | 6a20710 | 2010-01-04 02:43:19 -0300 | [diff] [blame] | 520 | |
Devin Heitmueller | 6a20710 | 2010-01-04 02:43:19 -0300 | [diff] [blame] | 521 | if (st->fw_version >= 0x10200) { |
| 522 | /* For 1.20 firmware , We need to keep the RC polling |
| 523 | callback so we can reuse the input device setup in |
| 524 | dvb-usb-remote.c. However, the actual work is being done |
| 525 | in the bulk URB completion handler. */ |
| 526 | return 0; |
| 527 | } |
| 528 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 529 | i = dib0700_ctrl_rd(d, rc_request, 2, key, 4); |
| 530 | if (i <= 0) { |
Janne Grunau | 034d65e | 2007-07-31 08:48:40 -0300 | [diff] [blame] | 531 | err("RC Query Failed"); |
Janne Grunau | 89f4267 | 2007-07-31 19:45:13 -0300 | [diff] [blame] | 532 | return -1; |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 533 | } |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 534 | |
| 535 | /* losing half of KEY_0 events from Philipps rc5 remotes.. */ |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 536 | if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0) |
| 537 | return 0; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 538 | |
| 539 | /* 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]); */ |
| 540 | |
Mauro Carvalho Chehab | c4018fa | 2014-05-21 17:40:25 -0300 | [diff] [blame] | 541 | dib0700_rc_setup(d, NULL); /* reset ir sensor data to prevent false events */ |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 542 | |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 543 | switch (d->props.rc.core.protocol) { |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 544 | case RC_BIT_NEC: |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 545 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
| 546 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && |
David Härdeman | 120703f | 2014-04-03 20:31:30 -0300 | [diff] [blame^] | 547 | (key[3] == 0xff)) { |
| 548 | rc_repeat(d->rc_dev); |
| 549 | return 0; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 550 | } |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 551 | |
David Härdeman | 120703f | 2014-04-03 20:31:30 -0300 | [diff] [blame^] | 552 | protocol = RC_TYPE_NEC; |
| 553 | scancode = RC_SCANCODE_NEC(key[3-2], key[3-3]); |
| 554 | toggle = 0; |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 555 | break; |
David Härdeman | 120703f | 2014-04-03 20:31:30 -0300 | [diff] [blame^] | 556 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 557 | default: |
| 558 | /* RC-5 protocol changes toggle bit on new keypress */ |
David Härdeman | 120703f | 2014-04-03 20:31:30 -0300 | [diff] [blame^] | 559 | protocol = RC_TYPE_RC5; |
| 560 | scancode = RC_SCANCODE_RC5(key[3-2], key[3-3]); |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 561 | toggle = key[3-1]; |
Patrick Boettcher | 58e6f95 | 2008-03-29 21:37:01 -0300 | [diff] [blame] | 562 | break; |
| 563 | } |
David Härdeman | 120703f | 2014-04-03 20:31:30 -0300 | [diff] [blame^] | 564 | |
| 565 | rc_keydown(d->rc_dev, protocol, scancode, toggle); |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 566 | return 0; |
| 567 | } |
| 568 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 569 | /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 570 | static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = { |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 571 | BAND_UHF | BAND_VHF, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 572 | |
| 573 | /* 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, |
| 574 | * 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 */ |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 575 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
| 576 | | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 577 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 578 | 712, |
| 579 | 41, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 580 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 581 | 0, |
| 582 | 118, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 583 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 584 | 0, |
| 585 | 4095, |
| 586 | 0, |
| 587 | 0, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 588 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 589 | 42598, |
| 590 | 17694, |
| 591 | 45875, |
| 592 | 2621, |
| 593 | 0, |
| 594 | 76, |
| 595 | 139, |
| 596 | 52, |
| 597 | 59, |
| 598 | 107, |
| 599 | 172, |
| 600 | 57, |
| 601 | 70, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 602 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 603 | 21, |
| 604 | 25, |
| 605 | 28, |
| 606 | 48, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 607 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 608 | 1, |
| 609 | { 0, |
| 610 | 107, |
| 611 | 51800, |
| 612 | 24700 |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 613 | }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 614 | }; |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 615 | |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 616 | static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = { |
| 617 | BAND_UHF | BAND_VHF, |
| 618 | |
| 619 | /* 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, |
| 620 | * 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 */ |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 621 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
| 622 | | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 623 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 624 | 712, |
| 625 | 41, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 626 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 627 | 0, |
| 628 | 118, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 629 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 630 | 0, |
| 631 | 4095, |
| 632 | 0, |
| 633 | 0, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 634 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 635 | 42598, |
| 636 | 16384, |
| 637 | 42598, |
| 638 | 0, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 639 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 640 | 0, |
| 641 | 137, |
| 642 | 255, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 643 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 644 | 0, |
| 645 | 255, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 646 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 647 | 0, |
| 648 | 0, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 649 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 650 | 0, |
| 651 | 41, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 652 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 653 | 15, |
| 654 | 25, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 655 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 656 | 28, |
| 657 | 48, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 658 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 659 | 0, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 660 | }; |
| 661 | |
| 662 | static struct dibx000_bandwidth_config stk7700p_pll_config = { |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 663 | 60000, 30000, |
| 664 | 1, 8, 3, 1, 0, |
| 665 | 0, 0, 1, 1, 0, |
| 666 | (3 << 14) | (1 << 12) | (524 << 0), |
| 667 | 60258167, |
| 668 | 20452225, |
| 669 | 30000000, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 670 | }; |
| 671 | |
| 672 | static struct dib7000m_config stk7700p_dib7000m_config = { |
| 673 | .dvbt_mode = 1, |
| 674 | .output_mpeg2_in_188_bytes = 1, |
| 675 | .quartz_direct = 1, |
| 676 | |
| 677 | .agc_config_count = 1, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 678 | .agc = &stk7700p_7000m_mt2060_agc_config, |
| 679 | .bw = &stk7700p_pll_config, |
| 680 | |
| 681 | .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, |
| 682 | .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, |
| 683 | .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, |
| 684 | }; |
| 685 | |
| 686 | static struct dib7000p_config stk7700p_dib7000p_config = { |
| 687 | .output_mpeg2_in_188_bytes = 1, |
| 688 | |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 689 | .agc_config_count = 1, |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 690 | .agc = &stk7700p_7000p_mt2060_agc_config, |
| 691 | .bw = &stk7700p_pll_config, |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 692 | |
| 693 | .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, |
| 694 | .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, |
| 695 | .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, |
| 696 | }; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 697 | |
| 698 | static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap) |
| 699 | { |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 700 | struct dib0700_state *st = adap->dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 701 | struct dib0700_adapter_state *state = adap->priv; |
| 702 | |
| 703 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 704 | return -ENODEV; |
| 705 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 706 | /* 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] | 707 | |
| 708 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 709 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50); |
| 710 | |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 711 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 712 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 713 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 714 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 715 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 716 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100); |
| 717 | |
| 718 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 719 | |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 720 | st->mt2060_if1[0] = 1220; |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 721 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 722 | if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap)) { |
| 723 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 724 | st->is_dib7000pc = 1; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 725 | } else { |
| 726 | dvb_detach(&state->dib7000p_ops); |
| 727 | memset(&state->dib7000p_ops, 0, sizeof(state->dib7000p_ops)); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 728 | adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 729 | } |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 730 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 731 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 732 | } |
| 733 | |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 734 | static struct mt2060_config stk7700p_mt2060_config = { |
| 735 | 0x60 |
| 736 | }; |
| 737 | |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 738 | static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap) |
| 739 | { |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 740 | struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; |
Patrick Boettcher | 69ea31e | 2006-10-17 18:28:14 -0300 | [diff] [blame] | 741 | struct dib0700_state *st = adap->dev->priv; |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 742 | struct i2c_adapter *tun_i2c; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 743 | struct dib0700_adapter_state *state = adap->priv; |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 744 | s8 a; |
| 745 | int if1=1220; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 746 | |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 747 | if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) && |
| 748 | 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] | 749 | if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a; |
| 750 | } |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 751 | if (st->is_dib7000pc) |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 752 | tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 753 | else |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 754 | tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
Patrick Boettcher | a75763f | 2006-10-18 08:34:16 -0300 | [diff] [blame] | 755 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 756 | return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config, |
Olivier DANET | c52344f | 2008-01-25 06:50:07 -0300 | [diff] [blame] | 757 | if1) == NULL ? -ENODEV : 0; |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 758 | } |
| 759 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 760 | /* DIB7070 generic */ |
| 761 | static struct dibx000_agc_config dib7070_agc_config = { |
| 762 | BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, |
| 763 | /* 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, |
| 764 | * 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 */ |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 765 | (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
| 766 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 767 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 768 | 600, |
| 769 | 10, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 770 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 771 | 0, |
| 772 | 118, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 773 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 774 | 0, |
| 775 | 3530, |
| 776 | 1, |
| 777 | 5, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 778 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 779 | 65535, |
| 780 | 0, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 781 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 782 | 65535, |
| 783 | 0, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 784 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 785 | 0, |
| 786 | 40, |
| 787 | 183, |
| 788 | 206, |
| 789 | 255, |
| 790 | 72, |
| 791 | 152, |
| 792 | 88, |
| 793 | 90, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 794 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 795 | 17, |
| 796 | 27, |
| 797 | 23, |
| 798 | 51, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 799 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 800 | 0, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 801 | }; |
| 802 | |
| 803 | static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff) |
| 804 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 805 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 806 | struct dib0700_adapter_state *state = adap->priv; |
| 807 | |
Patrick Boettcher | 7e5ce65 | 2009-08-03 13:43:40 -0300 | [diff] [blame] | 808 | deb_info("reset: %d", onoff); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 809 | return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff) |
| 813 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 814 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 815 | struct dib0700_adapter_state *state = adap->priv; |
| 816 | |
Patrick Boettcher | 7e5ce65 | 2009-08-03 13:43:40 -0300 | [diff] [blame] | 817 | deb_info("sleep: %d", onoff); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 818 | return state->dib7000p_ops.set_gpio(fe, 9, 0, onoff); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | static struct dib0070_config dib7070p_dib0070_config[2] = { |
| 822 | { |
| 823 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 824 | .reset = dib7070_tuner_reset, |
| 825 | .sleep = dib7070_tuner_sleep, |
| 826 | .clock_khz = 12000, |
Patrick Boettcher | 7e5ce65 | 2009-08-03 13:43:40 -0300 | [diff] [blame] | 827 | .clock_pad_drive = 4, |
| 828 | .charge_pump = 2, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 829 | }, { |
| 830 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 831 | .reset = dib7070_tuner_reset, |
| 832 | .sleep = dib7070_tuner_sleep, |
| 833 | .clock_khz = 12000, |
Patrick Boettcher | 7e5ce65 | 2009-08-03 13:43:40 -0300 | [diff] [blame] | 834 | .charge_pump = 2, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 835 | } |
| 836 | }; |
| 837 | |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 838 | static struct dib0070_config dib7770p_dib0070_config = { |
| 839 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
| 840 | .reset = dib7070_tuner_reset, |
| 841 | .sleep = dib7070_tuner_sleep, |
| 842 | .clock_khz = 12000, |
| 843 | .clock_pad_drive = 0, |
| 844 | .flip_chip = 1, |
Olivier Grenie | eac1fe1 | 2009-09-23 13:41:27 -0300 | [diff] [blame] | 845 | .charge_pump = 2, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 846 | }; |
| 847 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 848 | static int dib7070_set_param_override(struct dvb_frontend *fe) |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 849 | { |
Mauro Carvalho Chehab | 47b163a | 2011-12-24 10:18:24 -0300 | [diff] [blame] | 850 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 851 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 852 | struct dib0700_adapter_state *state = adap->priv; |
| 853 | |
| 854 | u16 offset; |
Mauro Carvalho Chehab | 47b163a | 2011-12-24 10:18:24 -0300 | [diff] [blame] | 855 | u8 band = BAND_OF_FREQUENCY(p->frequency/1000); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 856 | switch (band) { |
| 857 | case BAND_VHF: offset = 950; break; |
| 858 | case BAND_UHF: |
| 859 | default: offset = 550; break; |
| 860 | } |
| 861 | deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe)); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 862 | state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 863 | return state->set_param_save(fe); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 864 | } |
| 865 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 866 | static int dib7770_set_param_override(struct dvb_frontend *fe) |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 867 | { |
Mauro Carvalho Chehab | 47b163a | 2011-12-24 10:18:24 -0300 | [diff] [blame] | 868 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; |
| 869 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 870 | struct dib0700_adapter_state *state = adap->priv; |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 871 | |
| 872 | u16 offset; |
Mauro Carvalho Chehab | 47b163a | 2011-12-24 10:18:24 -0300 | [diff] [blame] | 873 | u8 band = BAND_OF_FREQUENCY(p->frequency/1000); |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 874 | switch (band) { |
| 875 | case BAND_VHF: |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 876 | state->dib7000p_ops.set_gpio(fe, 0, 0, 1); |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 877 | offset = 850; |
| 878 | break; |
| 879 | case BAND_UHF: |
| 880 | default: |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 881 | state->dib7000p_ops.set_gpio(fe, 0, 0, 0); |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 882 | offset = 250; |
| 883 | break; |
| 884 | } |
| 885 | deb_info("WBD for DiB7000P: %d\n", offset + dib0070_wbd_offset(fe)); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 886 | state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe)); |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 887 | return state->set_param_save(fe); |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap) |
| 891 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 892 | struct dib0700_adapter_state *st = adap->priv; |
| 893 | struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 894 | DIBX000_I2C_INTERFACE_TUNER, 1); |
| 895 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 896 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, |
| 897 | &dib7770p_dib0070_config) == NULL) |
| 898 | return -ENODEV; |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 899 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 900 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 901 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override; |
| 902 | return 0; |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 903 | } |
| 904 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 905 | static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) |
| 906 | { |
| 907 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 908 | struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 909 | |
| 910 | if (adap->id == 0) { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 911 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL) |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 912 | return -ENODEV; |
| 913 | } else { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 914 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL) |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 915 | return -ENODEV; |
| 916 | } |
| 917 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 918 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 919 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override; |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 920 | return 0; |
| 921 | } |
| 922 | |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 923 | static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index, |
| 924 | u16 pid, int onoff) |
| 925 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 926 | struct dib0700_adapter_state *state = adapter->priv; |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 927 | struct dib0700_state *st = adapter->dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 928 | |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 929 | if (st->is_dib7000pc) |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 930 | return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 931 | return dib7000m_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 932 | } |
| 933 | |
| 934 | static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) |
| 935 | { |
| 936 | struct dib0700_state *st = adapter->dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 937 | struct dib0700_adapter_state *state = adapter->priv; |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 938 | if (st->is_dib7000pc) |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 939 | return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 940 | return dib7000m_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 941 | } |
| 942 | |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 943 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) |
| 944 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 945 | struct dib0700_adapter_state *state = adapter->priv; |
| 946 | return state->dib7000p_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 947 | } |
| 948 | |
| 949 | static int stk70x0p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) |
| 950 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 951 | struct dib0700_adapter_state *state = adapter->priv; |
| 952 | return state->dib7000p_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 953 | } |
| 954 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 955 | static struct dibx000_bandwidth_config dib7070_bw_config_12_mhz = { |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 956 | 60000, 15000, |
| 957 | 1, 20, 3, 1, 0, |
| 958 | 0, 0, 1, 1, 2, |
| 959 | (3 << 14) | (1 << 12) | (524 << 0), |
| 960 | (0 << 25) | 0, |
| 961 | 20452225, |
| 962 | 12000000, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 963 | }; |
| 964 | |
| 965 | static struct dib7000p_config dib7070p_dib7000p_config = { |
| 966 | .output_mpeg2_in_188_bytes = 1, |
| 967 | |
| 968 | .agc_config_count = 1, |
| 969 | .agc = &dib7070_agc_config, |
| 970 | .bw = &dib7070_bw_config_12_mhz, |
Patrick Boettcher | 3cb2c39 | 2008-01-25 07:25:20 -0300 | [diff] [blame] | 971 | .tuner_is_baseband = 1, |
| 972 | .spur_protect = 1, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 973 | |
| 974 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 975 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 976 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 977 | |
| 978 | .hostbus_diversity = 1, |
| 979 | }; |
| 980 | |
| 981 | /* STK7070P */ |
| 982 | static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) |
| 983 | { |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 984 | struct usb_device_descriptor *p = &adap->dev->udev->descriptor; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 985 | struct dib0700_adapter_state *state = adap->priv; |
| 986 | |
| 987 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 988 | return -ENODEV; |
| 989 | |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 990 | if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) && |
| 991 | p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) |
| 992 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 993 | else |
Al Viro | da5ee48 | 2008-05-21 00:31:21 -0300 | [diff] [blame] | 994 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 995 | msleep(10); |
| 996 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 997 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 998 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 999 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1000 | |
| 1001 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1002 | |
| 1003 | msleep(10); |
| 1004 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1005 | msleep(10); |
| 1006 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1007 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1008 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 1009 | &dib7070p_dib7000p_config) != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1010 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 1011 | __func__); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1012 | dvb_detach(&state->dib7000p_ops); |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 1013 | return -ENODEV; |
| 1014 | } |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1015 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1016 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 1017 | &dib7070p_dib7000p_config); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1018 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 1019 | } |
| 1020 | |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1021 | /* STK7770P */ |
| 1022 | static struct dib7000p_config dib7770p_dib7000p_config = { |
| 1023 | .output_mpeg2_in_188_bytes = 1, |
| 1024 | |
| 1025 | .agc_config_count = 1, |
| 1026 | .agc = &dib7070_agc_config, |
| 1027 | .bw = &dib7070_bw_config_12_mhz, |
| 1028 | .tuner_is_baseband = 1, |
| 1029 | .spur_protect = 1, |
| 1030 | |
| 1031 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 1032 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 1033 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 1034 | |
| 1035 | .hostbus_diversity = 1, |
| 1036 | .enable_current_mirror = 1, |
Olivier Grenie | 970d14c | 2010-09-07 12:50:46 -0300 | [diff] [blame] | 1037 | .disable_sample_and_hold = 0, |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1038 | }; |
| 1039 | |
| 1040 | static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap) |
| 1041 | { |
| 1042 | struct usb_device_descriptor *p = &adap->dev->udev->descriptor; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1043 | struct dib0700_adapter_state *state = adap->priv; |
| 1044 | |
| 1045 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 1046 | return -ENODEV; |
| 1047 | |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1048 | if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) && |
| 1049 | p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) |
| 1050 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
| 1051 | else |
| 1052 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1053 | msleep(10); |
| 1054 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1055 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1056 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1057 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1058 | |
| 1059 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1060 | |
| 1061 | msleep(10); |
| 1062 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1063 | msleep(10); |
| 1064 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1065 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1066 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1067 | &dib7770p_dib7000p_config) != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1068 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1069 | __func__); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1070 | dvb_detach(&state->dib7000p_ops); |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1071 | return -ENODEV; |
| 1072 | } |
| 1073 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 1074 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1075 | &dib7770p_dib7000p_config); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1076 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 1077 | } |
| 1078 | |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1079 | /* DIB807x generic */ |
| 1080 | static struct dibx000_agc_config dib807x_agc_config[2] = { |
| 1081 | { |
| 1082 | BAND_VHF, |
| 1083 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, |
| 1084 | * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, |
| 1085 | * P_agc_inv_pwm2=0,P_agc_inh_dc_rv_est=0, |
| 1086 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, |
| 1087 | * P_agc_write=0 */ |
| 1088 | (0 << 15) | (0 << 14) | (7 << 11) | (0 << 10) | (0 << 9) | |
| 1089 | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | |
| 1090 | (0 << 0), /* setup*/ |
| 1091 | |
| 1092 | 600, /* inv_gain*/ |
| 1093 | 10, /* time_stabiliz*/ |
| 1094 | |
| 1095 | 0, /* alpha_level*/ |
| 1096 | 118, /* thlock*/ |
| 1097 | |
| 1098 | 0, /* wbd_inv*/ |
| 1099 | 3530, /* wbd_ref*/ |
| 1100 | 1, /* wbd_sel*/ |
| 1101 | 5, /* wbd_alpha*/ |
| 1102 | |
| 1103 | 65535, /* agc1_max*/ |
| 1104 | 0, /* agc1_min*/ |
| 1105 | |
| 1106 | 65535, /* agc2_max*/ |
| 1107 | 0, /* agc2_min*/ |
| 1108 | |
| 1109 | 0, /* agc1_pt1*/ |
| 1110 | 40, /* agc1_pt2*/ |
| 1111 | 183, /* agc1_pt3*/ |
| 1112 | 206, /* agc1_slope1*/ |
| 1113 | 255, /* agc1_slope2*/ |
| 1114 | 72, /* agc2_pt1*/ |
| 1115 | 152, /* agc2_pt2*/ |
| 1116 | 88, /* agc2_slope1*/ |
| 1117 | 90, /* agc2_slope2*/ |
| 1118 | |
| 1119 | 17, /* alpha_mant*/ |
| 1120 | 27, /* alpha_exp*/ |
| 1121 | 23, /* beta_mant*/ |
| 1122 | 51, /* beta_exp*/ |
| 1123 | |
| 1124 | 0, /* perform_agc_softsplit*/ |
| 1125 | }, { |
| 1126 | BAND_UHF, |
| 1127 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, |
| 1128 | * P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, |
| 1129 | * P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 1130 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, |
| 1131 | * P_agc_write=0 */ |
| 1132 | (0 << 15) | (0 << 14) | (1 << 11) | (0 << 10) | (0 << 9) | |
| 1133 | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | |
| 1134 | (0 << 0), /* setup */ |
| 1135 | |
| 1136 | 600, /* inv_gain*/ |
| 1137 | 10, /* time_stabiliz*/ |
| 1138 | |
| 1139 | 0, /* alpha_level*/ |
| 1140 | 118, /* thlock*/ |
| 1141 | |
| 1142 | 0, /* wbd_inv*/ |
| 1143 | 3530, /* wbd_ref*/ |
| 1144 | 1, /* wbd_sel*/ |
| 1145 | 5, /* wbd_alpha*/ |
| 1146 | |
| 1147 | 65535, /* agc1_max*/ |
| 1148 | 0, /* agc1_min*/ |
| 1149 | |
| 1150 | 65535, /* agc2_max*/ |
| 1151 | 0, /* agc2_min*/ |
| 1152 | |
| 1153 | 0, /* agc1_pt1*/ |
| 1154 | 40, /* agc1_pt2*/ |
| 1155 | 183, /* agc1_pt3*/ |
| 1156 | 206, /* agc1_slope1*/ |
| 1157 | 255, /* agc1_slope2*/ |
| 1158 | 72, /* agc2_pt1*/ |
| 1159 | 152, /* agc2_pt2*/ |
| 1160 | 88, /* agc2_slope1*/ |
| 1161 | 90, /* agc2_slope2*/ |
| 1162 | |
| 1163 | 17, /* alpha_mant*/ |
| 1164 | 27, /* alpha_exp*/ |
| 1165 | 23, /* beta_mant*/ |
| 1166 | 51, /* beta_exp*/ |
| 1167 | |
| 1168 | 0, /* perform_agc_softsplit*/ |
| 1169 | } |
| 1170 | }; |
| 1171 | |
| 1172 | static struct dibx000_bandwidth_config dib807x_bw_config_12_mhz = { |
| 1173 | 60000, 15000, /* internal, sampling*/ |
| 1174 | 1, 20, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass*/ |
| 1175 | 0, 0, 1, 1, 2, /* misc: refdiv, bypclk_div, IO_CLK_en_core, |
| 1176 | ADClkSrc, modulo */ |
| 1177 | (3 << 14) | (1 << 12) | (599 << 0), /* sad_cfg: refsel, sel, freq_15k*/ |
| 1178 | (0 << 25) | 0, /* ifreq = 0.000000 MHz*/ |
| 1179 | 18179755, /* timf*/ |
| 1180 | 12000000, /* xtal_hz*/ |
| 1181 | }; |
| 1182 | |
| 1183 | static struct dib8000_config dib807x_dib8000_config[2] = { |
| 1184 | { |
| 1185 | .output_mpeg2_in_188_bytes = 1, |
| 1186 | |
| 1187 | .agc_config_count = 2, |
| 1188 | .agc = dib807x_agc_config, |
| 1189 | .pll = &dib807x_bw_config_12_mhz, |
| 1190 | .tuner_is_baseband = 1, |
| 1191 | |
| 1192 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, |
| 1193 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, |
| 1194 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, |
| 1195 | |
| 1196 | .hostbus_diversity = 1, |
| 1197 | .div_cfg = 1, |
| 1198 | .agc_control = &dib0070_ctrl_agc_filter, |
| 1199 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 1200 | .drives = 0x2d98, |
| 1201 | }, { |
| 1202 | .output_mpeg2_in_188_bytes = 1, |
| 1203 | |
| 1204 | .agc_config_count = 2, |
| 1205 | .agc = dib807x_agc_config, |
| 1206 | .pll = &dib807x_bw_config_12_mhz, |
| 1207 | .tuner_is_baseband = 1, |
| 1208 | |
| 1209 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, |
| 1210 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, |
| 1211 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, |
| 1212 | |
| 1213 | .hostbus_diversity = 1, |
| 1214 | .agc_control = &dib0070_ctrl_agc_filter, |
| 1215 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 1216 | .drives = 0x2d98, |
| 1217 | } |
| 1218 | }; |
| 1219 | |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1220 | static int dib80xx_tuner_reset(struct dvb_frontend *fe, int onoff) |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1221 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1222 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 1223 | struct dib0700_adapter_state *state = adap->priv; |
| 1224 | |
| 1225 | return state->dib8000_ops.set_gpio(fe, 5, 0, !onoff); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1226 | } |
| 1227 | |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1228 | static int dib80xx_tuner_sleep(struct dvb_frontend *fe, int onoff) |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1229 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1230 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 1231 | struct dib0700_adapter_state *state = adap->priv; |
| 1232 | |
| 1233 | return state->dib8000_ops.set_gpio(fe, 0, 0, onoff); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1234 | } |
| 1235 | |
| 1236 | static const struct dib0070_wbd_gain_cfg dib8070_wbd_gain_cfg[] = { |
| 1237 | { 240, 7}, |
| 1238 | { 0xffff, 6}, |
| 1239 | }; |
| 1240 | |
| 1241 | static struct dib0070_config dib807x_dib0070_config[2] = { |
| 1242 | { |
| 1243 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1244 | .reset = dib80xx_tuner_reset, |
| 1245 | .sleep = dib80xx_tuner_sleep, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1246 | .clock_khz = 12000, |
| 1247 | .clock_pad_drive = 4, |
| 1248 | .vga_filter = 1, |
| 1249 | .force_crystal_mode = 1, |
| 1250 | .enable_third_order_filter = 1, |
| 1251 | .charge_pump = 0, |
| 1252 | .wbd_gain = dib8070_wbd_gain_cfg, |
| 1253 | .osc_buffer_state = 0, |
| 1254 | .freq_offset_khz_uhf = -100, |
| 1255 | .freq_offset_khz_vhf = -100, |
| 1256 | }, { |
| 1257 | .i2c_address = DEFAULT_DIB0070_I2C_ADDRESS, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1258 | .reset = dib80xx_tuner_reset, |
| 1259 | .sleep = dib80xx_tuner_sleep, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1260 | .clock_khz = 12000, |
| 1261 | .clock_pad_drive = 2, |
| 1262 | .vga_filter = 1, |
| 1263 | .force_crystal_mode = 1, |
| 1264 | .enable_third_order_filter = 1, |
| 1265 | .charge_pump = 0, |
| 1266 | .wbd_gain = dib8070_wbd_gain_cfg, |
| 1267 | .osc_buffer_state = 0, |
| 1268 | .freq_offset_khz_uhf = -25, |
| 1269 | .freq_offset_khz_vhf = -25, |
| 1270 | } |
| 1271 | }; |
| 1272 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 1273 | static int dib807x_set_param_override(struct dvb_frontend *fe) |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1274 | { |
Mauro Carvalho Chehab | 47b163a | 2011-12-24 10:18:24 -0300 | [diff] [blame] | 1275 | struct dtv_frontend_properties *p = &fe->dtv_property_cache; |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1276 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 1277 | struct dib0700_adapter_state *state = adap->priv; |
| 1278 | |
| 1279 | u16 offset = dib0070_wbd_offset(fe); |
Mauro Carvalho Chehab | 47b163a | 2011-12-24 10:18:24 -0300 | [diff] [blame] | 1280 | u8 band = BAND_OF_FREQUENCY(p->frequency/1000); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1281 | switch (band) { |
| 1282 | case BAND_VHF: |
| 1283 | offset += 750; |
| 1284 | break; |
| 1285 | case BAND_UHF: /* fall-thru wanted */ |
| 1286 | default: |
| 1287 | offset += 250; break; |
| 1288 | } |
| 1289 | deb_info("WBD for DiB8000: %d\n", offset); |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1290 | state->dib8000_ops.set_wbd_ref(fe, offset); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1291 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 1292 | return state->set_param_save(fe); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1293 | } |
| 1294 | |
| 1295 | static int dib807x_tuner_attach(struct dvb_usb_adapter *adap) |
| 1296 | { |
| 1297 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1298 | struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1299 | DIBX000_I2C_INTERFACE_TUNER, 1); |
| 1300 | |
| 1301 | if (adap->id == 0) { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1302 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1303 | &dib807x_dib0070_config[0]) == NULL) |
| 1304 | return -ENODEV; |
| 1305 | } else { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1306 | if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1307 | &dib807x_dib0070_config[1]) == NULL) |
| 1308 | return -ENODEV; |
| 1309 | } |
| 1310 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1311 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 1312 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override; |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1313 | return 0; |
| 1314 | } |
| 1315 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 1316 | static int stk80xx_pid_filter(struct dvb_usb_adapter *adapter, int index, |
| 1317 | u16 pid, int onoff) |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 1318 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1319 | struct dib0700_adapter_state *state = adapter->priv; |
| 1320 | |
| 1321 | return state->dib8000_ops.pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 1322 | } |
| 1323 | |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 1324 | static int stk80xx_pid_filter_ctrl(struct dvb_usb_adapter *adapter, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1325 | int onoff) |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 1326 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1327 | struct dib0700_adapter_state *state = adapter->priv; |
| 1328 | |
| 1329 | return state->dib8000_ops.pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 1330 | } |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1331 | |
| 1332 | /* STK807x */ |
| 1333 | static int stk807x_frontend_attach(struct dvb_usb_adapter *adap) |
| 1334 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1335 | struct dib0700_adapter_state *state = adap->priv; |
| 1336 | |
| 1337 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 1338 | return -ENODEV; |
| 1339 | |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1340 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1341 | msleep(10); |
| 1342 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1343 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1344 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1345 | |
| 1346 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1347 | |
| 1348 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1349 | |
| 1350 | msleep(10); |
| 1351 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1352 | msleep(10); |
| 1353 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1354 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1355 | state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
Olivier Grenie | 0c32dbd | 2011-08-10 05:17:18 -0300 | [diff] [blame] | 1356 | 0x80, 0); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1357 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1358 | adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1359 | &dib807x_dib8000_config[0]); |
| 1360 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1361 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1362 | } |
| 1363 | |
| 1364 | /* STK807xPVR */ |
| 1365 | static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap) |
| 1366 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1367 | struct dib0700_adapter_state *state = adap->priv; |
| 1368 | |
| 1369 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 1370 | return -ENODEV; |
| 1371 | |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1372 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
| 1373 | msleep(30); |
| 1374 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1375 | msleep(500); |
| 1376 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1377 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1378 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1379 | |
| 1380 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1381 | |
| 1382 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1383 | |
| 1384 | msleep(10); |
| 1385 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1386 | msleep(10); |
| 1387 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1388 | |
| 1389 | /* initialize IC 0 */ |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1390 | state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0); |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1391 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1392 | adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1393 | &dib807x_dib8000_config[0]); |
| 1394 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1395 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1396 | } |
| 1397 | |
| 1398 | static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap) |
| 1399 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1400 | struct dib0700_adapter_state *state = adap->priv; |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1401 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1402 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 1403 | return -ENODEV; |
| 1404 | |
| 1405 | /* initialize IC 1 */ |
| 1406 | state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0); |
| 1407 | |
| 1408 | adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1409 | &dib807x_dib8000_config[1]); |
| 1410 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1411 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1412 | } |
| 1413 | |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1414 | /* STK8096GP */ |
Olivier Grenie | a685dbb | 2011-08-05 14:10:40 -0300 | [diff] [blame] | 1415 | static struct dibx000_agc_config dib8090_agc_config[2] = { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1416 | { |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1417 | .band_caps = BAND_UHF | BAND_VHF | BAND_LBAND | BAND_SBAND, |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 1418 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1419 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 1420 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1421 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 1422 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1423 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1424 | .inv_gain = 787, |
| 1425 | .time_stabiliz = 10, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1426 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1427 | .alpha_level = 0, |
| 1428 | .thlock = 118, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1429 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1430 | .wbd_inv = 0, |
| 1431 | .wbd_ref = 3530, |
| 1432 | .wbd_sel = 1, |
| 1433 | .wbd_alpha = 5, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1434 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1435 | .agc1_max = 65535, |
| 1436 | .agc1_min = 0, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1437 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1438 | .agc2_max = 65535, |
| 1439 | .agc2_min = 0, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1440 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1441 | .agc1_pt1 = 0, |
| 1442 | .agc1_pt2 = 32, |
| 1443 | .agc1_pt3 = 114, |
| 1444 | .agc1_slope1 = 143, |
| 1445 | .agc1_slope2 = 144, |
| 1446 | .agc2_pt1 = 114, |
| 1447 | .agc2_pt2 = 227, |
| 1448 | .agc2_slope1 = 116, |
| 1449 | .agc2_slope2 = 117, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1450 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1451 | .alpha_mant = 28, |
| 1452 | .alpha_exp = 26, |
| 1453 | .beta_mant = 31, |
| 1454 | .beta_exp = 51, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1455 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1456 | .perform_agc_softsplit = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1457 | }, |
| 1458 | { |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1459 | .band_caps = BAND_CBAND, |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 1460 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1461 | * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 1462 | * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, P_agc_write=0 */ |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1463 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
Olivier Grenie | 9c78303 | 2009-12-07 07:49:40 -0300 | [diff] [blame] | 1464 | | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1465 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1466 | .inv_gain = 787, |
| 1467 | .time_stabiliz = 10, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1468 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1469 | .alpha_level = 0, |
| 1470 | .thlock = 118, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1471 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1472 | .wbd_inv = 0, |
| 1473 | .wbd_ref = 3530, |
| 1474 | .wbd_sel = 1, |
| 1475 | .wbd_alpha = 5, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1476 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1477 | .agc1_max = 0, |
| 1478 | .agc1_min = 0, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1479 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1480 | .agc2_max = 65535, |
| 1481 | .agc2_min = 0, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1482 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1483 | .agc1_pt1 = 0, |
| 1484 | .agc1_pt2 = 32, |
| 1485 | .agc1_pt3 = 114, |
| 1486 | .agc1_slope1 = 143, |
| 1487 | .agc1_slope2 = 144, |
| 1488 | .agc2_pt1 = 114, |
| 1489 | .agc2_pt2 = 227, |
| 1490 | .agc2_slope1 = 116, |
| 1491 | .agc2_slope2 = 117, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1492 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1493 | .alpha_mant = 28, |
| 1494 | .alpha_exp = 26, |
| 1495 | .beta_mant = 31, |
| 1496 | .beta_exp = 51, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1497 | |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1498 | .perform_agc_softsplit = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1499 | } |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1500 | }; |
| 1501 | |
| 1502 | static struct dibx000_bandwidth_config dib8090_pll_config_12mhz = { |
Mauro Carvalho Chehab | 40d1a7c | 2014-07-04 14:15:34 -0300 | [diff] [blame] | 1503 | .internal = 54000, |
| 1504 | .sampling = 13500, |
| 1505 | |
| 1506 | .pll_prediv = 1, |
| 1507 | .pll_ratio = 18, |
| 1508 | .pll_range = 3, |
| 1509 | .pll_reset = 1, |
| 1510 | .pll_bypass = 0, |
| 1511 | |
| 1512 | .enable_refdiv = 0, |
| 1513 | .bypclk_div = 0, |
| 1514 | .IO_CLK_en_core = 1, |
| 1515 | .ADClkSrc = 1, |
| 1516 | .modulo = 2, |
| 1517 | |
| 1518 | .sad_cfg = (3 << 14) | (1 << 12) | (599 << 0), |
| 1519 | |
| 1520 | .ifreq = (0 << 25) | 0, |
| 1521 | .timf = 20199727, |
| 1522 | |
| 1523 | .xtal_hz = 12000000, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1524 | }; |
| 1525 | |
| 1526 | static int dib8090_get_adc_power(struct dvb_frontend *fe) |
| 1527 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1528 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 1529 | struct dib0700_adapter_state *state = adap->priv; |
| 1530 | |
| 1531 | return state->dib8000_ops.get_adc_power(fe, 1); |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1532 | } |
| 1533 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1534 | static void dib8090_agc_control(struct dvb_frontend *fe, u8 restart) |
| 1535 | { |
| 1536 | deb_info("AGC control callback: %i\n", restart); |
| 1537 | dib0090_dcc_freq(fe, restart); |
| 1538 | |
| 1539 | if (restart == 0) /* before AGC startup */ |
| 1540 | dib0090_set_dc_servo(fe, 1); |
| 1541 | } |
| 1542 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1543 | static struct dib8000_config dib809x_dib8000_config[2] = { |
| 1544 | { |
| 1545 | .output_mpeg2_in_188_bytes = 1, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1546 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1547 | .agc_config_count = 2, |
| 1548 | .agc = dib8090_agc_config, |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1549 | .agc_control = dib8090_agc_control, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1550 | .pll = &dib8090_pll_config_12mhz, |
| 1551 | .tuner_is_baseband = 1, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1552 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1553 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, |
| 1554 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, |
| 1555 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1556 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1557 | .hostbus_diversity = 1, |
| 1558 | .div_cfg = 0x31, |
| 1559 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 1560 | .drives = 0x2d98, |
| 1561 | .diversity_delay = 48, |
| 1562 | .refclksel = 3, |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1563 | }, { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1564 | .output_mpeg2_in_188_bytes = 1, |
| 1565 | |
| 1566 | .agc_config_count = 2, |
| 1567 | .agc = dib8090_agc_config, |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1568 | .agc_control = dib8090_agc_control, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1569 | .pll = &dib8090_pll_config_12mhz, |
| 1570 | .tuner_is_baseband = 1, |
| 1571 | |
| 1572 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, |
| 1573 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, |
| 1574 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, |
| 1575 | |
| 1576 | .hostbus_diversity = 1, |
| 1577 | .div_cfg = 0x31, |
| 1578 | .output_mode = OUTMODE_DIVERSITY, |
| 1579 | .drives = 0x2d08, |
| 1580 | .diversity_delay = 1, |
| 1581 | .refclksel = 3, |
| 1582 | } |
| 1583 | }; |
| 1584 | |
| 1585 | static struct dib0090_wbd_slope dib8090_wbd_table[] = { |
| 1586 | /* max freq ; cold slope ; cold offset ; warm slope ; warm offset ; wbd gain */ |
| 1587 | { 120, 0, 500, 0, 500, 4 }, /* CBAND */ |
| 1588 | { 170, 0, 450, 0, 450, 4 }, /* CBAND */ |
| 1589 | { 380, 48, 373, 28, 259, 6 }, /* VHF */ |
| 1590 | { 860, 34, 700, 36, 616, 6 }, /* high UHF */ |
| 1591 | { 0xFFFF, 34, 700, 36, 616, 6 }, /* default */ |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1592 | }; |
| 1593 | |
| 1594 | static struct dib0090_config dib809x_dib0090_config = { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1595 | .io.pll_bypass = 1, |
| 1596 | .io.pll_range = 1, |
| 1597 | .io.pll_prediv = 1, |
| 1598 | .io.pll_loopdiv = 20, |
| 1599 | .io.adc_clock_ratio = 8, |
| 1600 | .io.pll_int_loop_filt = 0, |
| 1601 | .io.clock_khz = 12000, |
| 1602 | .reset = dib80xx_tuner_reset, |
| 1603 | .sleep = dib80xx_tuner_sleep, |
| 1604 | .clkouttobamse = 1, |
| 1605 | .analog_output = 1, |
| 1606 | .i2c_address = DEFAULT_DIB0090_I2C_ADDRESS, |
| 1607 | .use_pwm_agc = 1, |
| 1608 | .clkoutdrive = 1, |
| 1609 | .get_adc_power = dib8090_get_adc_power, |
| 1610 | .freq_offset_khz_uhf = -63, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1611 | .freq_offset_khz_vhf = -143, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1612 | .wbd = dib8090_wbd_table, |
| 1613 | .fref_clock_ratio = 6, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1614 | }; |
| 1615 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1616 | static u8 dib8090_compute_pll_parameters(struct dvb_frontend *fe) |
| 1617 | { |
| 1618 | u8 optimal_pll_ratio = 20; |
| 1619 | u32 freq_adc, ratio, rest, max = 0; |
| 1620 | u8 pll_ratio; |
| 1621 | |
| 1622 | for (pll_ratio = 17; pll_ratio <= 20; pll_ratio++) { |
| 1623 | freq_adc = 12 * pll_ratio * (1 << 8) / 16; |
| 1624 | ratio = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) / freq_adc; |
| 1625 | rest = ((fe->dtv_property_cache.frequency / 1000) * (1 << 8) / 1000) - ratio * freq_adc; |
| 1626 | |
| 1627 | if (rest > freq_adc / 2) |
| 1628 | rest = freq_adc - rest; |
| 1629 | deb_info("PLL ratio=%i rest=%i\n", pll_ratio, rest); |
| 1630 | if ((rest > max) && (rest > 717)) { |
| 1631 | optimal_pll_ratio = pll_ratio; |
| 1632 | max = rest; |
| 1633 | } |
| 1634 | } |
| 1635 | deb_info("optimal PLL ratio=%i\n", optimal_pll_ratio); |
| 1636 | |
| 1637 | return optimal_pll_ratio; |
| 1638 | } |
| 1639 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 1640 | static int dib8096_set_param_override(struct dvb_frontend *fe) |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1641 | { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1642 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 1643 | struct dib0700_adapter_state *state = adap->priv; |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1644 | u8 pll_ratio, band = BAND_OF_FREQUENCY(fe->dtv_property_cache.frequency / 1000); |
| 1645 | u16 target, ltgain, rf_gain_limit; |
| 1646 | u32 timf; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1647 | int ret = 0; |
| 1648 | enum frontend_tune_state tune_state = CT_SHUTDOWN; |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1649 | |
| 1650 | switch (band) { |
| 1651 | default: |
| 1652 | deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency); |
| 1653 | case BAND_VHF: |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1654 | state->dib8000_ops.set_gpio(fe, 3, 0, 1); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1655 | break; |
| 1656 | case BAND_UHF: |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1657 | state->dib8000_ops.set_gpio(fe, 3, 0, 0); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1658 | break; |
| 1659 | } |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1660 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 1661 | ret = state->set_param_save(fe); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1662 | if (ret < 0) |
| 1663 | return ret; |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1664 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1665 | if (fe->dtv_property_cache.bandwidth_hz != 6000000) { |
| 1666 | deb_info("only 6MHz bandwidth is supported\n"); |
| 1667 | return -EINVAL; |
| 1668 | } |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1669 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1670 | /** Update PLL if needed ratio **/ |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1671 | state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, 0); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1672 | |
| 1673 | /** Get optimize PLL ratio to remove spurious **/ |
| 1674 | pll_ratio = dib8090_compute_pll_parameters(fe); |
| 1675 | if (pll_ratio == 17) |
| 1676 | timf = 21387946; |
| 1677 | else if (pll_ratio == 18) |
| 1678 | timf = 20199727; |
| 1679 | else if (pll_ratio == 19) |
| 1680 | timf = 19136583; |
| 1681 | else |
| 1682 | timf = 18179756; |
| 1683 | |
| 1684 | /** Update ratio **/ |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1685 | state->dib8000_ops.update_pll(fe, &dib8090_pll_config_12mhz, fe->dtv_property_cache.bandwidth_hz / 1000, pll_ratio); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1686 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1687 | state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, timf); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1688 | |
| 1689 | if (band != BAND_CBAND) { |
| 1690 | /* dib0090_get_wbd_target is returning any possible temperature compensated wbd-target */ |
| 1691 | target = (dib0090_get_wbd_target(fe) * 8 * 18 / 33 + 1) / 2; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1692 | state->dib8000_ops.set_wbd_ref(fe, target); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1693 | } |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1694 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1695 | if (band == BAND_CBAND) { |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1696 | deb_info("tuning in CBAND - soft-AGC startup\n"); |
| 1697 | dib0090_set_tune_state(fe, CT_AGC_START); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1698 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1699 | do { |
| 1700 | ret = dib0090_gain_control(fe); |
| 1701 | msleep(ret); |
| 1702 | tune_state = dib0090_get_tune_state(fe); |
| 1703 | if (tune_state == CT_AGC_STEP_0) |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1704 | state->dib8000_ops.set_gpio(fe, 6, 0, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1705 | else if (tune_state == CT_AGC_STEP_1) { |
| 1706 | dib0090_get_current_gain(fe, NULL, NULL, &rf_gain_limit, <gain); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1707 | if (rf_gain_limit < 2000) /* activate the external attenuator in case of very high input power */ |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1708 | state->dib8000_ops.set_gpio(fe, 6, 0, 0); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1709 | } |
| 1710 | } while (tune_state < CT_AGC_STOP); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1711 | |
| 1712 | deb_info("switching to PWM AGC\n"); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1713 | dib0090_pwm_gain_reset(fe); |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1714 | state->dib8000_ops.pwm_agc_reset(fe); |
| 1715 | state->dib8000_ops.set_tune_state(fe, CT_DEMOD_START); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1716 | } else { |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1717 | /* for everything else than CBAND we are using standard AGC */ |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1718 | deb_info("not tuning in CBAND - standard AGC startup\n"); |
| 1719 | dib0090_pwm_gain_reset(fe); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1720 | } |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1721 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1722 | return 0; |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1723 | } |
| 1724 | |
| 1725 | static int dib809x_tuner_attach(struct dvb_usb_adapter *adap) |
| 1726 | { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1727 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1728 | struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1729 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1730 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1731 | return -ENODEV; |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1732 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1733 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 1734 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1735 | return 0; |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1736 | } |
| 1737 | |
| 1738 | static int stk809x_frontend_attach(struct dvb_usb_adapter *adap) |
| 1739 | { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1740 | struct dib0700_adapter_state *state = adap->priv; |
| 1741 | |
| 1742 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 1743 | return -ENODEV; |
| 1744 | |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1745 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1746 | msleep(10); |
| 1747 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1748 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1749 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1750 | |
| 1751 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1752 | |
| 1753 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1754 | |
| 1755 | msleep(10); |
| 1756 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 1757 | msleep(10); |
| 1758 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1759 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1760 | state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0); |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1761 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1762 | adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1763 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1764 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 1765 | } |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 1766 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1767 | static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap) |
| 1768 | { |
| 1769 | struct dib0700_adapter_state *st = adap->priv; |
| 1770 | struct i2c_adapter *tun_i2c; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1771 | struct dvb_frontend *fe_slave = st->dib8000_ops.get_slave_frontend(adap->fe_adap[0].fe, 1); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1772 | |
| 1773 | if (fe_slave) { |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1774 | tun_i2c = st->dib8000_ops.get_i2c_master(fe_slave, DIBX000_I2C_INTERFACE_TUNER, 1); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1775 | if (dvb_attach(dib0090_register, fe_slave, tun_i2c, &dib809x_dib0090_config) == NULL) |
| 1776 | return -ENODEV; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1777 | fe_slave->dvb = adap->fe_adap[0].fe->dvb; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1778 | fe_slave->ops.tuner_ops.set_params = dib8096_set_param_override; |
| 1779 | } |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1780 | tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1781 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1782 | return -ENODEV; |
| 1783 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1784 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 1785 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1786 | |
| 1787 | return 0; |
| 1788 | } |
| 1789 | |
| 1790 | static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap) |
| 1791 | { |
| 1792 | struct dvb_frontend *fe_slave; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1793 | struct dib0700_adapter_state *state = adap->priv; |
| 1794 | |
| 1795 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 1796 | return -ENODEV; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1797 | |
| 1798 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1799 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1800 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 1801 | msleep(1000); |
| 1802 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 1803 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 1804 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 1805 | |
| 1806 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 1807 | |
| 1808 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 1809 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1810 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1811 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 1812 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1813 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 1814 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1815 | state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1816 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1817 | adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 1818 | if (adap->fe_adap[0].fe == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1819 | return -ENODEV; |
| 1820 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1821 | /* Needed to increment refcount */ |
| 1822 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 1823 | return -ENODEV; |
| 1824 | |
| 1825 | fe_slave = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]); |
| 1826 | state->dib8000_ops.set_slave_frontend(adap->fe_adap[0].fe, fe_slave); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 1827 | |
| 1828 | return fe_slave == NULL ? -ENODEV : 0; |
| 1829 | } |
| 1830 | |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 1831 | /* TFE8096P */ |
| 1832 | static struct dibx000_agc_config dib8096p_agc_config[2] = { |
| 1833 | { |
| 1834 | .band_caps = BAND_UHF, |
| 1835 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, |
| 1836 | P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, |
| 1837 | P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 1838 | P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, |
| 1839 | P_agc_write=0 */ |
| 1840 | .setup = (0 << 15) | (0 << 14) | (5 << 11) |
| 1841 | | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) |
| 1842 | | (0 << 4) | (5 << 1) | (0 << 0), |
| 1843 | |
| 1844 | .inv_gain = 684, |
| 1845 | .time_stabiliz = 10, |
| 1846 | |
| 1847 | .alpha_level = 0, |
| 1848 | .thlock = 118, |
| 1849 | |
| 1850 | .wbd_inv = 0, |
| 1851 | .wbd_ref = 1200, |
| 1852 | .wbd_sel = 3, |
| 1853 | .wbd_alpha = 5, |
| 1854 | |
| 1855 | .agc1_max = 65535, |
| 1856 | .agc1_min = 0, |
| 1857 | |
| 1858 | .agc2_max = 32767, |
| 1859 | .agc2_min = 0, |
| 1860 | |
| 1861 | .agc1_pt1 = 0, |
| 1862 | .agc1_pt2 = 0, |
| 1863 | .agc1_pt3 = 105, |
| 1864 | .agc1_slope1 = 0, |
| 1865 | .agc1_slope2 = 156, |
| 1866 | .agc2_pt1 = 105, |
| 1867 | .agc2_pt2 = 255, |
| 1868 | .agc2_slope1 = 54, |
| 1869 | .agc2_slope2 = 0, |
| 1870 | |
| 1871 | .alpha_mant = 28, |
| 1872 | .alpha_exp = 26, |
| 1873 | .beta_mant = 31, |
| 1874 | .beta_exp = 51, |
| 1875 | |
| 1876 | .perform_agc_softsplit = 0, |
| 1877 | } , { |
| 1878 | .band_caps = BAND_FM | BAND_VHF | BAND_CBAND, |
| 1879 | /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, |
| 1880 | P_agc_freq_pwm_div=1, P_agc_inv_pwm1=0, |
| 1881 | P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
| 1882 | P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=5, |
| 1883 | P_agc_write=0 */ |
| 1884 | .setup = (0 << 15) | (0 << 14) | (5 << 11) |
| 1885 | | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) |
| 1886 | | (0 << 4) | (5 << 1) | (0 << 0), |
| 1887 | |
| 1888 | .inv_gain = 732, |
| 1889 | .time_stabiliz = 10, |
| 1890 | |
| 1891 | .alpha_level = 0, |
| 1892 | .thlock = 118, |
| 1893 | |
| 1894 | .wbd_inv = 0, |
| 1895 | .wbd_ref = 1200, |
| 1896 | .wbd_sel = 3, |
| 1897 | .wbd_alpha = 5, |
| 1898 | |
| 1899 | .agc1_max = 65535, |
| 1900 | .agc1_min = 0, |
| 1901 | |
| 1902 | .agc2_max = 32767, |
| 1903 | .agc2_min = 0, |
| 1904 | |
| 1905 | .agc1_pt1 = 0, |
| 1906 | .agc1_pt2 = 0, |
| 1907 | .agc1_pt3 = 98, |
| 1908 | .agc1_slope1 = 0, |
| 1909 | .agc1_slope2 = 167, |
| 1910 | .agc2_pt1 = 98, |
| 1911 | .agc2_pt2 = 255, |
| 1912 | .agc2_slope1 = 52, |
| 1913 | .agc2_slope2 = 0, |
| 1914 | |
| 1915 | .alpha_mant = 28, |
| 1916 | .alpha_exp = 26, |
| 1917 | .beta_mant = 31, |
| 1918 | .beta_exp = 51, |
| 1919 | |
| 1920 | .perform_agc_softsplit = 0, |
| 1921 | } |
| 1922 | }; |
| 1923 | |
| 1924 | static struct dibx000_bandwidth_config dib8096p_clock_config_12_mhz = { |
| 1925 | 108000, 13500, |
| 1926 | 1, 9, 1, 0, 0, |
| 1927 | 0, 0, 0, 0, 2, |
| 1928 | (3 << 14) | (1 << 12) | (524 << 0), |
| 1929 | (0 << 25) | 0, |
| 1930 | 20199729, |
| 1931 | 12000000, |
| 1932 | }; |
| 1933 | |
| 1934 | static struct dib8000_config tfe8096p_dib8000_config = { |
| 1935 | .output_mpeg2_in_188_bytes = 1, |
| 1936 | .hostbus_diversity = 1, |
| 1937 | .update_lna = NULL, |
| 1938 | |
| 1939 | .agc_config_count = 2, |
| 1940 | .agc = dib8096p_agc_config, |
| 1941 | .pll = &dib8096p_clock_config_12_mhz, |
| 1942 | |
| 1943 | .gpio_dir = DIB8000_GPIO_DEFAULT_DIRECTIONS, |
| 1944 | .gpio_val = DIB8000_GPIO_DEFAULT_VALUES, |
| 1945 | .gpio_pwm_pos = DIB8000_GPIO_DEFAULT_PWM_POS, |
| 1946 | |
| 1947 | .agc_control = NULL, |
| 1948 | .diversity_delay = 48, |
| 1949 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 1950 | .enMpegOutput = 1, |
| 1951 | }; |
| 1952 | |
| 1953 | static struct dib0090_wbd_slope dib8096p_wbd_table[] = { |
| 1954 | { 380, 81, 850, 64, 540, 4}, |
| 1955 | { 860, 51, 866, 21, 375, 4}, |
| 1956 | {1700, 0, 250, 0, 100, 6}, |
| 1957 | {2600, 0, 250, 0, 100, 6}, |
| 1958 | { 0xFFFF, 0, 0, 0, 0, 0}, |
| 1959 | }; |
| 1960 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 1961 | static struct dib0090_config tfe8096p_dib0090_config = { |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 1962 | .io.clock_khz = 12000, |
| 1963 | .io.pll_bypass = 0, |
| 1964 | .io.pll_range = 0, |
| 1965 | .io.pll_prediv = 3, |
| 1966 | .io.pll_loopdiv = 6, |
| 1967 | .io.adc_clock_ratio = 0, |
| 1968 | .io.pll_int_loop_filt = 0, |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 1969 | |
| 1970 | .freq_offset_khz_uhf = -143, |
| 1971 | .freq_offset_khz_vhf = -143, |
| 1972 | |
| 1973 | .get_adc_power = dib8090_get_adc_power, |
| 1974 | |
| 1975 | .clkouttobamse = 1, |
| 1976 | .analog_output = 0, |
| 1977 | |
| 1978 | .wbd_vhf_offset = 0, |
| 1979 | .wbd_cband_offset = 0, |
| 1980 | .use_pwm_agc = 1, |
| 1981 | .clkoutdrive = 0, |
| 1982 | |
| 1983 | .fref_clock_ratio = 1, |
| 1984 | |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 1985 | .ls_cfg_pad_drv = 0, |
| 1986 | .data_tx_drv = 0, |
| 1987 | .low_if = NULL, |
| 1988 | .in_soc = 1, |
| 1989 | .force_cband_input = 0, |
| 1990 | }; |
| 1991 | |
| 1992 | struct dibx090p_adc { |
| 1993 | u32 freq; /* RF freq MHz */ |
| 1994 | u32 timf; /* New Timf */ |
| 1995 | u32 pll_loopdiv; /* New prediv */ |
| 1996 | u32 pll_prediv; /* New loopdiv */ |
| 1997 | }; |
| 1998 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 1999 | struct dibx090p_best_adc { |
| 2000 | u32 timf; |
| 2001 | u32 pll_loopdiv; |
| 2002 | u32 pll_prediv; |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2003 | }; |
| 2004 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2005 | static int dib8096p_get_best_sampling(struct dvb_frontend *fe, struct dibx090p_best_adc *adc) |
| 2006 | { |
| 2007 | u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1; |
| 2008 | u16 xtal = 12000; |
| 2009 | u16 fcp_min = 1900; /* PLL, Minimum Frequency of phase comparator (KHz) */ |
| 2010 | u16 fcp_max = 20000; /* PLL, Maximum Frequency of phase comparator (KHz) */ |
| 2011 | u32 fmem_max = 140000; /* 140MHz max SDRAM freq */ |
| 2012 | u32 fdem_min = 66000; |
| 2013 | u32 fcp = 0, fs = 0, fdem = 0, fmem = 0; |
| 2014 | u32 harmonic_id = 0; |
| 2015 | |
| 2016 | adc->timf = 0; |
| 2017 | adc->pll_loopdiv = loopdiv; |
| 2018 | adc->pll_prediv = prediv; |
| 2019 | |
| 2020 | deb_info("bandwidth = %d", fe->dtv_property_cache.bandwidth_hz); |
| 2021 | |
| 2022 | /* Find Min and Max prediv */ |
| 2023 | while ((xtal / max_prediv) >= fcp_min) |
| 2024 | max_prediv++; |
| 2025 | |
| 2026 | max_prediv--; |
| 2027 | min_prediv = max_prediv; |
| 2028 | while ((xtal / min_prediv) <= fcp_max) { |
| 2029 | min_prediv--; |
| 2030 | if (min_prediv == 1) |
| 2031 | break; |
| 2032 | } |
| 2033 | deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv); |
| 2034 | |
| 2035 | min_prediv = 1; |
| 2036 | |
| 2037 | for (prediv = min_prediv; prediv < max_prediv; prediv++) { |
| 2038 | fcp = xtal / prediv; |
| 2039 | if (fcp > fcp_min && fcp < fcp_max) { |
| 2040 | for (loopdiv = 1; loopdiv < 64; loopdiv++) { |
| 2041 | fmem = ((xtal/prediv) * loopdiv); |
| 2042 | fdem = fmem / 2; |
| 2043 | fs = fdem / 4; |
| 2044 | |
| 2045 | /* test min/max system restrictions */ |
| 2046 | if ((fdem >= fdem_min) && (fmem <= fmem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz / 1000)) { |
| 2047 | spur = 0; |
| 2048 | /* test fs harmonics positions */ |
| 2049 | for (harmonic_id = (fe->dtv_property_cache.frequency / (1000 * fs)); harmonic_id <= ((fe->dtv_property_cache.frequency / (1000 * fs)) + 1); harmonic_id++) { |
| 2050 | if (((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)))) { |
| 2051 | spur = 1; |
| 2052 | break; |
| 2053 | } |
| 2054 | } |
| 2055 | |
| 2056 | if (!spur) { |
| 2057 | adc->pll_loopdiv = loopdiv; |
| 2058 | adc->pll_prediv = prediv; |
| 2059 | adc->timf = (4260880253U / fdem) * (1 << 8); |
| 2060 | adc->timf += ((4260880253U % fdem) << 8) / fdem; |
| 2061 | |
| 2062 | deb_info("RF %6d; BW %6d; Xtal %6d; Fmem %6d; Fdem %6d; Fs %6d; Prediv %2d; Loopdiv %2d; Timf %8d;", fe->dtv_property_cache.frequency, fe->dtv_property_cache.bandwidth_hz, xtal, fmem, fdem, fs, prediv, loopdiv, adc->timf); |
| 2063 | break; |
| 2064 | } |
| 2065 | } |
| 2066 | } |
| 2067 | } |
| 2068 | if (!spur) |
| 2069 | break; |
| 2070 | } |
| 2071 | |
| 2072 | if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0) |
| 2073 | return -EINVAL; |
| 2074 | return 0; |
| 2075 | } |
| 2076 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 2077 | static int dib8096p_agc_startup(struct dvb_frontend *fe) |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2078 | { |
| 2079 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 2080 | struct dib0700_adapter_state *state = adap->priv; |
| 2081 | struct dibx000_bandwidth_config pll; |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2082 | struct dibx090p_best_adc adc; |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2083 | u16 target; |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2084 | int ret; |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2085 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 2086 | ret = state->set_param_save(fe); |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2087 | if (ret < 0) |
| 2088 | return ret; |
| 2089 | memset(&pll, 0, sizeof(struct dibx000_bandwidth_config)); |
| 2090 | |
| 2091 | dib0090_pwm_gain_reset(fe); |
| 2092 | /* dib0090_get_wbd_target is returning any possible |
| 2093 | temperature compensated wbd-target */ |
| 2094 | target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2095 | state->dib8000_ops.set_wbd_ref(fe, target); |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2096 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2097 | if (dib8096p_get_best_sampling(fe, &adc) == 0) { |
| 2098 | pll.pll_ratio = adc.pll_loopdiv; |
| 2099 | pll.pll_prediv = adc.pll_prediv; |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2100 | |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2101 | dib0700_set_i2c_speed(adap->dev, 200); |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2102 | state->dib8000_ops.update_pll(fe, &pll, fe->dtv_property_cache.bandwidth_hz / 1000, 0); |
| 2103 | state->dib8000_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf); |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2104 | dib0700_set_i2c_speed(adap->dev, 1000); |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2105 | } |
| 2106 | return 0; |
| 2107 | } |
| 2108 | |
| 2109 | static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap) |
| 2110 | { |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2111 | struct dib0700_state *st = adap->dev->priv; |
| 2112 | u32 fw_version; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2113 | struct dib0700_adapter_state *state = adap->priv; |
| 2114 | |
| 2115 | if (!dvb_attach(dib8000_attach, &state->dib8000_ops)) |
| 2116 | return -ENODEV; |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2117 | |
| 2118 | dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); |
| 2119 | if (fw_version >= 0x10200) |
| 2120 | st->fw_use_new_i2c_api = 1; |
| 2121 | |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2122 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 2123 | msleep(20); |
| 2124 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 2125 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 2126 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 2127 | |
| 2128 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 2129 | |
| 2130 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 2131 | |
| 2132 | msleep(20); |
| 2133 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 2134 | msleep(20); |
| 2135 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 2136 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2137 | state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1); |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2138 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2139 | adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, |
| 2140 | 0x80, &tfe8096p_dib8000_config); |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2141 | |
| 2142 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
| 2143 | } |
| 2144 | |
| 2145 | static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap) |
| 2146 | { |
| 2147 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2148 | struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_tuner(adap->fe_adap[0].fe); |
| 2149 | |
| 2150 | tfe8096p_dib0090_config.reset = st->dib8000_ops.tuner_sleep; |
| 2151 | tfe8096p_dib0090_config.sleep = st->dib8000_ops.tuner_sleep; |
| 2152 | tfe8096p_dib0090_config.wbd = dib8096p_wbd_table; |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2153 | |
| 2154 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, |
| 2155 | &tfe8096p_dib0090_config) == NULL) |
| 2156 | return -ENODEV; |
| 2157 | |
Mauro Carvalho Chehab | d44913c | 2014-05-29 09:20:17 -0300 | [diff] [blame] | 2158 | st->dib8000_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 2159 | |
| 2160 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 2161 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup; |
| 2162 | return 0; |
| 2163 | } |
| 2164 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2165 | /* STK9090M */ |
| 2166 | static int dib90x0_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) |
| 2167 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2168 | return dib9000_fw_pid_filter(adapter->fe_adap[0].fe, index, pid, onoff); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2169 | } |
| 2170 | |
| 2171 | static int dib90x0_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) |
| 2172 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2173 | return dib9000_fw_pid_filter_ctrl(adapter->fe_adap[0].fe, onoff); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2174 | } |
| 2175 | |
| 2176 | static int dib90x0_tuner_reset(struct dvb_frontend *fe, int onoff) |
| 2177 | { |
| 2178 | return dib9000_set_gpio(fe, 5, 0, !onoff); |
| 2179 | } |
| 2180 | |
| 2181 | static int dib90x0_tuner_sleep(struct dvb_frontend *fe, int onoff) |
| 2182 | { |
| 2183 | return dib9000_set_gpio(fe, 0, 0, onoff); |
| 2184 | } |
| 2185 | |
| 2186 | static int dib01x0_pmu_update(struct i2c_adapter *i2c, u16 *data, u8 len) |
| 2187 | { |
| 2188 | u8 wb[4] = { 0xc >> 8, 0xc & 0xff, 0, 0 }; |
| 2189 | u8 rb[2]; |
| 2190 | struct i2c_msg msg[2] = { |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2191 | {.addr = 0x1e >> 1, .flags = 0, .buf = wb, .len = 2}, |
| 2192 | {.addr = 0x1e >> 1, .flags = I2C_M_RD, .buf = rb, .len = 2}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2193 | }; |
| 2194 | u8 index_data; |
| 2195 | |
| 2196 | dibx000_i2c_set_speed(i2c, 250); |
| 2197 | |
| 2198 | if (i2c_transfer(i2c, msg, 2) != 2) |
| 2199 | return -EIO; |
| 2200 | |
| 2201 | switch (rb[0] << 8 | rb[1]) { |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2202 | case 0: |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2203 | deb_info("Found DiB0170 rev1: This version of DiB0170 is not supported any longer.\n"); |
| 2204 | return -EIO; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2205 | case 1: |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2206 | deb_info("Found DiB0170 rev2"); |
| 2207 | break; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2208 | case 2: |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2209 | deb_info("Found DiB0190 rev2"); |
| 2210 | break; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2211 | default: |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2212 | deb_info("DiB01x0 not found"); |
| 2213 | return -EIO; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2214 | } |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2215 | |
| 2216 | for (index_data = 0; index_data < len; index_data += 2) { |
| 2217 | wb[2] = (data[index_data + 1] >> 8) & 0xff; |
| 2218 | wb[3] = (data[index_data + 1]) & 0xff; |
| 2219 | |
| 2220 | if (data[index_data] == 0) { |
| 2221 | wb[0] = (data[index_data] >> 8) & 0xff; |
| 2222 | wb[1] = (data[index_data]) & 0xff; |
| 2223 | msg[0].len = 2; |
| 2224 | if (i2c_transfer(i2c, msg, 2) != 2) |
| 2225 | return -EIO; |
| 2226 | wb[2] |= rb[0]; |
| 2227 | wb[3] |= rb[1] & ~(3 << 4); |
| 2228 | } |
| 2229 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2230 | wb[0] = (data[index_data] >> 8)&0xff; |
| 2231 | wb[1] = (data[index_data])&0xff; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2232 | msg[0].len = 4; |
| 2233 | if (i2c_transfer(i2c, &msg[0], 1) != 1) |
| 2234 | return -EIO; |
| 2235 | } |
| 2236 | return 0; |
| 2237 | } |
| 2238 | |
| 2239 | static struct dib9000_config stk9090m_config = { |
| 2240 | .output_mpeg2_in_188_bytes = 1, |
| 2241 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 2242 | .vcxo_timer = 279620, |
| 2243 | .timing_frequency = 20452225, |
| 2244 | .demod_clock_khz = 60000, |
| 2245 | .xtal_clock_khz = 30000, |
| 2246 | .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), |
| 2247 | .subband = { |
| 2248 | 2, |
| 2249 | { |
| 2250 | { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0008 } }, /* GPIO 3 to 1 for VHF */ |
| 2251 | { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0008, 0x0000, 0x0000 } }, /* GPIO 3 to 0 for UHF */ |
| 2252 | { 0 }, |
| 2253 | }, |
| 2254 | }, |
| 2255 | .gpio_function = { |
| 2256 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 }, |
| 2257 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 }, |
| 2258 | }, |
| 2259 | }; |
| 2260 | |
| 2261 | static struct dib9000_config nim9090md_config[2] = { |
| 2262 | { |
| 2263 | .output_mpeg2_in_188_bytes = 1, |
| 2264 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 2265 | .vcxo_timer = 279620, |
| 2266 | .timing_frequency = 20452225, |
| 2267 | .demod_clock_khz = 60000, |
| 2268 | .xtal_clock_khz = 30000, |
| 2269 | .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), |
| 2270 | }, { |
| 2271 | .output_mpeg2_in_188_bytes = 1, |
| 2272 | .output_mode = OUTMODE_DIVERSITY, |
| 2273 | .vcxo_timer = 279620, |
| 2274 | .timing_frequency = 20452225, |
| 2275 | .demod_clock_khz = 60000, |
| 2276 | .xtal_clock_khz = 30000, |
| 2277 | .if_drives = (0 << 15) | (1 << 13) | (0 << 12) | (3 << 10) | (0 << 9) | (1 << 7) | (0 << 6) | (0 << 4) | (1 << 3) | (1 << 1) | (0), |
| 2278 | .subband = { |
| 2279 | 2, |
| 2280 | { |
| 2281 | { 240, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0006 } }, /* GPIO 1 and 2 to 1 for VHF */ |
| 2282 | { 890, { BOARD_GPIO_COMPONENT_DEMOD, BOARD_GPIO_FUNCTION_SUBBAND_GPIO, 0x0006, 0x0000, 0x0000 } }, /* GPIO 1 and 2 to 0 for UHF */ |
| 2283 | { 0 }, |
| 2284 | }, |
| 2285 | }, |
| 2286 | .gpio_function = { |
| 2287 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_ON, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = (0x10 & ~0x1) | 0x20 }, |
| 2288 | { .component = BOARD_GPIO_COMPONENT_DEMOD, .function = BOARD_GPIO_FUNCTION_COMPONENT_OFF, .mask = 0x10 | 0x21, .direction = 0 & ~0x21, .value = 0 | 0x21 }, |
| 2289 | }, |
| 2290 | } |
| 2291 | }; |
| 2292 | |
| 2293 | static struct dib0090_config dib9090_dib0090_config = { |
| 2294 | .io.pll_bypass = 0, |
| 2295 | .io.pll_range = 1, |
| 2296 | .io.pll_prediv = 1, |
| 2297 | .io.pll_loopdiv = 8, |
| 2298 | .io.adc_clock_ratio = 8, |
| 2299 | .io.pll_int_loop_filt = 0, |
| 2300 | .io.clock_khz = 30000, |
| 2301 | .reset = dib90x0_tuner_reset, |
| 2302 | .sleep = dib90x0_tuner_sleep, |
| 2303 | .clkouttobamse = 0, |
| 2304 | .analog_output = 0, |
| 2305 | .use_pwm_agc = 0, |
| 2306 | .clkoutdrive = 0, |
| 2307 | .freq_offset_khz_uhf = 0, |
| 2308 | .freq_offset_khz_vhf = 0, |
| 2309 | }; |
| 2310 | |
| 2311 | static struct dib0090_config nim9090md_dib0090_config[2] = { |
| 2312 | { |
| 2313 | .io.pll_bypass = 0, |
| 2314 | .io.pll_range = 1, |
| 2315 | .io.pll_prediv = 1, |
| 2316 | .io.pll_loopdiv = 8, |
| 2317 | .io.adc_clock_ratio = 8, |
| 2318 | .io.pll_int_loop_filt = 0, |
| 2319 | .io.clock_khz = 30000, |
| 2320 | .reset = dib90x0_tuner_reset, |
| 2321 | .sleep = dib90x0_tuner_sleep, |
| 2322 | .clkouttobamse = 1, |
| 2323 | .analog_output = 0, |
| 2324 | .use_pwm_agc = 0, |
| 2325 | .clkoutdrive = 0, |
| 2326 | .freq_offset_khz_uhf = 0, |
| 2327 | .freq_offset_khz_vhf = 0, |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2328 | }, { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2329 | .io.pll_bypass = 0, |
| 2330 | .io.pll_range = 1, |
| 2331 | .io.pll_prediv = 1, |
| 2332 | .io.pll_loopdiv = 8, |
| 2333 | .io.adc_clock_ratio = 8, |
| 2334 | .io.pll_int_loop_filt = 0, |
| 2335 | .io.clock_khz = 30000, |
| 2336 | .reset = dib90x0_tuner_reset, |
| 2337 | .sleep = dib90x0_tuner_sleep, |
| 2338 | .clkouttobamse = 0, |
| 2339 | .analog_output = 0, |
| 2340 | .use_pwm_agc = 0, |
| 2341 | .clkoutdrive = 0, |
| 2342 | .freq_offset_khz_uhf = 0, |
| 2343 | .freq_offset_khz_vhf = 0, |
| 2344 | } |
| 2345 | }; |
| 2346 | |
| 2347 | |
| 2348 | static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap) |
| 2349 | { |
| 2350 | struct dib0700_adapter_state *state = adap->priv; |
| 2351 | struct dib0700_state *st = adap->dev->priv; |
| 2352 | u32 fw_version; |
| 2353 | |
| 2354 | /* Make use of the new i2c functions from FW 1.20 */ |
| 2355 | dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); |
| 2356 | if (fw_version >= 0x10200) |
| 2357 | st->fw_use_new_i2c_api = 1; |
| 2358 | dib0700_set_i2c_speed(adap->dev, 340); |
| 2359 | |
| 2360 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2361 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2362 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 2363 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 2364 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 2365 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 2366 | |
| 2367 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 2368 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2369 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2370 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2371 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2372 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 2373 | |
| 2374 | dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80); |
| 2375 | |
| 2376 | if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { |
| 2377 | deb_info("%s: Upload failed. (file not found?)\n", __func__); |
| 2378 | return -ENODEV; |
| 2379 | } else { |
| 2380 | deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size); |
| 2381 | } |
| 2382 | stk9090m_config.microcode_B_fe_size = state->frontend_firmware->size; |
| 2383 | stk9090m_config.microcode_B_fe_buffer = state->frontend_firmware->data; |
| 2384 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2385 | adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2386 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2387 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2388 | } |
| 2389 | |
| 2390 | static int dib9090_tuner_attach(struct dvb_usb_adapter *adap) |
| 2391 | { |
| 2392 | struct dib0700_adapter_state *state = adap->priv; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2393 | struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2394 | u16 data_dib190[10] = { |
| 2395 | 1, 0x1374, |
| 2396 | 2, 0x01a2, |
| 2397 | 7, 0x0020, |
| 2398 | 0, 0x00ef, |
| 2399 | 8, 0x0486, |
| 2400 | }; |
| 2401 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2402 | if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2403 | return -ENODEV; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2404 | i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2405 | if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0) |
| 2406 | return -ENODEV; |
Olivier Grenie | d119002 | 2011-08-29 10:58:47 -0300 | [diff] [blame] | 2407 | dib0700_set_i2c_speed(adap->dev, 1500); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2408 | if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2409 | return -ENODEV; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2410 | release_firmware(state->frontend_firmware); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2411 | return 0; |
| 2412 | } |
| 2413 | |
| 2414 | static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap) |
| 2415 | { |
| 2416 | struct dib0700_adapter_state *state = adap->priv; |
| 2417 | struct dib0700_state *st = adap->dev->priv; |
| 2418 | struct i2c_adapter *i2c; |
| 2419 | struct dvb_frontend *fe_slave; |
| 2420 | u32 fw_version; |
| 2421 | |
| 2422 | /* Make use of the new i2c functions from FW 1.20 */ |
| 2423 | dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); |
| 2424 | if (fw_version >= 0x10200) |
| 2425 | st->fw_use_new_i2c_api = 1; |
| 2426 | dib0700_set_i2c_speed(adap->dev, 340); |
| 2427 | |
| 2428 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2429 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2430 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 2431 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 2432 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 2433 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 2434 | |
| 2435 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 2436 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2437 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2438 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2439 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2440 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 2441 | |
| 2442 | if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { |
| 2443 | deb_info("%s: Upload failed. (file not found?)\n", __func__); |
| 2444 | return -EIO; |
| 2445 | } else { |
| 2446 | deb_info("%s: firmware read %Zu bytes.\n", __func__, state->frontend_firmware->size); |
| 2447 | } |
| 2448 | nim9090md_config[0].microcode_B_fe_size = state->frontend_firmware->size; |
| 2449 | nim9090md_config[0].microcode_B_fe_buffer = state->frontend_firmware->data; |
| 2450 | nim9090md_config[1].microcode_B_fe_size = state->frontend_firmware->size; |
| 2451 | nim9090md_config[1].microcode_B_fe_buffer = state->frontend_firmware->data; |
| 2452 | |
| 2453 | dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2454 | adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2455 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2456 | if (adap->fe_adap[0].fe == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2457 | return -ENODEV; |
| 2458 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2459 | i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2460 | dib9000_i2c_enumeration(i2c, 1, 0x12, 0x82); |
| 2461 | |
| 2462 | fe_slave = dvb_attach(dib9000_attach, i2c, 0x82, &nim9090md_config[1]); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2463 | dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2464 | |
| 2465 | return fe_slave == NULL ? -ENODEV : 0; |
| 2466 | } |
| 2467 | |
| 2468 | static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap) |
| 2469 | { |
| 2470 | struct dib0700_adapter_state *state = adap->priv; |
| 2471 | struct i2c_adapter *i2c; |
| 2472 | struct dvb_frontend *fe_slave; |
| 2473 | u16 data_dib190[10] = { |
| 2474 | 1, 0x5374, |
| 2475 | 2, 0x01ae, |
| 2476 | 7, 0x0020, |
| 2477 | 0, 0x00ef, |
| 2478 | 8, 0x0406, |
| 2479 | }; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2480 | i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); |
| 2481 | if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2482 | return -ENODEV; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2483 | i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2484 | if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0) |
| 2485 | return -ENODEV; |
Olivier Grenie | d119002 | 2011-08-29 10:58:47 -0300 | [diff] [blame] | 2486 | |
| 2487 | dib0700_set_i2c_speed(adap->dev, 1500); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2488 | if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2489 | return -ENODEV; |
| 2490 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2491 | fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2492 | if (fe_slave != NULL) { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2493 | i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2494 | dib9000_set_i2c_adapter(fe_slave, i2c); |
| 2495 | |
| 2496 | i2c = dib9000_get_tuner_interface(fe_slave); |
| 2497 | if (dvb_attach(dib0090_fw_register, fe_slave, i2c, &nim9090md_dib0090_config[1]) == NULL) |
| 2498 | return -ENODEV; |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 2499 | fe_slave->dvb = adap->fe_adap[0].fe->dvb; |
Olivier Grenie | d119002 | 2011-08-29 10:58:47 -0300 | [diff] [blame] | 2500 | dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2501 | if (dib9000_firmware_post_pll_init(fe_slave) < 0) |
| 2502 | return -ENODEV; |
| 2503 | } |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2504 | release_firmware(state->frontend_firmware); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2505 | |
| 2506 | return 0; |
| 2507 | } |
| 2508 | |
| 2509 | /* NIM7090 */ |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2510 | static int dib7090p_get_best_sampling(struct dvb_frontend *fe , struct dibx090p_best_adc *adc) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2511 | { |
| 2512 | u8 spur = 0, prediv = 0, loopdiv = 0, min_prediv = 1, max_prediv = 1; |
| 2513 | |
| 2514 | u16 xtal = 12000; |
| 2515 | u32 fcp_min = 1900; /* PLL Minimum Frequency comparator KHz */ |
| 2516 | u32 fcp_max = 20000; /* PLL Maximum Frequency comparator KHz */ |
| 2517 | u32 fdem_max = 76000; |
| 2518 | u32 fdem_min = 69500; |
| 2519 | u32 fcp = 0, fs = 0, fdem = 0; |
| 2520 | u32 harmonic_id = 0; |
| 2521 | |
| 2522 | adc->pll_loopdiv = loopdiv; |
| 2523 | adc->pll_prediv = prediv; |
| 2524 | adc->timf = 0; |
| 2525 | |
| 2526 | deb_info("bandwidth = %d fdem_min =%d", fe->dtv_property_cache.bandwidth_hz, fdem_min); |
| 2527 | |
| 2528 | /* Find Min and Max prediv */ |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2529 | while ((xtal/max_prediv) >= fcp_min) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2530 | max_prediv++; |
| 2531 | |
| 2532 | max_prediv--; |
| 2533 | min_prediv = max_prediv; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2534 | while ((xtal/min_prediv) <= fcp_max) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2535 | min_prediv--; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2536 | if (min_prediv == 1) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2537 | break; |
| 2538 | } |
| 2539 | deb_info("MIN prediv = %d : MAX prediv = %d", min_prediv, max_prediv); |
| 2540 | |
| 2541 | min_prediv = 2; |
| 2542 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2543 | for (prediv = min_prediv ; prediv < max_prediv; prediv++) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2544 | fcp = xtal / prediv; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2545 | if (fcp > fcp_min && fcp < fcp_max) { |
| 2546 | for (loopdiv = 1 ; loopdiv < 64 ; loopdiv++) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2547 | fdem = ((xtal/prediv) * loopdiv); |
| 2548 | fs = fdem / 4; |
| 2549 | /* test min/max system restrictions */ |
| 2550 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2551 | if ((fdem >= fdem_min) && (fdem <= fdem_max) && (fs >= fe->dtv_property_cache.bandwidth_hz/1000)) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2552 | spur = 0; |
| 2553 | /* test fs harmonics positions */ |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2554 | for (harmonic_id = (fe->dtv_property_cache.frequency / (1000*fs)) ; harmonic_id <= ((fe->dtv_property_cache.frequency / (1000*fs))+1) ; harmonic_id++) { |
| 2555 | if (((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)))) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2556 | spur = 1; |
| 2557 | break; |
| 2558 | } |
| 2559 | } |
| 2560 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2561 | if (!spur) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2562 | adc->pll_loopdiv = loopdiv; |
| 2563 | adc->pll_prediv = prediv; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2564 | adc->timf = 2396745143UL/fdem*(1 << 9); |
| 2565 | adc->timf += ((2396745143UL%fdem) << 9)/fdem; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2566 | deb_info("loopdiv=%i prediv=%i timf=%i", loopdiv, prediv, adc->timf); |
| 2567 | break; |
| 2568 | } |
| 2569 | } |
| 2570 | } |
| 2571 | } |
| 2572 | if (!spur) |
| 2573 | break; |
| 2574 | } |
| 2575 | |
| 2576 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2577 | if (adc->pll_loopdiv == 0 && adc->pll_prediv == 0) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2578 | return -EINVAL; |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2579 | else |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2580 | return 0; |
| 2581 | } |
| 2582 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 2583 | static int dib7090_agc_startup(struct dvb_frontend *fe) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2584 | { |
| 2585 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 2586 | struct dib0700_adapter_state *state = adap->priv; |
| 2587 | struct dibx000_bandwidth_config pll; |
| 2588 | u16 target; |
Olivier Grenie | 5e9c85d | 2012-12-31 10:17:44 -0300 | [diff] [blame] | 2589 | struct dibx090p_best_adc adc; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2590 | int ret; |
| 2591 | |
Mauro Carvalho Chehab | 14d24d1 | 2011-12-24 12:24:33 -0300 | [diff] [blame] | 2592 | ret = state->set_param_save(fe); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2593 | if (ret < 0) |
| 2594 | return ret; |
| 2595 | |
| 2596 | memset(&pll, 0, sizeof(struct dibx000_bandwidth_config)); |
| 2597 | dib0090_pwm_gain_reset(fe); |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 2598 | target = (dib0090_get_wbd_target(fe) * 8 + 1) / 2; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2599 | state->dib7000p_ops.set_wbd_ref(fe, target); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2600 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2601 | if (dib7090p_get_best_sampling(fe, &adc) == 0) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2602 | pll.pll_ratio = adc.pll_loopdiv; |
| 2603 | pll.pll_prediv = adc.pll_prediv; |
| 2604 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2605 | state->dib7000p_ops.update_pll(fe, &pll); |
| 2606 | state->dib7000p_ops.ctrl_timf(fe, DEMOD_TIMF_SET, adc.timf); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2607 | } |
| 2608 | return 0; |
| 2609 | } |
| 2610 | |
Olivier Grenie | 2e80286 | 2011-08-05 10:39:15 -0300 | [diff] [blame] | 2611 | static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart) |
| 2612 | { |
| 2613 | deb_info("AGC restart callback: %d", restart); |
| 2614 | if (restart == 0) /* before AGC startup */ |
| 2615 | dib0090_set_dc_servo(fe, 1); |
| 2616 | return 0; |
| 2617 | } |
| 2618 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2619 | static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global) |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 2620 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2621 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 2622 | struct dib0700_adapter_state *state = adap->priv; |
| 2623 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2624 | deb_info("update LNA: agc global=%i", agc_global); |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 2625 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2626 | if (agc_global < 25000) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2627 | state->dib7000p_ops.set_gpio(fe, 8, 0, 0); |
| 2628 | state->dib7000p_ops.set_agc1_min(fe, 0); |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 2629 | } else { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2630 | state->dib7000p_ops.set_gpio(fe, 8, 0, 1); |
| 2631 | state->dib7000p_ops.set_agc1_min(fe, 32768); |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 2632 | } |
| 2633 | |
| 2634 | return 0; |
| 2635 | } |
| 2636 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2637 | static struct dib0090_wbd_slope dib7090_wbd_table[] = { |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2638 | { 380, 81, 850, 64, 540, 4}, |
| 2639 | { 860, 51, 866, 21, 375, 4}, |
| 2640 | {1700, 0, 250, 0, 100, 6}, |
| 2641 | {2600, 0, 250, 0, 100, 6}, |
| 2642 | { 0xFFFF, 0, 0, 0, 0, 0}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2643 | }; |
| 2644 | |
Olivier Grenie | a685dbb | 2011-08-05 14:10:40 -0300 | [diff] [blame] | 2645 | static struct dibx000_agc_config dib7090_agc_config[2] = { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2646 | { |
| 2647 | .band_caps = BAND_UHF, |
| 2648 | /* 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, |
| 2649 | * 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 */ |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2650 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2651 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2652 | .inv_gain = 687, |
| 2653 | .time_stabiliz = 10, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2654 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2655 | .alpha_level = 0, |
| 2656 | .thlock = 118, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2657 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2658 | .wbd_inv = 0, |
| 2659 | .wbd_ref = 1200, |
| 2660 | .wbd_sel = 3, |
| 2661 | .wbd_alpha = 5, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2662 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2663 | .agc1_max = 65535, |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2664 | .agc1_min = 32768, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2665 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2666 | .agc2_max = 65535, |
| 2667 | .agc2_min = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2668 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2669 | .agc1_pt1 = 0, |
| 2670 | .agc1_pt2 = 32, |
| 2671 | .agc1_pt3 = 114, |
| 2672 | .agc1_slope1 = 143, |
| 2673 | .agc1_slope2 = 144, |
| 2674 | .agc2_pt1 = 114, |
| 2675 | .agc2_pt2 = 227, |
| 2676 | .agc2_slope1 = 116, |
| 2677 | .agc2_slope2 = 117, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2678 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2679 | .alpha_mant = 18, |
| 2680 | .alpha_exp = 0, |
| 2681 | .beta_mant = 20, |
| 2682 | .beta_exp = 59, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2683 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2684 | .perform_agc_softsplit = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2685 | } , { |
| 2686 | .band_caps = BAND_FM | BAND_VHF | BAND_CBAND, |
| 2687 | /* 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, |
| 2688 | * 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 */ |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2689 | .setup = (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2690 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2691 | .inv_gain = 732, |
| 2692 | .time_stabiliz = 10, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2693 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2694 | .alpha_level = 0, |
| 2695 | .thlock = 118, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2696 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2697 | .wbd_inv = 0, |
| 2698 | .wbd_ref = 1200, |
| 2699 | .wbd_sel = 3, |
| 2700 | .wbd_alpha = 5, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2701 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2702 | .agc1_max = 65535, |
| 2703 | .agc1_min = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2704 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2705 | .agc2_max = 65535, |
| 2706 | .agc2_min = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2707 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2708 | .agc1_pt1 = 0, |
| 2709 | .agc1_pt2 = 0, |
| 2710 | .agc1_pt3 = 98, |
| 2711 | .agc1_slope1 = 0, |
| 2712 | .agc1_slope2 = 167, |
Patrick Boettcher | 7f4d527 | 2011-04-03 12:28:08 -0300 | [diff] [blame] | 2713 | .agc2_pt1 = 98, |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2714 | .agc2_pt2 = 255, |
| 2715 | .agc2_slope1 = 104, |
| 2716 | .agc2_slope2 = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2717 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2718 | .alpha_mant = 18, |
| 2719 | .alpha_exp = 0, |
| 2720 | .beta_mant = 20, |
| 2721 | .beta_exp = 59, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2722 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2723 | .perform_agc_softsplit = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2724 | } |
| 2725 | }; |
| 2726 | |
| 2727 | static struct dibx000_bandwidth_config dib7090_clock_config_12_mhz = { |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2728 | 60000, 15000, |
| 2729 | 1, 5, 0, 0, 0, |
| 2730 | 0, 0, 1, 1, 2, |
| 2731 | (3 << 14) | (1 << 12) | (524 << 0), |
| 2732 | (0 << 25) | 0, |
| 2733 | 20452225, |
| 2734 | 15000000, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2735 | }; |
| 2736 | |
| 2737 | static struct dib7000p_config nim7090_dib7000p_config = { |
| 2738 | .output_mpeg2_in_188_bytes = 1, |
| 2739 | .hostbus_diversity = 1, |
| 2740 | .tuner_is_baseband = 1, |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2741 | .update_lna = tfe7790p_update_lna, /* GPIO used is the same as TFE7790 */ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2742 | |
| 2743 | .agc_config_count = 2, |
| 2744 | .agc = dib7090_agc_config, |
| 2745 | |
| 2746 | .bw = &dib7090_clock_config_12_mhz, |
| 2747 | |
| 2748 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 2749 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 2750 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 2751 | |
| 2752 | .pwm_freq_div = 0, |
| 2753 | |
| 2754 | .agc_control = dib7090_agc_restart, |
| 2755 | |
| 2756 | .spur_protect = 0, |
| 2757 | .disable_sample_and_hold = 0, |
| 2758 | .enable_current_mirror = 0, |
| 2759 | .diversity_delay = 0, |
| 2760 | |
| 2761 | .output_mode = OUTMODE_MPEG2_FIFO, |
| 2762 | .enMpegOutput = 1, |
| 2763 | }; |
| 2764 | |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2765 | static int tfe7090p_pvr_update_lna(struct dvb_frontend *fe, u16 agc_global) |
| 2766 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2767 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 2768 | struct dib0700_adapter_state *state = adap->priv; |
| 2769 | |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2770 | deb_info("TFE7090P-PVR update LNA: agc global=%i", agc_global); |
| 2771 | if (agc_global < 25000) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2772 | state->dib7000p_ops.set_gpio(fe, 5, 0, 0); |
| 2773 | state->dib7000p_ops.set_agc1_min(fe, 0); |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2774 | } else { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2775 | state->dib7000p_ops.set_gpio(fe, 5, 0, 1); |
| 2776 | state->dib7000p_ops.set_agc1_min(fe, 32768); |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2777 | } |
| 2778 | |
| 2779 | return 0; |
| 2780 | } |
| 2781 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2782 | static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = { |
| 2783 | { |
| 2784 | .output_mpeg2_in_188_bytes = 1, |
| 2785 | .hostbus_diversity = 1, |
| 2786 | .tuner_is_baseband = 1, |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2787 | .update_lna = tfe7090p_pvr_update_lna, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2788 | |
| 2789 | .agc_config_count = 2, |
| 2790 | .agc = dib7090_agc_config, |
| 2791 | |
| 2792 | .bw = &dib7090_clock_config_12_mhz, |
| 2793 | |
| 2794 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 2795 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 2796 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 2797 | |
| 2798 | .pwm_freq_div = 0, |
| 2799 | |
| 2800 | .agc_control = dib7090_agc_restart, |
| 2801 | |
| 2802 | .spur_protect = 0, |
| 2803 | .disable_sample_and_hold = 0, |
| 2804 | .enable_current_mirror = 0, |
| 2805 | .diversity_delay = 0, |
| 2806 | |
| 2807 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, |
| 2808 | .default_i2c_addr = 0x90, |
| 2809 | .enMpegOutput = 1, |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2810 | }, { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2811 | .output_mpeg2_in_188_bytes = 1, |
| 2812 | .hostbus_diversity = 1, |
| 2813 | .tuner_is_baseband = 1, |
Olivier Grenie | 59501bb | 2012-12-31 09:51:17 -0300 | [diff] [blame] | 2814 | .update_lna = tfe7090p_pvr_update_lna, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2815 | |
| 2816 | .agc_config_count = 2, |
| 2817 | .agc = dib7090_agc_config, |
| 2818 | |
| 2819 | .bw = &dib7090_clock_config_12_mhz, |
| 2820 | |
| 2821 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 2822 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 2823 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 2824 | |
| 2825 | .pwm_freq_div = 0, |
| 2826 | |
| 2827 | .agc_control = dib7090_agc_restart, |
| 2828 | |
| 2829 | .spur_protect = 0, |
| 2830 | .disable_sample_and_hold = 0, |
| 2831 | .enable_current_mirror = 0, |
| 2832 | .diversity_delay = 0, |
| 2833 | |
| 2834 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, |
| 2835 | .default_i2c_addr = 0x92, |
| 2836 | .enMpegOutput = 0, |
| 2837 | } |
| 2838 | }; |
| 2839 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2840 | static struct dib0090_config nim7090_dib0090_config = { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2841 | .io.clock_khz = 12000, |
| 2842 | .io.pll_bypass = 0, |
| 2843 | .io.pll_range = 0, |
| 2844 | .io.pll_prediv = 3, |
| 2845 | .io.pll_loopdiv = 6, |
| 2846 | .io.adc_clock_ratio = 0, |
| 2847 | .io.pll_int_loop_filt = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2848 | |
| 2849 | .freq_offset_khz_uhf = 0, |
| 2850 | .freq_offset_khz_vhf = 0, |
| 2851 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2852 | .clkouttobamse = 1, |
| 2853 | .analog_output = 0, |
| 2854 | |
| 2855 | .wbd_vhf_offset = 0, |
| 2856 | .wbd_cband_offset = 0, |
| 2857 | .use_pwm_agc = 1, |
| 2858 | .clkoutdrive = 0, |
| 2859 | |
| 2860 | .fref_clock_ratio = 0, |
| 2861 | |
| 2862 | .wbd = dib7090_wbd_table, |
| 2863 | |
| 2864 | .ls_cfg_pad_drv = 0, |
| 2865 | .data_tx_drv = 0, |
| 2866 | .low_if = NULL, |
| 2867 | .in_soc = 1, |
| 2868 | }; |
| 2869 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2870 | static struct dib7000p_config tfe7790p_dib7000p_config = { |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2871 | .output_mpeg2_in_188_bytes = 1, |
| 2872 | .hostbus_diversity = 1, |
| 2873 | .tuner_is_baseband = 1, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2874 | .update_lna = tfe7790p_update_lna, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2875 | |
| 2876 | .agc_config_count = 2, |
| 2877 | .agc = dib7090_agc_config, |
| 2878 | |
| 2879 | .bw = &dib7090_clock_config_12_mhz, |
| 2880 | |
| 2881 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 2882 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 2883 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 2884 | |
| 2885 | .pwm_freq_div = 0, |
| 2886 | |
| 2887 | .agc_control = dib7090_agc_restart, |
| 2888 | |
| 2889 | .spur_protect = 0, |
| 2890 | .disable_sample_and_hold = 0, |
| 2891 | .enable_current_mirror = 0, |
| 2892 | .diversity_delay = 0, |
| 2893 | |
| 2894 | .output_mode = OUTMODE_MPEG2_PAR_GATED_CLK, |
| 2895 | .enMpegOutput = 1, |
| 2896 | }; |
| 2897 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2898 | static struct dib0090_config tfe7790p_dib0090_config = { |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2899 | .io.clock_khz = 12000, |
| 2900 | .io.pll_bypass = 0, |
| 2901 | .io.pll_range = 0, |
| 2902 | .io.pll_prediv = 3, |
| 2903 | .io.pll_loopdiv = 6, |
| 2904 | .io.adc_clock_ratio = 0, |
| 2905 | .io.pll_int_loop_filt = 0, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2906 | |
| 2907 | .freq_offset_khz_uhf = 0, |
| 2908 | .freq_offset_khz_vhf = 0, |
| 2909 | |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2910 | .clkouttobamse = 1, |
| 2911 | .analog_output = 0, |
| 2912 | |
| 2913 | .wbd_vhf_offset = 0, |
| 2914 | .wbd_cband_offset = 0, |
| 2915 | .use_pwm_agc = 1, |
| 2916 | .clkoutdrive = 0, |
| 2917 | |
| 2918 | .fref_clock_ratio = 0, |
| 2919 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2920 | .wbd = dib7090_wbd_table, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2921 | |
| 2922 | .ls_cfg_pad_drv = 0, |
| 2923 | .data_tx_drv = 0, |
| 2924 | .low_if = NULL, |
| 2925 | .in_soc = 1, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 2926 | .force_cband_input = 0, |
| 2927 | .is_dib7090e = 0, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 2928 | .force_crystal_mode = 1, |
| 2929 | }; |
| 2930 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2931 | static struct dib0090_config tfe7090pvr_dib0090_config[2] = { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2932 | { |
| 2933 | .io.clock_khz = 12000, |
| 2934 | .io.pll_bypass = 0, |
| 2935 | .io.pll_range = 0, |
| 2936 | .io.pll_prediv = 3, |
| 2937 | .io.pll_loopdiv = 6, |
| 2938 | .io.adc_clock_ratio = 0, |
| 2939 | .io.pll_int_loop_filt = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2940 | |
| 2941 | .freq_offset_khz_uhf = 50, |
| 2942 | .freq_offset_khz_vhf = 70, |
| 2943 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2944 | .clkouttobamse = 1, |
| 2945 | .analog_output = 0, |
| 2946 | |
| 2947 | .wbd_vhf_offset = 0, |
| 2948 | .wbd_cband_offset = 0, |
| 2949 | .use_pwm_agc = 1, |
| 2950 | .clkoutdrive = 0, |
| 2951 | |
| 2952 | .fref_clock_ratio = 0, |
| 2953 | |
| 2954 | .wbd = dib7090_wbd_table, |
| 2955 | |
| 2956 | .ls_cfg_pad_drv = 0, |
| 2957 | .data_tx_drv = 0, |
| 2958 | .low_if = NULL, |
| 2959 | .in_soc = 1, |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2960 | }, { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2961 | .io.clock_khz = 12000, |
| 2962 | .io.pll_bypass = 0, |
| 2963 | .io.pll_range = 0, |
| 2964 | .io.pll_prediv = 3, |
| 2965 | .io.pll_loopdiv = 6, |
| 2966 | .io.adc_clock_ratio = 0, |
| 2967 | .io.pll_int_loop_filt = 0, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2968 | |
| 2969 | .freq_offset_khz_uhf = -50, |
| 2970 | .freq_offset_khz_vhf = -70, |
| 2971 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2972 | .clkouttobamse = 1, |
| 2973 | .analog_output = 0, |
| 2974 | |
| 2975 | .wbd_vhf_offset = 0, |
| 2976 | .wbd_cband_offset = 0, |
| 2977 | .use_pwm_agc = 1, |
| 2978 | .clkoutdrive = 0, |
| 2979 | |
| 2980 | .fref_clock_ratio = 0, |
| 2981 | |
| 2982 | .wbd = dib7090_wbd_table, |
| 2983 | |
| 2984 | .ls_cfg_pad_drv = 0, |
| 2985 | .data_tx_drv = 0, |
| 2986 | .low_if = NULL, |
| 2987 | .in_soc = 1, |
| 2988 | } |
| 2989 | }; |
| 2990 | |
| 2991 | static int nim7090_frontend_attach(struct dvb_usb_adapter *adap) |
| 2992 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 2993 | struct dib0700_adapter_state *state = adap->priv; |
| 2994 | |
| 2995 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 2996 | return -ENODEV; |
| 2997 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 2998 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 2999 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3000 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 3001 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 3002 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 3003 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 3004 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 3005 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3006 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 3007 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3008 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 3009 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3010 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) { |
| 3011 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__); |
| 3012 | dvb_detach(&state->dib7000p_ops); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3013 | return -ENODEV; |
| 3014 | } |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3015 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3016 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3017 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3018 | } |
| 3019 | |
| 3020 | static int nim7090_tuner_attach(struct dvb_usb_adapter *adap) |
| 3021 | { |
| 3022 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3023 | struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); |
| 3024 | |
| 3025 | nim7090_dib0090_config.reset = st->dib7000p_ops.tuner_sleep, |
| 3026 | nim7090_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep, |
| 3027 | nim7090_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3028 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3029 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3030 | return -ENODEV; |
| 3031 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3032 | st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3033 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3034 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 3035 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3036 | return 0; |
| 3037 | } |
| 3038 | |
| 3039 | static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap) |
| 3040 | { |
| 3041 | struct dib0700_state *st = adap->dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3042 | struct dib0700_adapter_state *state = adap->priv; |
| 3043 | |
| 3044 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3045 | return -ENODEV; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3046 | |
| 3047 | /* The TFE7090 requires the dib0700 to not be in master mode */ |
| 3048 | st->disable_streaming_master_mode = 1; |
| 3049 | |
| 3050 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 3051 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3052 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 3053 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 3054 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 3055 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 3056 | |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 3057 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3058 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
Olivier Grenie | b4d6046e | 2011-01-04 13:08:14 -0300 | [diff] [blame] | 3059 | msleep(20); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3060 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 3061 | |
| 3062 | /* initialize IC 0 */ |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3063 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) { |
| 3064 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__); |
| 3065 | dvb_detach(&state->dib7000p_ops); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3066 | return -ENODEV; |
| 3067 | } |
| 3068 | |
| 3069 | dib0700_set_i2c_speed(adap->dev, 340); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3070 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3071 | if (adap->fe_adap[0].fe == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3072 | return -ENODEV; |
| 3073 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3074 | state->dib7000p_ops.slave_reset(adap->fe_adap[0].fe); |
Patrick Boettcher | 7168252 | 2011-04-03 12:44:25 -0300 | [diff] [blame] | 3075 | |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3076 | return 0; |
| 3077 | } |
| 3078 | |
| 3079 | static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap) |
| 3080 | { |
| 3081 | struct i2c_adapter *i2c; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3082 | struct dib0700_adapter_state *state = adap->priv; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3083 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3084 | if (adap->dev->adapter[0].fe_adap[0].fe == NULL) { |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3085 | err("the master dib7090 has to be initialized first"); |
| 3086 | return -ENODEV; /* the master device has not been initialized */ |
| 3087 | } |
| 3088 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3089 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3090 | return -ENODEV; |
| 3091 | |
| 3092 | i2c = state->dib7000p_ops.get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1); |
| 3093 | if (state->dib7000p_ops.i2c_enumeration(i2c, 1, 0x10, &tfe7090pvr_dib7000p_config[1]) != 0) { |
| 3094 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", __func__); |
| 3095 | dvb_detach(&state->dib7000p_ops); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3096 | return -ENODEV; |
| 3097 | } |
| 3098 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3099 | adap->fe_adap[0].fe = state->dib7000p_ops.init(i2c, 0x92, &tfe7090pvr_dib7000p_config[1]); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3100 | dib0700_set_i2c_speed(adap->dev, 200); |
| 3101 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3102 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3103 | } |
| 3104 | |
| 3105 | static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap) |
| 3106 | { |
| 3107 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3108 | struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); |
| 3109 | |
| 3110 | tfe7090pvr_dib0090_config[0].reset = st->dib7000p_ops.tuner_sleep; |
| 3111 | tfe7090pvr_dib0090_config[0].sleep = st->dib7000p_ops.tuner_sleep; |
| 3112 | tfe7090pvr_dib0090_config[0].get_adc_power = st->dib7000p_ops.get_adc_power; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3113 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3114 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3115 | return -ENODEV; |
| 3116 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3117 | st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3118 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3119 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 3120 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3121 | return 0; |
| 3122 | } |
| 3123 | |
| 3124 | static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap) |
| 3125 | { |
| 3126 | struct dib0700_adapter_state *st = adap->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3127 | struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); |
| 3128 | |
| 3129 | tfe7090pvr_dib0090_config[1].reset = st->dib7000p_ops.tuner_sleep; |
| 3130 | tfe7090pvr_dib0090_config[1].sleep = st->dib7000p_ops.tuner_sleep; |
| 3131 | tfe7090pvr_dib0090_config[1].get_adc_power = st->dib7000p_ops.get_adc_power; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3132 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3133 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL) |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3134 | return -ENODEV; |
| 3135 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3136 | st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3137 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3138 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 3139 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3140 | return 0; |
| 3141 | } |
| 3142 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3143 | static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap) |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3144 | { |
| 3145 | struct dib0700_state *st = adap->dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3146 | struct dib0700_adapter_state *state = adap->priv; |
| 3147 | |
| 3148 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3149 | return -ENODEV; |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3150 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3151 | /* The TFE7790P requires the dib0700 to not be in master mode */ |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3152 | st->disable_streaming_master_mode = 1; |
| 3153 | |
| 3154 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 3155 | msleep(20); |
| 3156 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 3157 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 3158 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 3159 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 3160 | msleep(20); |
| 3161 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 3162 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 3163 | msleep(20); |
| 3164 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 3165 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3166 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3167 | 1, 0x10, &tfe7790p_dib7000p_config) != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3168 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3169 | __func__); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3170 | dvb_detach(&state->dib7000p_ops); |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3171 | return -ENODEV; |
| 3172 | } |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3173 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3174 | 0x80, &tfe7790p_dib7000p_config); |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3175 | |
| 3176 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
| 3177 | } |
| 3178 | |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3179 | static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap) |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3180 | { |
| 3181 | struct dib0700_adapter_state *st = adap->priv; |
| 3182 | struct i2c_adapter *tun_i2c = |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3183 | st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); |
| 3184 | |
| 3185 | |
| 3186 | tfe7790p_dib0090_config.reset = st->dib7000p_ops.tuner_sleep; |
| 3187 | tfe7790p_dib0090_config.sleep = st->dib7000p_ops.tuner_sleep; |
| 3188 | tfe7790p_dib0090_config.get_adc_power = st->dib7000p_ops.get_adc_power; |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 3189 | |
| 3190 | if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3191 | &tfe7790p_dib0090_config) == NULL) |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 3192 | return -ENODEV; |
| 3193 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3194 | st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 3195 | |
| 3196 | st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; |
| 3197 | adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; |
| 3198 | return 0; |
| 3199 | } |
| 3200 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3201 | /* STK7070PD */ |
| 3202 | static struct dib7000p_config stk7070pd_dib7000p_config[2] = { |
| 3203 | { |
| 3204 | .output_mpeg2_in_188_bytes = 1, |
| 3205 | |
| 3206 | .agc_config_count = 1, |
| 3207 | .agc = &dib7070_agc_config, |
| 3208 | .bw = &dib7070_bw_config_12_mhz, |
Patrick Boettcher | 3cb2c39 | 2008-01-25 07:25:20 -0300 | [diff] [blame] | 3209 | .tuner_is_baseband = 1, |
| 3210 | .spur_protect = 1, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3211 | |
| 3212 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 3213 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 3214 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 3215 | |
| 3216 | .hostbus_diversity = 1, |
| 3217 | }, { |
| 3218 | .output_mpeg2_in_188_bytes = 1, |
| 3219 | |
| 3220 | .agc_config_count = 1, |
| 3221 | .agc = &dib7070_agc_config, |
| 3222 | .bw = &dib7070_bw_config_12_mhz, |
Patrick Boettcher | 3cb2c39 | 2008-01-25 07:25:20 -0300 | [diff] [blame] | 3223 | .tuner_is_baseband = 1, |
| 3224 | .spur_protect = 1, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3225 | |
| 3226 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
| 3227 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
| 3228 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
| 3229 | |
| 3230 | .hostbus_diversity = 1, |
| 3231 | } |
| 3232 | }; |
| 3233 | |
Jiri Slaby | 52fd5b2 | 2012-01-10 14:11:23 -0300 | [diff] [blame] | 3234 | static void stk7070pd_init(struct dvb_usb_device *dev) |
| 3235 | { |
| 3236 | dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1); |
| 3237 | msleep(10); |
| 3238 | dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1); |
| 3239 | dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1); |
| 3240 | dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1); |
| 3241 | dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0); |
| 3242 | |
| 3243 | dib0700_ctrl_clock(dev, 72, 1); |
| 3244 | |
| 3245 | msleep(10); |
| 3246 | dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1); |
| 3247 | } |
| 3248 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3249 | static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) |
| 3250 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3251 | struct dib0700_adapter_state *state = adap->priv; |
| 3252 | |
| 3253 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3254 | return -ENODEV; |
| 3255 | |
Jiri Slaby | 52fd5b2 | 2012-01-10 14:11:23 -0300 | [diff] [blame] | 3256 | stk7070pd_init(adap->dev); |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3257 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3258 | msleep(10); |
| 3259 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 3260 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3261 | if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 3262 | stk7070pd_dib7000p_config) != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3263 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 3264 | __func__); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3265 | dvb_detach(&state->dib7000p_ops); |
Devin Heitmueller | 83c4fdf | 2009-01-21 01:55:45 -0300 | [diff] [blame] | 3266 | return -ENODEV; |
| 3267 | } |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3268 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3269 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3270 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3271 | } |
| 3272 | |
| 3273 | static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap) |
| 3274 | { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3275 | struct dib0700_adapter_state *state = adap->priv; |
| 3276 | |
| 3277 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3278 | return -ENODEV; |
| 3279 | |
| 3280 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3281 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3282 | } |
| 3283 | |
Jiri Slaby | d43272a | 2012-01-10 14:11:25 -0300 | [diff] [blame] | 3284 | static int novatd_read_status_override(struct dvb_frontend *fe, |
| 3285 | fe_status_t *stat) |
| 3286 | { |
| 3287 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 3288 | struct dvb_usb_device *dev = adap->dev; |
| 3289 | struct dib0700_state *state = dev->priv; |
| 3290 | int ret; |
| 3291 | |
| 3292 | ret = state->read_status(fe, stat); |
| 3293 | |
| 3294 | if (!ret) |
| 3295 | dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, |
| 3296 | !!(*stat & FE_HAS_LOCK)); |
| 3297 | |
| 3298 | return ret; |
| 3299 | } |
| 3300 | |
| 3301 | static int novatd_sleep_override(struct dvb_frontend* fe) |
| 3302 | { |
| 3303 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 3304 | struct dvb_usb_device *dev = adap->dev; |
| 3305 | struct dib0700_state *state = dev->priv; |
| 3306 | |
| 3307 | /* turn off LED */ |
| 3308 | dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0); |
| 3309 | |
| 3310 | return state->sleep(fe); |
| 3311 | } |
| 3312 | |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3313 | /** |
| 3314 | * novatd_frontend_attach - Nova-TD specific attach |
| 3315 | * |
| 3316 | * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for |
| 3317 | * information purposes. |
| 3318 | */ |
| 3319 | static int novatd_frontend_attach(struct dvb_usb_adapter *adap) |
| 3320 | { |
| 3321 | struct dvb_usb_device *dev = adap->dev; |
Jiri Slaby | d43272a | 2012-01-10 14:11:25 -0300 | [diff] [blame] | 3322 | struct dib0700_state *st = dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3323 | struct dib0700_adapter_state *state = adap->priv; |
| 3324 | |
| 3325 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3326 | return -ENODEV; |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3327 | |
| 3328 | if (adap->id == 0) { |
| 3329 | stk7070pd_init(dev); |
| 3330 | |
| 3331 | /* turn the power LED on, the other two off (just in case) */ |
| 3332 | dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0); |
| 3333 | dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0); |
| 3334 | dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1); |
| 3335 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3336 | if (state->dib7000p_ops.i2c_enumeration(&dev->i2c_adap, 2, 18, |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3337 | stk7070pd_dib7000p_config) != 0) { |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3338 | err("%s: state->dib7000p_ops.i2c_enumeration failed. Cannot continue\n", |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3339 | __func__); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3340 | dvb_detach(&state->dib7000p_ops); |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3341 | return -ENODEV; |
| 3342 | } |
| 3343 | } |
| 3344 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3345 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&dev->i2c_adap, |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3346 | adap->id == 0 ? 0x80 : 0x82, |
| 3347 | &stk7070pd_dib7000p_config[adap->id]); |
Jiri Slaby | d43272a | 2012-01-10 14:11:25 -0300 | [diff] [blame] | 3348 | |
| 3349 | if (adap->fe_adap[0].fe == NULL) |
| 3350 | return -ENODEV; |
| 3351 | |
| 3352 | st->read_status = adap->fe_adap[0].fe->ops.read_status; |
| 3353 | adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override; |
| 3354 | st->sleep = adap->fe_adap[0].fe->ops.sleep; |
| 3355 | adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override; |
| 3356 | |
| 3357 | return 0; |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 3358 | } |
| 3359 | |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3360 | /* S5H1411 */ |
| 3361 | static struct s5h1411_config pinnacle_801e_config = { |
| 3362 | .output_mode = S5H1411_PARALLEL_OUTPUT, |
| 3363 | .gpio = S5H1411_GPIO_OFF, |
| 3364 | .mpeg_timing = S5H1411_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK, |
| 3365 | .qam_if = S5H1411_IF_44000, |
| 3366 | .vsb_if = S5H1411_IF_44000, |
| 3367 | .inversion = S5H1411_INVERSION_OFF, |
| 3368 | .status_mode = S5H1411_DEMODLOCKING |
| 3369 | }; |
| 3370 | |
| 3371 | /* Pinnacle PCTV HD Pro 801e GPIOs map: |
| 3372 | GPIO0 - currently unknown |
| 3373 | GPIO1 - xc5000 tuner reset |
| 3374 | GPIO2 - CX25843 sleep |
| 3375 | GPIO3 - currently unknown |
| 3376 | GPIO4 - currently unknown |
| 3377 | GPIO6 - currently unknown |
| 3378 | GPIO7 - currently unknown |
| 3379 | GPIO9 - currently unknown |
| 3380 | GPIO10 - CX25843 reset |
| 3381 | */ |
| 3382 | static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap) |
| 3383 | { |
| 3384 | struct dib0700_state *st = adap->dev->priv; |
| 3385 | |
| 3386 | /* Make use of the new i2c functions from FW 1.20 */ |
| 3387 | st->fw_use_new_i2c_api = 1; |
| 3388 | |
| 3389 | /* The s5h1411 requires the dib0700 to not be in master mode */ |
| 3390 | st->disable_streaming_master_mode = 1; |
| 3391 | |
| 3392 | /* All msleep values taken from Windows USB trace */ |
| 3393 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); |
| 3394 | dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0); |
| 3395 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 3396 | msleep(400); |
| 3397 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 3398 | msleep(60); |
| 3399 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 3400 | msleep(30); |
| 3401 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
| 3402 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
| 3403 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
| 3404 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
| 3405 | dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0); |
| 3406 | msleep(30); |
| 3407 | |
| 3408 | /* Put the CX25843 to sleep for now since we're in digital mode */ |
| 3409 | dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); |
| 3410 | |
| 3411 | /* GPIOs are initialized, do the attach */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3412 | adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3413 | &adap->dev->i2c_adap); |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3414 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3415 | } |
| 3416 | |
Michael Krufky | 767f3b3 | 2008-09-25 09:47:07 -0300 | [diff] [blame] | 3417 | static int dib0700_xc5000_tuner_callback(void *priv, int component, |
| 3418 | int command, int arg) |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3419 | { |
| 3420 | struct dvb_usb_adapter *adap = priv; |
| 3421 | |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 3422 | if (command == XC5000_TUNER_RESET) { |
| 3423 | /* Reset the tuner */ |
| 3424 | dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); |
Devin Heitmueller | f0f4633 | 2009-05-04 21:57:41 -0300 | [diff] [blame] | 3425 | msleep(10); |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 3426 | dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); |
Devin Heitmueller | f0f4633 | 2009-05-04 21:57:41 -0300 | [diff] [blame] | 3427 | msleep(10); |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 3428 | } else { |
| 3429 | err("xc5000: unknown tuner callback command: %d\n", command); |
| 3430 | return -EINVAL; |
| 3431 | } |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3432 | |
| 3433 | return 0; |
| 3434 | } |
| 3435 | |
| 3436 | static struct xc5000_config s5h1411_xc5000_tunerconfig = { |
| 3437 | .i2c_address = 0x64, |
| 3438 | .if_khz = 5380, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3439 | }; |
| 3440 | |
| 3441 | static int xc5000_tuner_attach(struct dvb_usb_adapter *adap) |
| 3442 | { |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 3443 | /* FIXME: generalize & move to common area */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3444 | adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback; |
Devin Heitmueller | 79025a9 | 2008-10-06 12:07:48 -0300 | [diff] [blame] | 3445 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3446 | return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, |
Michael Krufky | 767f3b3 | 2008-09-25 09:47:07 -0300 | [diff] [blame] | 3447 | &s5h1411_xc5000_tunerconfig) |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3448 | == NULL ? -ENODEV : 0; |
| 3449 | } |
| 3450 | |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3451 | static int dib0700_xc4000_tuner_callback(void *priv, int component, |
| 3452 | int command, int arg) |
| 3453 | { |
| 3454 | struct dvb_usb_adapter *adap = priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3455 | struct dib0700_adapter_state *state = adap->priv; |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3456 | |
| 3457 | if (command == XC4000_TUNER_RESET) { |
| 3458 | /* Reset the tuner */ |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3459 | state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0); |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3460 | msleep(10); |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3461 | state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3462 | } else { |
| 3463 | err("xc4000: unknown tuner callback command: %d\n", command); |
| 3464 | return -EINVAL; |
| 3465 | } |
| 3466 | |
| 3467 | return 0; |
| 3468 | } |
| 3469 | |
Devin Heitmueller | 8583fc8 | 2009-07-28 01:16:05 -0300 | [diff] [blame] | 3470 | static struct dibx000_agc_config stk7700p_7000p_xc4000_agc_config = { |
| 3471 | .band_caps = BAND_UHF | BAND_VHF, |
| 3472 | .setup = 0x64, |
| 3473 | .inv_gain = 0x02c8, |
| 3474 | .time_stabiliz = 0x15, |
| 3475 | .alpha_level = 0x00, |
| 3476 | .thlock = 0x76, |
| 3477 | .wbd_inv = 0x01, |
| 3478 | .wbd_ref = 0x0b33, |
| 3479 | .wbd_sel = 0x00, |
| 3480 | .wbd_alpha = 0x02, |
| 3481 | .agc1_max = 0x00, |
| 3482 | .agc1_min = 0x00, |
| 3483 | .agc2_max = 0x9b26, |
| 3484 | .agc2_min = 0x26ca, |
| 3485 | .agc1_pt1 = 0x00, |
| 3486 | .agc1_pt2 = 0x00, |
| 3487 | .agc1_pt3 = 0x00, |
| 3488 | .agc1_slope1 = 0x00, |
| 3489 | .agc1_slope2 = 0x00, |
| 3490 | .agc2_pt1 = 0x00, |
| 3491 | .agc2_pt2 = 0x80, |
| 3492 | .agc2_slope1 = 0x1d, |
| 3493 | .agc2_slope2 = 0x1d, |
Devin Heitmueller | 2df1251 | 2009-12-27 17:44:31 -0300 | [diff] [blame] | 3494 | .alpha_mant = 0x11, |
Devin Heitmueller | 8583fc8 | 2009-07-28 01:16:05 -0300 | [diff] [blame] | 3495 | .alpha_exp = 0x1b, |
| 3496 | .beta_mant = 0x17, |
| 3497 | .beta_exp = 0x33, |
| 3498 | .perform_agc_softsplit = 0x00, |
| 3499 | }; |
| 3500 | |
Devin Heitmueller | f1c78d3 | 2009-10-05 00:34:04 -0300 | [diff] [blame] | 3501 | static struct dibx000_bandwidth_config stk7700p_xc4000_pll_config = { |
istvan_v@mailbox.hu | 341747b | 2011-06-06 12:54:54 -0300 | [diff] [blame] | 3502 | 60000, 30000, /* internal, sampling */ |
| 3503 | 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ |
| 3504 | 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, */ |
| 3505 | /* ADClkSrc, modulo */ |
| 3506 | (3 << 14) | (1 << 12) | 524, /* sad_cfg: refsel, sel, freq_15k */ |
| 3507 | 39370534, /* ifreq */ |
| 3508 | 20452225, /* timf */ |
| 3509 | 30000000 /* xtal */ |
Devin Heitmueller | f1c78d3 | 2009-10-05 00:34:04 -0300 | [diff] [blame] | 3510 | }; |
| 3511 | |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3512 | /* FIXME: none of these inputs are validated yet */ |
| 3513 | static struct dib7000p_config pctv_340e_config = { |
Devin Heitmueller | 62956ce | 2009-12-27 18:58:11 -0300 | [diff] [blame] | 3514 | .output_mpeg2_in_188_bytes = 1, |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3515 | |
| 3516 | .agc_config_count = 1, |
Devin Heitmueller | 8583fc8 | 2009-07-28 01:16:05 -0300 | [diff] [blame] | 3517 | .agc = &stk7700p_7000p_xc4000_agc_config, |
Devin Heitmueller | f1c78d3 | 2009-10-05 00:34:04 -0300 | [diff] [blame] | 3518 | .bw = &stk7700p_xc4000_pll_config, |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3519 | |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3520 | .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, |
| 3521 | .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, |
| 3522 | .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, |
| 3523 | }; |
| 3524 | |
| 3525 | /* PCTV 340e GPIOs map: |
| 3526 | dib0700: |
| 3527 | GPIO2 - CX25843 sleep |
| 3528 | GPIO3 - CS5340 reset |
| 3529 | GPIO5 - IRD |
| 3530 | GPIO6 - Power Supply |
| 3531 | GPIO8 - LNA (1=off 0=on) |
| 3532 | GPIO10 - CX25843 reset |
| 3533 | dib7000: |
| 3534 | GPIO8 - xc4000 reset |
| 3535 | */ |
| 3536 | static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) |
| 3537 | { |
| 3538 | struct dib0700_state *st = adap->dev->priv; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3539 | struct dib0700_adapter_state *state = adap->priv; |
| 3540 | |
| 3541 | if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops)) |
| 3542 | return -ENODEV; |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3543 | |
| 3544 | /* Power Supply on */ |
| 3545 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
| 3546 | msleep(50); |
| 3547 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 3548 | msleep(100); /* Allow power supply to settle before probing */ |
| 3549 | |
| 3550 | /* cx25843 reset */ |
| 3551 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 3552 | msleep(1); /* cx25843 datasheet say 350us required */ |
| 3553 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 3554 | |
| 3555 | /* LNA off for now */ |
| 3556 | dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1); |
| 3557 | |
| 3558 | /* Put the CX25843 to sleep for now since we're in digital mode */ |
| 3559 | dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); |
| 3560 | |
| 3561 | /* FIXME: not verified yet */ |
| 3562 | dib0700_ctrl_clock(adap->dev, 72, 1); |
| 3563 | |
Devin Heitmueller | 2750d9c | 2009-07-20 00:42:33 -0300 | [diff] [blame] | 3564 | msleep(500); |
| 3565 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3566 | if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap) == 0) { |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3567 | /* Demodulator not found for some reason? */ |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3568 | dvb_detach(&state->dib7000p_ops); |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3569 | return -ENODEV; |
| 3570 | } |
| 3571 | |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3572 | adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x12, |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3573 | &pctv_340e_config); |
| 3574 | st->is_dib7000pc = 1; |
| 3575 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3576 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 3577 | } |
| 3578 | |
Devin Heitmueller | 8583fc8 | 2009-07-28 01:16:05 -0300 | [diff] [blame] | 3579 | static struct xc4000_config dib7000p_xc4000_tunerconfig = { |
istvan_v@mailbox.hu | 8edeb6e | 2011-06-06 13:03:44 -0300 | [diff] [blame] | 3580 | .i2c_address = 0x61, |
| 3581 | .default_pm = 1, |
| 3582 | .dvb_amplitude = 0, |
| 3583 | .set_smoothedcvbs = 0, |
| 3584 | .if_khz = 5400 |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3585 | }; |
| 3586 | |
| 3587 | static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) |
| 3588 | { |
Devin Heitmueller | 59d0c37 | 2009-06-29 21:11:02 -0300 | [diff] [blame] | 3589 | struct i2c_adapter *tun_i2c; |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3590 | struct dib0700_adapter_state *state = adap->priv; |
Devin Heitmueller | 59d0c37 | 2009-06-29 21:11:02 -0300 | [diff] [blame] | 3591 | |
| 3592 | /* The xc4000 is not on the main i2c bus */ |
Mauro Carvalho Chehab | 8abe4a0 | 2014-05-29 09:20:15 -0300 | [diff] [blame] | 3593 | tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, |
Devin Heitmueller | 59d0c37 | 2009-06-29 21:11:02 -0300 | [diff] [blame] | 3594 | DIBX000_I2C_INTERFACE_TUNER, 1); |
| 3595 | if (tun_i2c == NULL) { |
Mauro Carvalho Chehab | 941830c | 2011-06-06 16:51:11 -0300 | [diff] [blame] | 3596 | printk(KERN_ERR "Could not reach tuner i2c bus\n"); |
Devin Heitmueller | 59d0c37 | 2009-06-29 21:11:02 -0300 | [diff] [blame] | 3597 | return 0; |
| 3598 | } |
| 3599 | |
| 3600 | /* Setup the reset callback */ |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3601 | adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback; |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3602 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3603 | return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c, |
Devin Heitmueller | 8583fc8 | 2009-07-28 01:16:05 -0300 | [diff] [blame] | 3604 | &dib7000p_xc4000_tunerconfig) |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3605 | == NULL ? -ENODEV : 0; |
| 3606 | } |
| 3607 | |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 3608 | static struct lgdt3305_config hcw_lgdt3305_config = { |
| 3609 | .i2c_addr = 0x0e, |
| 3610 | .mpeg_mode = LGDT3305_MPEG_PARALLEL, |
| 3611 | .tpclk_edge = LGDT3305_TPCLK_FALLING_EDGE, |
| 3612 | .tpvalid_polarity = LGDT3305_TP_VALID_LOW, |
| 3613 | .deny_i2c_rptr = 0, |
| 3614 | .spectral_inversion = 1, |
| 3615 | .qam_if_khz = 6000, |
| 3616 | .vsb_if_khz = 6000, |
| 3617 | .usref_8vsb = 0x0500, |
| 3618 | }; |
| 3619 | |
| 3620 | static struct mxl5007t_config hcw_mxl5007t_config = { |
| 3621 | .xtal_freq_hz = MxL_XTAL_25_MHZ, |
| 3622 | .if_freq_hz = MxL_IF_6_MHZ, |
| 3623 | .invert_if = 1, |
| 3624 | }; |
| 3625 | |
| 3626 | /* TIGER-ATSC map: |
| 3627 | GPIO0 - LNA_CTR (H: LNA power enabled, L: LNA power disabled) |
| 3628 | GPIO1 - ANT_SEL (H: VPA, L: MCX) |
| 3629 | GPIO4 - SCL2 |
| 3630 | GPIO6 - EN_TUNER |
| 3631 | GPIO7 - SDA2 |
| 3632 | GPIO10 - DEM_RST |
| 3633 | |
| 3634 | MXL is behind LG's i2c repeater. LG is on SCL2/SDA2 gpios on the DIB |
| 3635 | */ |
| 3636 | static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) |
| 3637 | { |
| 3638 | struct dib0700_state *st = adap->dev->priv; |
| 3639 | |
| 3640 | /* Make use of the new i2c functions from FW 1.20 */ |
| 3641 | st->fw_use_new_i2c_api = 1; |
| 3642 | |
| 3643 | st->disable_streaming_master_mode = 1; |
| 3644 | |
| 3645 | /* fe power enable */ |
| 3646 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
| 3647 | msleep(30); |
| 3648 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
| 3649 | msleep(30); |
| 3650 | |
| 3651 | /* demod reset */ |
| 3652 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 3653 | msleep(30); |
| 3654 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
| 3655 | msleep(30); |
| 3656 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
| 3657 | msleep(30); |
| 3658 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3659 | adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach, |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 3660 | &hcw_lgdt3305_config, |
| 3661 | &adap->dev->i2c_adap); |
| 3662 | |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3663 | return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 3664 | } |
| 3665 | |
| 3666 | static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap) |
| 3667 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3668 | return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe, |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 3669 | &adap->dev->i2c_adap, 0x60, |
| 3670 | &hcw_mxl5007t_config) == NULL ? -ENODEV : 0; |
| 3671 | } |
| 3672 | |
| 3673 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3674 | /* DVB-USB and USB stuff follows */ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3675 | struct usb_device_id dib0700_usb_id_table[] = { |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3676 | /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3677 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) }, |
| 3678 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, |
| 3679 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, |
| 3680 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3681 | /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3682 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) }, |
| 3683 | { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) }, |
| 3684 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, |
| 3685 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3686 | /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3687 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, |
| 3688 | { USB_DEVICE(USB_VID_TERRATEC, |
| 3689 | USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, |
| 3690 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, |
| 3691 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3692 | /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3693 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, |
| 3694 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) }, |
| 3695 | { USB_DEVICE(USB_VID_PINNACLE, |
| 3696 | USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, |
| 3697 | { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) }, |
Joachim Steiger | fa3b877 | 2007-10-08 20:08:46 -0300 | [diff] [blame] | 3698 | /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3699 | { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) }, |
| 3700 | { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, |
| 3701 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) }, |
| 3702 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) }, |
| 3703 | /* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, |
| 3704 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, |
| 3705 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) }, |
| 3706 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) }, |
| 3707 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) }, |
| 3708 | /* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) }, |
| 3709 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) }, |
| 3710 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, |
Alexander Simon | dc88807 | 2008-03-29 21:37:54 -0300 | [diff] [blame] | 3711 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS) }, |
Darryl Green | 5da4e2c | 2008-03-29 21:47:43 -0300 | [diff] [blame] | 3712 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P_2) }, |
Michael Krufky | af2a887 | 2008-09-03 17:12:24 -0300 | [diff] [blame] | 3713 | /* 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] | 3714 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_3) }, |
Finn Thain | 17a370b | 2008-09-06 13:42:47 -0300 | [diff] [blame] | 3715 | { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U8000) }, |
Daniel Oliveira Nascimento | 8751aaa | 2008-09-07 12:39:44 -0300 | [diff] [blame] | 3716 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700PH) }, |
Albert Comerma | 5769743 | 2008-09-07 12:43:33 -0300 | [diff] [blame] | 3717 | { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000H) }, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 3718 | /* 40 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E) }, |
Devin Heitmueller | d2fc3bf | 2008-09-25 06:22:23 -0300 | [diff] [blame] | 3719 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV801E_SE) }, |
Yusuf Altin | bb1b082 | 2009-01-08 07:58:45 -0300 | [diff] [blame] | 3720 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_EXPRESS) }, |
Nicolas Fournier | db4b2d1 | 2009-01-13 07:15:25 -0300 | [diff] [blame] | 3721 | { USB_DEVICE(USB_VID_TERRATEC, |
| 3722 | USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2) }, |
sebastian.blanes@gmail.com | 0a6e1ed | 2009-02-24 14:51:43 -0300 | [diff] [blame] | 3723 | { USB_DEVICE(USB_VID_SONY, USB_PID_SONY_PLAYTV) }, |
Pascal Terjan | 9abb6e6 | 2009-02-26 10:31:41 -0300 | [diff] [blame] | 3724 | /* 45 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_PD378S) }, |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 3725 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC) }, |
| 3726 | { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_TIGER_ATSC_B210) }, |
Xoan Loureiro | 16ba1ee | 2009-03-29 08:43:36 -0300 | [diff] [blame] | 3727 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_MC770) }, |
Klaus Flittner | 919a548 | 2009-03-29 09:12:06 -0300 | [diff] [blame] | 3728 | { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT) }, |
Armin Schenker | 513846e | 2009-04-20 11:57:49 -0300 | [diff] [blame] | 3729 | /* 50 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_Dlx) }, |
tomas petr | f0f4ae7 | 2009-05-20 05:28:05 -0300 | [diff] [blame] | 3730 | { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_H) }, |
Patrick Boettcher | a9b8fe3 | 2009-05-20 05:35:02 -0300 | [diff] [blame] | 3731 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T3) }, |
| 3732 | { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_T5) }, |
Pete Hildebrandt | c53d83c | 2009-08-05 11:46:38 -0300 | [diff] [blame] | 3733 | { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D) }, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 3734 | /* 55 */{ USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_STK7700D_2) }, |
| 3735 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73A) }, |
Patrick Boettcher | e414753 | 2009-11-30 13:52:57 -0300 | [diff] [blame] | 3736 | { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV73ESE) }, |
| 3737 | { USB_DEVICE(USB_VID_PCTV, USB_PID_PINNACLE_PCTV282E) }, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 3738 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7770P) }, |
Patrick Boettcher | db48138 | 2009-09-15 07:16:51 -0300 | [diff] [blame] | 3739 | /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) }, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 3740 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, |
| 3741 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, |
Mauro Carvalho Chehab | 3bfb317 | 2010-09-03 10:50:24 -0300 | [diff] [blame] | 3742 | { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) }, |
S?rgio Fortier | 8a378e8 | 2009-09-28 04:19:21 -0300 | [diff] [blame] | 3743 | { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, |
Patrick Boettcher | 20232c4 | 2009-12-01 12:08:56 -0300 | [diff] [blame] | 3744 | /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, |
Patrick Boettcher | e414753 | 2009-11-30 13:52:57 -0300 | [diff] [blame] | 3745 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 3746 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK8096GP) }, |
Michael Müller | 84e2f03 | 2010-04-26 22:18:57 -0300 | [diff] [blame] | 3747 | { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DIVERSITY) }, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 3748 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090M) }, |
| 3749 | /* 70 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM8096MD) }, |
| 3750 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM9090MD) }, |
| 3751 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_NIM7090) }, |
| 3752 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090PVR) }, |
Lukas Max Fisch | 498e677 | 2011-02-08 16:51:45 -0300 | [diff] [blame] | 3753 | { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_AIRSTAR_TELESTICK_2) }, |
Stéphane Elmaleh | d140230 | 2011-05-21 07:33:38 -0300 | [diff] [blame] | 3754 | /* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) }, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 3755 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) }, |
Devin Heitmueller | 33fb168 | 2009-06-23 22:48:02 -0300 | [diff] [blame] | 3756 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) }, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 3757 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790P) }, |
| 3758 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) }, |
| 3759 | /* 80 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) }, |
Michael Krufky | c859e6e | 2013-06-30 12:43:58 -0300 | [diff] [blame] | 3760 | { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E) }, |
| 3761 | { USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_2002E_SE) }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3762 | { 0 } /* Terminating entry */ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3763 | }; |
| 3764 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); |
| 3765 | |
| 3766 | #define DIB0700_DEFAULT_DEVICE_PROPERTIES \ |
| 3767 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, \ |
| 3768 | .usb_ctrl = DEVICE_SPECIFIC, \ |
Devin Heitmueller | bdc203e | 2008-09-06 13:45:27 -0300 | [diff] [blame] | 3769 | .firmware = "dvb-usb-dib0700-1.20.fw", \ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3770 | .download_firmware = dib0700_download_firmware, \ |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 3771 | .no_reconnect = 1, \ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3772 | .size_of_priv = sizeof(struct dib0700_state), \ |
Patrick Boettcher | 6958eff | 2006-09-19 12:51:40 -0300 | [diff] [blame] | 3773 | .i2c_algo = &dib0700_i2c_algo, \ |
| 3774 | .identify_state = dib0700_identify_state |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3775 | |
| 3776 | #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \ |
| 3777 | .streaming_ctrl = dib0700_streaming_ctrl, \ |
| 3778 | .stream = { \ |
| 3779 | .type = USB_BULK, \ |
| 3780 | .count = 4, \ |
| 3781 | .endpoint = ep, \ |
| 3782 | .u = { \ |
| 3783 | .bulk = { \ |
| 3784 | .buffersize = 39480, \ |
| 3785 | } \ |
| 3786 | } \ |
| 3787 | } |
| 3788 | |
| 3789 | struct dvb_usb_device_properties dib0700_devices[] = { |
| 3790 | { |
| 3791 | DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 3792 | |
| 3793 | .num_adapters = 1, |
| 3794 | .adapter = { |
| 3795 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3796 | .num_frontends = 1, |
| 3797 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 3798 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 3799 | .pid_filter_count = 32, |
Olivier Grenie | e192a7c | 2011-01-14 13:58:59 -0300 | [diff] [blame] | 3800 | .pid_filter = stk7700p_pid_filter, |
| 3801 | .pid_filter_ctrl = stk7700p_pid_filter_ctrl, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3802 | .frontend_attach = stk7700p_frontend_attach, |
| 3803 | .tuner_attach = stk7700p_tuner_attach, |
| 3804 | |
| 3805 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3806 | }}, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3807 | }, |
| 3808 | }, |
| 3809 | |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 3810 | .num_device_descs = 8, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3811 | .devices = { |
| 3812 | { "DiBcom STK7700P reference design", |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 3813 | { &dib0700_usb_id_table[0], &dib0700_usb_id_table[1] }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3814 | { NULL }, |
| 3815 | }, |
| 3816 | { "Hauppauge Nova-T Stick", |
Stefan Traby | f9aeba4 | 2006-11-12 13:02:51 -0300 | [diff] [blame] | 3817 | { &dib0700_usb_id_table[4], &dib0700_usb_id_table[9], NULL }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3818 | { NULL }, |
| 3819 | }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 3820 | { "AVerMedia AVerTV DVB-T Volar", |
Jose Carlos Garcia Sogo | ced8fec | 2006-11-14 05:01:47 -0300 | [diff] [blame] | 3821 | { &dib0700_usb_id_table[5], &dib0700_usb_id_table[10] }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 3822 | { NULL }, |
| 3823 | }, |
| 3824 | { "Compro Videomate U500", |
Patrick Boettcher | 1f8ca4b | 2007-07-30 14:24:37 -0300 | [diff] [blame] | 3825 | { &dib0700_usb_id_table[6], &dib0700_usb_id_table[19] }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 3826 | { NULL }, |
Henning Schroeer | 0ce215e | 2006-10-19 07:58:22 -0300 | [diff] [blame] | 3827 | }, |
| 3828 | { "Uniwill STK7700P based (Hama and others)", |
| 3829 | { &dib0700_usb_id_table[7], NULL }, |
| 3830 | { NULL }, |
Michael Krufky | 8637a87 | 2006-11-08 16:47:32 -0300 | [diff] [blame] | 3831 | }, |
| 3832 | { "Leadtek Winfast DTV Dongle (STK7700P based)", |
Patrick Boettcher | 1e13c8f | 2009-09-19 05:24:40 -0300 | [diff] [blame] | 3833 | { &dib0700_usb_id_table[8], &dib0700_usb_id_table[34] }, |
Michael Krufky | 8637a87 | 2006-11-08 16:47:32 -0300 | [diff] [blame] | 3834 | { NULL }, |
Joachim Steiger | fa3b877 | 2007-10-08 20:08:46 -0300 | [diff] [blame] | 3835 | }, |
| 3836 | { "AVerMedia AVerTV DVB-T Express", |
| 3837 | { &dib0700_usb_id_table[20] }, |
| 3838 | { NULL }, |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 3839 | }, |
dominik | 67053a4 | 2007-11-10 19:23:31 -0300 | [diff] [blame] | 3840 | { "Gigabyte U7000", |
| 3841 | { &dib0700_usb_id_table[21], NULL }, |
| 3842 | { NULL }, |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 3843 | } |
Darren Salt | b1139e3 | 2007-08-18 18:05:31 -0300 | [diff] [blame] | 3844 | }, |
| 3845 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 3846 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3847 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 3848 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 3849 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 3850 | .allowed_protos = RC_BIT_RC5 | |
| 3851 | RC_BIT_RC6_MCE | |
| 3852 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 3853 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3854 | }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3855 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 3856 | |
| 3857 | .num_adapters = 2, |
| 3858 | .adapter = { |
| 3859 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3860 | .num_frontends = 1, |
| 3861 | .fe = {{ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3862 | .frontend_attach = bristol_frontend_attach, |
| 3863 | .tuner_attach = bristol_tuner_attach, |
| 3864 | |
| 3865 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3866 | }}, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3867 | }, { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3868 | .num_frontends = 1, |
| 3869 | .fe = {{ |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3870 | .frontend_attach = bristol_frontend_attach, |
| 3871 | .tuner_attach = bristol_tuner_attach, |
| 3872 | |
| 3873 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3874 | }}, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3875 | } |
| 3876 | }, |
| 3877 | |
| 3878 | .num_device_descs = 1, |
| 3879 | .devices = { |
| 3880 | { "Hauppauge Nova-T 500 Dual DVB-T", |
Tomi Koivulahti | 49a1376 | 2006-10-19 07:27:19 -0300 | [diff] [blame] | 3881 | { &dib0700_usb_id_table[2], &dib0700_usb_id_table[3], NULL }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 3882 | { NULL }, |
| 3883 | }, |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 3884 | }, |
| 3885 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 3886 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3887 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 3888 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 3889 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 3890 | .allowed_protos = RC_BIT_RC5 | |
| 3891 | RC_BIT_RC6_MCE | |
| 3892 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 3893 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3894 | }, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3895 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 3896 | |
| 3897 | .num_adapters = 2, |
| 3898 | .adapter = { |
| 3899 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3900 | .num_frontends = 1, |
| 3901 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 3902 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 3903 | .pid_filter_count = 32, |
| 3904 | .pid_filter = stk70x0p_pid_filter, |
| 3905 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3906 | .frontend_attach = stk7700d_frontend_attach, |
| 3907 | .tuner_attach = stk7700d_tuner_attach, |
| 3908 | |
| 3909 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3910 | }}, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3911 | }, { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3912 | .num_frontends = 1, |
| 3913 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 3914 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 3915 | .pid_filter_count = 32, |
| 3916 | .pid_filter = stk70x0p_pid_filter, |
| 3917 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3918 | .frontend_attach = stk7700d_frontend_attach, |
| 3919 | .tuner_attach = stk7700d_tuner_attach, |
| 3920 | |
| 3921 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3922 | }}, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3923 | } |
| 3924 | }, |
| 3925 | |
James A Webb | 200e861 | 2009-08-04 02:38:05 -0300 | [diff] [blame] | 3926 | .num_device_descs = 5, |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3927 | .devices = { |
| 3928 | { "Pinnacle PCTV 2000e", |
| 3929 | { &dib0700_usb_id_table[11], NULL }, |
| 3930 | { NULL }, |
| 3931 | }, |
| 3932 | { "Terratec Cinergy DT XS Diversity", |
| 3933 | { &dib0700_usb_id_table[12], NULL }, |
| 3934 | { NULL }, |
| 3935 | }, |
Darren Salt | faebb91 | 2007-08-18 18:04:00 -0300 | [diff] [blame] | 3936 | { "Hauppauge Nova-TD Stick/Elgato Eye-TV Diversity", |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3937 | { &dib0700_usb_id_table[13], NULL }, |
| 3938 | { NULL }, |
| 3939 | }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3940 | { "DiBcom STK7700D reference design", |
Patrick Boettcher | b6884a1 | 2007-07-27 10:08:51 -0300 | [diff] [blame] | 3941 | { &dib0700_usb_id_table[14], NULL }, |
| 3942 | { NULL }, |
Yusuf Altin | bb1b082 | 2009-01-08 07:58:45 -0300 | [diff] [blame] | 3943 | }, |
James A Webb | 200e861 | 2009-08-04 02:38:05 -0300 | [diff] [blame] | 3944 | { "YUAN High-Tech DiBcom STK7700D", |
| 3945 | { &dib0700_usb_id_table[55], NULL }, |
| 3946 | { NULL }, |
| 3947 | }, |
Yusuf Altin | bb1b082 | 2009-01-08 07:58:45 -0300 | [diff] [blame] | 3948 | |
Olivier DANET | 54d75eb | 2007-07-25 14:42:54 -0300 | [diff] [blame] | 3949 | }, |
Janne Grunau | 82f3d55 | 2007-07-30 13:50:28 -0300 | [diff] [blame] | 3950 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 3951 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3952 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 3953 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 3954 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 3955 | .allowed_protos = RC_BIT_RC5 | |
| 3956 | RC_BIT_RC6_MCE | |
| 3957 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 3958 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3959 | }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 3960 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 3961 | |
| 3962 | .num_adapters = 1, |
| 3963 | .adapter = { |
| 3964 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3965 | .num_frontends = 1, |
| 3966 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 3967 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 3968 | .pid_filter_count = 32, |
| 3969 | .pid_filter = stk70x0p_pid_filter, |
| 3970 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 3971 | .frontend_attach = stk7700P2_frontend_attach, |
| 3972 | .tuner_attach = stk7700d_tuner_attach, |
| 3973 | |
| 3974 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 3975 | }}, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 3976 | }, |
| 3977 | }, |
| 3978 | |
Yusuf Altin | bb1b082 | 2009-01-08 07:58:45 -0300 | [diff] [blame] | 3979 | .num_device_descs = 3, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 3980 | .devices = { |
| 3981 | { "ASUS My Cinema U3000 Mini DVBT Tuner", |
| 3982 | { &dib0700_usb_id_table[23], NULL }, |
| 3983 | { NULL }, |
| 3984 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3985 | { "Yuan EC372S", |
| 3986 | { &dib0700_usb_id_table[31], NULL }, |
| 3987 | { NULL }, |
Yusuf Altin | bb1b082 | 2009-01-08 07:58:45 -0300 | [diff] [blame] | 3988 | }, |
| 3989 | { "Terratec Cinergy T Express", |
| 3990 | { &dib0700_usb_id_table[42], NULL }, |
| 3991 | { NULL }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 3992 | } |
Chris Rankin | 48aa739 | 2008-09-25 06:52:24 -0300 | [diff] [blame] | 3993 | }, |
| 3994 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 3995 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 3996 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 3997 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 3998 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 3999 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4000 | .allowed_protos = RC_BIT_RC5 | |
| 4001 | RC_BIT_RC6_MCE | |
| 4002 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4003 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4004 | }, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 4005 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4006 | |
| 4007 | .num_adapters = 1, |
| 4008 | .adapter = { |
| 4009 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4010 | .num_frontends = 1, |
| 4011 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4012 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4013 | .pid_filter_count = 32, |
| 4014 | .pid_filter = stk70x0p_pid_filter, |
| 4015 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4016 | .frontend_attach = stk7070p_frontend_attach, |
| 4017 | .tuner_attach = dib7070p_tuner_attach, |
| 4018 | |
| 4019 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4020 | }}, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4021 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4022 | }, |
| 4023 | }, |
| 4024 | |
Gianluca Gennari | 0bc9d39 | 2012-04-14 09:14:07 -0300 | [diff] [blame] | 4025 | .num_device_descs = 12, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4026 | .devices = { |
| 4027 | { "DiBcom STK7070P reference design", |
| 4028 | { &dib0700_usb_id_table[15], NULL }, |
| 4029 | { NULL }, |
| 4030 | }, |
| 4031 | { "Pinnacle PCTV DVB-T Flash Stick", |
| 4032 | { &dib0700_usb_id_table[16], NULL }, |
| 4033 | { NULL }, |
| 4034 | }, |
Yousef Lamlum | 7999a81 | 2008-01-25 05:51:48 -0300 | [diff] [blame] | 4035 | { "Artec T14BR DVB-T", |
| 4036 | { &dib0700_usb_id_table[22], NULL }, |
| 4037 | { NULL }, |
Daniel Gimpelevich | 132c318 | 2008-01-25 06:02:42 -0300 | [diff] [blame] | 4038 | }, |
| 4039 | { "ASUS My Cinema U3100 Mini DVBT Tuner", |
| 4040 | { &dib0700_usb_id_table[24], NULL }, |
| 4041 | { NULL }, |
| 4042 | }, |
Tim Taubert | c7637b1 | 2008-01-25 06:16:36 -0300 | [diff] [blame] | 4043 | { "Hauppauge Nova-T Stick", |
| 4044 | { &dib0700_usb_id_table[25], NULL }, |
| 4045 | { NULL }, |
| 4046 | }, |
Darren Salt | 13b83b5 | 2008-01-25 06:20:02 -0300 | [diff] [blame] | 4047 | { "Hauppauge Nova-T MyTV.t", |
| 4048 | { &dib0700_usb_id_table[26], NULL }, |
| 4049 | { NULL }, |
| 4050 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 4051 | { "Pinnacle PCTV 72e", |
| 4052 | { &dib0700_usb_id_table[29], NULL }, |
| 4053 | { NULL }, |
| 4054 | }, |
| 4055 | { "Pinnacle PCTV 73e", |
| 4056 | { &dib0700_usb_id_table[30], NULL }, |
| 4057 | { NULL }, |
| 4058 | }, |
Klaus Flittner | 919a548 | 2009-03-29 09:12:06 -0300 | [diff] [blame] | 4059 | { "Elgato EyeTV DTT", |
| 4060 | { &dib0700_usb_id_table[49], NULL }, |
| 4061 | { NULL }, |
| 4062 | }, |
Pascal Terjan | 9abb6e6 | 2009-02-26 10:31:41 -0300 | [diff] [blame] | 4063 | { "Yuan PD378S", |
| 4064 | { &dib0700_usb_id_table[45], NULL }, |
| 4065 | { NULL }, |
| 4066 | }, |
Armin Schenker | 513846e | 2009-04-20 11:57:49 -0300 | [diff] [blame] | 4067 | { "Elgato EyeTV Dtt Dlx PD378S", |
| 4068 | { &dib0700_usb_id_table[50], NULL }, |
| 4069 | { NULL }, |
| 4070 | }, |
Gianluca Gennari | 0bc9d39 | 2012-04-14 09:14:07 -0300 | [diff] [blame] | 4071 | { "Elgato EyeTV DTT rev. 2", |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 4072 | { &dib0700_usb_id_table[80], NULL }, |
Gianluca Gennari | 0bc9d39 | 2012-04-14 09:14:07 -0300 | [diff] [blame] | 4073 | { NULL }, |
| 4074 | }, |
Tim Taubert | c7637b1 | 2008-01-25 06:16:36 -0300 | [diff] [blame] | 4075 | }, |
| 4076 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4077 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4078 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4079 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4080 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4081 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4082 | .allowed_protos = RC_BIT_RC5 | |
| 4083 | RC_BIT_RC6_MCE | |
| 4084 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4085 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4086 | }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4087 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4088 | |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4089 | .num_adapters = 1, |
| 4090 | .adapter = { |
| 4091 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4092 | .num_frontends = 1, |
| 4093 | .fe = {{ |
Mauro Carvalho Chehab | 648732f | 2009-11-04 12:11:43 -0200 | [diff] [blame] | 4094 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4095 | .pid_filter_count = 32, |
| 4096 | .pid_filter = stk70x0p_pid_filter, |
| 4097 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4098 | .frontend_attach = stk7070p_frontend_attach, |
| 4099 | .tuner_attach = dib7070p_tuner_attach, |
| 4100 | |
| 4101 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4102 | }}, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4103 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4104 | }, |
| 4105 | }, |
| 4106 | |
Patrick Boettcher | 20232c4 | 2009-12-01 12:08:56 -0300 | [diff] [blame] | 4107 | .num_device_descs = 3, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4108 | .devices = { |
| 4109 | { "Pinnacle PCTV 73A", |
| 4110 | { &dib0700_usb_id_table[56], NULL }, |
| 4111 | { NULL }, |
| 4112 | }, |
| 4113 | { "Pinnacle PCTV 73e SE", |
Patrick Boettcher | 20232c4 | 2009-12-01 12:08:56 -0300 | [diff] [blame] | 4114 | { &dib0700_usb_id_table[57], &dib0700_usb_id_table[65], NULL }, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4115 | { NULL }, |
| 4116 | }, |
| 4117 | { "Pinnacle PCTV 282e", |
Patrick Boettcher | 20232c4 | 2009-12-01 12:08:56 -0300 | [diff] [blame] | 4118 | { &dib0700_usb_id_table[58], &dib0700_usb_id_table[66], NULL }, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4119 | { NULL }, |
| 4120 | }, |
| 4121 | }, |
| 4122 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4123 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4124 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4125 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4126 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4127 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4128 | .allowed_protos = RC_BIT_RC5 | |
| 4129 | RC_BIT_RC6_MCE | |
| 4130 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4131 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4132 | }, |
Olivier Grenie | 74b76f2 | 2009-09-02 08:19:19 -0300 | [diff] [blame] | 4133 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4134 | |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4135 | .num_adapters = 2, |
| 4136 | .adapter = { |
| 4137 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4138 | .num_frontends = 1, |
| 4139 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4140 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4141 | .pid_filter_count = 32, |
| 4142 | .pid_filter = stk70x0p_pid_filter, |
| 4143 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 4144 | .frontend_attach = novatd_frontend_attach, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4145 | .tuner_attach = dib7070p_tuner_attach, |
| 4146 | |
| 4147 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4148 | }}, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4149 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4150 | }, { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4151 | .num_frontends = 1, |
| 4152 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4153 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4154 | .pid_filter_count = 32, |
| 4155 | .pid_filter = stk70x0p_pid_filter, |
| 4156 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Jiri Slaby | 2b05b88 | 2012-01-10 14:11:24 -0300 | [diff] [blame] | 4157 | .frontend_attach = novatd_frontend_attach, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4158 | .tuner_attach = dib7070p_tuner_attach, |
| 4159 | |
| 4160 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4161 | }}, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4162 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4163 | } |
| 4164 | }, |
| 4165 | |
Michael Krufky | c859e6e | 2013-06-30 12:43:58 -0300 | [diff] [blame] | 4166 | .num_device_descs = 3, |
Jiri Slaby | 9b6ba57 | 2012-01-10 14:11:22 -0300 | [diff] [blame] | 4167 | .devices = { |
| 4168 | { "Hauppauge Nova-TD Stick (52009)", |
| 4169 | { &dib0700_usb_id_table[35], NULL }, |
| 4170 | { NULL }, |
| 4171 | }, |
Michael Krufky | c859e6e | 2013-06-30 12:43:58 -0300 | [diff] [blame] | 4172 | { "PCTV 2002e", |
| 4173 | { &dib0700_usb_id_table[81], NULL }, |
| 4174 | { NULL }, |
| 4175 | }, |
| 4176 | { "PCTV 2002e SE", |
| 4177 | { &dib0700_usb_id_table[82], NULL }, |
| 4178 | { NULL }, |
| 4179 | }, |
Jiri Slaby | 9b6ba57 | 2012-01-10 14:11:22 -0300 | [diff] [blame] | 4180 | }, |
| 4181 | |
| 4182 | .rc.core = { |
| 4183 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4184 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4185 | .module_name = "dib0700", |
| 4186 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4187 | .allowed_protos = RC_BIT_RC5 | |
| 4188 | RC_BIT_RC6_MCE | |
| 4189 | RC_BIT_NEC, |
Jiri Slaby | 9b6ba57 | 2012-01-10 14:11:22 -0300 | [diff] [blame] | 4190 | .change_protocol = dib0700_change_protocol, |
| 4191 | }, |
| 4192 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4193 | |
| 4194 | .num_adapters = 2, |
| 4195 | .adapter = { |
| 4196 | { |
| 4197 | .num_frontends = 1, |
| 4198 | .fe = {{ |
| 4199 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4200 | .pid_filter_count = 32, |
| 4201 | .pid_filter = stk70x0p_pid_filter, |
| 4202 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4203 | .frontend_attach = stk7070pd_frontend_attach0, |
| 4204 | .tuner_attach = dib7070p_tuner_attach, |
| 4205 | |
| 4206 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 4207 | }}, |
| 4208 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4209 | }, { |
| 4210 | .num_frontends = 1, |
| 4211 | .fe = {{ |
| 4212 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4213 | .pid_filter_count = 32, |
| 4214 | .pid_filter = stk70x0p_pid_filter, |
| 4215 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4216 | .frontend_attach = stk7070pd_frontend_attach1, |
| 4217 | .tuner_attach = dib7070p_tuner_attach, |
| 4218 | |
| 4219 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
| 4220 | }}, |
| 4221 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4222 | } |
| 4223 | }, |
| 4224 | |
| 4225 | .num_device_descs = 5, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4226 | .devices = { |
| 4227 | { "DiBcom STK7070PD reference design", |
| 4228 | { &dib0700_usb_id_table[17], NULL }, |
| 4229 | { NULL }, |
| 4230 | }, |
| 4231 | { "Pinnacle PCTV Dual DVB-T Diversity Stick", |
| 4232 | { &dib0700_usb_id_table[18], NULL }, |
| 4233 | { NULL }, |
Michael Krufky | d01eb2d | 2008-07-03 23:43:36 -0300 | [diff] [blame] | 4234 | }, |
Michael Krufky | 9a0c04a | 2008-09-03 17:12:24 -0300 | [diff] [blame] | 4235 | { "Hauppauge Nova-TD-500 (84xxx)", |
| 4236 | { &dib0700_usb_id_table[36], NULL }, |
| 4237 | { NULL }, |
Nicolas Fournier | db4b2d1 | 2009-01-13 07:15:25 -0300 | [diff] [blame] | 4238 | }, |
Patrick Boettcher | a9b8fe3 | 2009-05-20 05:35:02 -0300 | [diff] [blame] | 4239 | { "Terratec Cinergy DT USB XS Diversity/ T5", |
| 4240 | { &dib0700_usb_id_table[43], |
| 4241 | &dib0700_usb_id_table[53], NULL}, |
Nicolas Fournier | db4b2d1 | 2009-01-13 07:15:25 -0300 | [diff] [blame] | 4242 | { NULL }, |
sebastian.blanes@gmail.com | 0a6e1ed | 2009-02-24 14:51:43 -0300 | [diff] [blame] | 4243 | }, |
| 4244 | { "Sony PlayTV", |
| 4245 | { &dib0700_usb_id_table[44], NULL }, |
| 4246 | { NULL }, |
Michael Müller | 84e2f03 | 2010-04-26 22:18:57 -0300 | [diff] [blame] | 4247 | }, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4248 | }, |
| 4249 | |
| 4250 | .rc.core = { |
| 4251 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4252 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4253 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4254 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4255 | .allowed_protos = RC_BIT_RC5 | |
| 4256 | RC_BIT_RC6_MCE | |
| 4257 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4258 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4259 | }, |
| 4260 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4261 | |
| 4262 | .num_adapters = 2, |
| 4263 | .adapter = { |
| 4264 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4265 | .num_frontends = 1, |
| 4266 | .fe = {{ |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4267 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4268 | .pid_filter_count = 32, |
| 4269 | .pid_filter = stk70x0p_pid_filter, |
| 4270 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4271 | .frontend_attach = stk7070pd_frontend_attach0, |
| 4272 | .tuner_attach = dib7070p_tuner_attach, |
| 4273 | |
| 4274 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4275 | }}, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4276 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4277 | }, { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4278 | .num_frontends = 1, |
| 4279 | .fe = {{ |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4280 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4281 | .pid_filter_count = 32, |
| 4282 | .pid_filter = stk70x0p_pid_filter, |
| 4283 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4284 | .frontend_attach = stk7070pd_frontend_attach1, |
| 4285 | .tuner_attach = dib7070p_tuner_attach, |
| 4286 | |
| 4287 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4288 | }}, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4289 | .size_of_priv = sizeof(struct dib0700_adapter_state), |
| 4290 | } |
| 4291 | }, |
| 4292 | |
| 4293 | .num_device_descs = 1, |
| 4294 | .devices = { |
Michael Müller | 84e2f03 | 2010-04-26 22:18:57 -0300 | [diff] [blame] | 4295 | { "Elgato EyeTV Diversity", |
| 4296 | { &dib0700_usb_id_table[68], NULL }, |
| 4297 | { NULL }, |
| 4298 | }, |
Arne Luehrs | c985a8d | 2009-01-21 01:37:20 -0300 | [diff] [blame] | 4299 | }, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4300 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4301 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4302 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4303 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4304 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4305 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4306 | .allowed_protos = RC_BIT_RC5 | |
| 4307 | RC_BIT_RC6_MCE | |
| 4308 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4309 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4310 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 4311 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4312 | |
| 4313 | .num_adapters = 1, |
| 4314 | .adapter = { |
| 4315 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4316 | .num_frontends = 1, |
| 4317 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4318 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4319 | .pid_filter_count = 32, |
| 4320 | .pid_filter = stk70x0p_pid_filter, |
| 4321 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 4322 | .frontend_attach = stk7700ph_frontend_attach, |
| 4323 | .tuner_attach = stk7700ph_tuner_attach, |
| 4324 | |
| 4325 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4326 | }}, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 4327 | .size_of_priv = sizeof(struct |
| 4328 | dib0700_adapter_state), |
| 4329 | }, |
| 4330 | }, |
| 4331 | |
Pete Hildebrandt | c53d83c | 2009-08-05 11:46:38 -0300 | [diff] [blame] | 4332 | .num_device_descs = 9, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 4333 | .devices = { |
| 4334 | { "Terratec Cinergy HT USB XE", |
| 4335 | { &dib0700_usb_id_table[27], NULL }, |
| 4336 | { NULL }, |
| 4337 | }, |
| 4338 | { "Pinnacle Expresscard 320cx", |
| 4339 | { &dib0700_usb_id_table[28], NULL }, |
| 4340 | { NULL }, |
| 4341 | }, |
| 4342 | { "Terratec Cinergy HT Express", |
| 4343 | { &dib0700_usb_id_table[32], NULL }, |
| 4344 | { NULL }, |
| 4345 | }, |
Finn Thain | 17a370b | 2008-09-06 13:42:47 -0300 | [diff] [blame] | 4346 | { "Gigabyte U8000-RH", |
| 4347 | { &dib0700_usb_id_table[37], NULL }, |
| 4348 | { NULL }, |
| 4349 | }, |
Daniel Oliveira Nascimento | 8751aaa | 2008-09-07 12:39:44 -0300 | [diff] [blame] | 4350 | { "YUAN High-Tech STK7700PH", |
| 4351 | { &dib0700_usb_id_table[38], NULL }, |
| 4352 | { NULL }, |
| 4353 | }, |
Albert Comerma | 5769743 | 2008-09-07 12:43:33 -0300 | [diff] [blame] | 4354 | { "Asus My Cinema-U3000Hybrid", |
| 4355 | { &dib0700_usb_id_table[39], NULL }, |
| 4356 | { NULL }, |
| 4357 | }, |
Xoan Loureiro | 16ba1ee | 2009-03-29 08:43:36 -0300 | [diff] [blame] | 4358 | { "YUAN High-Tech MC770", |
| 4359 | { &dib0700_usb_id_table[48], NULL }, |
| 4360 | { NULL }, |
| 4361 | }, |
tomas petr | f0f4ae7 | 2009-05-20 05:28:05 -0300 | [diff] [blame] | 4362 | { "Leadtek WinFast DTV Dongle H", |
| 4363 | { &dib0700_usb_id_table[51], NULL }, |
| 4364 | { NULL }, |
| 4365 | }, |
Pete Hildebrandt | c53d83c | 2009-08-05 11:46:38 -0300 | [diff] [blame] | 4366 | { "YUAN High-Tech STK7700D", |
| 4367 | { &dib0700_usb_id_table[54], NULL }, |
| 4368 | { NULL }, |
| 4369 | }, |
Albert Comerma | 6ca8f0b | 2008-03-29 21:35:57 -0300 | [diff] [blame] | 4370 | }, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4371 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4372 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4373 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4374 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4375 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4376 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4377 | .allowed_protos = RC_BIT_RC5 | |
| 4378 | RC_BIT_RC6_MCE | |
| 4379 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4380 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4381 | }, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 4382 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4383 | .num_adapters = 1, |
| 4384 | .adapter = { |
| 4385 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4386 | .num_frontends = 1, |
| 4387 | .fe = {{ |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 4388 | .frontend_attach = s5h1411_frontend_attach, |
| 4389 | .tuner_attach = xc5000_tuner_attach, |
| 4390 | |
| 4391 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4392 | }}, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 4393 | .size_of_priv = sizeof(struct |
| 4394 | dib0700_adapter_state), |
| 4395 | }, |
| 4396 | }, |
| 4397 | |
Devin Heitmueller | d2fc3bf | 2008-09-25 06:22:23 -0300 | [diff] [blame] | 4398 | .num_device_descs = 2, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 4399 | .devices = { |
| 4400 | { "Pinnacle PCTV HD Pro USB Stick", |
| 4401 | { &dib0700_usb_id_table[40], NULL }, |
| 4402 | { NULL }, |
| 4403 | }, |
Devin Heitmueller | d2fc3bf | 2008-09-25 06:22:23 -0300 | [diff] [blame] | 4404 | { "Pinnacle PCTV HD USB Stick", |
| 4405 | { &dib0700_usb_id_table[41], NULL }, |
| 4406 | { NULL }, |
| 4407 | }, |
Devin Heitmueller | cb22cb5 | 2008-09-08 05:42:42 -0300 | [diff] [blame] | 4408 | }, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4409 | |
| 4410 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4411 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4412 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4413 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4414 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4415 | .allowed_protos = RC_BIT_RC5 | |
| 4416 | RC_BIT_RC6_MCE | |
| 4417 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4418 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4419 | }, |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 4420 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4421 | .num_adapters = 1, |
| 4422 | .adapter = { |
| 4423 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4424 | .num_frontends = 1, |
| 4425 | .fe = {{ |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 4426 | .frontend_attach = lgdt3305_frontend_attach, |
| 4427 | .tuner_attach = mxl5007t_tuner_attach, |
| 4428 | |
| 4429 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4430 | }}, |
Michael Krufky | ce904bc | 2009-01-19 01:12:55 -0300 | [diff] [blame] | 4431 | .size_of_priv = sizeof(struct |
| 4432 | dib0700_adapter_state), |
| 4433 | }, |
| 4434 | }, |
| 4435 | |
| 4436 | .num_device_descs = 2, |
| 4437 | .devices = { |
| 4438 | { "Hauppauge ATSC MiniCard (B200)", |
| 4439 | { &dib0700_usb_id_table[46], NULL }, |
| 4440 | { NULL }, |
| 4441 | }, |
| 4442 | { "Hauppauge ATSC MiniCard (B210)", |
| 4443 | { &dib0700_usb_id_table[47], NULL }, |
| 4444 | { NULL }, |
| 4445 | }, |
| 4446 | }, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 4447 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4448 | |
| 4449 | .num_adapters = 1, |
| 4450 | .adapter = { |
| 4451 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4452 | .num_frontends = 1, |
| 4453 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4454 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4455 | .pid_filter_count = 32, |
| 4456 | .pid_filter = stk70x0p_pid_filter, |
| 4457 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Olivier Grenie | 90e12ce | 2010-09-07 12:50:45 -0300 | [diff] [blame] | 4458 | .frontend_attach = stk7770p_frontend_attach, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 4459 | .tuner_attach = dib7770p_tuner_attach, |
| 4460 | |
| 4461 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4462 | }}, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 4463 | .size_of_priv = |
Patrick Boettcher | db48138 | 2009-09-15 07:16:51 -0300 | [diff] [blame] | 4464 | sizeof(struct dib0700_adapter_state), |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 4465 | }, |
| 4466 | }, |
| 4467 | |
Stéphane Elmaleh | d140230 | 2011-05-21 07:33:38 -0300 | [diff] [blame] | 4468 | .num_device_descs = 4, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 4469 | .devices = { |
| 4470 | { "DiBcom STK7770P reference design", |
| 4471 | { &dib0700_usb_id_table[59], NULL }, |
| 4472 | { NULL }, |
| 4473 | }, |
Patrick Boettcher | 1e13c8f | 2009-09-19 05:24:40 -0300 | [diff] [blame] | 4474 | { "Terratec Cinergy T USB XXS (HD)/ T3", |
| 4475 | { &dib0700_usb_id_table[33], |
| 4476 | &dib0700_usb_id_table[52], |
| 4477 | &dib0700_usb_id_table[60], NULL}, |
Patrick Boettcher | db48138 | 2009-09-15 07:16:51 -0300 | [diff] [blame] | 4478 | { NULL }, |
| 4479 | }, |
Lukas Max Fisch | 498e677 | 2011-02-08 16:51:45 -0300 | [diff] [blame] | 4480 | { "TechniSat AirStar TeleStick 2", |
| 4481 | { &dib0700_usb_id_table[74], NULL }, |
| 4482 | { NULL }, |
| 4483 | }, |
Stéphane Elmaleh | d140230 | 2011-05-21 07:33:38 -0300 | [diff] [blame] | 4484 | { "Medion CTX1921 DVB-T USB", |
| 4485 | { &dib0700_usb_id_table[75], NULL }, |
| 4486 | { NULL }, |
| 4487 | }, |
Olivier Grenie | d300bd6 | 2009-09-15 06:55:35 -0300 | [diff] [blame] | 4488 | }, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4489 | |
| 4490 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4491 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4492 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4493 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4494 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4495 | .allowed_protos = RC_BIT_RC5 | |
| 4496 | RC_BIT_RC6_MCE | |
| 4497 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4498 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4499 | }, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4500 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4501 | .num_adapters = 1, |
| 4502 | .adapter = { |
| 4503 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4504 | .num_frontends = 1, |
| 4505 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4506 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4507 | .pid_filter_count = 32, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 4508 | .pid_filter = stk80xx_pid_filter, |
| 4509 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4510 | .frontend_attach = stk807x_frontend_attach, |
| 4511 | .tuner_attach = dib807x_tuner_attach, |
| 4512 | |
| 4513 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4514 | }}, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4515 | .size_of_priv = |
| 4516 | sizeof(struct dib0700_adapter_state), |
| 4517 | }, |
| 4518 | }, |
| 4519 | |
S?rgio Fortier | 8a378e8 | 2009-09-28 04:19:21 -0300 | [diff] [blame] | 4520 | .num_device_descs = 3, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4521 | .devices = { |
| 4522 | { "DiBcom STK807xP reference design", |
| 4523 | { &dib0700_usb_id_table[62], NULL }, |
| 4524 | { NULL }, |
| 4525 | }, |
Mauro Carvalho Chehab | aaeab30 | 2009-09-16 09:18:26 -0300 | [diff] [blame] | 4526 | { "Prolink Pixelview SBTVD", |
| 4527 | { &dib0700_usb_id_table[63], NULL }, |
| 4528 | { NULL }, |
| 4529 | }, |
S?rgio Fortier | 8a378e8 | 2009-09-28 04:19:21 -0300 | [diff] [blame] | 4530 | { "EvolutePC TVWay+", |
| 4531 | { &dib0700_usb_id_table[64], NULL }, |
| 4532 | { NULL }, |
| 4533 | }, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4534 | }, |
| 4535 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4536 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4537 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4538 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4539 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4540 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4541 | .allowed_protos = RC_BIT_RC5 | |
| 4542 | RC_BIT_RC6_MCE | |
| 4543 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4544 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4545 | }, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4546 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4547 | .num_adapters = 2, |
| 4548 | .adapter = { |
| 4549 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4550 | .num_frontends = 1, |
| 4551 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4552 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4553 | .pid_filter_count = 32, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 4554 | .pid_filter = stk80xx_pid_filter, |
| 4555 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4556 | .frontend_attach = stk807xpvr_frontend_attach0, |
| 4557 | .tuner_attach = dib807x_tuner_attach, |
| 4558 | |
| 4559 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4560 | }}, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4561 | .size_of_priv = |
| 4562 | sizeof(struct dib0700_adapter_state), |
| 4563 | }, |
| 4564 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4565 | .num_frontends = 1, |
| 4566 | .fe = {{ |
Olivier Grenie | f8731f4 | 2009-09-18 04:08:43 -0300 | [diff] [blame] | 4567 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4568 | .pid_filter_count = 32, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 4569 | .pid_filter = stk80xx_pid_filter, |
| 4570 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4571 | .frontend_attach = stk807xpvr_frontend_attach1, |
| 4572 | .tuner_attach = dib807x_tuner_attach, |
| 4573 | |
| 4574 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4575 | }}, |
Patrick Boettcher | ba3fe3a | 2009-09-16 09:51:30 -0300 | [diff] [blame] | 4576 | .size_of_priv = |
| 4577 | sizeof(struct dib0700_adapter_state), |
| 4578 | }, |
| 4579 | }, |
| 4580 | |
| 4581 | .num_device_descs = 1, |
| 4582 | .devices = { |
| 4583 | { "DiBcom STK807xPVR reference design", |
| 4584 | { &dib0700_usb_id_table[61], NULL }, |
| 4585 | { NULL }, |
| 4586 | }, |
| 4587 | }, |
| 4588 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4589 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4590 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4591 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4592 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4593 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4594 | .allowed_protos = RC_BIT_RC5 | |
| 4595 | RC_BIT_RC6_MCE | |
| 4596 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4597 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4598 | }, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 4599 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4600 | .num_adapters = 1, |
| 4601 | .adapter = { |
| 4602 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4603 | .num_frontends = 1, |
| 4604 | .fe = {{ |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 4605 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4606 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4607 | .pid_filter_count = 32, |
| 4608 | .pid_filter = stk80xx_pid_filter, |
| 4609 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, |
| 4610 | .frontend_attach = stk809x_frontend_attach, |
| 4611 | .tuner_attach = dib809x_tuner_attach, |
| 4612 | |
| 4613 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4614 | }}, |
Olivier Grenie | 03245a5 | 2009-12-04 13:27:57 -0300 | [diff] [blame] | 4615 | .size_of_priv = |
| 4616 | sizeof(struct dib0700_adapter_state), |
| 4617 | }, |
| 4618 | }, |
| 4619 | |
| 4620 | .num_device_descs = 1, |
| 4621 | .devices = { |
| 4622 | { "DiBcom STK8096GP reference design", |
| 4623 | { &dib0700_usb_id_table[67], NULL }, |
| 4624 | { NULL }, |
| 4625 | }, |
| 4626 | }, |
| 4627 | |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4628 | .rc.core = { |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4629 | .rc_interval = DEFAULT_RC_INTERVAL, |
Mauro Carvalho Chehab | 5af935c | 2010-08-01 08:02:35 -0300 | [diff] [blame] | 4630 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
Mauro Carvalho Chehab | 72b3931 | 2010-07-31 22:56:00 -0300 | [diff] [blame] | 4631 | .module_name = "dib0700", |
Mauro Carvalho Chehab | 0ffd1ab | 2010-08-01 09:37:23 -0300 | [diff] [blame] | 4632 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4633 | .allowed_protos = RC_BIT_RC5 | |
| 4634 | RC_BIT_RC6_MCE | |
| 4635 | RC_BIT_NEC, |
David Härdeman | d8b4b58 | 2010-10-29 16:08:23 -0300 | [diff] [blame] | 4636 | .change_protocol = dib0700_change_protocol, |
Mauro Carvalho Chehab | f72a27b | 2010-07-31 18:04:09 -0300 | [diff] [blame] | 4637 | }, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4638 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4639 | .num_adapters = 1, |
| 4640 | .adapter = { |
| 4641 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4642 | .num_frontends = 1, |
| 4643 | .fe = {{ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4644 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4645 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4646 | .pid_filter_count = 32, |
| 4647 | .pid_filter = dib90x0_pid_filter, |
| 4648 | .pid_filter_ctrl = dib90x0_pid_filter_ctrl, |
| 4649 | .frontend_attach = stk9090m_frontend_attach, |
| 4650 | .tuner_attach = dib9090_tuner_attach, |
| 4651 | |
| 4652 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4653 | }}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4654 | .size_of_priv = |
| 4655 | sizeof(struct dib0700_adapter_state), |
| 4656 | }, |
| 4657 | }, |
| 4658 | |
| 4659 | .num_device_descs = 1, |
| 4660 | .devices = { |
| 4661 | { "DiBcom STK9090M reference design", |
| 4662 | { &dib0700_usb_id_table[69], NULL }, |
| 4663 | { NULL }, |
| 4664 | }, |
| 4665 | }, |
| 4666 | |
| 4667 | .rc.core = { |
| 4668 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4669 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4670 | .module_name = "dib0700", |
| 4671 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4672 | .allowed_protos = RC_BIT_RC5 | |
| 4673 | RC_BIT_RC6_MCE | |
| 4674 | RC_BIT_NEC, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4675 | .change_protocol = dib0700_change_protocol, |
| 4676 | }, |
| 4677 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4678 | .num_adapters = 1, |
| 4679 | .adapter = { |
| 4680 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4681 | .num_frontends = 1, |
| 4682 | .fe = {{ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4683 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4684 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4685 | .pid_filter_count = 32, |
| 4686 | .pid_filter = stk80xx_pid_filter, |
| 4687 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, |
| 4688 | .frontend_attach = nim8096md_frontend_attach, |
| 4689 | .tuner_attach = nim8096md_tuner_attach, |
| 4690 | |
| 4691 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4692 | }}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4693 | .size_of_priv = |
| 4694 | sizeof(struct dib0700_adapter_state), |
| 4695 | }, |
| 4696 | }, |
| 4697 | |
| 4698 | .num_device_descs = 1, |
| 4699 | .devices = { |
| 4700 | { "DiBcom NIM8096MD reference design", |
| 4701 | { &dib0700_usb_id_table[70], NULL }, |
| 4702 | { NULL }, |
| 4703 | }, |
| 4704 | }, |
| 4705 | |
| 4706 | .rc.core = { |
| 4707 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4708 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4709 | .module_name = "dib0700", |
| 4710 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4711 | .allowed_protos = RC_BIT_RC5 | |
| 4712 | RC_BIT_RC6_MCE | |
| 4713 | RC_BIT_NEC, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4714 | .change_protocol = dib0700_change_protocol, |
| 4715 | }, |
| 4716 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4717 | .num_adapters = 1, |
| 4718 | .adapter = { |
| 4719 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4720 | .num_frontends = 1, |
| 4721 | .fe = {{ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4722 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4723 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4724 | .pid_filter_count = 32, |
| 4725 | .pid_filter = dib90x0_pid_filter, |
| 4726 | .pid_filter_ctrl = dib90x0_pid_filter_ctrl, |
| 4727 | .frontend_attach = nim9090md_frontend_attach, |
| 4728 | .tuner_attach = nim9090md_tuner_attach, |
| 4729 | |
| 4730 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4731 | }}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4732 | .size_of_priv = |
| 4733 | sizeof(struct dib0700_adapter_state), |
| 4734 | }, |
| 4735 | }, |
| 4736 | |
| 4737 | .num_device_descs = 1, |
| 4738 | .devices = { |
| 4739 | { "DiBcom NIM9090MD reference design", |
| 4740 | { &dib0700_usb_id_table[71], NULL }, |
| 4741 | { NULL }, |
| 4742 | }, |
| 4743 | }, |
| 4744 | |
| 4745 | .rc.core = { |
| 4746 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4747 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4748 | .module_name = "dib0700", |
| 4749 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4750 | .allowed_protos = RC_BIT_RC5 | |
| 4751 | RC_BIT_RC6_MCE | |
| 4752 | RC_BIT_NEC, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4753 | .change_protocol = dib0700_change_protocol, |
| 4754 | }, |
| 4755 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4756 | .num_adapters = 1, |
| 4757 | .adapter = { |
| 4758 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4759 | .num_frontends = 1, |
| 4760 | .fe = {{ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4761 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4762 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4763 | .pid_filter_count = 32, |
| 4764 | .pid_filter = stk70x0p_pid_filter, |
| 4765 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4766 | .frontend_attach = nim7090_frontend_attach, |
| 4767 | .tuner_attach = nim7090_tuner_attach, |
| 4768 | |
| 4769 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4770 | }}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4771 | .size_of_priv = |
| 4772 | sizeof(struct dib0700_adapter_state), |
| 4773 | }, |
| 4774 | }, |
| 4775 | |
| 4776 | .num_device_descs = 1, |
| 4777 | .devices = { |
| 4778 | { "DiBcom NIM7090 reference design", |
| 4779 | { &dib0700_usb_id_table[72], NULL }, |
| 4780 | { NULL }, |
| 4781 | }, |
| 4782 | }, |
| 4783 | |
| 4784 | .rc.core = { |
| 4785 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4786 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4787 | .module_name = "dib0700", |
| 4788 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4789 | .allowed_protos = RC_BIT_RC5 | |
| 4790 | RC_BIT_RC6_MCE | |
| 4791 | RC_BIT_NEC, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4792 | .change_protocol = dib0700_change_protocol, |
| 4793 | }, |
| 4794 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4795 | .num_adapters = 2, |
| 4796 | .adapter = { |
| 4797 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4798 | .num_frontends = 1, |
| 4799 | .fe = {{ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4800 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4801 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4802 | .pid_filter_count = 32, |
| 4803 | .pid_filter = stk70x0p_pid_filter, |
| 4804 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4805 | .frontend_attach = tfe7090pvr_frontend0_attach, |
| 4806 | .tuner_attach = tfe7090pvr_tuner0_attach, |
| 4807 | |
| 4808 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4809 | }}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4810 | .size_of_priv = |
| 4811 | sizeof(struct dib0700_adapter_state), |
| 4812 | }, |
| 4813 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4814 | .num_frontends = 1, |
| 4815 | .fe = {{ |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4816 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4817 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4818 | .pid_filter_count = 32, |
| 4819 | .pid_filter = stk70x0p_pid_filter, |
| 4820 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
| 4821 | .frontend_attach = tfe7090pvr_frontend1_attach, |
| 4822 | .tuner_attach = tfe7090pvr_tuner1_attach, |
| 4823 | |
| 4824 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4825 | }}, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4826 | .size_of_priv = |
| 4827 | sizeof(struct dib0700_adapter_state), |
| 4828 | }, |
| 4829 | }, |
| 4830 | |
| 4831 | .num_device_descs = 1, |
| 4832 | .devices = { |
| 4833 | { "DiBcom TFE7090PVR reference design", |
| 4834 | { &dib0700_usb_id_table[73], NULL }, |
| 4835 | { NULL }, |
| 4836 | }, |
| 4837 | }, |
| 4838 | |
| 4839 | .rc.core = { |
| 4840 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4841 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4842 | .module_name = "dib0700", |
| 4843 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4844 | .allowed_protos = RC_BIT_RC5 | |
| 4845 | RC_BIT_RC6_MCE | |
| 4846 | RC_BIT_NEC, |
Olivier Grenie | be9bae1 | 2011-01-04 05:42:19 -0300 | [diff] [blame] | 4847 | .change_protocol = dib0700_change_protocol, |
| 4848 | }, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 4849 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4850 | .num_adapters = 1, |
| 4851 | .adapter = { |
| 4852 | { |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4853 | .num_frontends = 1, |
| 4854 | .fe = {{ |
Devin Heitmueller | 01f1626 | 2009-06-24 00:07:01 -0300 | [diff] [blame] | 4855 | .frontend_attach = pctv340e_frontend_attach, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 4856 | .tuner_attach = xc4000_tuner_attach, |
| 4857 | |
| 4858 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
Michael Krufky | 77eed21 | 2011-09-06 09:31:57 -0300 | [diff] [blame] | 4859 | }}, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 4860 | .size_of_priv = sizeof(struct |
| 4861 | dib0700_adapter_state), |
| 4862 | }, |
| 4863 | }, |
| 4864 | |
Devin Heitmueller | 33fb168 | 2009-06-23 22:48:02 -0300 | [diff] [blame] | 4865 | .num_device_descs = 2, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 4866 | .devices = { |
| 4867 | { "Pinnacle PCTV 340e HD Pro USB Stick", |
| 4868 | { &dib0700_usb_id_table[76], NULL }, |
| 4869 | { NULL }, |
| 4870 | }, |
Devin Heitmueller | 33fb168 | 2009-06-23 22:48:02 -0300 | [diff] [blame] | 4871 | { "Pinnacle PCTV Hybrid Stick Solo", |
| 4872 | { &dib0700_usb_id_table[77], NULL }, |
| 4873 | { NULL }, |
| 4874 | }, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 4875 | }, |
| 4876 | .rc.core = { |
| 4877 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4878 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4879 | .module_name = "dib0700", |
| 4880 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4881 | .allowed_protos = RC_BIT_RC5 | |
| 4882 | RC_BIT_RC6_MCE | |
| 4883 | RC_BIT_NEC, |
Davide Ferri | 8d009a0 | 2009-06-23 22:34:06 -0300 | [diff] [blame] | 4884 | .change_protocol = dib0700_change_protocol, |
| 4885 | }, |
Olivier Grenie | 6724a2f | 2011-08-05 13:49:33 -0300 | [diff] [blame] | 4886 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4887 | .num_adapters = 1, |
| 4888 | .adapter = { |
| 4889 | { |
| 4890 | .num_frontends = 1, |
| 4891 | .fe = {{ |
| 4892 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4893 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4894 | .pid_filter_count = 32, |
| 4895 | .pid_filter = stk70x0p_pid_filter, |
| 4896 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 4897 | .frontend_attach = tfe7790p_frontend_attach, |
| 4898 | .tuner_attach = tfe7790p_tuner_attach, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 4899 | |
| 4900 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), |
| 4901 | } }, |
| 4902 | |
| 4903 | .size_of_priv = |
| 4904 | sizeof(struct dib0700_adapter_state), |
| 4905 | }, |
| 4906 | }, |
| 4907 | |
| 4908 | .num_device_descs = 1, |
| 4909 | .devices = { |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 4910 | { "DiBcom TFE7790P reference design", |
| 4911 | { &dib0700_usb_id_table[78], NULL }, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 4912 | { NULL }, |
| 4913 | }, |
| 4914 | }, |
| 4915 | |
| 4916 | .rc.core = { |
| 4917 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4918 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4919 | .module_name = "dib0700", |
| 4920 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4921 | .allowed_protos = RC_BIT_RC5 | |
| 4922 | RC_BIT_RC6_MCE | |
| 4923 | RC_BIT_NEC, |
Olivier Grenie | b293f30 | 2011-08-09 04:48:25 -0300 | [diff] [blame] | 4924 | .change_protocol = dib0700_change_protocol, |
| 4925 | }, |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 4926 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 4927 | .num_adapters = 1, |
| 4928 | .adapter = { |
| 4929 | { |
| 4930 | .num_frontends = 1, |
| 4931 | .fe = {{ |
| 4932 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | |
| 4933 | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
| 4934 | .pid_filter_count = 32, |
| 4935 | .pid_filter = stk80xx_pid_filter, |
| 4936 | .pid_filter_ctrl = stk80xx_pid_filter_ctrl, |
| 4937 | .frontend_attach = tfe8096p_frontend_attach, |
| 4938 | .tuner_attach = tfe8096p_tuner_attach, |
| 4939 | |
| 4940 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
| 4941 | |
| 4942 | } }, |
| 4943 | |
| 4944 | .size_of_priv = |
| 4945 | sizeof(struct dib0700_adapter_state), |
| 4946 | }, |
| 4947 | }, |
| 4948 | |
| 4949 | .num_device_descs = 1, |
| 4950 | .devices = { |
| 4951 | { "DiBcom TFE8096P reference design", |
Olivier Grenie | f45f513 | 2012-12-31 09:47:10 -0300 | [diff] [blame] | 4952 | { &dib0700_usb_id_table[79], NULL }, |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 4953 | { NULL }, |
| 4954 | }, |
| 4955 | }, |
| 4956 | |
| 4957 | .rc.core = { |
| 4958 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 4959 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 4960 | .module_name = "dib0700", |
| 4961 | .rc_query = dib0700_rc_query_old_firmware, |
David Härdeman | c003ab1 | 2012-10-11 19:11:54 -0300 | [diff] [blame] | 4962 | .allowed_protos = RC_BIT_RC5 | |
| 4963 | RC_BIT_RC6_MCE | |
| 4964 | RC_BIT_NEC, |
Olivier Grenie | 88f3a35 | 2011-08-10 05:28:38 -0300 | [diff] [blame] | 4965 | .change_protocol = dib0700_change_protocol, |
| 4966 | }, |
Patrick Boettcher | 01373a5 | 2007-07-30 12:49:04 -0300 | [diff] [blame] | 4967 | }, |
Patrick Boettcher | b7f5491 | 2006-09-19 12:51:37 -0300 | [diff] [blame] | 4968 | }; |
| 4969 | |
| 4970 | int dib0700_device_count = ARRAY_SIZE(dib0700_devices); |