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_DESCRIPTION("Common methods for DIB3000MC");
12 MODULE_LICENSE("GPL");
15 // Config Adjacent channels Perf -cal22
16 static struct dibx000_agc_config dib3000p_mt2060_agc_config
= {
17 .band_caps
= BAND_VHF
| BAND_UHF
,
18 .setup
= (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
38 static struct dib3000mc_config stk3000p_dib3000p_config
= {
39 &dib3000p_mt2060_agc_config
,
42 .ln_adc_level
= 0x1cc7,
44 .output_mpeg2_in_188_bytes
= 1,
50 static struct dibx000_agc_config dib3000p_panasonic_agc_config
= {
51 .band_caps
= BAND_VHF
| BAND_UHF
,
52 .setup
= (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0),
72 static struct dib3000mc_config mod3000p_dib3000p_config
= {
73 &dib3000p_panasonic_agc_config
,
76 .ln_adc_level
= 0x1cc7,
78 .output_mpeg2_in_188_bytes
= 1,
84 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter
*adap
)
86 if (le16_to_cpu(adap
->dev
->udev
->descriptor
.idVendor
) == USB_VID_LITEON
&&
87 le16_to_cpu(adap
->dev
->udev
->descriptor
.idProduct
) ==
88 USB_PID_LITEON_DVB_T_WARM
) {
92 adap
->fe_adap
[0].fe
= dvb_attach(dib3000mc_attach
,
94 DEFAULT_DIB3000P_I2C_ADDRESS
,
95 &mod3000p_dib3000p_config
);
96 if ((adap
->fe_adap
[0].fe
) == NULL
)
97 adap
->fe_adap
[0].fe
= dvb_attach(dib3000mc_attach
,
99 DEFAULT_DIB3000MC_I2C_ADDRESS
,
100 &mod3000p_dib3000p_config
);
101 if ((adap
->fe_adap
[0].fe
) != NULL
) {
102 if (adap
->priv
!= NULL
) {
103 struct dibusb_state
*st
= adap
->priv
;
104 st
->ops
.pid_parse
= dib3000mc_pid_parse
;
105 st
->ops
.pid_ctrl
= dib3000mc_pid_control
;
111 EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach
);
113 static struct mt2060_config stk3000p_mt2060_config
= {
117 int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter
*adap
)
119 struct dibusb_state
*st
= adap
->priv
;
122 struct i2c_adapter
*tun_i2c
;
124 // First IF calibration for Liteon Sticks
125 if (le16_to_cpu(adap
->dev
->udev
->descriptor
.idVendor
) == USB_VID_LITEON
&&
126 le16_to_cpu(adap
->dev
->udev
->descriptor
.idProduct
) == USB_PID_LITEON_DVB_T_WARM
) {
128 dibusb_read_eeprom_byte(adap
->dev
,0x7E,&a
);
129 dibusb_read_eeprom_byte(adap
->dev
,0x7F,&b
);
136 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a
, b
);
138 } else if (le16_to_cpu(adap
->dev
->udev
->descriptor
.idVendor
) == USB_VID_DIBCOM
&&
139 le16_to_cpu(adap
->dev
->udev
->descriptor
.idProduct
) == USB_PID_DIBCOM_MOD3001_WARM
) {
141 dibusb_read_eeprom_byte(adap
->dev
, 7, &desc
);
145 dibusb_read_eeprom_byte(adap
->dev
, a
, &desc
);
147 } while (a
> 7 && (desc
== 0xff || desc
== 0x00));
149 if1
-= (0xff - desc
);
155 tun_i2c
= dib3000mc_get_tuner_i2c_master(adap
->fe_adap
[0].fe
, 1);
156 if (dvb_attach(mt2060_attach
, adap
->fe_adap
[0].fe
, tun_i2c
, &stk3000p_mt2060_config
, if1
) == NULL
) {
157 /* not found - use panasonic pll parameters */
158 if (dvb_attach(dvb_pll_attach
, adap
->fe_adap
[0].fe
, 0x60, tun_i2c
, DVB_PLL_ENV57H1XD5
) == NULL
)
161 st
->mt2060_present
= 1;
162 /* set the correct parameters for the dib3000p */
163 dib3000mc_set_config(adap
->fe_adap
[0].fe
, &stk3000p_dib3000p_config
);
167 EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach
);