static int SI2168_Set_Frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { pr_dbg("Si2168_set_frontend\n"); int lock; int freq; int bandwidth_Hz; unsigned int symbol_rate_bps; CUSTOM_Constel_Enum constellation; CUSTOM_Stream_Enum stream; int standard; int polarization; int band; int plp_id; int i; struct si2168_state *state = fe->demodulator_priv; freq=p->frequency; unsigned char bandwidth=8; bandwidth=p->u.ofdm.bandwidth; if(bandwidth==0) bandwidth=8; else if(bandwidth==1) bandwidth=7; else if(bandwidth==2) bandwidth=6; else bandwidth=8; if((50000>p->frequency)||(p->frequency>900000)) { p->frequency =474000; pr_dbg("freq is out of range,force to set 474000khz\n"); } // MDrv_Tuner_SetTuner(freq,8); printk("tuner set ok\n"); standard=SILABS_DVB_T2; bandwidth_Hz=bandwidth*1000000; stream=0; symbol_rate_bps=0; constellation=0; polarization=0; band=0; plp_id=0; /* Call SiLabs_API_switch_to_standard, in case the standard is different or the init has not been done yet */ // if (SiLabs_API_switch_to_standard (&front_end, standard, 1) ==0) return 0; MDrv_Tuner_SetTuner(freq,bandwidth); NMI120_GetRSSI(1); printk("now to lock carrier\n"); SiLabs_API_lock_to_carrier (&front_end, standard, freq, bandwidth_Hz, stream, symbol_rate_bps, constellation, polarization, band, plp_id); state->freq=p->frequency; //these data will be writed to eeprom for(i=0;i<50;i++){ SiLabs_API_Demod_status(&front_end, &custom_status); if(1==custom_status.fec_lock){ printk("si2168 lock success\n"); break; } msleep(20); } printk("per is %d,c_n is %d,fec_lock is %d\n",custom_status.per,custom_status.c_n,custom_status.fec_lock); pr_dbg("si2168=>frequency=%d\r\n",p->frequency); return 0; }
static int si2168_set_frontend(struct dvb_frontend *fe) { struct aml_fe *afe = fe->demodulator_priv; struct aml_fe_dev *dev = afe->dtv_demod; struct dtv_frontend_properties *c = &fe->dtv_property_cache; pr_dbg("Si2168_set_frontend\n"); int lock; int freq; int bandwidth_Hz; unsigned int symbol_rate_bps; CUSTOM_Constel_Enum constellation; CUSTOM_Stream_Enum stream; int standard; int polarization; int band; int plp_id; int i; freq=c->frequency; unsigned int bandwidth=8; bandwidth=c->bandwidth_hz/1000000; if((bandwidth!=8)&&(bandwidth!=7)&&(bandwidth!=6)) bandwidth=8; if((50000000>c->frequency)||(c->frequency>900000000)) { c->frequency =474000000; pr_dbg("freq is out of range,force to set 474000khz\n"); } // MDrv_Tuner_SetTuner(freq,8); printk("tuner set ok\n"); if(c->ofdm_mode==OFDM_DVBT){ standard=SILABS_DVB_T; printk("SILABS_DVB_T\n"); }else if(c->ofdm_mode==OFDM_DVBT2){ standard=SILABS_DVB_T2; printk("SILABS_DVB_T2\n"); }else{ standard=SILABS_DVB_T2; printk("SILABS_DVB_T2\n"); } bandwidth_Hz=bandwidth*1000000; stream=0; symbol_rate_bps=0; constellation=0; polarization=0; band=0; plp_id=0; /* Call SiLabs_API_switch_to_standard, in case the standard is different or the init has not been done yet */ // if (SiLabs_API_switch_to_standard (&front_end, standard, 1) ==0) return 0; SiLabs_API_Tuner_I2C_Enable(&front_end); MDrv_Tuner_SetTuner(freq,bandwidth); NMI120_GetRSSI(1); SiLabs_API_Tuner_I2C_Disable(&front_end); printk("now to lock carrier\n"); SiLabs_API_lock_to_carrier (&front_end, standard, freq, bandwidth_Hz, stream, symbol_rate_bps, constellation, polarization, band, plp_id); afe->params = *c;//these data will be writed to eeprom for(i=0;i<50;i++){ SiLabs_API_Demod_status(&front_end, &custom_status); if(1==custom_status.fec_lock){ printk("si2168 lock success\n"); break; } msleep(20); } pr_dbg("per is %d,c_n is %d,fec_lock is %d\n",custom_status.per,custom_status.c_n,custom_status.fec_lock); pr_dbg("si2168=>frequency=%d\r\n",c->frequency); return 0; }