示例#1
0
INT32 DVBT2_change_PLP(struct nim_device *dev, UINT8 plp_id, BOOL NeedToInitSystem, BOOL NeedToConfigTuner, BOOL AUTOSCAN)
{
	sony_result_t tuneResult = SONY_RESULT_OK;
	sony_demod_t* pDemod = (sony_demod_t *)dev->priv;
	sony_dvbt2_tune_param_t tuneParam;

	pDemod->t2_signal = 1;
	pDemod->plp_id = plp_id;
	memset(&tuneParam,0,sizeof(tuneParam));
	tuneParam.centerFreqKHz = pDemod->Frequency;
	tuneParam.bandwidth= pDemod->bandwidth;
	tuneParam.dataPlpId = plp_id; //selected data PLP ID. 
	tuneParam.profile = pDemod->t2_profile;
	tuneParam.tuneInfo = SONY_DEMOD_DVBT2_TUNE_INFO_OK;

	PRINTK_INFO("[%s]:PLP_id(%d),autoScan(%d).\n",__FUNCTION__,plp_id,AUTOSCAN);

	if(0 == AUTOSCAN)
		tuneResult = sony_integ_dvbt2_Tune(pDemod, &tuneParam,NeedToConfigTuner);
	else if(1 == AUTOSCAN)
	{
		tuneResult = sony_integ_dvbt2_BlindTune(pDemod, &tuneParam,NeedToConfigTuner,t2_lite_support);	//By SONY AEC 20130701
	}
	switch(tuneResult){
        case SONY_RESULT_OK:
	        PRINTK_INFO("[%s]:DVB-T2 TS Locked.\n",__FUNCTION__);
	        return SUCCESS;
        case SONY_RESULT_ERROR_UNLOCK:
	        PRINTK_INFO("[%s]:DVB-T2 TS Unlocked.\n",__FUNCTION__);
	        return ERR_FAILUE;
        case SONY_RESULT_ERROR_TIMEOUT:
            PRINTK_INFO("[%s]:DVB-T2 Wait TS Lock but Timeout.\n",__FUNCTION__);
	        return ERR_FAILUE;
        default:
	        PRINTK_INFO("[%s]:Error in sony_integ_dvbt2_Tune (%d)\n",__FUNCTION__,tuneResult);
	        return ERR_FAILUE;
    }

}
sony_result_t CXD2837_Scan(struct cxd2837_state *state,uint32_t startFreqkHz,uint8_t bwMHz)
{
#ifndef CONFIG_TH_CXD2837_DVBC_ENABLE
  	unsigned int modulation_mode=state->mode;
#endif
//	sony_result_t result = SONY_RESULT_OK;
	sony_result_t tuneResult = SONY_RESULT_OK;
//	sony_integ_t integ;
//	sony_demod_t demod;
//	sony_tuner_terr_cable_t tunerTerrCable;
#ifdef SONY_EXAMPLE_TUNER_ASCOT2E
//	sony_ascot2e_t ascot2e;
#endif
#ifdef	SONY_EXAMPLE_TUNER_ASCOT3
//	sony_ascot3_t ascot3;
#endif
//	sony_i2c_t i2c;
#ifndef CONFIG_TH_CXD2837_DVBC_ENABLE
	sony_dvbt2_tune_param_t tuneParam;

        sony_dvbt_tune_param_t dvbttuneParam;
#endif
//	int i;

	#ifdef CONFIG_TH_CXD2837_DVBC_ENABLE
		sony_dvbc_tune_param_t dvtcTunerParam;
		dvtcTunerParam.centerFreqKHz = startFreqkHz/1000;

		printk (" Tune to DVB-C signal with the following parameters:\n");
		printk ("  - Center Freq    : %uKHz\n", dvtcTunerParam.centerFreqKHz);

		/* Perform DVBC Tune */
		tuneResult = sony_integ_dvbc_Tune (&(state->device), &dvtcTunerParam);
		printk ("  - DVBC - Result         : %s\n\n", Common_Result[tuneResult]);

		if (tuneResult == SONY_RESULT_OK) {
			 SONY_TRACE_RETURN (tuneResult);
		}
		return tuneResult;
	#else

		/*------------------------------------------------------------------------------
		   Scan - DVB-T/T2 multiple standard scan.
		  ------------------------------------------------------------------------------*/

		//	printk ("------------------------------------------\n");
		//	printk (" Demodulator configuration \n");
		//	printk ("------------------------------------------\n");
		if((modulation_mode==0))
		{
			/* Configure the DVBT tune parameters based on the channel requirements */
			dvbttuneParam.bandwidth = bwMHz;//SONY_DEMOD_BW_8_MHZ;          /* Channel bandwidth */
			dvbttuneParam.centerFreqKHz = startFreqkHz/1000;                   /* Channel centre frequency in KHz */
			dvbttuneParam.profile = SONY_DVBT_PROFILE_HP;           /* Channel profile for hierachical modes.  For non-hierachical use HP */

			printk (" Tune to DVB-T signal with the following parameters:\n");
			printk ("  - Center Freq    : %uKHz\n", dvbttuneParam.centerFreqKHz);
			printk ("  - Bandwidth      : %s\n", Common_Bandwidth[dvbttuneParam.bandwidth]);
			printk ("  - Profile        : %s\n", DVBT_Profile[dvbttuneParam.profile]);

			/* Perform DVBT Tune */
			tuneResult = sony_integ_dvbt_Tune (&(state->device), &dvbttuneParam);
			printk ("  - Result         : %s\n\n", Common_Result[tuneResult]);

			if (tuneResult == SONY_RESULT_OK) {
				 SONY_TRACE_RETURN (tuneResult);
			}

		}
		else
		{
			/* Configure the DVBT2 tune parameters based on the channel requirements */
			tuneParam.bandwidth = bwMHz;// SONY_DEMOD_BW_8_MHZ;          /* Channel bandwidth */
			tuneParam.centerFreqKHz = startFreqkHz/1000;                   /* Channel center frequency in KHz */
			tuneParam.dataPlpId = 0;                            /* PLP ID where multiple PLP's are available */
			tuneParam.profile = SONY_DVBT2_PROFILE_BASE;        /* Channel profile is T2-Base */
			/* Additional tune information fed back from the driver.  This parameter should be checked
			if the result from the tune call is SONY_RESULT_OK_CONFIRM. */
			tuneParam.tuneInfo = SONY_DEMOD_DVBT2_TUNE_INFO_OK;

		        tuneParam.dataPlpId = plpidnew;
			plpidold = plpidnew;

			printk (" Tune to DVB-T2 signal with the following parameters:\n");
			printk ("  - Center Freq    : %uKHz\n", tuneParam.centerFreqKHz);
			printk ("  - Bandwidth      : %s\n", Common_Bandwidth[tuneParam.bandwidth]);
			printk ("  - PLP ID         : %u\n", tuneParam.dataPlpId);
			printk ("  - Profile        : %s\n", DVBT2_Profile[tuneParam.profile]);
			/* Perform DVBT2 Tune */
			tuneResult = sony_integ_dvbt2_Tune (&(state->device), &tuneParam);
			printk ("  - Result         : %s\n", Common_Result[tuneResult]);
			printk ("  - Tune Info      : %s\n\n", DVBT2_TuneInfo[tuneParam.tuneInfo]);
		}
	#endif
	return tuneResult;
}