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
14 MODULE_LICENSE("GPL");
17 // Config Adjacent channels Perf -cal22
18 static struct dibx000_agc_config dib3000p_mt2060_agc_config = {
19 .band_caps = BAND_VHF | BAND_UHF,
20 .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
40 static struct dib3000mc_config stk3000p_dib3000p_config = {
41 &dib3000p_mt2060_agc_config,
44 .ln_adc_level = 0x1cc7,
46 .output_mpeg2_in_188_bytes = 1,
52 static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
53 .band_caps = BAND_VHF | BAND_UHF,
54 .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
74 static struct dib3000mc_config mod3000p_dib3000p_config = {
75 &dib3000p_panasonic_agc_config,
78 .ln_adc_level = 0x1cc7,
80 .output_mpeg2_in_188_bytes = 1,
86 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap)
88 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON &&
89 le16_to_cpu(adap->dev->udev->descriptor.idProduct) ==
90 USB_PID_LITEON_DVB_T_WARM) {
94 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach,
96 DEFAULT_DIB3000P_I2C_ADDRESS,
97 &mod3000p_dib3000p_config);
98 if ((adap->fe_adap[0].fe) == NULL)
99 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach,
100 &adap->dev->i2c_adap,
101 DEFAULT_DIB3000MC_I2C_ADDRESS,
102 &mod3000p_dib3000p_config);
103 if ((adap->fe_adap[0].fe) != NULL) {
104 if (adap->priv != NULL) {
105 struct dibusb_state *st = adap->priv;
106 st->ops.pid_parse = dib3000mc_pid_parse;
107 st->ops.pid_ctrl = dib3000mc_pid_control;
113 EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
115 static struct mt2060_config stk3000p_mt2060_config = {
119 int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
121 struct dibusb_state *st = adap->priv;
124 struct i2c_adapter *tun_i2c;
126 // First IF calibration for Liteon Sticks
127 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON &&
128 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_LITEON_DVB_T_WARM) {
130 dibusb_read_eeprom_byte(adap->dev,0x7E,&a);
131 dibusb_read_eeprom_byte(adap->dev,0x7F,&b);
138 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b);
140 } else if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_DIBCOM &&
141 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_DIBCOM_MOD3001_WARM) {
143 dibusb_read_eeprom_byte(adap->dev, 7, &desc);
147 dibusb_read_eeprom_byte(adap->dev, a, &desc);
149 } while (a > 7 && (desc == 0xff || desc == 0x00));
151 if1 -= (0xff - desc);
157 tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1);
158 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) {
159 /* not found - use panasonic pll parameters */
160 if (dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, tun_i2c, DVB_PLL_ENV57H1XD5) == NULL)
163 st->mt2060_present = 1;
164 /* set the correct parameters for the dib3000p */
165 dib3000mc_set_config(adap->fe_adap[0].fe, &stk3000p_dib3000p_config);
169 EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);