Commit b6884a17 authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Mauro Carvalho Chehab

V4L/DVB (5954): Sync with DiBcom Driver Release 2.1.3 + some improvements

This changesets syncs the OpenSource driver for DiBcom demodulators
with version 2.1.3 of DiBcom reference driver. There were some
improvements since the last release for linux-dvb, e.g.:

- stepped AGC startup
- less space for initialization
- diversity synchronization

Furthermore this changeset contains the following things:

- latest AGC settings for MT2266-based devices (namely Nova-TD and other) will improve the sensitivity
- support for STK7700D reference design in dib0700-devices
- remove some line-breaks when debugging is enabled
- getting rid of layer between frontend_parameters and ofdm_channel used in dib*-drivers
Signed-off-by: default avatarPatrick Boettcher <pboettcher@dibcom.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent b2a65760
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 2. * Software Foundation, version 2.
* *
* Copyright (C) 2005-6 DiBcom, SA * Copyright (C) 2005-7 DiBcom, SA
*/ */
#include "dib0700.h" #include "dib0700.h"
...@@ -99,41 +99,87 @@ static int bristol_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -99,41 +99,87 @@ static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
/* STK7700D: Pinnacle Dual DVB-T Diversity */ /* STK7700D: Pinnacle Dual DVB-T Diversity */
static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config = { /* MT226x */
BAND_UHF/* | BAND_VHF*/, static struct dibx000_agc_config stk7700d_7000p_mt2266_agc_config[2] = {
0xE64, // setup {
2372, // inv_gain BAND_UHF, // band_caps
21, // time_stabiliz
/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
0, // alpha_level * P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
118, // thlock (0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (5 << 1) | (0 << 0), // setup
0, // wbd_inv 1130, // inv_gain
0, // wbd_ref 21, // time_stabiliz
0, // wbd_sel
0, // wbd_alpha 0, // alpha_level
118, // thlock
65535, // agc1_max
0, // agc1_min 0, // wbd_inv
65535, // agc2_max 3530, // wbd_ref
23592, // agc2_min 1, // wbd_sel
0, // agc1_pt1 0, // wbd_alpha
128, // agc1_pt2
128, // agc1_pt3 65535, // agc1_max
128, // agc1_slope1 33770, // agc1_min
0, // agc1_slope2 65535, // agc2_max
128, // agc2_pt1 23592, // agc2_min
253, // agc2_pt2
81, // agc2_slope1 0, // agc1_pt1
0, // agc2_slope2 62, // agc1_pt2
255, // agc1_pt3
17, // alpha_mant 64, // agc1_slope1
27, // alpha_exp 64, // agc1_slope2
132, // agc2_pt1
23, // beta_mant 192, // agc2_pt2
51, // beta_exp 80, // agc2_slope1
80, // agc2_slope2
0, // perform_agc_softsplit : 1 en vrai!
17, // alpha_mant
27, // alpha_exp
23, // beta_mant
51, // beta_exp
1, // perform_agc_softsplit
}, {
BAND_VHF | BAND_LBAND, // band_caps
/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=1, P_agc_inv_pwm1=1, P_agc_inv_pwm2=1,
* P_agc_inh_dc_rv_est=0, P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
(0 << 15) | (0 << 14) | (1 << 11) | (1 << 10) | (1 << 9) | (0 << 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), // setup
2372, // inv_gain
21, // time_stabiliz
0, // alpha_level
118, // thlock
0, // wbd_inv
3530, // wbd_ref
1, // wbd_sel
0, // wbd_alpha
65535, // agc1_max
0, // agc1_min
65535, // agc2_max
23592, // agc2_min
0, // agc1_pt1
128, // agc1_pt2
128, // agc1_pt3
128, // agc1_slope1
0, // agc1_slope2
128, // agc2_pt1
253, // agc2_pt2
81, // agc2_slope1
0, // agc2_slope2
17, // alpha_mant
27, // alpha_exp
23, // beta_mant
51, // beta_exp
1, // perform_agc_softsplit
}
}; };
static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = { static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
...@@ -150,23 +196,25 @@ static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = { ...@@ -150,23 +196,25 @@ static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
.hostbus_diversity = 1, .hostbus_diversity = 1,
.tuner_is_baseband = 1, .tuner_is_baseband = 1,
.agc = &stk7700d_7000p_mt2266_agc_config, .agc_config_count = 2,
.agc = stk7700d_7000p_mt2266_agc_config,
.bw = &stk7700d_mt2266_pll_config, .bw = &stk7700d_mt2266_pll_config,
.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
}, },
{ .output_mpeg2_in_188_bytes = 1, { .output_mpeg2_in_188_bytes = 1,
.hostbus_diversity = 1, .hostbus_diversity = 1,
.tuner_is_baseband = 1, .tuner_is_baseband = 1,
.agc = &stk7700d_7000p_mt2266_agc_config, .agc_config_count = 2,
.agc = stk7700d_7000p_mt2266_agc_config,
.bw = &stk7700d_mt2266_pll_config, .bw = &stk7700d_mt2266_pll_config,
.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS, .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES, .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS, .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,
} }
}; };
...@@ -211,7 +259,7 @@ static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -211,7 +259,7 @@ static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap)
static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
int stk7700d_rc_query(struct dvb_usb_device *d, u32 *event, int *state) static int stk7700d_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{ {
u8 key[4]; u8 key[4];
int i; int i;
...@@ -241,7 +289,7 @@ int stk7700d_rc_query(struct dvb_usb_device *d, u32 *event, int *state) ...@@ -241,7 +289,7 @@ int stk7700d_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
#define KEY_MAP_SIZE (25+48) #define KEY_MAP_SIZE (25+48)
struct dvb_usb_rc_key stk7700d_rc_keys[] = { static struct dvb_usb_rc_key stk7700d_rc_keys[] = {
/* Key codes for the tiny Pinnacle remote*/ /* Key codes for the tiny Pinnacle remote*/
{ 0x07, 0x00, KEY_MUTE }, { 0x07, 0x00, KEY_MUTE },
{ 0x07, 0x01, KEY_MENU }, // Pinnacle logo { 0x07, 0x01, KEY_MENU }, // Pinnacle logo
...@@ -436,6 +484,7 @@ static struct dib7000m_config stk7700p_dib7000m_config = { ...@@ -436,6 +484,7 @@ static struct dib7000m_config stk7700p_dib7000m_config = {
static struct dib7000p_config stk7700p_dib7000p_config = { static struct dib7000p_config stk7700p_dib7000p_config = {
.output_mpeg2_in_188_bytes = 1, .output_mpeg2_in_188_bytes = 1,
.agc_config_count = 1,
.agc = &stk7700p_7000p_mt2060_agc_config, .agc = &stk7700p_7000p_mt2060_agc_config,
.bw = &stk7700p_pll_config, .bw = &stk7700p_pll_config,
...@@ -506,6 +555,7 @@ struct usb_device_id dib0700_usb_id_table[] = { ...@@ -506,6 +555,7 @@ struct usb_device_id dib0700_usb_id_table[] = {
{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) },
{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) },
{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
...@@ -615,7 +665,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { ...@@ -615,7 +665,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
} }
}, },
.num_device_descs = 3, .num_device_descs = 4,
.devices = { .devices = {
{ "Pinnacle PCTV 2000e", { "Pinnacle PCTV 2000e",
{ &dib0700_usb_id_table[11], NULL }, { &dib0700_usb_id_table[11], NULL },
...@@ -629,6 +679,10 @@ struct dvb_usb_device_properties dib0700_devices[] = { ...@@ -629,6 +679,10 @@ struct dvb_usb_device_properties dib0700_devices[] = {
{ &dib0700_usb_id_table[13], NULL }, { &dib0700_usb_id_table[13], NULL },
{ NULL }, { NULL },
}, },
{ "DiBcom STK7700D",
{ &dib0700_usb_id_table[14], NULL },
{ NULL },
},
}, },
.rc_interval = DEFAULT_RC_INTERVAL, .rc_interval = DEFAULT_RC_INTERVAL,
.rc_key_map = stk7700d_rc_keys, .rc_key_map = stk7700d_rc_keys,
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7
#define USB_PID_DIBCOM_STK7700P 0x1e14 #define USB_PID_DIBCOM_STK7700P 0x1e14
#define USB_PID_DIBCOM_STK7700P_PC 0x1e78 #define USB_PID_DIBCOM_STK7700P_PC 0x1e78
#define USB_PID_DIBCOM_STK7700D 0x1ef0
#define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131
#define USB_PID_DPOSH_M9206_COLD 0x9206 #define USB_PID_DPOSH_M9206_COLD 0x9206
#define USB_PID_DPOSH_M9206_WARM 0xa090 #define USB_PID_DPOSH_M9206_WARM 0xa090
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -9,6 +9,7 @@ struct dib7000p_config { ...@@ -9,6 +9,7 @@ struct dib7000p_config {
u8 tuner_is_baseband; u8 tuner_is_baseband;
int (*update_lna) (struct dvb_frontend *, u16 agc_global); int (*update_lna) (struct dvb_frontend *, u16 agc_global);
u8 agc_config_count;
struct dibx000_agc_config *agc; struct dibx000_agc_config *agc;
struct dibx000_bandwidth_config *bw; struct dibx000_bandwidth_config *bw;
...@@ -27,15 +28,19 @@ struct dib7000p_config { ...@@ -27,15 +28,19 @@ struct dib7000p_config {
u8 quartz_direct; u8 quartz_direct;
u8 spur_protect;
int (*agc_control) (struct dvb_frontend *, u8 before); int (*agc_control) (struct dvb_frontend *, u8 before);
}; };
#define DEFAULT_DIB7000P_I2C_ADDRESS 18 #define DEFAULT_DIB7000P_I2C_ADDRESS 18
extern struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg); extern struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg);
extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]);
extern struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int); extern struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int);
extern int dib7000pc_detection(struct i2c_adapter *i2c_adap); extern int dib7000pc_detection(struct i2c_adapter *i2c_adap);
extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]);
/* TODO /* TODO
extern INT dib7000p_set_gpio(struct dibDemod *demod, UCHAR num, UCHAR dir, UCHAR val); extern INT dib7000p_set_gpio(struct dibDemod *demod, UCHAR num, UCHAR dir, UCHAR val);
extern INT dib7000p_enable_vbg_voltage(struct dibDemod *demod); extern INT dib7000p_enable_vbg_voltage(struct dibDemod *demod);
......
...@@ -111,6 +111,8 @@ struct dibx000_bandwidth_config { ...@@ -111,6 +111,8 @@ struct dibx000_bandwidth_config {
u32 ifreq; u32 ifreq;
u32 timf; u32 timf;
u32 xtal_hz;
}; };
enum dibx000_adc_states { enum dibx000_adc_states {
...@@ -122,56 +124,17 @@ enum dibx000_adc_states { ...@@ -122,56 +124,17 @@ enum dibx000_adc_states {
DIBX000_VBG_DISABLE, DIBX000_VBG_DISABLE,
}; };
#define BW_INDEX_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \ #define BANDWIDTH_TO_KHZ(v) ( (v) == BANDWIDTH_8_MHZ ? 8000 : \
(v) == BANDWIDTH_7_MHZ ? 7000 : \ (v) == BANDWIDTH_7_MHZ ? 7000 : \
(v) == BANDWIDTH_6_MHZ ? 6000 : 8000 ) (v) == BANDWIDTH_6_MHZ ? 6000 : 8000 )
/* Chip output mode. */ /* Chip output mode. */
#define OUTMODE_HIGH_Z 0 #define OUTMODE_HIGH_Z 0
#define OUTMODE_MPEG2_PAR_GATED_CLK 1 #define OUTMODE_MPEG2_PAR_GATED_CLK 1
#define OUTMODE_MPEG2_PAR_CONT_CLK 2 #define OUTMODE_MPEG2_PAR_CONT_CLK 2
#define OUTMODE_MPEG2_SERIAL 7 #define OUTMODE_MPEG2_SERIAL 7
#define OUTMODE_DIVERSITY 4 #define OUTMODE_DIVERSITY 4
#define OUTMODE_MPEG2_FIFO 5 #define OUTMODE_MPEG2_FIFO 5
#define OUTMODE_ANALOG_ADC 6
/* I hope I can get rid of the following kludge in the near future */
struct dibx000_ofdm_channel {
u32 RF_kHz;
u8 Bw;
s16 nfft;
s16 guard;
s16 nqam;
s16 vit_hrch;
s16 vit_select_hp;
s16 vit_alpha;
s16 vit_code_rate_hp;
s16 vit_code_rate_lp;
u8 intlv_native;
};
#define FEP2DIB(fep,ch) \
(ch)->RF_kHz = (fep)->frequency / 1000; \
(ch)->Bw = (fep)->u.ofdm.bandwidth; \
(ch)->nfft = (fep)->u.ofdm.transmission_mode == TRANSMISSION_MODE_AUTO ? -1 : (fep)->u.ofdm.transmission_mode; \
(ch)->guard = (fep)->u.ofdm.guard_interval == GUARD_INTERVAL_AUTO ? -1 : (fep)->u.ofdm.guard_interval; \
(ch)->nqam = (fep)->u.ofdm.constellation == QAM_AUTO ? -1 : (fep)->u.ofdm.constellation == QAM_64 ? 2 : (fep)->u.ofdm.constellation; \
(ch)->vit_hrch = 0; /* linux-dvb is not prepared for HIERARCHICAL TRANSMISSION */ \
(ch)->vit_select_hp = 1; \
(ch)->vit_alpha = 1; \
(ch)->vit_code_rate_hp = (fep)->u.ofdm.code_rate_HP == FEC_AUTO ? -1 : (fep)->u.ofdm.code_rate_HP; \
(ch)->vit_code_rate_lp = (fep)->u.ofdm.code_rate_LP == FEC_AUTO ? -1 : (fep)->u.ofdm.code_rate_LP; \
(ch)->intlv_native = 1;
#define INIT_OFDM_CHANNEL(ch) do {\
(ch)->Bw = 0; \
(ch)->nfft = -1; \
(ch)->guard = -1; \
(ch)->nqam = -1; \
(ch)->vit_hrch = -1; \
(ch)->vit_select_hp = -1; \
(ch)->vit_alpha = -1; \
(ch)->vit_code_rate_hp = -1; \
(ch)->vit_code_rate_lp = -1; \
} while (0)
#endif #endif
...@@ -159,7 +159,7 @@ static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame ...@@ -159,7 +159,7 @@ static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
b[3] = tune >> 13; b[3] = tune >> 13;
mt2266_writeregs(priv,b,4); mt2266_writeregs(priv,b,4);
dprintk("set_parms: tune=%d band=%d\n",(int)tune,(int)lnaband); dprintk("set_parms: tune=%d band=%d",(int)tune,(int)lnaband);
dprintk("set_parms: [1..3]: %2x %2x %2x",(int)b[1],(int)b[2],(int)b[3]); dprintk("set_parms: [1..3]: %2x %2x %2x",(int)b[1],(int)b[2],(int)b[3]);
b[0] = 0x05; b[0] = 0x05;
...@@ -176,7 +176,7 @@ static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame ...@@ -176,7 +176,7 @@ static int mt2266_set_params(struct dvb_frontend *fe, struct dvb_frontend_parame
msleep(10); msleep(10);
i++; i++;
} while (i<10); } while (i<10);
dprintk("Lock when i=%i\n",(int)i); dprintk("Lock when i=%i",(int)i);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment