diff options
Diffstat (limited to 'drivers/media/dvb/frontends/dib3000mc.c')
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mc.c | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 4a31c05eaecd..cd33705a4320 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -48,8 +48,6 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe,16=s #define deb_getf(args...) dprintk(0x08,args) #define deb_stat(args...) dprintk(0x10,args) -static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr); - static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) { @@ -297,7 +295,7 @@ static int dib3000mc_set_general_cfg(struct dib3000_state *state, struct dvb_fro static int dib3000mc_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *fep) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; fe_code_rate_t *cr; u16 tps_val,cr_val; @@ -458,15 +456,13 @@ static int dib3000mc_get_frontend(struct dvb_frontend* fe, static int dib3000mc_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *fep, int tuner) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; struct dvb_ofdm_parameters *ofdm = &fep->u.ofdm; int search_state,auto_val; u16 val; - if (tuner) { /* initial call from dvb */ - dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); - state->config.pll_set(fe,fep,NULL); - dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); + if (tuner && state->config.pll_set) { /* initial call from dvb */ + state->config.pll_set(fe,fep); state->last_tuned_freq = fep->frequency; // if (!scanboost) { @@ -554,19 +550,15 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, dib3000mc_set_adp_cfg(state,ofdm->constellation); wr_foreach(dib3000mc_reg_offset, dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); - - } return 0; } static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) { - struct dib3000_state *state; - + struct dib3000_state *state = fe->demodulator_priv; deb_info("init start\n"); - state = fe->demodulator_priv; state->timing_offset = 0; state->timing_offset_comp_done = 0; @@ -649,17 +641,15 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); -/* if (state->config->pll_init) { - dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); - state->config->pll_init(fe,NULL); - dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); - }*/ + if (state->config.pll_init) + state->config.pll_init(fe); + deb_info("init end\n"); return 0; } static int dib3000mc_read_status(struct dvb_frontend* fe, fe_status_t *stat) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; u16 lock = rd(DIB3000MC_REG_LOCKING); *stat = 0; @@ -679,23 +669,23 @@ static int dib3000mc_read_status(struct dvb_frontend* fe, fe_status_t *stat) static int dib3000mc_read_ber(struct dvb_frontend* fe, u32 *ber) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; *ber = ((rd(DIB3000MC_REG_BER_MSB) << 16) | rd(DIB3000MC_REG_BER_LSB)); return 0; } static int dib3000mc_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; - *unc = rd(DIB3000MC_REG_PACKET_ERROR_COUNT); + *unc = rd(DIB3000MC_REG_PACKET_ERRORS); return 0; } /* see dib3000mb.c for calculation comments */ static int dib3000mc_read_signal_strength(struct dvb_frontend* fe, u16 *strength) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB); *strength = (((val >> 6) & 0xff) << 8) + (val & 0x3f); @@ -706,7 +696,7 @@ static int dib3000mc_read_signal_strength(struct dvb_frontend* fe, u16 *strength /* see dib3000mb.c for calculation comments */ static int dib3000mc_read_snr(struct dvb_frontend* fe, u16 *snr) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; u16 val = rd(DIB3000MC_REG_SIGNAL_NOISE_LSB), val2 = rd(DIB3000MC_REG_SIGNAL_NOISE_MSB); u16 sig,noise; @@ -726,7 +716,7 @@ static int dib3000mc_read_snr(struct dvb_frontend* fe, u16 *snr) static int dib3000mc_sleep(struct dvb_frontend* fe) { - struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state* state = fe->demodulator_priv; set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_PWR_DOWN); wr(DIB3000MC_REG_CLK_CFG_1,DIB3000MC_CLK_CFG_1_POWER_DOWN); @@ -737,10 +727,7 @@ static int dib3000mc_sleep(struct dvb_frontend* fe) static int dib3000mc_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) { - tune->min_delay_ms = 2000; - tune->step_size = 166667; - tune->max_drift = 166667 * 2; - + tune->min_delay_ms = 1000; return 0; } @@ -756,7 +743,7 @@ static int dib3000mc_set_frontend_and_tuner(struct dvb_frontend* fe, struct dvb_ static void dib3000mc_release(struct dvb_frontend* fe) { - struct dib3000_state *state = (struct dib3000_state *) fe->demodulator_priv; + struct dib3000_state *state = fe->demodulator_priv; kfree(state); } @@ -771,7 +758,7 @@ static int dib3000mc_pid_control(struct dvb_frontend *fe,int index, int pid,int static int dib3000mc_fifo_control(struct dvb_frontend *fe, int onoff) { - struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state *state = fe->demodulator_priv; u16 tmp = rd(DIB3000MC_REG_SMO_MODE); deb_xfer("%s fifo\n",onoff ? "enabling" : "disabling"); @@ -803,7 +790,7 @@ static int dib3000mc_pid_parse(struct dvb_frontend *fe, int onoff) static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr) { - struct dib3000_state *state = (struct dib3000_state*) fe->demodulator_priv; + struct dib3000_state *state = fe->demodulator_priv; if (onoff) { wr(DIB3000MC_REG_TUNER, DIB3000_TUNER_WRITE_ENABLE(pll_addr)); } else { @@ -844,7 +831,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, u16 devid; /* allocate memory for the internal state */ - state = (struct dib3000_state*) kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); + state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL); if (state == NULL) goto error; memset(state,0,sizeof(struct dib3000_state)); |