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
11 #include "dib3000mc.h"
14 /* Hauppauge Nova-T 500
15 * has a LNA on GPIO0 which is enabled by setting 1 */
16 static struct mt2060_config bristol_mt2060_config[2] = {
25 static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
26 .band_caps = BAND_VHF | BAND_UHF,
27 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
47 static struct dib3000mc_config bristol_dib3000mc_config[2] = {
48 { .agc = &bristol_dib3000p_mt2060_agc_config,
50 .ln_adc_level = 0x1cc7,
51 .output_mpeg2_in_188_bytes = 1,
53 { .agc = &bristol_dib3000p_mt2060_agc_config,
55 .ln_adc_level = 0x1cc7,
56 .output_mpeg2_in_188_bytes = 1,
60 static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
62 struct dib0700_state *st = adap->dev->priv;
64 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
65 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
66 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
67 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
69 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); msleep(10); // LNA
71 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
72 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
76 st->mt2060_if1[adap->id] = 1220;
77 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
78 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
81 static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
83 struct dib0700_state *st = adap->dev->priv;
84 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
85 return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id],
86 st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
89 /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
90 static struct mt2060_config stk7000p_mt2060_config = {
94 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
96 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
97 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
98 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
99 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
100 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
102 // adap->fe = dib7000m_attach(&adap->dev->i2c_adap, &stk7700p_dib7000m_config, 18);
106 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
108 // tun_i2c = dib7000m_get_tuner_i2c_master(adap->fe, 1);
109 // return mt2060_attach(adap->fe, tun_i2c, &stk3000p_mt2060_config, if1);
113 struct usb_device_id dib0700_usb_id_table[] = {
114 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
115 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
116 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
117 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
118 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
119 { } /* Terminating entry */
121 MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
123 #define DIB0700_DEFAULT_DEVICE_PROPERTIES \
124 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
125 .usb_ctrl = DEVICE_SPECIFIC, \
126 .firmware = "dvb-usb-dib0700-01.fw", \
127 .download_firmware = dib0700_download_firmware, \
129 .size_of_priv = sizeof(struct dib0700_state), \
130 .i2c_algo = &dib0700_i2c_algo, \
131 .identify_state = dib0700_identify_state
133 #define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
134 .streaming_ctrl = dib0700_streaming_ctrl, \
141 .buffersize = 39480, \
146 struct dvb_usb_device_properties dib0700_devices[] = {
148 DIB0700_DEFAULT_DEVICE_PROPERTIES,
153 .frontend_attach = stk7700p_frontend_attach,
154 .tuner_attach = stk7700p_tuner_attach,
156 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
160 .num_device_descs = 3,
162 { "DiBcom STK7700P reference design",
163 { &dib0700_usb_id_table[0], NULL },
166 { "Hauppauge Nova-T Stick",
167 { &dib0700_usb_id_table[3], NULL },
170 { "AVerMedia AVerTV DVB-T Volar",
171 { &dib0700_usb_id_table[4], NULL },
175 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
180 .frontend_attach = bristol_frontend_attach,
181 .tuner_attach = bristol_tuner_attach,
183 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
185 .frontend_attach = bristol_frontend_attach,
186 .tuner_attach = bristol_tuner_attach,
188 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
192 .num_device_descs = 1,
194 { "Hauppauge Nova-T 500 Dual DVB-T",
195 { &dib0700_usb_id_table[1], &dib0700_usb_id_table[2], NULL },
202 int dib0700_device_count = ARRAY_SIZE(dib0700_devices);