[PATCH] w1 kconfig fix
[linux-2.6/verdex.git] / drivers / media / dvb / dvb-usb / dib0700_devices.c
blobe473bfed226b6004e55b4bb158bf7cc6f58558a7
1 /* Linux driver for devices based on the DiBcom DiB0700 USB bridge
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.
7 * Copyright (C) 2005-6 DiBcom, SA
8 */
9 #include "dib0700.h"
11 #include "dib3000mc.h"
12 #include "mt2060.h"
14 static int force_lna_activation;
15 module_param(force_lna_activation, int, 0644);
16 MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
17 "if applicable for the device (default: 0=automatic/off).");
19 /* Hauppauge Nova-T 500
20 * has a LNA on GPIO0 which is enabled by setting 1 */
21 static struct mt2060_config bristol_mt2060_config[2] = {
23 .i2c_address = 0x60,
24 .clock_out = 3,
25 }, {
26 .i2c_address = 0x61,
30 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
31 .band_caps = BAND_VHF | BAND_UHF,
32 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
34 .agc1_max = 42598,
35 .agc1_min = 17694,
36 .agc2_max = 45875,
37 .agc2_min = 0,
39 .agc1_pt1 = 0,
40 .agc1_pt2 = 59,
42 .agc1_slope1 = 0,
43 .agc1_slope2 = 69,
45 .agc2_pt1 = 0,
46 .agc2_pt2 = 59,
48 .agc2_slope1 = 111,
49 .agc2_slope2 = 28,
52 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
53 { .agc = &bristol_dib3000p_mt2060_agc_config,
54 .max_time = 0x196,
55 .ln_adc_level = 0x1cc7,
56 .output_mpeg2_in_188_bytes = 1,
58 { .agc = &bristol_dib3000p_mt2060_agc_config,
59 .max_time = 0x196,
60 .ln_adc_level = 0x1cc7,
61 .output_mpeg2_in_188_bytes = 1,
65 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
67 struct dib0700_state *st = adap->dev->priv;
68 if (adap->id == 0) {
69 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
70 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
71 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
72 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
74 if (force_lna_activation)
75 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
76 else
77 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
79 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
80 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
81 return -ENODEV;
84 st->mt2060_if1[adap->id] = 1220;
85 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
86 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
89 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
91 struct dib0700_state *st = adap->dev->priv;
92 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
93 return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id],
94 st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
97 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
99 static struct mt2060_config stk7000p_mt2060_config = {
100 0x60
104 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
106 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
107 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
108 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
109 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
110 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
112 // adap->fe = dib7000m_attach(&adap->dev->i2c_adap, &stk7700p_dib7000m_config, 18);
113 return 0;
116 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
118 // tun_i2c = dib7000m_get_tuner_i2c_master(adap->fe, 1);
119 // return mt2060_attach(adap->fe, tun_i2c, &stk3000p_mt2060_config, if1);
120 return 0;
123 struct usb_device_id dib0700_usb_id_table[] = {
124 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
125 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
126 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
127 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
128 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
129 { } /* Terminating entry */
131 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
133 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
134 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
135 .usb_ctrl = DEVICE_SPECIFIC, \
136 .firmware = "dvb-usb-dib0700-01.fw", \
137 .download_firmware = dib0700_download_firmware, \
138 .no_reconnect = 1, \
139 .size_of_priv = sizeof(struct dib0700_state), \
140 .i2c_algo = &dib0700_i2c_algo, \
141 .identify_state = dib0700_identify_state
143 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
144 .streaming_ctrl = dib0700_streaming_ctrl, \
145 .stream = { \
146 .type = USB_BULK, \
147 .count = 4, \
148 .endpoint = ep, \
149 .u = { \
150 .bulk = { \
151 .buffersize = 39480, \
156 struct dvb_usb_device_properties dib0700_devices[] = {
158 DIB0700_DEFAULT_DEVICE_PROPERTIES,
160 .num_adapters = 1,
161 .adapter = {
163 .frontend_attach = stk7700p_frontend_attach,
164 .tuner_attach = stk7700p_tuner_attach,
166 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
170 .num_device_descs = 3,
171 .devices = {
172 { "DiBcom STK7700P reference design",
173 { &dib0700_usb_id_table[0], NULL },
174 { NULL },
176 { "Hauppauge Nova-T Stick",
177 { &dib0700_usb_id_table[3], NULL },
178 { NULL },
180 { "AVerMedia AVerTV DVB-T Volar",
181 { &dib0700_usb_id_table[4], NULL },
182 { NULL },
185 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
187 .num_adapters = 2,
188 .adapter = {
190 .frontend_attach = bristol_frontend_attach,
191 .tuner_attach = bristol_tuner_attach,
193 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
194 }, {
195 .frontend_attach = bristol_frontend_attach,
196 .tuner_attach = bristol_tuner_attach,
198 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
202 .num_device_descs = 1,
203 .devices = {
204 { "Hauppauge Nova-T 500 Dual DVB-T",
205 { &dib0700_usb_id_table[1], &dib0700_usb_id_table[2], NULL },
206 { NULL },
212 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);