Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367081
b: refs/heads/master
c: f45f513
h: refs/heads/master
i:
  367079: 9bbf255
v: v3
  • Loading branch information
Olivier Grenie authored and Mauro Carvalho Chehab committed Apr 22, 2013
1 parent 18e6f0b commit 7913cd2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 208 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5e9c85d983375fd84a4ba98b34f8fc38d4ec8766
refs/heads/master: f45f513a9325b52a5f3e26ee8d15471e8b692947
3 changes: 1 addition & 2 deletions trunk/drivers/media/dvb-core/dvb-usb-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@
#define USB_PID_DIBCOM_STK7770P 0x1e80
#define USB_PID_DIBCOM_NIM7090 0x1bb2
#define USB_PID_DIBCOM_TFE7090PVR 0x1bb4
#define USB_PID_DIBCOM_TFE7090E 0x1bb7
#define USB_PID_DIBCOM_TFE7790E 0x1e6e
#define USB_PID_DIBCOM_TFE7790P 0x1e6e
#define USB_PID_DIBCOM_NIM9090M 0x2383
#define USB_PID_DIBCOM_NIM9090MD 0x2384
#define USB_PID_DPOSH_M9206_COLD 0x9206
Expand Down
233 changes: 28 additions & 205 deletions trunk/drivers/media/usb/dvb-usb/dib0700_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -2499,36 +2499,16 @@ static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
return 0;
}

static int dib7090e_update_lna(struct dvb_frontend *fe, u16 agc_global)
static int tfe7790p_update_lna(struct dvb_frontend *fe, u16 agc_global)
{
u16 agc1 = 0, agc2, wbd = 0, wbd_target, wbd_offset, threshold_agc1;
s16 wbd_delta;
deb_info("update LNA: agc global=%i", agc_global);

if ((fe->dtv_property_cache.frequency) < 400000000)
threshold_agc1 = 25000;
else
threshold_agc1 = 30000;

wbd_target = (dib0090_get_wbd_target(fe)*8+1)/2;
wbd_offset = dib0090_get_wbd_offset(fe);
dib7000p_get_agc_values(fe, NULL, &agc1, &agc2, &wbd);
wbd_delta = (s16)wbd - (((s16)wbd_offset+10)*4) ;

deb_info("update lna, agc_global=%d agc1=%d agc2=%d",
agc_global, agc1, agc2);
deb_info("update lna, wbd=%d wbd target=%d wbd offset=%d wbd delta=%d",
wbd, wbd_target, wbd_offset, wbd_delta);

if ((agc1 < threshold_agc1) && (wbd_delta > 0)) {
dib0090_set_switch(fe, 1, 1, 1);
dib0090_set_vga(fe, 0);
dib0090_update_rframp_7090(fe, 0);
dib0090_update_tuning_table_7090(fe, 0);
if (agc_global < 25000) {
dib7000p_set_gpio(fe, 8, 0, 0);
dib7000p_set_agc1_min(fe, 0);
} else {
dib0090_set_vga(fe, 1);
dib0090_update_rframp_7090(fe, 1);
dib0090_update_tuning_table_7090(fe, 1);
dib0090_set_switch(fe, 0, 0, 0);
dib7000p_set_gpio(fe, 8, 0, 1);
dib7000p_set_agc1_min(fe, 32768);
}

return 0;
Expand All @@ -2542,15 +2522,6 @@ static struct dib0090_wbd_slope dib7090_wbd_table[] = {
{ 0xFFFF, 0, 0, 0, 0, 0},
};

static struct dib0090_wbd_slope dib7090e_wbd_table[] = {
{ 380, 81, 850, 64, 540, 4},
{ 700, 51, 866, 21, 320, 4},
{ 860, 48, 666, 18, 330, 6},
{1700, 0, 250, 0, 100, 6},
{2600, 0, 250, 0, 100, 6},
{ 0xFFFF, 0, 0, 0, 0, 0},
};

static struct dibx000_agc_config dib7090_agc_config[2] = {
{
.band_caps = BAND_UHF,
Expand Down Expand Up @@ -2729,34 +2700,6 @@ static struct dib7000p_config tfe7090pvr_dib7000p_config[2] = {
}
};

static struct dib7000p_config tfe7090e_dib7000p_config = {
.output_mpeg2_in_188_bytes = 1,
.hostbus_diversity = 1,
.tuner_is_baseband = 1,
.update_lna = dib7090e_update_lna,

.agc_config_count = 2,
.agc = dib7090_agc_config,

.bw = &dib7090_clock_config_12_mhz,

.gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS,
.gpio_val = DIB7000P_GPIO_DEFAULT_VALUES,
.gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS,

.pwm_freq_div = 0,

.agc_control = dib7090_agc_restart,

.spur_protect = 0,
.disable_sample_and_hold = 0,
.enable_current_mirror = 0,
.diversity_delay = 0,

.output_mode = OUTMODE_MPEG2_FIFO,
.enMpegOutput = 1,
};

static const struct dib0090_config nim7090_dib0090_config = {
.io.clock_khz = 12000,
.io.pll_bypass = 0,
Expand Down Expand Up @@ -2791,47 +2734,11 @@ static const struct dib0090_config nim7090_dib0090_config = {
.in_soc = 1,
};

static const struct dib0090_config tfe7090e_dib0090_config = {
.io.clock_khz = 12000,
.io.pll_bypass = 0,
.io.pll_range = 0,
.io.pll_prediv = 3,
.io.pll_loopdiv = 6,
.io.adc_clock_ratio = 0,
.io.pll_int_loop_filt = 0,
.reset = dib7090_tuner_sleep,
.sleep = dib7090_tuner_sleep,

.freq_offset_khz_uhf = 0,
.freq_offset_khz_vhf = 0,

.get_adc_power = dib7090_get_adc_power,

.clkouttobamse = 1,
.analog_output = 0,

.wbd_vhf_offset = 0,
.wbd_cband_offset = 0,
.use_pwm_agc = 1,
.clkoutdrive = 0,

.fref_clock_ratio = 0,

.wbd = dib7090e_wbd_table,

.ls_cfg_pad_drv = 0,
.data_tx_drv = 0,
.low_if = NULL,
.in_soc = 1,
.force_cband_input = 1,
.is_dib7090e = 1,
};

static struct dib7000p_config tfe7790e_dib7000p_config = {
static struct dib7000p_config tfe7790p_dib7000p_config = {
.output_mpeg2_in_188_bytes = 1,
.hostbus_diversity = 1,
.tuner_is_baseband = 1,
.update_lna = dib7090e_update_lna,
.update_lna = tfe7790p_update_lna,

.agc_config_count = 2,
.agc = dib7090_agc_config,
Expand All @@ -2855,7 +2762,7 @@ static struct dib7000p_config tfe7790e_dib7000p_config = {
.enMpegOutput = 1,
};

static const struct dib0090_config tfe7790e_dib0090_config = {
static const struct dib0090_config tfe7790p_dib0090_config = {
.io.clock_khz = 12000,
.io.pll_bypass = 0,
.io.pll_range = 0,
Expand All @@ -2881,14 +2788,14 @@ static const struct dib0090_config tfe7790e_dib0090_config = {

.fref_clock_ratio = 0,

.wbd = dib7090e_wbd_table,
.wbd = dib7090_wbd_table,

.ls_cfg_pad_drv = 0,
.data_tx_drv = 0,
.low_if = NULL,
.in_soc = 1,
.force_cband_input = 1,
.is_dib7090e = 1,
.force_cband_input = 0,
.is_dib7090e = 0,
.force_crystal_mode = 1,
};

Expand Down Expand Up @@ -3084,37 +2991,11 @@ static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap)
return 0;
}

static int tfe7090e_frontend_attach(struct dvb_usb_adapter *adap)
{
dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
msleep(20);
dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1);
dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);

msleep(20);
dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
msleep(20);
dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);

if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
1, 0x10, &tfe7090e_dib7000p_config) != 0) {
err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
__func__);
return -ENODEV;
}
adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
0x80, &tfe7090e_dib7000p_config);

return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
}

static int tfe7790e_frontend_attach(struct dvb_usb_adapter *adap)
static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap)
{
struct dib0700_state *st = adap->dev->priv;

/* The TFE7790E requires the dib0700 to not be in master mode */
/* The TFE7790P requires the dib0700 to not be in master mode */
st->disable_streaming_master_mode = 1;

dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
Expand All @@ -3130,42 +3011,25 @@ static int tfe7790e_frontend_attach(struct dvb_usb_adapter *adap)
dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);

if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap,
1, 0x10, &tfe7790e_dib7000p_config) != 0) {
1, 0x10, &tfe7790p_dib7000p_config) != 0) {
err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n",
__func__);
return -ENODEV;
}
adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,
0x80, &tfe7790e_dib7000p_config);
0x80, &tfe7790p_dib7000p_config);

return adap->fe_adap[0].fe == NULL ? -ENODEV : 0;
}

static int tfe7790e_tuner_attach(struct dvb_usb_adapter *adap)
{
struct dib0700_adapter_state *st = adap->priv;
struct i2c_adapter *tun_i2c =
dib7090_get_i2c_tuner(adap->fe_adap[0].fe);

if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
&tfe7790e_dib0090_config) == NULL)
return -ENODEV;

dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);

st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params;
adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup;
return 0;
}

static int tfe7090e_tuner_attach(struct dvb_usb_adapter *adap)
static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap)
{
struct dib0700_adapter_state *st = adap->priv;
struct i2c_adapter *tun_i2c =
dib7090_get_i2c_tuner(adap->fe_adap[0].fe);

if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c,
&tfe7090e_dib0090_config) == NULL)
&tfe7790p_dib0090_config) == NULL)
return -ENODEV;

dib7000p_set_gpio(adap->fe_adap[0].fe, 8, 0, 1);
Expand Down Expand Up @@ -3708,10 +3572,9 @@ struct usb_device_id dib0700_usb_id_table[] = {
/* 75 */{ USB_DEVICE(USB_VID_MEDION, USB_PID_CREATIX_CTX1921) },
{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E) },
{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV340E_SE) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7090E) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790E) },
/* 80 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE7790P) },
{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_TFE8096P) },
/* 80 */{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_DTT_2) },
{ 0 } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
Expand Down Expand Up @@ -4022,7 +3885,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
{ NULL },
},
{ "Elgato EyeTV DTT rev. 2",
{ &dib0700_usb_id_table[81], NULL },
{ &dib0700_usb_id_table[80], NULL },
{ NULL },
},
},
Expand Down Expand Up @@ -4839,48 +4702,8 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.pid_filter_count = 32,
.pid_filter = stk70x0p_pid_filter,
.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
.frontend_attach = tfe7090e_frontend_attach,
.tuner_attach = tfe7090e_tuner_attach,

DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
} },

.size_of_priv =
sizeof(struct dib0700_adapter_state),
},
},

.num_device_descs = 1,
.devices = {
{ "DiBcom TFE7090E reference design",
{ &dib0700_usb_id_table[78], NULL },
{ NULL },
},
},

.rc.core = {
.rc_interval = DEFAULT_RC_INTERVAL,
.rc_codes = RC_MAP_DIB0700_RC5_TABLE,
.module_name = "dib0700",
.rc_query = dib0700_rc_query_old_firmware,
.allowed_protos = RC_BIT_RC5 |
RC_BIT_RC6_MCE |
RC_BIT_NEC,
.change_protocol = dib0700_change_protocol,
},
}, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
.num_adapters = 1,
.adapter = {
{
.num_frontends = 1,
.fe = {{
.caps = DVB_USB_ADAP_HAS_PID_FILTER |
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
.pid_filter_count = 32,
.pid_filter = stk70x0p_pid_filter,
.pid_filter_ctrl = stk70x0p_pid_filter_ctrl,
.frontend_attach = tfe7790e_frontend_attach,
.tuner_attach = tfe7790e_tuner_attach,
.frontend_attach = tfe7790p_frontend_attach,
.tuner_attach = tfe7790p_tuner_attach,

DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
} },
Expand All @@ -4892,8 +4715,8 @@ struct dvb_usb_device_properties dib0700_devices[] = {

.num_device_descs = 1,
.devices = {
{ "DiBcom TFE7790E reference design",
{ &dib0700_usb_id_table[79], NULL },
{ "DiBcom TFE7790P reference design",
{ &dib0700_usb_id_table[78], NULL },
{ NULL },
},
},
Expand Down Expand Up @@ -4934,7 +4757,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.num_device_descs = 1,
.devices = {
{ "DiBcom TFE8096P reference design",
{ &dib0700_usb_id_table[80], NULL },
{ &dib0700_usb_id_table[79], NULL },
{ NULL },
},
},
Expand Down

0 comments on commit 7913cd2

Please sign in to comment.