Dword MT2260B0_set (
	IN  Demodulator*	demodulator,
	IN  Byte			chip,
    IN  Word			bandwidth,
    IN  Dword			frequency
) {
    Dword error = Error_NO_ERROR;
    UData_t status = MT_OK;
    UData_t freq;
    UData_t bw;

    freq = frequency * 1000UL;
    bw = (UData_t) bandwidth * 1000UL;

    /** Change frequency */
    status = MT2260_ChangeFreq (Microtune_MT2260B0_tunerHandles[chip], freq);
	if (MT_NO_ERROR (status))
		status |= MT2260_SetParam (Microtune_MT2260B0_tunerHandles[chip], MT2260_OUTPUT_BW, bw);
	if (MT_IS_ERROR (status))
		error = Error_MT_TUNE_FAIL;

	User_delay (demodulator, 100);

	return (error);
}
Example #2
0
/*****************************************************************************
 * Func : microtune_cofdm_mt2060_set 
 *
 * Desc : set mt2060 tuner
 *
 * Parm : hFE      : handle of dvb_frontend
 *        hFEParam : handle of dvb frontend parameters
 *        pllbuf   : not used 
 *
 * Retn : 0 for success, others for fail 
 *
 *****************************************************************************/ 
int microtune_cofdm_mt2060_set(
    void*           hFE,
    void*           hFEParam,
    unsigned char   pllbuf[4])
{
    struct dvb_frontend* fe = (struct dvb_frontend*) hFE;            
    struct dvb_frontend_parameters* fep = (struct dvb_frontend_parameters*) hFEParam;
    unsigned long MTStatus = MT_OK;    
    MT2060_MODULE*  pMT2060_Module = (MT2060_MODULE*) fe->tuner_priv;   
    
    if (pMT2060_Module == NULL){
        printk("[ERROR][FETAL] microtune_cofdm_mt2060_set:: NULL Module!!\n");
        goto error_status_null_module;
    }
    
    printk("microtune_cofdm_mt2060_set....\n");
    
    MTStatus |= MT2060_ChangeFreq(
            pMT2060_Module->hMT2060,
		    fep->frequency,             /* RF input center frequency   */
		    pMT2060_Module->f_IF1,      /* desired 1st IF frequency    */
		    pMT2060_Module->f_out,      /* IF output center frequency  */
		    pMT2060_Module->f_IFBW);    /* IF output bandwidth + guard */
    
	if(MT_NO_ERROR(MTStatus)){
	    pMT2060_Module->f_in = fep->frequency;              
        return 0; 
    }        
    else        
        return 1;        
        
error_status_null_module:
    return 1;        
}
Dword MT2260B0_open (
	IN  Demodulator*	demodulator,
	IN  Byte			chip
) {
	Dword error = Error_NO_ERROR;
    UData_t status = MT_OK;

	Microtune_MT2260B0_userDatas[chip].chip = chip;
	Microtune_MT2260B0_userDatas[chip].demodulator = demodulator;
    status = MT2260_Open ((unsigned int)Microtune_MT2260B0_EXT_ADDRESS, &Microtune_MT2260B0_tunerHandles[chip], &Microtune_MT2260B0_userDatas[chip]);
	if (MT_NO_ERROR (status))
		status |= MT2260_SetParam (Microtune_MT2260B0_tunerHandles[chip], MT2260_STEPSIZE, 62500);
	if (MT_NO_ERROR (status))
		status |= MT2260_SetParam (Microtune_MT2260B0_tunerHandles[chip], MT2260_RF_EXT, 1);
	if (MT_NO_ERROR (status))
		status |= MT2260_SetParam (Microtune_MT2260B0_tunerHandles[chip], MT2260_BB_EXT, 1);
    if (MT_IS_ERROR (status)) 
		error = Error_MT_TUNE_FAIL;

    return (error);
}
Example #4
0
/***************************************************************************** 
 * Func : microtune_cofdm_mt2060_init 
 *
 * Desc : init mt2060 tuner
 *
 * Parm : hFE      : handle of dvb_frontend
 *        pllbuf   : not used  
 *
 * Retn : 0 for success, others for fail 
 *
 *****************************************************************************/ 
int microtune_cofdm_mt2060_init(
    void*                   hFE, 
    unsigned char           tuner_addr, 
    struct i2c_adapter*     i2c_adap
    )
{              
    struct dvb_frontend* fe     = (struct dvb_frontend*) hFE;      
    unsigned long   MTStatus    =  MT_OK;     
    MT2060_MODULE*  pMT2060_Module = NULL;   

    if (fe->tuner_priv == NULL)
    {
        printk("microtune_cofdm_mt2060_init....\n");                
        
        pMT2060_Module = kmalloc(sizeof(MT2060_MODULE), GFP_KERNEL);
        if (pMT2060_Module == NULL){
            printk("[ERROR][FETAL] : allocate mt2060 module memory fail\n");
            goto error_status_allocate_extra_module_memory;
        }
        
        fe->tuner_priv = (void*) pMT2060_Module; 
        
        pMT2060_Module->hMT2060         = NULL;
        pMT2060_Module->f_in            = 545000000;          // Default RF Freq
        pMT2060_Module->f_IF1           = 1220000000;         // 1st IF SAW : 1220 MHz
        pMT2060_Module->f_out           = 36125000;           // Ouput IF Frequency : 36.125 MHz
        pMT2060_Module->f_IFBW          = 6000000 + 750000;   // Bandwidth : 6MHz + 750KHz Guard Band        
        pMT2060_Module->VGA_Gain        = MT2060_VGAG_5DB;    
        pMT2060_Module->tuner_addr      = tuner_addr;
        pMT2060_Module->i2c_adap        = i2c_adap;
            	    	
        if ((MTStatus=MT2060_Open(tuner_addr,&(pMT2060_Module->hMT2060), fe))!=MT_OK){
            printk("[ERROR][FETAL] : construct mt2060 fail (%d)\n",(int)MTStatus);
            goto error_status_construct_mt2060;                    
        }         
                
        //perform tuner driver overrides here
    	MTStatus |= MT2060_SetParam(pMT2060_Module->hMT2060, MT2060_IF1_CENTER, pMT2060_Module->f_IF1);
    	if(!MT_NO_ERROR(MTStatus))
    	{
    		printk("[ERROR][FETAL]Initial:: SetParam Error!! \n");
    		goto error_status_set_mt2060_if1;       		
    	}
    	
    	MTStatus |= MT2060_SetGainRange(pMT2060_Module->hMT2060, pMT2060_Module->VGA_Gain);
    	if(!MT_NO_ERROR(MTStatus))
    	{
    		printk("[ERROR][FETAL]Initial::SetGainRange Fail!! \n");
    		goto error_status_set_mt2060_vga;   
    	}      	          
    	
    	MTStatus |= MT2060_ChangeFreq(
    	    pMT2060_Module->hMT2060,
		    pMT2060_Module->f_in,     /* RF input center frequency   */
		    pMT2060_Module->f_IF1,    /* desired 1st IF frequency    */
		    pMT2060_Module->f_out,    /* IF output center frequency  */
		    pMT2060_Module->f_IFBW);  /* IF output bandwidth + guard */        
		    
    	if(!MT_NO_ERROR(MTStatus))
    	{
    		printk("[ERROR][FETAL]Initial::MT2060_ChangeFreq Fail!! \n");
    		goto error_status_set_mt2060_frequency;   
    	}      	     	        		    
    }                        	    	                                      
    return 0;
    
//---    
error_status_set_mt2060_frequency:
error_status_set_mt2060_vga:
error_status_set_mt2060_if1:
    MT2060_Close(pMT2060_Module->hMT2060);
error_status_construct_mt2060:
    kfree(pMT2060_Module);    
error_status_allocate_extra_module_memory:
    return 1;    
}