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>
16 // Config Adjacent channels Perf -cal22
17 static struct dibx000_agc_config dib3000p_mt2060_agc_config = {
18 .band_caps = BAND_VHF | BAND_UHF,
19 .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
39 static struct dib3000mc_config stk3000p_dib3000p_config = {
40 &dib3000p_mt2060_agc_config,
43 .ln_adc_level = 0x1cc7,
45 .output_mpeg2_in_188_bytes = 1,
51 static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
52 .band_caps = BAND_VHF | BAND_UHF,
53 .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
73 static struct dib3000mc_config mod3000p_dib3000p_config = {
74 &dib3000p_panasonic_agc_config,
77 .ln_adc_level = 0x1cc7,
79 .output_mpeg2_in_188_bytes = 1,
85 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap)
87 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON &&
88 le16_to_cpu(adap->dev->udev->descriptor.idProduct) ==
89 USB_PID_LITEON_DVB_T_WARM) {
93 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach,
95 DEFAULT_DIB3000P_I2C_ADDRESS,
96 &mod3000p_dib3000p_config);
97 if ((adap->fe_adap[0].fe) == NULL)
98 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach,
100 DEFAULT_DIB3000MC_I2C_ADDRESS,
101 &mod3000p_dib3000p_config);
102 if ((adap->fe_adap[0].fe) != NULL) {
103 if (adap->priv != NULL) {
104 struct dibusb_state *st = adap->priv;
105 st->ops.pid_parse = dib3000mc_pid_parse;
106 st->ops.pid_ctrl = dib3000mc_pid_control;
112 EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
114 static struct mt2060_config stk3000p_mt2060_config = {
118 int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
120 struct dibusb_state *st = adap->priv;
123 struct i2c_adapter *tun_i2c;
125 // First IF calibration for Liteon Sticks
126 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON &&
127 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_LITEON_DVB_T_WARM) {
129 dibusb_read_eeprom_byte(adap->dev,0x7E,&a);
130 dibusb_read_eeprom_byte(adap->dev,0x7F,&b);
137 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b);
139 } else if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_DIBCOM &&
140 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_DIBCOM_MOD3001_WARM) {
142 dibusb_read_eeprom_byte(adap->dev, 7, &desc);
146 dibusb_read_eeprom_byte(adap->dev, a, &desc);
148 } while (a > 7 && (desc == 0xff || desc == 0x00));
150 if1 -= (0xff - desc);
156 tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
157 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) {
158 /* not found - use panasonic pll parameters */
159 if (dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, tun_i2c, DVB_PLL_ENV57H1XD5) == NULL)
162 st->mt2060_present = 1;
163 /* set the correct parameters for the dib3000p */
164 dib3000mc_set_config(adap->fe_adap[0].fe, &stk3000p_dib3000p_config);
168 EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);