1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Common methods for dibusb-based-receivers.
4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
6 * see Documentation/driver-api/media/drivers/dvb-usb.rst for more information
11 MODULE_LICENSE("GPL");
14 // Config Adjacent channels Perf -cal22
15 static struct dibx000_agc_config dib3000p_mt2060_agc_config
= {
16 .band_caps
= BAND_VHF
| BAND_UHF
,
17 .setup
= (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
37 static struct dib3000mc_config stk3000p_dib3000p_config
= {
38 &dib3000p_mt2060_agc_config
,
41 .ln_adc_level
= 0x1cc7,
43 .output_mpeg2_in_188_bytes
= 1,
49 static struct dibx000_agc_config dib3000p_panasonic_agc_config
= {
50 .band_caps
= BAND_VHF
| BAND_UHF
,
51 .setup
= (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
71 static struct dib3000mc_config mod3000p_dib3000p_config
= {
72 &dib3000p_panasonic_agc_config
,
75 .ln_adc_level
= 0x1cc7,
77 .output_mpeg2_in_188_bytes
= 1,
83 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter
*adap
)
85 if (le16_to_cpu(adap
->dev
->udev
->descriptor
.idVendor
) == USB_VID_LITEON
&&
86 le16_to_cpu(adap
->dev
->udev
->descriptor
.idProduct
) ==
87 USB_PID_LITEON_DVB_T_WARM
) {
91 adap
->fe_adap
[0].fe
= dvb_attach(dib3000mc_attach
,
93 DEFAULT_DIB3000P_I2C_ADDRESS
,
94 &mod3000p_dib3000p_config
);
95 if ((adap
->fe_adap
[0].fe
) == NULL
)
96 adap
->fe_adap
[0].fe
= dvb_attach(dib3000mc_attach
,
98 DEFAULT_DIB3000MC_I2C_ADDRESS
,
99 &mod3000p_dib3000p_config
);
100 if ((adap
->fe_adap
[0].fe
) != NULL
) {
101 if (adap
->priv
!= NULL
) {
102 struct dibusb_state
*st
= adap
->priv
;
103 st
->ops
.pid_parse
= dib3000mc_pid_parse
;
104 st
->ops
.pid_ctrl
= dib3000mc_pid_control
;
110 EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach
);
112 static struct mt2060_config stk3000p_mt2060_config
= {
116 int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter
*adap
)
118 struct dibusb_state
*st
= adap
->priv
;
121 struct i2c_adapter
*tun_i2c
;
123 // First IF calibration for Liteon Sticks
124 if (le16_to_cpu(adap
->dev
->udev
->descriptor
.idVendor
) == USB_VID_LITEON
&&
125 le16_to_cpu(adap
->dev
->udev
->descriptor
.idProduct
) == USB_PID_LITEON_DVB_T_WARM
) {
127 dibusb_read_eeprom_byte(adap
->dev
,0x7E,&a
);
128 dibusb_read_eeprom_byte(adap
->dev
,0x7F,&b
);
135 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a
, b
);
137 } else if (le16_to_cpu(adap
->dev
->udev
->descriptor
.idVendor
) == USB_VID_DIBCOM
&&
138 le16_to_cpu(adap
->dev
->udev
->descriptor
.idProduct
) == USB_PID_DIBCOM_MOD3001_WARM
) {
140 dibusb_read_eeprom_byte(adap
->dev
, 7, &desc
);
144 dibusb_read_eeprom_byte(adap
->dev
, a
, &desc
);
146 } while (a
> 7 && (desc
== 0xff || desc
== 0x00));
148 if1
-= (0xff - desc
);
154 tun_i2c
= dib3000mc_get_tuner_i2c_master(adap
->fe_adap
[0].fe
, 1);
155 if (dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &stk3000p_mt2060_config
, if1
) == NULL
) {
156 /* not found - use panasonic pll parameters */
157 if (dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60, tun_i2c
, DVB_PLL_ENV57H1XD5
) == NULL
)
160 st
->mt2060_present
= 1;
161 /* set the correct parameters for the dib3000p */
162 dib3000mc_set_config(adap
->fe_adap
[0].fe
, &stk3000p_dib3000p_config
);
166 EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach
);