Skip to content

Commit

Permalink
[media] dib7000p/dib0090: update the driver
Browse files Browse the repository at this point in the history
This patch intends to update the dib7000p and dib0090 driver in order to
improve the performances.

Signed-off-by: Olivier Grenie <olivier.grenie@dibcom.fr>
Signed-off-by: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Olivier Grenie authored and Mauro Carvalho Chehab committed Nov 24, 2011
1 parent dd7aaa4 commit 2e80286
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 159 deletions.
8 changes: 8 additions & 0 deletions drivers/media/dvb/dvb-usb/dib0700_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,14 @@ static int dib7090_agc_startup(struct dvb_frontend *fe, struct dvb_frontend_para
return 0;
}

static int dib7090_agc_restart(struct dvb_frontend *fe, u8 restart)
{
deb_info("AGC restart callback: %d", restart);
if (restart == 0) /* before AGC startup */
dib0090_set_dc_servo(fe, 1);
return 0;
}

static struct dib0090_wbd_slope dib7090_wbd_table[] = {
{ 380, 81, 850, 64, 540, 4},
{ 860, 51, 866, 21, 375, 4},
Expand Down
15 changes: 13 additions & 2 deletions drivers/media/dvb/frontends/dib0090.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,13 +1112,21 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
else
dib0090_write_reg(state, 0x32, (0 << 11));

dib0090_write_reg(state, 0x04, 0x01);
dib0090_write_reg(state, 0x04, 0x03);
dib0090_write_reg(state, 0x39, (1 << 10));
}
}

EXPORT_SYMBOL(dib0090_pwm_gain_reset);

void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff)
{
struct dib0090_state *state = fe->tuner_priv;
if (DC_servo_cutoff < 4)
dib0090_write_reg(state, 0x04, DC_servo_cutoff);
}
EXPORT_SYMBOL(dib0090_set_dc_servo);

static u32 dib0090_get_slow_adc_val(struct dib0090_state *state)
{
u16 adc_val = dib0090_read_reg(state, 0x1d);
Expand Down Expand Up @@ -1505,7 +1513,10 @@ static int dib0090_reset(struct dvb_frontend *fe)
dib0090_set_EFUSE(state);

/* Congigure in function of the crystal */
if (state->config->io.clock_khz >= 24000)
if (state->config->force_crystal_mode != 0)
dib0090_write_reg(state, 0x14,
state->config->force_crystal_mode & 3);
else if (state->config->io.clock_khz >= 24000)
dib0090_write_reg(state, 0x14, 1);
else
dib0090_write_reg(state, 0x14, 2);
Expand Down
8 changes: 8 additions & 0 deletions drivers/media/dvb/frontends/dib0090.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ struct dib0090_config {
u8 fref_clock_ratio;
u16 force_cband_input;
struct dib0090_wbd_slope *wbd;
u8 is_dib7090e;
u8 force_crystal_mode;
};

#if defined(CONFIG_DVB_TUNER_DIB0090) || (defined(CONFIG_DVB_TUNER_DIB0090_MODULE) && defined(MODULE))
Expand All @@ -83,6 +85,7 @@ extern int dib0090_gain_control(struct dvb_frontend *fe);
extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff);
#else
static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
{
Expand Down Expand Up @@ -134,6 +137,11 @@ static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
}

static inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
}
#endif

#endif
Loading

0 comments on commit 2e80286

Please sign in to comment.