Esempio n. 1
0
void DDC_Init()
{
	__inf("DDC_Init\n");

    HDMI_WUINT32(0x504,HDMI_RUINT32(0x504)| 0x00000010);//set intial sequence
    HDMI_WUINT32(0x500,HDMI_RUINT32(0x500)| 0x08000000);//start
    while(HDMI_RUINT32(0x500)& 0x08000000);
    HDMI_WUINT32(0x504,HDMI_RUINT32(0x504)& 0xffffffef);//clear intial sequence
}
Esempio n. 2
0
__s32 DDC_Read(char cmd,char pointer,char offset,int nbyte,char * pbuf)
{
#if 0
   char i=0;
   char n=0;
   char off = offset;
   __u32 wait_ms;

   __inf("DDC_Read\n");

   while(nbyte >0)
   {
      if(nbyte > 16)
        n = 16;
      else
        n = nbyte;
      nbyte = nbyte -n;

      HDMI_WUINT32(0x518,HDMI_RUINT32(0x518)| 0x00008000);		//FIFO address clear
      HDMI_WUINT8(0x50f,pointer	);										//segment pointer
      HDMI_WUINT8(0x50d,off  		);										//offset address
      HDMI_WUINT32(0x508,(n<<16) +cmd);									//nbyte to access and cmd type
      HDMI_WUINT32(0x500,HDMI_RUINT32(0x500)| 0x08000000);		//start the command

      off   += n;

      wait_ms = 0;
      while(HDMI_RUINT32(0x500) & 0x08000000)
       {
        disp_delay_ms(1);
        wait_ms ++;
        if(wait_ms > 1000)
          {
              __wrn("ddc read timeout\n");
              return -1;
          }
        }


      i=0;
      while(i<n)
      {
   	     * pbuf ++ = HDMI_RUINT8(0x580);
   	     i++;
      }
   }
#endif
   return 0;

}
Esempio n. 3
0
//hdmi_core_close: cp from sun4i, any problem?
__s32 hdmi_core_close(void)
{
	HDMI_WUINT32(0x200,0x00000000);         //close drv/pll
	HDMI_WUINT32(0x204,0x00000000);
	HDMI_WUINT32(0x208,0x00000000);
	HDMI_WUINT32(0x004,0x00000000);			//close hdmi controller
	hdmi_state	=	HDMI_State_Idle;
	video_mode  = 	HDMI720P_50;
	memset(&audio_info,0,sizeof(HDMI_AUDIO_INFO));
	memset(Device_Support_VIC,0,sizeof(Device_Support_VIC));
	__inf("reg:  200:0x%08x,  204:0x%08x,  208:0x%08x,  004:0x%08x\n",HDMI_RUINT32(0x200), HDMI_RUINT32(0x204), HDMI_RUINT32(0x208), HDMI_RUINT32(0x004));
	return 0;
}
__s32 main_Hpd_Check(void)
{
	__s32 i,times;
	times    = 0;

	for(i=0;i<3;i++)
	{
		hdmi_delay_ms(200);
		if( HDMI_RUINT32(0x00c)&0x01)
			times++;
	}
	if(times == 3)      
        return 1;
	else
        return 0;
}
Esempio n. 5
0
static __s32 main_Hpd_Check(void)
{
	__s32 i,times_0 = 0,times_1 = 0;

	for(i=0;i<3;i++) {
		hdmi_delay_ms(200);
		if( HDMI_RUINT32(0x00c)&0x01) {
			times_1++;
		} else {
			times_0++;
		}
	}
	if(times_1 == 3)
		return 1;

	if(times_0 == 3)
		return 0;

	return HPD;
}
__s32 hdmi_main_task_loop(void)
{
	static __u32 times = 0;
	HPD = main_Hpd_Check();
	if( !HPD )
	{
        if((times++) >= 10)
        {
            times = 0;
            __inf("unplug state\n");
        }
		
		if(hdmi_state > HDMI_State_Wait_Hpd)
		{
            __inf("plugout\n");
            hdmi_state = HDMI_State_Wait_Hpd;
            Hdmi_hpd_event();
		}
	}
	switch(hdmi_state)
        {
    	        case HDMI_State_Idle:
    		        hdmi_state = 	HDMI_State_Wait_Hpd;
    		        return 0; 
    		 
    	        case HDMI_State_Wait_Hpd:
    		        if(HPD)
    		        {
    		 	        hdmi_state = 	HDMI_State_EDID_Parse;
    		 	        __inf("plugin\n");
    		        }else
    		        {
    		 	        return 0;
    		        } 
    		 
    	        case HDMI_State_Rx_Sense:
    		 
    	        case HDMI_State_EDID_Parse:
                        HDMI_WUINT32(0x004,0x80000000);
                        HDMI_WUINT32(0x208,(1<<31)+ (1<<30)+ (1<<29)+ (3<<27)+ (0<<26)+ 
                        	       (1<<25)+ (0<<24)+ (0<<23)+ (4<<20)+ (7<<17)+
                        	       (15<<12)+ (7<<8)+ (0x0f<<4)+(8<<0) );	  
                        HDMI_WUINT32(0x200,0xfe800000);   			//txen enable
                        HDMI_WUINT32(0x204,0x00D8C850);   			//ckss = 1

                        HDMI_WUINT32(0x20c, 0 << 21);    		 


                        ParseEDID();
                        HDMI_RUINT32(0x5f0);

    		        hdmi_state = HDMI_State_Wait_Video_config;
                        Hdmi_hpd_event();

    	        case HDMI_State_Wait_Video_config:
    	        if(video_enable)
                {
                        hdmi_state = 	HDMI_State_Video_config;
                }else
                {
                	return 0;
                }
    		 
    	        case HDMI_State_Video_config:
                        video_config(video_mode);
                        hdmi_state = 	HDMI_State_Audio_config;    	
    		 
    	        case HDMI_State_Audio_config:
                        audio_config();
                        hdmi_state = 	HDMI_State_Playback;    
    		 
    	        case HDMI_State_Playback:
    		        return 0;  
    		 
		default:
                        __wrn(" unkonwn hdmi state, set to idle\n");
                        hdmi_state = HDMI_State_Idle;	
                        return 0;	
        }
}
__s32 audio_config(void)
{
	__s32 i;

        __inf("audio_config, sample_rate:%d\n", audio_info.sample_rate);

	HDMI_WUINT32(0x040,0x00000000);
	HDMI_WUINT32(0x040,0x40000000);
	while(HDMI_RUINT32(0x040) != 0);
	HDMI_WUINT32(0x040,0x40000000);
	while(HDMI_RUINT32(0x040) != 0);	
	
	if(!audio_info.audio_en)
	{
        return 0;
	}
	i = get_audio_info(audio_info.sample_rate);
	if(i == -1)
	{
		return 0;
	}	
	
	if(audio_info.channel_num == 1)
        {
          HDMI_WUINT32(0x044,0x00000000);             	//audio fifo rst and select ddma, 2 ch 16bit pcm 
          HDMI_WUINT32(0x048,0x00000000);				//ddma,pcm layout0 1ch
          HDMI_WUINT32(0x04c,0x76543200);
		  
          HDMI_WUINT32(0x0A0,0x710a0184);             	//audio infoframe head 
          HDMI_WUINT32(0x0A4,0x00000000);             	//CA = 0X1F 
          HDMI_WUINT32(0x0A8,0x00000000); 
          HDMI_WUINT32(0x0Ac,0x00000000);           
        }else  if(audio_info.channel_num == 2)
        {
          HDMI_WUINT32(0x044,0x00000000);             	//audio fifo rst and select ddma, 2 ch 16bit pcm 
          if(audio_info.data_raw == 0)
          {
                HDMI_WUINT32(0x048,0x00000001);				//ddma,pcm layout0 2ch
          }
          else
          {
                HDMI_WUINT32(0x048,0x01000001);				//ddma,raw layout0 2ch
          }
          HDMI_WUINT32(0x04c,0x76543210);
		  
          HDMI_WUINT32(0x0A0,0x710a0184);             	//audio infoframe head 
          HDMI_WUINT32(0x0A4,0x00000000);             	//CA = 0X1F 
          HDMI_WUINT32(0x0A8,0x00000000); 
          HDMI_WUINT32(0x0Ac,0x00000000);           
    }else if(audio_info.channel_num == 8)
    {
          HDMI_WUINT32(0x044,0x00000000);             	//audio fifo rst and select ddma, 2 ch 16bit pcm 
          HDMI_WUINT32(0x048,0x0000000f);				//ddma,pcm layout1 8ch
          HDMI_WUINT32(0x04c,0x76543210);
		  
          HDMI_WUINT32(0x0A0,0x520a0184);             	//audio infoframe head 
          HDMI_WUINT32(0x0A4,0x1F000000);             	//CA = 0X1F 
          HDMI_WUINT32(0x0A8,0x00000000); 
          HDMI_WUINT32(0x0Ac,0x00000000); 
    }else
    {
    		__wrn("unkonwn num_ch:%d\n", audio_info.channel_num);
    }     

    
    HDMI_WUINT32(0x050,audio_info.CTS			);                   	//CTS and N 
    HDMI_WUINT32(0x054,audio_info.ACR_N			);
    HDMI_WUINT32(0x058,audio_info.CH_STATUS0 	);
    HDMI_WUINT32(0x05c,audio_info.CH_STATUS1 	);

    HDMI_WUINT32(0x040,0x80000000);
    HDMI_WUINT32(0x004,0x80000000);

//for audio test
#if 0
    //dedicated dma setting  aw1623 env  
    sys_put_wvalue(0xf1c023a4,0x40c00000);	//ddma ch5 seting from addr =0x40c00000
    sys_put_wvalue(0xf1c023a8,0x00000000);	//des =0
    sys_put_wvalue(0xf1c023ac,0x01f00000);	//byte to trans
    sys_put_wvalue(0xf1c023b8,(31<<24) +(7<<16) + (31<<8) +(7<<0));	//data block and wait cycle
    sys_put_wvalue(0xf1c023a0,0xa4b80481); 	//from src0 to des1,continous mode
#endif

    return 0;
}