aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dib0700_devices.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pboettcher@dibcom.fr>2006-10-18 07:34:16 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-12-10 05:51:03 -0500
commita75763ffff4175bd8c115c217a39fbf445612aae (patch)
treed3d77ecc41fd8ad1b9dcad81805a171da06f8496 /drivers/media/dvb/dvb-usb/dib0700_devices.c
parent8364681766cc18b948cf9d7bd46d1b92f343743b (diff)
V4L/DVB (4772): Add support for DiBcom DiB7000PC
This patch contains support for the DiB7000PC-driver. Signed-off-by: Francois KANOUNNIKOFF <fkanounnikoff@dibcom.fr> Signed-off-by: Patrick Boettcher <pboettcher@dibcom.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dib0700_devices.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c96
1 files changed, 87 insertions, 9 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 305dd35a1021..c231a1e5204e 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -10,6 +10,7 @@
10 10
11#include "dib3000mc.h" 11#include "dib3000mc.h"
12#include "dib7000m.h" 12#include "dib7000m.h"
13#include "dib7000p.h"
13#include "mt2060.h" 14#include "mt2060.h"
14 15
15static int force_lna_activation; 16static int force_lna_activation;
@@ -96,7 +97,7 @@ static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
96} 97}
97 98
98/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ 99/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
99static struct dibx000_agc_config stk7700p_dib7000m_agc_config = { 100static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = {
100 BAND_UHF | BAND_VHF, // band_caps 101 BAND_UHF | BAND_VHF, // band_caps
101 102
102 /* 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, 103 /* 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,
@@ -141,7 +142,52 @@ static struct dibx000_agc_config stk7700p_dib7000m_agc_config = {
141 }, 142 },
142}; 143};
143 144
144static struct dibx000_bandwidth_config stk7700p_dib7000m_mt2060_config = { 145static struct dibx000_agc_config stk7700p_7000p_mt2060_agc_config = {
146 BAND_UHF | BAND_VHF,
147
148 /* 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,
149 * 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 */
150 (0 << 15) | (0 << 14) | (5 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
151
152 712, // inv_gain
153 41, // time_stabiliz
154
155 0, // alpha_level
156 118, // thlock
157
158 0, // wbd_inv
159 4095, // wbd_ref
160 0, // wbd_sel
161 0, // wbd_alpha
162
163 42598, // agc1_max
164 16384, // agc1_min
165 42598, // agc2_max
166 0, // agc2_min
167
168 0, // agc1_pt1
169 137, // agc1_pt2
170 255, // agc1_pt3
171
172 0, // agc1_slope1
173 255, // agc1_slope2
174
175 0, // agc2_pt1
176 0, // agc2_pt2
177
178 0, // agc2_slope1
179 41, // agc2_slope2
180
181 15, // alpha_mant
182 25, // alpha_exp
183
184 28, // beta_mant
185 48, // beta_exp
186
187 0, // perform_agc_softsplit
188};
189
190static struct dibx000_bandwidth_config stk7700p_pll_config = {
145 60000, 30000, // internal, sampling 191 60000, 30000, // internal, sampling
146 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass 192 1, 8, 3, 1, 0, // pll_cfg: prediv, ratio, range, reset, bypass
147 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo 193 0, 0, 1, 1, 0, // misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, modulo
@@ -156,8 +202,19 @@ static struct dib7000m_config stk7700p_dib7000m_config = {
156 .quartz_direct = 1, 202 .quartz_direct = 1,
157 203
158 .agc_config_count = 1, 204 .agc_config_count = 1,
159 .agc = &stk7700p_dib7000m_agc_config, 205 .agc = &stk7700p_7000m_mt2060_agc_config,
160 .bw = &stk7700p_dib7000m_mt2060_config, 206 .bw = &stk7700p_pll_config,
207
208 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
209 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
210 .gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
211};
212
213static struct dib7000p_config stk7700p_dib7000p_config = {
214 .output_mpeg2_in_188_bytes = 1,
215
216 .agc = &stk7700p_7000p_mt2060_agc_config,
217 .bw = &stk7700p_pll_config,
161 218
162 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, 219 .gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
163 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, 220 .gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
@@ -168,13 +225,28 @@ static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
168{ 225{
169 struct dib0700_state *st = adap->dev->priv; 226 struct dib0700_state *st = adap->dev->priv;
170 /* unless there is no real power management in DVB - we leave the device on GPIO6 */ 227 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
171 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); 228
229 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
230 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50);
231
172 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); 232 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
233 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
234
173 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); 235 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
174 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); 236 dib0700_ctrl_clock(adap->dev, 72, 1);
237 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100);
238
239 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
175 240
176 st->mt2060_if1[0] = 1220; 241 st->mt2060_if1[0] = 1220;
177 return (adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config)) == NULL ? -ENODEV : 0; 242
243 if (dib7000pc_detection(&adap->dev->i2c_adap)) {
244 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config);
245 st->is_dib7000pc = 1;
246 } else
247 adap->fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config);
248
249 return adap->fe == NULL ? -ENODEV : 0;
178} 250}
179 251
180static struct mt2060_config stk7700p_mt2060_config = { 252static struct mt2060_config stk7700p_mt2060_config = {
@@ -184,8 +256,14 @@ static struct mt2060_config stk7700p_mt2060_config = {
184static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap) 256static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
185{ 257{
186 struct dib0700_state *st = adap->dev->priv; 258 struct dib0700_state *st = adap->dev->priv;
187 struct i2c_adapter *tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1); 259 struct i2c_adapter *tun_i2c;
188 return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &stk7700p_mt2060_config, 260
261 if (st->is_dib7000pc)
262 tun_i2c = dib7000p_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
263 else
264 tun_i2c = dib7000m_get_i2c_master(adap->fe, DIBX000_I2C_INTERFACE_TUNER, 1);
265
266 return dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk7700p_mt2060_config,
189 st->mt2060_if1[0]) == NULL ? -ENODEV : 0; 267 st->mt2060_if1[0]) == NULL ? -ENODEV : 0;
190} 268}
191 269