1 /* Common methods for dibusb-based-receivers.
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation, version 2.
9 * see Documentation/dvb/README.dvb-usb for more information
12 #include <linux/kconfig.h>
15 MODULE_LICENSE("GPL");
18 // Config Adjacent channels Perf -cal22
19 static struct dibx000_agc_config dib3000p_mt2060_agc_config = {
20 .band_caps = BAND_VHF | BAND_UHF,
21 .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
41 static struct dib3000mc_config stk3000p_dib3000p_config = {
42 &dib3000p_mt2060_agc_config,
45 .ln_adc_level = 0x1cc7,
47 .output_mpeg2_in_188_bytes = 1,
53 static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
54 .band_caps = BAND_VHF | BAND_UHF,
55 .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
75 static struct dib3000mc_config mod3000p_dib3000p_config = {
76 &dib3000p_panasonic_agc_config,
79 .ln_adc_level = 0x1cc7,
81 .output_mpeg2_in_188_bytes = 1,
87 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap)
89 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON &&
90 le16_to_cpu(adap->dev->udev->descriptor.idProduct) ==
91 USB_PID_LITEON_DVB_T_WARM) {
95 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach,
97 DEFAULT_DIB3000P_I2C_ADDRESS,
98 &mod3000p_dib3000p_config);
99 if ((adap->fe_adap[0].fe) == NULL)
100 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach,
101 &adap->dev->i2c_adap,
102 DEFAULT_DIB3000MC_I2C_ADDRESS,
103 &mod3000p_dib3000p_config);
104 if ((adap->fe_adap[0].fe) != NULL) {
105 if (adap->priv != NULL) {
106 struct dibusb_state *st = adap->priv;
107 st->ops.pid_parse = dib3000mc_pid_parse;
108 st->ops.pid_ctrl = dib3000mc_pid_control;
114 EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
116 static struct mt2060_config stk3000p_mt2060_config = {
120 int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
122 struct dibusb_state *st = adap->priv;
125 struct i2c_adapter *tun_i2c;
127 // First IF calibration for Liteon Sticks
128 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON &&
129 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_LITEON_DVB_T_WARM) {
131 dibusb_read_eeprom_byte(adap->dev,0x7E,&a);
132 dibusb_read_eeprom_byte(adap->dev,0x7F,&b);
139 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b);
141 } else if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_DIBCOM &&
142 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_DIBCOM_MOD3001_WARM) {
144 dibusb_read_eeprom_byte(adap->dev, 7, &desc);
148 dibusb_read_eeprom_byte(adap->dev, a, &desc);
150 } while (a > 7 && (desc == 0xff || desc == 0x00));
152 if1 -= (0xff - desc);
158 tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
159 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) {
160 /* not found - use panasonic pll parameters */
161 if (dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, tun_i2c, DVB_PLL_ENV57H1XD5) == NULL)
164 st->mt2060_present = 1;
165 /* set the correct parameters for the dib3000p */
166 dib3000mc_set_config(adap->fe_adap[0].fe, &stk3000p_dib3000p_config);
170 EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);