it66121 hdmi updates:
authoryzq <yzq@rock-chips.com>
Sat, 23 Mar 2013 01:16:23 +0000 (09:16 +0800)
committeryzq <yzq@rock-chips.com>
Sat, 23 Mar 2013 01:39:13 +0000 (09:39 +0800)
1、change poll mode to irq mode(Please check the irq gpio if ok at board file)
2、support csc, RGB to YUV,YUV to RGB

16 files changed:
drivers/video/rockchip/hdmi/chips/cat66121/Makefile
drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c
drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.h
drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi_hw.c
drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi_hw.h
drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c [deleted file]
drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.h [deleted file]
drivers/video/rockchip/hdmi/chips/cat66121/config.h
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.c
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.h
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.c
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.h
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c [deleted file]
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.h [deleted file]
drivers/video/rockchip/hdmi/chips/cat66121/typedef.h
drivers/video/rockchip/hdmi/rk_hdmi_sysfs.c

index d701e3b0eec5a5f3d0c74283404728c4ef2f88ff..8ddc0d3f70d399a0148f5f8b315aeb51a472f73c 100755 (executable)
@@ -2,9 +2,10 @@ ccflags-$(CONFIG_RK_HDMI_DEBUG) = -DDEBUG -DHDMI_DEBUG
 
 obj-$(CONFIG_HDMI_CAT66121)       += cat66121_hdmi.o \
                                        cat66121_hdmi_hw.o \
-                                       hdmitx_sys.o \
-                                       hdmitx_hdcp.o \
                                        hdmitx_input.o \
                                        hdmitx_drv.o \
-                                       sha1.o
+                                       csc.o 
+
+obj-$(CONFIG_SUPPORT_HDCP)       += hdmitx_hdcp.o \
+                                       sha1.o 
 
index 8e73dc6da6a2a03d56c1825bc3761f35ff4b114a..90d4a635f62c089bdc04ff4434799ae8b676cdcf 100755 (executable)
@@ -7,6 +7,7 @@
 #include <mach/iomux.h>
 #include <linux/i2c.h>
 #include "cat66121_hdmi.h"
+#include "cat66121_hdmi_hw.h"
 
 struct cat66121_hdmi_pdata *cat66121_hdmi = NULL;
 struct hdmi *hdmi=NULL;
@@ -14,7 +15,18 @@ struct hdmi *hdmi=NULL;
 extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name);
 extern void hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent);
 extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi);
+static void check_status_func(struct work_struct *work);
+static void cat66121_irq_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(check_status_work,check_status_func);
 
+static void check_status_func(struct work_struct *work)
+{
+       if(HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS) & B_TX_INT_ACTIVE){
+               cat66121_irq_work_func(NULL);
+       }
+       schedule_delayed_work(&check_status_work, msecs_to_jiffies(5000));
+}
+#if 0
 int cat66121_hdmi_register_hdcp_callbacks(void (*hdcp_cb)(void),
                                         void (*hdcp_irq_cb)(int status),
                                         int (*hdcp_power_on_cb)(void),
@@ -27,7 +39,7 @@ int cat66121_hdmi_register_hdcp_callbacks(void (*hdcp_cb)(void),
        
        return HDMI_ERROR_SUCESS;
 }
-
+#endif
 #ifdef CONFIG_HAS_EARLYSUSPEND
 static void hdmi_early_suspend(struct early_suspend *h)
 {
@@ -53,6 +65,7 @@ static void hdmi_early_suspend(struct early_suspend *h)
        wait_for_completion_interruptible_timeout(&hdmi->complete,
                                                        msecs_to_jiffies(5000));
        flush_delayed_work(&hdmi->delay_work);
+       cancel_delayed_work_sync(&check_status_work);
        return;
 }
 
@@ -70,6 +83,7 @@ static void hdmi_early_resume(struct early_suspend *h)
        queue_delayed_work(cat66121_hdmi->workqueue, &cat66121_hdmi->delay_work, 100);
        #endif
        queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));   
+       schedule_delayed_work(&check_status_work, msecs_to_jiffies(5000));
        mutex_unlock(&hdmi->enable_mutex);
        return;
 }
@@ -221,6 +235,10 @@ static int cat66121_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_de
        
 
        cat66121_hdmi_sys_init();
+#ifdef HDMI_DEBUG
+       device_create_file(&(client->dev), &hdmi_attrs[0]);
+#endif
+
 #ifdef HDMI_USE_IRQ
        if(client->irq != INVALID_GPIO) {
                INIT_WORK(&cat66121_hdmi->irq_work, cat66121_irq_work_func);
@@ -230,11 +248,13 @@ static int cat66121_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_de
                dev_err(&client->dev, "fail to request gpio %d\n", client->irq);
                goto err_request_lcdc;
            }
+
+               schedule_delayed_work(&check_status_work, msecs_to_jiffies(5000));
            hdmi->irq = gpio_to_irq(client->irq);
                cat66121_hdmi->gpio = client->irq;
            gpio_pull_updown(client->irq, GPIOPullUp);
            gpio_direction_input(client->irq);
-           if((rc = request_irq(hdmi->irq, cat66121_irq, IRQF_TRIGGER_RISING, NULL, hdmi)) < 0)
+           if((rc = request_irq(hdmi->irq, cat66121_irq, IRQF_TRIGGER_FALLING, NULL, hdmi)) < 0)
            {
                dev_err(&client->dev, "fail to request hdmi irq\n");
                goto err_request_irq;
@@ -249,9 +269,6 @@ static int cat66121_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_de
        }
 #endif
 
-#ifdef HDMI_DEBUG
-       device_create_file(&(client->dev), &hdmi_attrs[0]);
-#endif
        dev_info(&client->dev, "cat66121 hdmi i2c probe ok\n");
        
     return 0;
index 2d0f79194c5439a02251b55d473eb2f427019862..8ba11fa9b94feaa20ba37ba86861f0ae8cfadde8 100755 (executable)
@@ -9,7 +9,7 @@
 #endif
 
 //#define HDMI_SOURCE_DEFAULT HDMI_SOURCE_LCDC0
-//#define HDMI_USE_IRQ
+#define HDMI_USE_IRQ
 
 struct cat66121_hdmi_pdata {
        int gpio;
index 15f7abdfb189717e229faaeff7223d58d714dadb..2ed090e0aa93d156c5543327e407d21fe8d0c127 100755 (executable)
@@ -8,14 +8,47 @@
 
 #define HDMITX_INPUT_SIGNAL_TYPE 0  // for default(Sync Sep Mode)
 #define INPUT_SPDIF_ENABLE     0
-extern int CAT66121_Interrupt_Process(void);
 /*******************************
  * Global Data
  ******************************/
-static _XDATA AVI_InfoFrame AviInfo;
-static _XDATA Audio_InfoFrame AudioInfo;
-static unsigned long VideoPixelClock;
+_XDATA unsigned char CommunBuff[128] ;
 static unsigned int pixelrep;
+static BYTE bInputColorMode = INPUT_COLOR_MODE;
+static char bOutputColorMode = F_MODE_RGB444;
+#ifdef SUPPORT_HDCP
+static void hdcp_delay_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(hdcp_delay_work,hdcp_delay_work_func);
+#endif
+static DEFINE_MUTEX(handler_mutex);
+
+HDMITXDEV InstanceData =
+{
+
+    0,      // BYTE I2C_DEV ;
+    HDMI_TX_I2C_SLAVE_ADDR,    // BYTE I2C_ADDR ;
+
+    /////////////////////////////////////////////////
+    // Interrupt Type
+    /////////////////////////////////////////////////
+    0x40,      // BYTE bIntType ; // = 0 ;
+    /////////////////////////////////////////////////
+    // Video Property
+    /////////////////////////////////////////////////
+    INPUT_SIGNAL_TYPE ,// BYTE bInputVideoSignalType ; // for Sync Embedded,CCIR656,InputDDR
+
+    /////////////////////////////////////////////////
+    // Audio Property
+    /////////////////////////////////////////////////
+    I2S_FORMAT, // BYTE bOutputAudioMode ; // = 0 ;
+    FALSE , // BYTE bAudioChannelSwap ; // = 0 ;
+    0x01, // BYTE bAudioChannelEnable ;
+    INPUT_SAMPLE_FREQ ,// BYTE bAudFs ;
+    0, // unsigned long TMDSClock ;
+    FALSE, // BYTE bAuthenticated:1 ;
+    FALSE, // BYTE bHDMIMode: 1;
+    FALSE, // BYTE bIntPOL:1 ; // 0 = Low Active
+    FALSE, // BYTE bHPD:1 ;
+};
 
 /* I2C read/write funcs */
 BYTE HDMITX_ReadI2C_Byte(BYTE RegAddr)
@@ -38,7 +71,7 @@ BYTE HDMITX_ReadI2C_Byte(BYTE RegAddr)
        msgs[1].len             = 1;
        msgs[1].buf             = &buf[0];
        msgs[1].scl_rate= 100*1000;
-       
+
        ret = i2c_transfer(cat66121_hdmi->client->adapter, msgs, 2);
        if(ret != 2)
                printk("I2C transfer Error! ret = %d\n", ret);
@@ -61,7 +94,7 @@ SYS_STATUS HDMITX_WriteI2C_Byte(BYTE RegAddr, BYTE data)
        msg.len         = 2;
        msg.buf         = buf;          
        msg.scl_rate= 100*1000;
-       
+
        ret = i2c_transfer(cat66121_hdmi->client->adapter, &msg, 1);
        if(ret != 1)
                printk("I2C transfer Error!\n");
@@ -87,7 +120,7 @@ SYS_STATUS HDMITX_ReadI2C_ByteN(BYTE RegAddr, BYTE *pData, int N)
        msgs[1].len             = N;
        msgs[1].buf             = pData;
        msgs[1].scl_rate= 100*1000;
-       
+
        ret = i2c_transfer(cat66121_hdmi->client->adapter, msgs, 2);
        if(ret != 2)
                printk("I2C transfer Error! ret = %d\n", ret);
@@ -109,7 +142,7 @@ SYS_STATUS HDMITX_WriteI2C_ByteN(BYTE RegAddr, BYTE *pData, int N)
        msg.len         = N + 1;
        msg.buf         = buf;          // gModify.Exp."Include RegAddr"
        msg.scl_rate= 100*1000;
-       
+
        ret = i2c_transfer(cat66121_hdmi->client->adapter, &msg, 1);
        if(ret != 1)
                printk("I2C transfer Error! ret = %d\n", ret);
@@ -118,35 +151,35 @@ SYS_STATUS HDMITX_WriteI2C_ByteN(BYTE RegAddr, BYTE *pData, int N)
 }
 SYS_STATUS HDMITX_SetI2C_Byte(BYTE Reg,BYTE Mask,BYTE Value)
 {
-    BYTE Temp;
-    if( Mask != 0xFF )
-    {
-        Temp=HDMITX_ReadI2C_Byte(Reg);
-        Temp&=(~Mask);
-        Temp|=Value&Mask;
-    }
-    else
-    {
-        Temp=Value;
-    }
-    return HDMITX_WriteI2C_Byte(Reg,Temp);
+       BYTE Temp;
+       if( Mask != 0xFF )
+       {
+               Temp=HDMITX_ReadI2C_Byte(Reg);
+               Temp&=(~Mask);
+               Temp|=Value&Mask;
+       }
+       else
+       {
+               Temp=Value;
+       }
+       return HDMITX_WriteI2C_Byte(Reg,Temp);
 }
 
 int cat66121_detect_device(void)
 {
        uint8_t VendorID0, VendorID1, DeviceID0, DeviceID1;
-       
+
        Switch_HDMITX_Bank(0);
        VendorID0 = HDMITX_ReadI2C_Byte(REG_TX_VENDOR_ID0);
        VendorID1 = HDMITX_ReadI2C_Byte(REG_TX_VENDOR_ID1);
        DeviceID0 = HDMITX_ReadI2C_Byte(REG_TX_DEVICE_ID0);
        DeviceID1 = HDMITX_ReadI2C_Byte(REG_TX_DEVICE_ID1);
        if( (VendorID0 == 0x54) && (VendorID1 == 0x49) &&
-               (DeviceID0 == 0x12) && (DeviceID1 == 0x16) )
+                       (DeviceID0 == 0x12) && (DeviceID1 == 0x16) )
                return 1;
 
        printk("CAT66121: Reg[0-3] = 0x[%02x].[%02x].[%02x].[%02x]\n",
-                          VendorID0, VendorID1, DeviceID0, DeviceID1);
+                       VendorID0, VendorID1, DeviceID0, DeviceID1);
        printk("[CAT66121] Device not found!\n");
 
        return 0;
@@ -154,21 +187,123 @@ int cat66121_detect_device(void)
 int cat66121_hdmi_sys_init(void)
 {
        hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
-       VideoPixelClock = 0;
-       pixelrep = 0;
-       InitHDMITX_Variable();
+       HDMITX_InitTxDev(&InstanceData);
        InitHDMITX();
-       msleep(100);
+       msleep(1);
        return HDMI_ERROR_SUCESS;
 }
 
-void cat66121_hdmi_interrupt()
+#ifdef SUPPORT_HDCP
+static void hdcp_delay_work_func(struct work_struct *work)
+{
+       if(0==(B_TXVIDSTABLE&HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS)))
+       {
+               schedule_delayed_work(&hdcp_delay_work, msecs_to_jiffies(100));
+               HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Authenticate(): Video not stable\n"));
+       }else{
+               HDMITX_EnableHDCP(TRUE);
+       }
+}
+#endif
+void cat66121_InterruptClr(void)
+{
+       char intclr3,intdata4;
+       intdata4= HDMITX_ReadI2C_Byte(0xEE);
+       HDMITX_DEBUG_PRINTF(("REG_TX_INT_STAT4=%x \n",intdata4));
+       intclr3 = (HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS))|B_TX_CLR_AUD_CTS | B_TX_INTACTDONE ;
+       if( intdata4 )
+       {
+               HDMITX_WriteI2C_Byte(0xEE,intdata4); // clear ext interrupt ;
+               HDMITX_DEBUG_PRINTF(("%s%s%s%s%s%s%s\n",
+                                       (intdata4&0x40)?"video parameter change \n":"",
+                                       (intdata4&0x20)?"HDCP Pj check done \n":"",
+                                       (intdata4&0x10)?"HDCP Ri check done \n":"",
+                                       (intdata4&0x8)? "DDC bus hang \n":"",
+                                       (intdata4&0x4)? "Video input FIFO auto reset \n":"",
+                                       (intdata4&0x2)? "No audio input interrupt  \n":"",
+                                       (intdata4&0x1)? "Audio decode error interrupt \n":""));
+       }
+       HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,intclr3); // clear interrupt.
+       HDMITX_WriteI2C_Byte(REG_TX_INT_CLR0,0xFF);
+       HDMITX_WriteI2C_Byte(REG_TX_INT_CLR1,0xFF);
+       intclr3 &= ~(B_TX_INTACTDONE);
+       HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,intclr3); // INTACTDONE reset to zero.
+}
+void cat66121_hdmi_interrupt(void)
 {
-       if(HDMITX_DevLoopProc()){
-               if(hdmi->state == HDMI_SLEEP)
-                       hdmi->state = WAIT_HOTPLUG;
-               queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));   
+       char sysstat = 0; 
+       mutex_lock(&handler_mutex);
+       sysstat = HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS);
+       if(sysstat & B_TX_INT_ACTIVE){
+               char intdata1,intdata2,intdata3;
+               intdata1 = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT1);
+               intdata2 = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT2);
+               intdata3 = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT3);
+               HDMITX_DEBUG_PRINTF(("REG_TX_INT_STAT1=%x \n",intdata1));
+               HDMITX_DEBUG_PRINTF(("REG_TX_INT_STAT2=%x \n",intdata2));
+               HDMITX_DEBUG_PRINTF(("REG_TX_INT_STAT3=%x \n",intdata3));
+               if(getHDMI_PowerStatus()==FALSE){
+                       HDMITX_PowerOn();
+               }
+
+               /******* Clear interrupt **********/
+               cat66121_InterruptClr();
+               /******** handler interrupt event ********/
+               
+               if(intdata1 & B_TX_INT_DDCFIFO_ERR)
+               {
+                       HDMITX_DEBUG_PRINTF(("DDC FIFO Error.\n"));
+                       hdmitx_ClearDDCFIFO();
+               }
+               if(intdata1 & B_TX_INT_DDC_BUS_HANG)
+               {
+                       HDMITX_DEBUG_PRINTF(("DDC BUS HANG.\n"));
+                       hdmitx_AbortDDC();
+               }
+               if(intdata1 & B_TX_INT_AUD_OVERFLOW ){
+                       HDMITX_DEBUG_PRINTF(("AUDIO FIFO OVERFLOW.\n"));
+                       HDMITX_OrReg_Byte(REG_TX_SW_RST,(B_HDMITX_AUD_RST|B_TX_AREF_RST));
+                       HDMITX_AndReg_Byte(REG_TX_SW_RST,~(B_HDMITX_AUD_RST|B_TX_AREF_RST));
+               }
+
+               if(intdata3 & B_TX_INT_VIDSTABLE)
+               {
+                       sysstat = HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS);
+                       if(sysstat & B_TXVIDSTABLE)
+                       {
+                               hdmitx_FireAFE();
+                       }
+               }
+               
+#ifdef SUPPORT_HDCP
+               if(intdata2 & B_TX_INT_AUTH_FAIL){
+                       if(getHDMITX_LinkStatus())
+                       {
+                               // AudioModeDetect();
+                               if(getHDMITX_AuthenticationDone() ==FALSE)
+                               {
+                                       HDMITX_DEBUG_PRINTF(("getHDMITX_AuthenticationDone() ==FALSE\n") );
+                                       HDMITX_EnableHDCP(TRUE);
+                                       setHDMITX_AVMute(FALSE);
+                               }
+                       }
+               }else if(intdata2 & B_TX_INT_AUTH_DONE){
+                       HDMITX_SetI2C_Byte(REG_TX_INT_MASK2, B_TX_AUTH_DONE_MASK, B_TX_AUTH_DONE_MASK);
+                       HDMITX_DEBUG_PRINTF(("getHDMITX_AuthenticationDone() ==SUCCESS\n") );
+               }
+#endif
+               if(intdata1 & B_TX_INT_HPD_PLUG){
+                       if(sysstat & B_TX_HPDETECT){
+                               HDMITX_DEBUG_PRINTF(("HPD plug\n") );
+                       }else{
+                               HDMITX_DEBUG_PRINTF(("HPD unplug\n") );
+                       }
+                       if(hdmi->state == HDMI_SLEEP)
+                               hdmi->state = WAIT_HOTPLUG;
+                       queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(0));    
+               }
        }
+       mutex_unlock(&handler_mutex);
 }
 
 int cat66121_hdmi_sys_detect_hpd(void)
@@ -190,47 +325,334 @@ int cat66121_hdmi_sys_read_edid(int block, unsigned char *buff)
        return (getHDMITX_EDIDBlock(block, buff) == TRUE)?HDMI_ERROR_SUCESS:HDMI_ERROR_FALSE;
 }
 
+void ConfigfHdmiVendorSpecificInfoFrame(BYTE _3D_Stru)
+{
+       VendorSpecific_InfoFrame *VS_Info;
+
+       VS_Info=(VendorSpecific_InfoFrame *)CommunBuff ;
+
+       VS_Info->pktbyte.VS_HB[0] = VENDORSPEC_INFOFRAME_TYPE|0x80;
+       VS_Info->pktbyte.VS_HB[1] = VENDORSPEC_INFOFRAME_VER;
+       VS_Info->pktbyte.VS_HB[2] = (_3D_Stru == Side_by_Side)?6:5;
+       VS_Info->pktbyte.VS_DB[0] = 0x03;
+       VS_Info->pktbyte.VS_DB[1] = 0x0C;
+       VS_Info->pktbyte.VS_DB[2] = 0x00;
+       VS_Info->pktbyte.VS_DB[3] = 0x40;
+       switch(_3D_Stru)
+       {
+               case Side_by_Side:
+               case Frame_Pcaking:
+               case Top_and_Botton:
+                       VS_Info->pktbyte.VS_DB[4] = (_3D_Stru<<4);
+                       break;
+               default:
+                       VS_Info->pktbyte.VS_DB[4] = (Frame_Pcaking<<4);
+                       break ;
+       }
+       VS_Info->pktbyte.VS_DB[5] = 0x00;
+       HDMITX_EnableVSInfoFrame(TRUE,(BYTE *)VS_Info);
+}
+
 static void cat66121_sys_config_avi(int VIC, int bOutputColorMode, int aspec, int Colorimetry, int pixelrep)
 {
+       AVI_InfoFrame *AviInfo;
        hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
-//     AVI_InfoFrame AviInfo;
+       AviInfo = (AVI_InfoFrame *)CommunBuff ;
+
+       AviInfo->pktbyte.AVI_HB[0] = AVI_INFOFRAME_TYPE|0x80 ;
+       AviInfo->pktbyte.AVI_HB[1] = AVI_INFOFRAME_VER ;
+       AviInfo->pktbyte.AVI_HB[2] = AVI_INFOFRAME_LEN ;
+
+       switch(bOutputColorMode)
+       {
+               case F_MODE_YUV444:
+                       // AviInfo->info.ColorMode = 2 ;
+                       AviInfo->pktbyte.AVI_DB[0] = (2<<5)|(1<<4);
+                       break ;
+               case F_MODE_YUV422:
+                       // AviInfo->info.ColorMode = 1 ;
+                       AviInfo->pktbyte.AVI_DB[0] = (1<<5)|(1<<4);
+                       break ;
+               case F_MODE_RGB444:
+               default:
+                       // AviInfo->info.ColorMode = 0 ;
+                       AviInfo->pktbyte.AVI_DB[0] = (0<<5)|(1<<4);
+                       break ;
+       }
+       AviInfo->pktbyte.AVI_DB[1] = 8 ;
+       AviInfo->pktbyte.AVI_DB[1] |= (aspec != HDMI_16x9)?(1<<4):(2<<4); // 4:3 or 16:9
+       AviInfo->pktbyte.AVI_DB[1] |= (Colorimetry != HDMI_ITU709)?(1<<6):(2<<6); // 4:3 or 16:9
+       AviInfo->pktbyte.AVI_DB[2] = 0 ;
+       AviInfo->pktbyte.AVI_DB[3] = VIC ;
+       AviInfo->pktbyte.AVI_DB[4] =  pixelrep & 3 ;
+       AviInfo->pktbyte.AVI_DB[5] = 0 ;
+       AviInfo->pktbyte.AVI_DB[6] = 0 ;
+       AviInfo->pktbyte.AVI_DB[7] = 0 ;
+       AviInfo->pktbyte.AVI_DB[8] = 0 ;
+       AviInfo->pktbyte.AVI_DB[9] = 0 ;
+       AviInfo->pktbyte.AVI_DB[10] = 0 ;
+       AviInfo->pktbyte.AVI_DB[11] = 0 ;
+       AviInfo->pktbyte.AVI_DB[12] = 0 ;
+
+       HDMITX_EnableAVIInfoFrame(TRUE, (unsigned char *)AviInfo);
 
 }
 
 int cat66121_hdmi_sys_config_video(struct hdmi_video_para *vpara)
 {
-       HDMITX_ChangeDisplayOption(vpara->vic,HDMI_RGB444) ;
+       struct fb_videomode *mode;
+       HDMI_Aspec aspec ;
+       HDMI_Colorimetry Colorimetry ;
+       VIDEOPCLKLEVEL level ;
+
+       if(vpara == NULL) {
+               hdmi_err(hdmi->dev, "[%s] input parameter error\n", __FUNCTION__);
+               return -1;
+       }
+
+       // output Color mode
+       switch(vpara->output_color)
+       {
+               case HDMI_COLOR_YCbCr444:
+                       bOutputColorMode = F_MODE_YUV444 ;
+                       break ;
+               case HDMI_COLOR_YCbCr422:
+                       bOutputColorMode = F_MODE_YUV422 ;
+                       break ;
+               case HDMI_COLOR_RGB:
+               default:
+                       bOutputColorMode = F_MODE_RGB444 ;
+                       break ;
+       }
+       // Set ext video
+       mode = (struct fb_videomode *)hdmi_vic_to_videomode(vpara->vic);
+       if(mode == NULL)
+       {
+               hdmi_err(hdmi->dev, "[%s] not found vic %d\n", __FUNCTION__, vpara->vic);
+               return -ENOENT;
+       }
+
+       hdmi->tmdsclk = mode->pixclock;
+       switch(vpara->vic)
+       {
+               case HDMI_640x480p60:
+                       pixelrep = 0 ;
+                       aspec = HDMI_4x3 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_480p60:
+                       pixelrep = 0 ;
+                       aspec = HDMI_4x3 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_480p60_16x9:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_720p60:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_1080i60:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_480i60:
+                       pixelrep = 1 ;
+                       aspec = HDMI_4x3 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_480i60_16x9:
+                       pixelrep = 1 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_1080p60:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_576p50:
+                       pixelrep = 0 ;
+                       aspec = HDMI_4x3 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_576p50_16x9:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_720p50:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_1080i50:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_576i50:
+                       pixelrep = 1 ;
+                       aspec = HDMI_4x3 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_576i50_16x9:
+                       pixelrep = 1 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU601 ;
+                       break ;
+               case HDMI_1080p50:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_1080p24:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_1080p25:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+               case HDMI_1080p30:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+                       break ;
+
+               case HDMI_720p30:
+                       pixelrep = 0 ;
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;             
+               default:
+                       aspec = HDMI_16x9 ;
+                       Colorimetry = HDMI_ITU709 ;
+       }
+       if( Colorimetry == HDMI_ITU709 )
+       {
+               bInputColorMode |= F_VIDMODE_ITU709 ;
+       }
+       else
+       {
+               bInputColorMode &= ~F_VIDMODE_ITU709 ;
+       }
+       if( vpara->vic != HDMI_640x480p60)
+       {
+               bInputColorMode |= F_VIDMODE_16_235 ;
+       }
+       else
+       {
+               bInputColorMode &= ~F_VIDMODE_16_235 ;
+       }
+       
+       if( (hdmi->tmdsclk*(pixelrep+1))>80000000L )
+       {
+               level = PCLK_HIGH ;
+       }
+       else if((hdmi->tmdsclk*(pixelrep+1))>20000000L)
+       {
+               level = PCLK_MEDIUM ;
+       }
+       else
+       {
+               level = PCLK_LOW ;
+       }
+
+       HDMITX_EnableVideoOutput(level,bInputColorMode,bOutputColorMode ,vpara->output_mode);
+
+       if(vpara->output_mode == OUTPUT_HDMI) {
+               cat66121_sys_config_avi(vpara->vic, bOutputColorMode, aspec, Colorimetry, pixelrep);
+#ifdef OUTPUT_3D_MODE
+               ConfigfHdmiVendorSpecificInfoFrame(OUTPUT_3D_MODE);
+#endif
+
+       }
+       else {
+               HDMITX_EnableAVIInfoFrame(FALSE ,NULL);
+               HDMITX_EnableVSInfoFrame(FALSE,NULL);
+       }
+       setHDMITX_VideoSignalType(INPUT_SIGNAL_TYPE);
+#ifdef SUPPORT_SYNCEMBEDDED
+       if(INPUT_SIGNAL_TYPE & T_MODE_SYNCEMB)
+       {
+               setHDMITX_SyncEmbeddedByVIC(vpara->vic,INPUT_SIGNAL_TYPE);
+       }
+#endif
+
        return HDMI_ERROR_SUCESS;
 }
 
 static void cat66121_hdmi_config_aai(void)
 {
-       printk( "[%s]\n", __FUNCTION__);
+       int i ;
+       Audio_InfoFrame *AudioInfo ;
+       AudioInfo = (Audio_InfoFrame *)CommunBuff ;
+
+       AudioInfo->pktbyte.AUD_HB[0] = AUDIO_INFOFRAME_TYPE ;
+       AudioInfo->pktbyte.AUD_HB[1] = 1 ;
+       AudioInfo->pktbyte.AUD_HB[2] = AUDIO_INFOFRAME_LEN ;
+       AudioInfo->pktbyte.AUD_DB[0] = 1 ;
+       for( i = 1 ;i < AUDIO_INFOFRAME_LEN ; i++ )
+       {
+               AudioInfo->pktbyte.AUD_DB[i] = 0 ;
+       }
+       HDMITX_EnableAudioInfoFrame(TRUE, (unsigned char *)AudioInfo);
 }
 
 int cat66121_hdmi_sys_config_audio(struct hdmi_audio *audio)
 {
-       printk( "[%s]\n", __FUNCTION__);
+       cat66121_hdmi_config_aai();
+       HDMITX_EnableAudioOutput(
+                       CNOFIG_INPUT_AUDIO_TYPE,
+                       CONFIG_INPUT_AUDIO_SPDIF,
+                       audio->rate,
+                       audio->channel,
+                       NULL, // pointer to cahnnel status.
+                       hdmi->tmdsclk*(pixelrep+1));
        return HDMI_ERROR_SUCESS;
 }
 
 void cat66121_hdmi_sys_enalbe_output(int enable)
 {
+       hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
        
-       printk( "[%s]\n", __FUNCTION__);
+       if(enable){
+#ifdef SUPPORT_HDCP
+               cancel_delayed_work_sync(&hdcp_delay_work);
+               schedule_delayed_work(&hdcp_delay_work, msecs_to_jiffies(100));
+#endif
+               setHDMITX_AVMute(FALSE);
+       }else{
+               setHDMITX_AVMute(TRUE);
+       }
+       DumpHDMITXReg() ;
 }
 
 int cat66121_hdmi_sys_insert(void)
 {
        hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
-       printk( "[%s]\n", __FUNCTION__);
+       if(getHDMI_PowerStatus()==FALSE)
+               HDMITX_PowerOn();
+
+       HDMITX_DisableAudioOutput();
        return 0;
 }
 
 int cat66121_hdmi_sys_remove(void)
 {
        hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
-//     printk( "[%s]\n", __FUNCTION__);
-
+#ifdef SUPPORT_HDCP
+       cancel_delayed_work_sync(&hdcp_delay_work);
+       HDMITX_EnableHDCP(FALSE);
+#endif
+       HDMITX_DisableVideoOutput();
+       if(getHDMI_PowerStatus()==TRUE)
+               HDMITX_PowerDown();
        return 0;
 }
index d22bed25acb99b5b6081f7cfbf52610d1f5a425d..8ff54aa1acc99eeade329c046eb08de8e881c2b7 100755 (executable)
@@ -2,8 +2,9 @@
 #define _CAT6611_HDMI_HW_H
 
 #include "typedef.h"
+#include "config.h"
+#include "debug.h"
 #include "hdmitx_drv.h"
-#include "hdmitx_sys.h"
 #define CAT6611_SCL_RATE       100 * 1000
 #define I2S 0
 #define SPDIF 1
 ////////////////////////////////////////////////////////////////////////////////
 // Internal Data Type
 ////////////////////////////////////////////////////////////////////////////////
-
+enum {
+               OUTPUT_DVI = 0,
+               OUTPUT_HDMI
+       };
 typedef enum tagHDMI_Video_Type {
     HDMI_Unkown = 0 ,
     HDMI_640x480p60 = 1 ,
@@ -248,13 +252,14 @@ SYS_STATUS HDMITX_ReadI2C_ByteN(BYTE RegAddr,BYTE *pData,int N);
 SYS_STATUS HDMITX_WriteI2C_ByteN(BYTE RegAddr,BYTE *pData,int N);
 SYS_STATUS HDMITX_SetI2C_Byte(BYTE Reg,BYTE Mask,BYTE Value);
 
-void InitHDMITX_Variable();
-void HDMITX_ChangeDisplayOption(HDMI_Video_Type VideoMode, HDMI_OutputColorMode OutputColorMode);
-void HDMITX_SetOutput();
-int  HDMITX_DevLoopProc();
-void ConfigfHdmiVendorSpecificInfoFrame(BYTE _3D_Stru);
+void InitHDMITX_Variable(void);
+#if 0
+//void HDMITX_ChangeDisplayOption(HDMI_Video_Type VideoMode, HDMI_OutputColorMode OutputColorMode);
+//void HDMITX_SetOutput();
+//int  HDMITX_DevLoopProc();
+//void ConfigfHdmiVendorSpecificInfoFrame(BYTE _3D_Stru);
 void HDMITX_ChangeAudioOption(BYTE Option, BYTE channelNum, BYTE AudioFs);
 void HDMITX_SetAudioOutput();
 void HDMITX_ChangeColorDepth(BYTE colorDepth);
-
+#endif
 #endif
diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c
deleted file mode 100644 (file)
index aa3f068..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-///*****************************************
-//  Copyright (C) 2009-2014
-//  ITE Tech. Inc. All Rights Reserved
-//  Proprietary and Confidential
-///*****************************************
-//   @file   >cat66121_sys.c<
-//   @author Jau-Chih.Tseng@ite.com.tw
-//   @date   2009/08/24
-//   @fileversion: cat66121_SAMPLEINTERFACE_1.12
-//******************************************/
-
-///////////////////////////////////////////////////////////////////////////////
-// This is the sample program for cat66121 driver usage.
-///////////////////////////////////////////////////////////////////////////////
-
-#include "hdmitx.h"
-#include "hdmitx_sys.h"
-#include "cat66121_hdmi.h"
-
-#if 0
-BYTE HDMITX_ReadI2C_Byte(BYTE RegAddr);
-SYS_STATUS HDMITX_WriteI2C_Byte(BYTE RegAddr,BYTE d);
-SYS_STATUS HDMITX_ReadI2C_ByteN(BYTE RegAddr,BYTE *pData,int N);
-SYS_STATUS HDMITX_WriteI2C_ByteN(BYTE RegAddr,BYTE *pData,int N);
-SYS_STATUS HDMITX_SetI2C_Byte(BYTE Reg,BYTE Mask,BYTE Value);
-#endif
-/* I2C read/write funcs */
-BYTE HDMITX_ReadI2C_Byte(BYTE RegAddr)
-{
-       struct i2c_msg msgs[2];
-       SYS_STATUS ret = -1;
-       BYTE buf[1];
-
-       buf[0] = RegAddr;
-
-       /* Write device addr fisrt */
-       msgs[0].addr    = cat66121_hdmi->client->addr;
-       msgs[0].flags   = !I2C_M_RD;
-       msgs[0].len             = 1;
-       msgs[0].buf             = &buf[0];
-       msgs[0].scl_rate= 100*1000;
-       /* Then, begin to read data */
-       msgs[1].addr    = cat66121_hdmi->client->addr;
-       msgs[1].flags   = I2C_M_RD;
-       msgs[1].len             = 1;
-       msgs[1].buf             = &buf[0];
-       msgs[1].scl_rate= 100*1000;
-       
-       ret = i2c_transfer(cat66121_hdmi->client->adapter, msgs, 2);
-       if(ret != 2)
-               printk("I2C transfer Error! ret = %d\n", ret);
-
-       //ErrorF("Reg%02xH: 0x%02x\n", RegAddr, buf[0]);
-       return buf[0];
-}
-
-SYS_STATUS HDMITX_WriteI2C_Byte(BYTE RegAddr, BYTE data)
-{
-       struct i2c_msg msg;
-       SYS_STATUS ret = -1;
-       BYTE buf[2];
-
-       buf[0] = RegAddr;
-       buf[1] = data;
-
-       msg.addr        = cat66121_hdmi->client->addr;
-       msg.flags       = !I2C_M_RD;
-       msg.len         = 2;
-       msg.buf         = buf;          
-       msg.scl_rate= 100*1000;
-       
-       ret = i2c_transfer(cat66121_hdmi->client->adapter, &msg, 1);
-       if(ret != 1)
-               printk("I2C transfer Error!\n");
-
-       return ret;
-}
-
-SYS_STATUS HDMITX_ReadI2C_ByteN(BYTE RegAddr, BYTE *pData, int N)
-{
-       struct i2c_msg msgs[2];
-       SYS_STATUS ret = -1;
-
-       pData[0] = RegAddr;
-
-       msgs[0].addr    = cat66121_hdmi->client->addr;
-       msgs[0].flags   = !I2C_M_RD;
-       msgs[0].len             = 1;
-       msgs[0].buf             = &pData[0];
-       msgs[0].scl_rate= 100*1000;
-
-       msgs[1].addr    = cat66121_hdmi->client->addr;
-       msgs[1].flags   = I2C_M_RD;
-       msgs[1].len             = N;
-       msgs[1].buf             = pData;
-       msgs[1].scl_rate= 100*1000;
-       
-       ret = i2c_transfer(cat66121_hdmi->client->adapter, msgs, 2);
-       if(ret != 2)
-               printk("I2C transfer Error! ret = %d\n", ret);
-
-       return ret;
-}
-
-SYS_STATUS HDMITX_WriteI2C_ByteN(BYTE RegAddr, BYTE *pData, int N)
-{
-       struct i2c_msg msg;
-       SYS_STATUS ret = -1;
-       BYTE buf[N + 1];
-
-       buf[0] = RegAddr;
-    memcpy(&buf[1], pData, N);
-
-       msg.addr        = cat66121_hdmi->client->addr;
-       msg.flags       = !I2C_M_RD;
-       msg.len         = N + 1;
-       msg.buf         = buf;          // gModify.Exp."Include RegAddr"
-       msg.scl_rate= 100*1000;
-       
-       ret = i2c_transfer(cat66121_hdmi->client->adapter, &msg, 1);
-       if(ret != 1)
-               printk("I2C transfer Error! ret = %d\n", ret);
-
-       return ret;
-}
-static int cat66121_hdmi_i2c_read_reg(char reg, char *val)
-{
-       if(i2c_master_reg8_recv(cat66121_hdmi->client, reg, val, 1, 100*1000) > 0)
-               return  0;
-       else {
-               printk("[%s] reg %02x error\n", __FUNCTION__, reg);
-               return -EINVAL;
-       }
-}
-/*******************************
- * Global Data
- ******************************/
-
-/*******************************
- * Functions
- ******************************/
-int cat66121_detect_device(void)
-{
-       uint8_t VendorID0, VendorID1, DeviceID0, DeviceID1;
-       
-       Switch_HDMITX_Bank(0);
-       VendorID0 = HDMITX_ReadI2C_Byte(REG_VENDOR_ID0);
-       VendorID1 = HDMITX_ReadI2C_Byte(REG_VENDOR_ID1);
-       DeviceID0 = HDMITX_ReadI2C_Byte(REG_DEVICE_ID0);
-       DeviceID1 = HDMITX_ReadI2C_Byte(REG_DEVICE_ID1);
-       ErrorF("CAT66121: Reg[0-3] = 0x[%02x].[%02x].[%02x].[%02x]\n",
-                          VendorID0, VendorID1, DeviceID0, DeviceID1);
-       if( (VendorID0 == 0x54) && (VendorID1 == 0x49) &&
-               (DeviceID0 == 0x12) && (DeviceID1 == 0x06) )
-               return 1;
-
-       printk("[CAT66121] Device not found!\n");
-
-       return 0;
-}
-
-int cat66121_sys_init(struct hdmi *hdmi)
-{
-       printk(">>>%s \n",__func__);
-       InitHDMITX_Variable();
-       InitHDMITX();
-       HDMITX_ChangeDisplayOption(HDMI_720p60,HDMI_RGB444) ;
-            HDMITX_DevLoopProc();
-       return HDMI_ERROR_SUCESS;
-}
-
-int cat66121_sys_unplug(struct hdmi *hdmi)
-{
-       printk(">>>%s \n",__func__);
-       return HDMI_ERROR_SUCESS;
-}
-
-int cat66121_sys_detect_hpd(struct hdmi *hdmi, int *hpdstatus)
-{
-       printk(">>>%s \n",__func__);
-    *hpdstatus = TRUE;
-    
-    return HDMI_ERROR_SUCESS;
-}
-
-int cat66121_sys_detect_sink(struct hdmi *hdmi, int *sink_status)
-{
-       printk(">>>%s \n",__func__);
-    *sink_status = TRUE;
-    return HDMI_ERROR_SUCESS;
-}
-
-int cat66121_sys_read_edid(struct hdmi *hdmi, int block, unsigned char *buff)
-{
-       printk(">>>%s \n",__func__);
-       return HDMI_ERROR_SUCESS;
-}
-
-static void cat66121_sys_config_avi(int VIC, int bOutputColorMode, int aspec, int Colorimetry, int pixelrep)
-{
-}
-
-int cat66121_sys_config_video(struct hdmi *hdmi, int vic, int input_color, int output_color)
-{
-       printk(">>>%s \n",__func__);
-            HDMITX_DevLoopProc();
-       return HDMI_ERROR_SUCESS ;
-}
-
-static void cat66121_sys_config_aai(void)
-{
-       printk(">>>%s \n",__func__);
-}
-
-int cat66121_sys_config_audio(struct hdmi *hdmi, struct hdmi_audio *audio)
-{
-       printk(">>>%s \n",__func__);
-       return HDMI_ERROR_SUCESS;
-}
-
-int cat66121_sys_config_hdcp(struct hdmi *hdmi, int enable)
-{
-       printk(">>>%s \n",__func__);
-       return HDMI_ERROR_SUCESS;
-}
-
-int cat66121_sys_enalbe_output(struct hdmi *hdmi, int enable)
-{
-       printk(">>>%s \n",__func__);
-       return HDMI_ERROR_SUCESS;
-}
diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.h b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.h
deleted file mode 100755 (executable)
index 8d3994b..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-///*****************************************
-//  Copyright (C) 2009-2014
-//  ITE Tech. Inc. All Rights Reserved
-//  Proprietary and Confidential
-///*****************************************
-//   @file   >cat66121_sys.h<
-//   @author Jau-Chih.Tseng@ite.com.tw
-//   @date   2009/08/24
-//   @fileversion: cat66121_SAMPLEINTERFACE_1.12
-//******************************************/
-
-#ifndef _CAT66121_SYS_H_
-#define _CAT66121_SYS_H_
-////////////////////////////////////////////////////////////////////////////////
-// Internal Data Type
-////////////////////////////////////////////////////////////////////////////////
-
-typedef enum tagHDMI_Video_Type {
-    HDMI_Unkown = 0 ,
-    HDMI_640x480p60 = 1 ,
-    HDMI_480p60,
-    HDMI_480p60_16x9,
-    HDMI_720p60,
-    HDMI_1080i60,
-    HDMI_480i60,
-    HDMI_480i60_16x9,
-    HDMI_1080p60 = 16,
-    HDMI_576p50,
-    HDMI_576p50_16x9,
-    HDMI_720p50,
-    HDMI_1080i50,
-    HDMI_576i50,
-    HDMI_576i50_16x9,
-    HDMI_1080p50 = 31,
-    HDMI_1080p24,
-    HDMI_1080p25,
-    HDMI_1080p30,
-} HDMI_Video_Type ;
-
-typedef enum tagHDMI_Aspec {
-    HDMI_4x3 ,
-    HDMI_16x9
-} HDMI_Aspec;
-
-typedef enum tagHDMI_OutputColorMode {
-    HDMI_RGB444,
-    HDMI_YUV444,
-    HDMI_YUV422
-} HDMI_OutputColorMode ;
-
-typedef enum tagHDMI_Colorimetry {
-    HDMI_ITU601,
-    HDMI_ITU709
-} HDMI_Colorimetry ;
-
-typedef enum tagMODE_ID{    
-       CEA_640x480p60, 
-       CEA_720x480p60,         
-       CEA_1280x720p60,                
-       CEA_1920x1080i60,               
-       CEA_720x480i60,         
-       CEA_720x240p60,         
-       CEA_1440x480i60,                
-       CEA_1440x240p60,                
-       CEA_2880x480i60,                
-       CEA_2880x240p60,                
-       CEA_1440x480p60,                
-       CEA_1920x1080p60,
-       CEA_720x576p50,         
-       CEA_1280x720p50,                
-       CEA_1920x1080i50,               
-       CEA_720x576i50,         
-       CEA_1440x576i50,                
-       CEA_720x288p50,         
-       CEA_1440x288p50,
-       CEA_2880x576i50,
-       CEA_2880x288p50,
-       CEA_1440x576p50,
-       CEA_1920x1080p50,
-       CEA_1920x1080p24,
-       CEA_1920x1080p25,
-       CEA_1920x1080p30,
-       VESA_640x350p85,
-       VESA_640x400p85,
-       VESA_720x400p85,
-       VESA_640x480p60,
-       VESA_640x480p72,
-       VESA_640x480p75,
-       VESA_640x480p85,
-       VESA_800x600p56,
-       VESA_800x600p60,
-       VESA_800x600p72,
-       VESA_800x600p75,
-       VESA_800X600p85,
-       VESA_840X480p60,
-       VESA_1024x768p60,
-       VESA_1024x768p70,
-       VESA_1024x768p75,
-       VESA_1024x768p85,
-       VESA_1152x864p75,
-       VESA_1280x768p60R,
-       VESA_1280x768p60,
-       VESA_1280x768p75,
-       VESA_1280x768p85,
-       VESA_1280x960p60,
-       VESA_1280x960p85,
-       VESA_1280x1024p60,
-       VESA_1280x1024p75,
-       VESA_1280X1024p85,
-       VESA_1360X768p60,
-       VESA_1400x768p60R,
-       VESA_1400x768p60,
-       VESA_1400x1050p75,
-       VESA_1400x1050p85,
-       VESA_1440x900p60R,
-       VESA_1440x900p60,
-       VESA_1440x900p75,
-       VESA_1440x900p85,
-       VESA_1600x1200p60,
-       VESA_1600x1200p65,
-       VESA_1600x1200p70,
-       VESA_1600x1200p75,
-       VESA_1600x1200p85,
-       VESA_1680x1050p60R,
-       VESA_1680x1050p60,
-       VESA_1680x1050p75,
-       VESA_1680x1050p85,
-       VESA_1792x1344p60,
-       VESA_1792x1344p75,
-       VESA_1856x1392p60,
-       VESA_1856x1392p75,
-       VESA_1920x1200p60R,
-       VESA_1920x1200p60,
-       VESA_1920x1200p75,
-       VESA_1920x1200p85,
-       VESA_1920x1440p60,
-       VESA_1920x1440p75,
-       UNKNOWN_MODE    
-} MODE_ID;
-///////////////////////////////////////////////////////////////////////
-// Output Mode Type
-///////////////////////////////////////////////////////////////////////
-
-#define RES_ASPEC_4x3 0
-#define RES_ASPEC_16x9 1
-#define F_MODE_REPT_NO 0
-#define F_MODE_REPT_TWICE 1
-#define F_MODE_REPT_QUATRO 3
-#define F_MODE_CSC_ITU601 0
-#define F_MODE_CSC_ITU709 1
-
-/* Follow prototypes need accomplish by ourself */
-int cat66121_detect_device(void);
-int cat66121_sys_init(struct hdmi *hdmi);
-int cat66121_sys_unplug(struct hdmi *hdmi);
-int cat66121_sys_detect_hpd(struct hdmi *hdmi, int *hpdstatus);
-int cat66121_sys_detect_sink(struct hdmi *hdmi, int *sink_status);
-int cat66121_sys_read_edid(struct hdmi *hdmi, int block, unsigned char *buff);
-int cat66121_sys_config_video(struct hdmi *hdmi, int vic, int input_color, int output_color);
-int cat66121_sys_config_audio(struct hdmi *hdmi, struct hdmi_audio *audio);
-int cat66121_sys_config_hdcp(struct hdmi *hdmi, int enable);
-int cat66121_sys_enalbe_output(struct hdmi *hdmi, int enable);
-int cat66121_sys_check_status(struct hdmi *hdmi);
-#endif // _cat66121_SYS_H_
index 6ef47c8341b01e540bcf18488a4acccb8ba31214..f879720773b333ebbc1a3dc954a9465b76f54479 100755 (executable)
@@ -74,7 +74,7 @@
     #endif // INPUT_COLOR_MODE
     #define INPUT_COLOR_MODE F_MODE_YUV422
 #else
-    #pragma message ("Defined seperated sync.")
+//    #pragma message ("Defined seperated sync.")
     #define INPUT_SIGNAL_TYPE 0 // 24 bit sync seperate
     //#define INPUT_SIGNAL_TYPE ( T_MODE_DEGEN )
     //#define INPUT_SIGNAL_TYPE ( T_MODE_INDDR)
index 88bd80da963853e4069a4f0246c336149513c42a..fa47aee15683f67e53df772ecf896e7e83ebbb1c 100755 (executable)
@@ -341,6 +341,7 @@ _CODE RegSetEntry HDMITX_PwrOn_Table[] = {
 #ifdef DETECT_VSYNC_CHG_IN_SAV\r
 BOOL EnSavVSync = FALSE ;\r
 #endif\r
+static bool PowerStatus=FALSE;\r
 \r
 //////////////////////////////////////////////////////////////////////\r
 // Function Prototype\r
@@ -399,6 +400,7 @@ BOOL getHDMITX_LinkStatus()
     return FALSE;\r
 }\r
 \r
+#if 0\r
 BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)\r
 {\r
     BYTE intdata1,intdata2,intdata3,sysstat;\r
@@ -529,12 +531,13 @@ BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)
                 (intdata3&0x2)? "No audio input interrupt  \n":"",\r
                 (intdata3&0x1)? "Audio decode error interrupt \n":""));\r
         }\r
-        HDMITX_WriteI2C_Byte(REG_TX_INT_CLR0,0xFF);\r
-        HDMITX_WriteI2C_Byte(REG_TX_INT_CLR1,0xFF);\r
-        intclr3 = (HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS))|B_TX_CLR_AUD_CTS | B_TX_INTACTDONE ;\r
-        HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,intclr3); // clear interrupt.\r
-        intclr3 &= ~(B_TX_INTACTDONE);\r
-        HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,intclr3); // INTACTDONE reset to zero.\r
+\r
+       intclr3 = (HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS))|B_TX_CLR_AUD_CTS | B_TX_INTACTDONE ;\r
+       HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,intclr3); // clear interrupt.\r
+       HDMITX_WriteI2C_Byte(REG_TX_INT_CLR0,0xFF);\r
+       HDMITX_WriteI2C_Byte(REG_TX_INT_CLR1,0xFF);\r
+       intclr3 &= ~(B_TX_INTACTDONE);\r
+       HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,intclr3); // INTACTDONE reset to zero.\r
     }\r
     //\r
     // else\r
@@ -565,16 +568,22 @@ BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)
     hdmiTxDev[0].bHPD = HPD ;\r
     return HPD ;\r
 }\r
-\r
+#endif\r
 void HDMITX_PowerOn()\r
 {\r
+       PowerStatus = TRUE;\r
     hdmitx_LoadRegSetting(HDMITX_PwrOn_Table);\r
 }\r
 \r
 void HDMITX_PowerDown()\r
 {\r
+       PowerStatus = FALSE;\r
     hdmitx_LoadRegSetting(HDMITX_PwrDown_Table);\r
 }\r
+BOOL getHDMI_PowerStatus()\r
+{\r
+       return PowerStatus;\r
+}\r
 \r
 void setHDMITX_AVMute(BYTE bEnable)\r
 {\r
@@ -632,6 +641,16 @@ BOOL getHDMITX_EDIDBlock(int EDIDBlockID,BYTE *pEDIDData)
     {\r
         return FALSE ;\r
     }\r
+#if Debug_message\r
+    {\r
+           int j=0;\r
+           EDID_DEBUG_PRINTF(("------BlockID=%d------\n",EDIDBlockID));\r
+           for( j = 0 ; j < 128 ; j++ )\r
+           {\r
+                   EDID_DEBUG_PRINTF(("%02X%c",(int)pEDIDData[j],(7 == (j&7))?'\n':' '));\r
+           }\r
+    }\r
+#endif\r
     return TRUE ;\r
 }\r
 \r
@@ -726,7 +745,7 @@ SYS_STATUS getHDMITX_EDIDBytes(BYTE *pData,BYTE bSegment,BYTE offset,SHORT Count
         }\r
         if(TimeOut == 0)\r
         {\r
-            HDMITX_DEBUG_PRINTF(("getHDMITX_EDIDBytes(): DDC TimeOut. \n",(int)ucdata));\r
+            HDMITX_DEBUG_PRINTF(("getHDMITX_EDIDBytes(): DDC TimeOut %d . \n",(int)ucdata));\r
             // HDMITX_AndReg_Byte(REG_TX_INT_CTRL,~(1<<1));\r
             return ER_FAIL ;\r
         }\r
@@ -817,11 +836,11 @@ void hdmitx_AbortDDC()
 \r
 extern HDMITXDEV hdmiTxDev[HDMITX_MAX_DEV_COUNT] ;\r
 \r
-void WaitTxVidStable();\r
+void WaitTxVidStable(void);\r
 void hdmitx_SetInputMode(BYTE InputMode,BYTE bInputSignalType);\r
 void hdmitx_SetCSCScale(BYTE bInputMode,BYTE bOutputMode);\r
 void hdmitx_SetupAFE(VIDEOPCLKLEVEL PCLKLevel);\r
-void hdmitx_FireAFE();\r
+void hdmitx_FireAFE(void);\r
 \r
 //////////////////////////////////////////////////////////////////////\r
 // utility function for main..\r
@@ -1301,7 +1320,7 @@ void hdmitx_SetInputMode(BYTE InputColorMode,BYTE bInputSignalType)
 \r
 void hdmitx_SetCSCScale(BYTE bInputMode,BYTE bOutputMode)\r
 {\r
-    BYTE ucData,csc ;\r
+    BYTE ucData = 0,csc = B_HDMITX_CSC_BYPASS ;\r
     BYTE i ;\r
     BYTE filter = 0 ; // filter is for Video CTRL DN_FREE_GO,EN_DITHER,and ENUDFILT\r
 \r
@@ -1904,7 +1923,7 @@ void HDMITX_EnableAudioOutput(BYTE AudioType, BOOL bSPDIF,  ULONG SampleFreq,  B
                 ucIEC60958ChStat[2] = 4 ;\r
             }\r
             ucIEC60958ChStat[3] = Fs ;\r
-            ucIEC60958ChStat[4] = ((~Fs)<<4) & 0xF0 | CHTSTS_SWCODE ; // Fs | 24bit word length\r
+            ucIEC60958ChStat[4] = (((~Fs)<<4) & 0xF0) | CHTSTS_SWCODE ; // Fs | 24bit word length\r
             pIEC60958ChStat = ucIEC60958ChStat ;\r
         }\r
     }\r
@@ -2531,6 +2550,7 @@ void DumpHDMITXReg()
     int i,j ;\r
     BYTE ucData ;\r
 \r
+       printk( "[%s]\n", __FUNCTION__);\r
     HDMITX_DEBUG_PRINTF(("       "));\r
     for(j = 0 ; j < 16 ; j++)\r
     {\r
@@ -2556,7 +2576,7 @@ void DumpHDMITXReg()
             }\r
             else\r
             {\r
-                HDMITX_DEBUG_PRINTF((" XX",(int)ucData)); // for DDC FIFO\r
+                HDMITX_DEBUG_PRINTF((" XX")); // for DDC FIFO\r
             }\r
             if((j == 3)||(j==7)||(j==11))\r
             {\r
index e3570210f0785be94c926d59ff332b02b38bb3f6..7a998933668d3f1070e7d41b2460a616a32a414f 100755 (executable)
@@ -26,7 +26,7 @@
 #define HDMI_TX_I2C_SLAVE_ADDR 0x98\r
 #define CEC_I2C_SLAVE_ADDR 0x9C\r
 \r
-#define DISABLE_HDMITX_CSC\r
+//#define DISABLE_HDMITX_CSC\r
 ///////////////////////////////////////////////////////////////////////\r
 // Register offset\r
 ///////////////////////////////////////////////////////////////////////\r
@@ -646,18 +646,19 @@ typedef enum {
 /////////////////////////////////////////////////////////////////////////////////////\r
 // HDMITX function prototype\r
 /////////////////////////////////////////////////////////////////////////////////////\r
-void InitHDMITX();\r
+void InitHDMITX(void);\r
 void HDMITX_InitTxDev(HDMITXDEV *pInstance);\r
 BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange);\r
-BOOL getHDMITX_LinkStatus();\r
-void HDMITX_PowerOn();\r
-void HDMITX_PowerDown();\r
+BOOL getHDMITX_LinkStatus(void);\r
+BOOL getHDMI_PowerStatus(void);\r
+void HDMITX_PowerOn(void);\r
+void HDMITX_PowerDown(void);\r
 \r
 void hdmitx_LoadRegSetting(RegSetEntry table[]);\r
 /////////////////////////////////////////////////////////////////////////////////////\r
 // HDMITX video function prototype\r
 /////////////////////////////////////////////////////////////////////////////////////\r
-void HDMITX_DisableVideoOutput();\r
+void HDMITX_DisableVideoOutput(void);\r
 BOOL HDMITX_EnableVideoOutput(VIDEOPCLKLEVEL level,BYTE inputColorMode,BYTE outputColorMode,BYTE bHDMI);\r
 BOOL setHDMITX_VideoSignalType(BYTE inputSignalType);\r
 void setHDMITX_ColorDepthPhase(BYTE ColorDepth,BYTE bPhase);\r
@@ -675,31 +676,31 @@ void setHDMITX_ColorDepthPhase(BYTE ColorDepth,BYTE bPhase);
 void hdmitx_SetInputMode(BYTE InputMode,BYTE bInputSignalType);\r
 void hdmitx_SetCSCScale(BYTE bInputMode,BYTE bOutputMode);\r
 void hdmitx_SetupAFE(VIDEOPCLKLEVEL level);\r
-void hdmitx_FireAFE();\r
+void hdmitx_FireAFE(void);\r
 \r
 /////////////////////////////////////////////////////////////////////////////////////\r
 // HDMITX audio function prototype\r
 /////////////////////////////////////////////////////////////////////////////////////\r
-void HDMITX_DisableAudioOutput();\r
+void HDMITX_DisableAudioOutput(void);\r
 void HDMITX_EnableAudioOutput(BYTE AudioType, BOOL bSPDIF,  ULONG SampleFreq,  BYTE ChNum, BYTE *pIEC60958ChStat, ULONG TMDSClock);\r
 \r
 void setHDMITX_AudioChannelEnable(BOOL EnableAudio_b);\r
 void setHDMITX_ChStat(BYTE ucIEC60958ChStat[]);\r
-void setHDMITX_DSDAudio();\r
+void setHDMITX_DSDAudio(void);\r
 void setHDMITX_HBRAudio(BOOL bSPDIF);\r
 void setHDMITX_LPCMAudio(BYTE AudioSrcNum, BYTE AudSWL, BOOL bSPDIF);\r
 void setHDMITX_NCTS(BYTE Fs);\r
 void setHDMITX_NLPCMAudio(BOOL bSPDIF);\r
 void setHDMITX_UpdateChStatFs(ULONG Fs);\r
 \r
-BOOL hdmitx_IsAudioChang();\r
-void hdmitx_AutoAdjustAudio();\r
+BOOL hdmitx_IsAudioChang(void);\r
+void hdmitx_AutoAdjustAudio(void);\r
 \r
 /////////////////////////////////////////////////////////////////////////////////////\r
 // HDMITX hdcp function prototype\r
 /////////////////////////////////////////////////////////////////////////////////////\r
 BOOL HDMITX_EnableHDCP(BYTE bEnable);\r
-BOOL getHDMITX_AuthenticationDone();\r
+BOOL getHDMITX_AuthenticationDone(void);\r
 \r
 /////////////////////////////////////////////////////////////////////////////////////\r
 // HDMITX pkt/infoframe function prototype\r
@@ -721,12 +722,12 @@ SYS_STATUS hdmitx_Set_GeneralPurpose_PKT(BYTE *pData);
 BOOL getHDMITX_EDIDBlock(int EDIDBlockID,BYTE *pEDIDData);\r
 SYS_STATUS getHDMITX_EDIDBytes(BYTE *pData,BYTE bSegment,BYTE offset,SHORT Count);\r
 \r
-void hdmitx_GenerateDDCSCLK();\r
-void hdmitx_ClearDDCFIFO();\r
-void hdmitx_AbortDDC();\r
+void hdmitx_GenerateDDCSCLK(void);\r
+void hdmitx_ClearDDCFIFO(void);\r
+void hdmitx_AbortDDC(void);\r
 \r
 #if defined(Debug_message) && (Debug_message==1)\r
-    void DumpHDMITXReg();\r
+    void DumpHDMITXReg(void);\r
 #else\r
     #define DumpHDMITXReg()\r
 #endif\r
index 4f49796639666ff4101025c7c8c31c712ef0a485..ec8484e46f8184f7866d726e63f7065efb3e2194 100755 (executable)
@@ -31,7 +31,7 @@ BOOL HDMITX_EnableHDCP(BYTE bEnable)
     {\r
         if(ER_FAIL == hdmitx_hdcp_Authenticate())\r
         {\r
-            printk("ER_FAIL == hdmitx_hdcp_Authenticate\n");\r
+            HDCP_DEBUG_PRINTF(("ER_FAIL == hdmitx_hdcp_Authenticate\n"));\r
             hdmitx_hdcp_ResetAuth();\r
                        return FALSE ;\r
         }\r
@@ -48,7 +48,7 @@ BOOL HDMITX_EnableHDCP(BYTE bEnable)
 \r
 #ifdef SUPPORT_HDCP\r
 \r
-BOOL getHDMITX_AuthenticationDone()\r
+BOOL getHDMITX_AuthenticationDone(void)\r
 {\r
     //HDCP_DEBUG_PRINTF((" getHDMITX_AuthenticationDone() = %s\n",hdmiTxDev[0].bAuthenticated?"TRUE":"FALSE" ));\r
     return hdmiTxDev[0].bAuthenticated;\r
@@ -57,7 +57,7 @@ BOOL getHDMITX_AuthenticationDone()
 //////////////////////////////////////////////////////////////////////\r
 // Authentication\r
 //////////////////////////////////////////////////////////////////////\r
-void hdmitx_hdcp_ClearAuthInterrupt()\r
+void hdmitx_hdcp_ClearAuthInterrupt(void)\r
 {\r
     // BYTE uc ;\r
     // uc = HDMITX_ReadI2C_Byte(REG_TX_INT_MASK2) & (~(B_TX_KSVLISTCHK_MASK|B_TX_AUTH_DONE_MASK|B_TX_AUTH_FAIL_MASK));\r
@@ -67,7 +67,7 @@ void hdmitx_hdcp_ClearAuthInterrupt()
     HDMITX_WriteI2C_Byte(REG_TX_SYS_STATUS,B_TX_INTACTDONE);\r
 }\r
 \r
-void hdmitx_hdcp_ResetAuth()\r
+void hdmitx_hdcp_ResetAuth(void)\r
 {\r
     HDMITX_WriteI2C_Byte(REG_TX_LISTCTRL,0);\r
     HDMITX_WriteI2C_Byte(REG_TX_HDCP_DESIRE,0);\r
@@ -85,7 +85,7 @@ void hdmitx_hdcp_ResetAuth()
 // Side-Effect: N/A\r
 //////////////////////////////////////////////////////////////////////\r
 \r
-void hdmitx_hdcp_Auth_Fire()\r
+void hdmitx_hdcp_Auth_Fire(void)\r
 {\r
     // HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Auth_Fire():\n"));\r
     HDMITX_WriteI2C_Byte(REG_TX_DDC_MASTER_CTRL,B_TX_MASTERDDC|B_TX_MASTERHDCP); // MASTERHDCP,no need command but fire.\r
@@ -101,7 +101,7 @@ void hdmitx_hdcp_Auth_Fire()
 // Side-Effect: N/A\r
 //////////////////////////////////////////////////////////////////////\r
 \r
-void hdmitx_hdcp_StartAnCipher()\r
+void hdmitx_hdcp_StartAnCipher(void)\r
 {\r
     HDMITX_WriteI2C_Byte(REG_TX_AN_GENERATE,B_TX_START_CIPHER_GEN);\r
     delay1ms(1); // delay 1 ms\r
@@ -114,7 +114,7 @@ void hdmitx_hdcp_StartAnCipher()
 // Side-Effect: N/A\r
 //////////////////////////////////////////////////////////////////////\r
 \r
-void hdmitx_hdcp_StopAnCipher()\r
+void hdmitx_hdcp_StopAnCipher(void)\r
 {\r
     HDMITX_WriteI2C_Byte(REG_TX_AN_GENERATE,B_TX_STOP_CIPHER_GEN);\r
 }\r
@@ -128,7 +128,7 @@ void hdmitx_hdcp_StopAnCipher()
 // Side-Effect:\r
 //////////////////////////////////////////////////////////////////////\r
 \r
-void hdmitx_hdcp_GenerateAn()\r
+void hdmitx_hdcp_GenerateAn(void)\r
 {\r
     BYTE Data[8];\r
     BYTE i=0;\r
@@ -280,7 +280,7 @@ static BYTE countbit(BYTE b)
     return count ;\r
 }\r
 \r
-void hdmitx_hdcp_Reset()\r
+void hdmitx_hdcp_Reset(void)\r
 {\r
     BYTE uc ;\r
     uc = HDMITX_ReadI2C_Byte(REG_TX_SW_RST) | B_TX_HDCP_RST_HDMITX ;\r
@@ -299,13 +299,14 @@ SYS_STATUS hdmitx_hdcp_Authenticate()
     USHORT BStatus ;\r
     USHORT TimeOut ;\r
 \r
-    BYTE revoked = FALSE ;\r
//   BYTE revoked = FALSE ;\r
     BYTE BKSV[5] ;\r
 \r
     hdmiTxDev[0].bAuthenticated = FALSE ;\r
     if(0==(B_TXVIDSTABLE&HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS)))\r
     {\r
-        return ER_FAIL;\r
+           HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Authenticate(): Video not stable\n"));\r
+           return ER_FAIL;\r
     }\r
     // Authenticate should be called after AFE setup up.\r
 \r
@@ -388,6 +389,7 @@ SYS_STATUS hdmitx_hdcp_Authenticate()
             if(ucdata & B_TX_AUTH_DONE)\r
             {\r
                 hdmiTxDev[0].bAuthenticated = TRUE ;\r
+                HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Authenticate()-receiver: Authenticate SUCESS\n"));\r
                 break ;\r
             }\r
             ucdata = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT2);\r
@@ -994,6 +996,7 @@ SYS_STATUS hdmitx_hdcp_Authenticate_Repeater()
     }\r
 #endif // SUPPORT_SHA\r
 \r
+    HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Authenticate()-receiver: Authenticate SUCESS\n"));\r
     hdmitx_hdcp_ResumeRepeaterAuthenticate();\r
     hdmiTxDev[0].bAuthenticated = TRUE ;\r
     return ER_SUCCESS ;\r
index 453149a26aa3ae20a44eb1e95744906d4c3675f7..18c0434313c8d2d84a4bcc32387fe8d5290ebc17 100755 (executable)
 // Function Prototype\r
 ////////////////////////////////////////////////////\r
 \r
-BOOL getHDMITX_AuthenticationDone();\r
-void hdmitx_hdcp_ClearAuthInterrupt();\r
-void hdmitx_hdcp_ResetAuth();\r
-void hdmitx_hdcp_Auth_Fire();\r
-void hdmitx_hdcp_StartAnCipher();\r
-void hdmitx_hdcp_StopAnCipher();\r
-void hdmitx_hdcp_GenerateAn();\r
+BOOL getHDMITX_AuthenticationDone(void);\r
+void hdmitx_hdcp_ClearAuthInterrupt(void);\r
+void hdmitx_hdcp_ResetAuth(void);\r
+void hdmitx_hdcp_Auth_Fire(void);\r
+void hdmitx_hdcp_StartAnCipher(void);\r
+void hdmitx_hdcp_StopAnCipher(void);\r
+void hdmitx_hdcp_GenerateAn(void);\r
 SYS_STATUS hdmitx_hdcp_GetBCaps(PBYTE pBCaps ,PUSHORT pBStatus);\r
 SYS_STATUS hdmitx_hdcp_GetBKSV(BYTE *pBKSV);\r
 \r
-void hdmitx_hdcp_Reset();\r
-SYS_STATUS hdmitx_hdcp_Authenticate();\r
-SYS_STATUS hdmitx_hdcp_VerifyIntegration();\r
-void hdmitx_hdcp_CancelRepeaterAuthenticate();\r
-void hdmitx_hdcp_ResumeRepeaterAuthenticate();\r
+void hdmitx_hdcp_Reset(void);\r
+SYS_STATUS hdmitx_hdcp_Authenticate(void);\r
+SYS_STATUS hdmitx_hdcp_VerifyIntegration(void);\r
+void hdmitx_hdcp_CancelRepeaterAuthenticate(void);\r
+void hdmitx_hdcp_ResumeRepeaterAuthenticate(void);\r
 SYS_STATUS hdmitx_hdcp_CheckSHA(BYTE pM0[],USHORT BStatus,BYTE pKSVList[],int cDownStream,BYTE Vr[]);\r
 SYS_STATUS hdmitx_hdcp_GetKSVList(BYTE *pKSVList,BYTE cDownStream);\r
 SYS_STATUS hdmitx_hdcp_GetVr(BYTE *pVr);\r
 SYS_STATUS hdmitx_hdcp_GetM0(BYTE *pM0);\r
-SYS_STATUS hdmitx_hdcp_Authenticate_Repeater();\r
-void hdmitx_hdcp_ResumeAuthentication();\r
+SYS_STATUS hdmitx_hdcp_Authenticate_Repeater(void);\r
+void hdmitx_hdcp_ResumeAuthentication(void);\r
 #endif // _HDMITX_HDCP_H_\r
diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c
deleted file mode 100755 (executable)
index 6b939e2..0000000
+++ /dev/null
@@ -1,1381 +0,0 @@
-///*****************************************\r
-//  Copyright (C) 2009-2014\r
-//  ITE Tech. Inc. All Rights Reserved\r
-//  Proprietary and Confidential\r
-///*****************************************\r
-//   @file   <hdmitx_sys.c>\r
-//   @author Jau-Chih.Tseng@ite.com.tw\r
-//   @date   2012/12/20\r
-//   @fileversion: ITE_HDMITX_SAMPLE_3.14\r
-//******************************************/\r
-\r
-///////////////////////////////////////////////////////////////////////////////\r
-// This is the sample program for CAT6611 driver usage.\r
-///////////////////////////////////////////////////////////////////////////////\r
-#include <linux/kernel.h>\r
-#include <linux/delay.h>\r
-\r
-#include "hdmitx.h"\r
-#include "hdmitx_sys.h"\r
-\r
-_CODE HDMITXDEV InstanceData =\r
-{\r
-\r
-    0,      // BYTE I2C_DEV ;\r
-    HDMI_TX_I2C_SLAVE_ADDR,    // BYTE I2C_ADDR ;\r
-\r
-    /////////////////////////////////////////////////\r
-    // Interrupt Type\r
-    /////////////////////////////////////////////////\r
-    0x40,      // BYTE bIntType ; // = 0 ;\r
-    /////////////////////////////////////////////////\r
-    // Video Property\r
-    /////////////////////////////////////////////////\r
-    INPUT_SIGNAL_TYPE ,// BYTE bInputVideoSignalType ; // for Sync Embedded,CCIR656,InputDDR\r
-\r
-    /////////////////////////////////////////////////\r
-    // Audio Property\r
-    /////////////////////////////////////////////////\r
-    I2S_FORMAT, // BYTE bOutputAudioMode ; // = 0 ;\r
-    FALSE , // BYTE bAudioChannelSwap ; // = 0 ;\r
-    0x01, // BYTE bAudioChannelEnable ;\r
-    INPUT_SAMPLE_FREQ ,// BYTE bAudFs ;\r
-    0, // unsigned long TMDSClock ;\r
-    FALSE, // BYTE bAuthenticated:1 ;\r
-    FALSE, // BYTE bHDMIMode: 1;\r
-    FALSE, // BYTE bIntPOL:1 ; // 0 = Low Active\r
-    FALSE, // BYTE bHPD:1 ;\r
-};\r
-\r
-#ifdef HDMITX_INPUT_INFO\r
-// HDMI_VTiming currVTiming ;\r
-////////////////////////////////////////////////////////////////////////////////\r
-// HDMI VTable\r
-////////////////////////////////////////////////////////////////////////////////\r
-static HDMI_VTiming _CODE s_VMTable[] = {\r
-\r
-    { 1,0,640,480,800,525,25175000L,0x89,16,96,48,10,2,33,PROG,Vneg,Hneg},//640x480@60Hz\r
-    { 2,0,720,480,858,525,27000000L,0x80,16,62,60,9,6,30,PROG,Vneg,Hneg},//720x480@60Hz\r
-    { 3,0,720,480,858,525,27000000L,0x80,16,62,60,9,6,30,PROG,Vneg,Hneg},//720x480@60Hz\r
-    { 4,0,1280,720,1650,750,74250000L,0x2E,110,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@60Hz\r
-    { 5,0,1920,540,2200,562,74250000L,0x2E,88,44,148,2,5,15,INTERLACE,Vpos,Hpos},//1920x1080(I)@60Hz\r
-    { 6,1,720,240,858,262,13500000L,0x100,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@60Hz\r
-    { 7,1,720,240,858,262,13500000L,0x100,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@60Hz\r
-    { 8,1,720,240,858,262,13500000L,0x100,19,62,57,4,3,15,PROG,Vneg,Hneg},//720x480(I)@60Hz\r
-    { 9,1,720,240,858,262,13500000L,0x100,19,62,57,4,3,15,PROG,Vneg,Hneg},//720x480(I)@60Hz\r
-    {10,2,720,240,858,262,54000000L,0x40,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@60Hz\r
-    {11,2,720,240,858,262,54000000L,0x40,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@60Hz\r
-    {12,2,720,240,858,262,54000000L,0x40,19,62,57,4,3,15,PROG,Vneg,Hneg},//720x480(I)@60Hz\r
-    {13,2,720,240,858,262,54000000L,0x40,19,62,57,4,3,15,PROG,Vneg,Hneg},//720x480(I)@60Hz\r
-    {14,1,1440,480,1716,525,54000000L,0x40,32,124,120,9,6,30,PROG,Vneg,Hneg},//1440x480@60Hz\r
-    {15,1,1440,480,1716,525,54000000L,0x40,32,124,120,9,6,30,PROG,Vneg,Hneg},//1440x480@60Hz\r
-    {16,0,1920,1080,2200,1125,148500000L,0x17,88,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@60Hz\r
-    {17,0,720,576,864,625,27000000L,0x80,12,64,68,5,5,39,PROG,Vneg,Hneg},//720x576@50Hz\r
-    {18,0,720,576,864,625,27000000L,0x80,12,64,68,5,5,39,PROG,Vneg,Hneg},//720x576@50Hz\r
-    {19,0,1280,720,1980,750,74250000L,0x2E,440,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@50Hz\r
-    {20,0,1920,540,2640,562,74250000L,0x2E,528,44,148,2,5,15,INTERLACE,Vpos,Hpos},//1920x1080(I)@50Hz\r
-    {21,1,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@50Hz\r
-    {22,1,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@50Hz\r
-    {23,1,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,PROG,Vneg,Hneg},//1440x288@50Hz\r
-    {24,1,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,PROG,Vneg,Hneg},//1440x288@50Hz\r
-    {25,2,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@50Hz\r
-    {26,2,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@50Hz\r
-    {27,2,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,PROG,Vneg,Hneg},//1440x288@50Hz\r
-    {28,2,720,288,864,312,13500000L,0x100,12,63,69,2,3,19,PROG,Vneg,Hneg},//1440x288@50Hz\r
-    {29,1,1440,576,1728,625,54000000L,0x40,24,128,136,5,5,39,PROG,Vpos,Hneg},//1440x576@50Hz\r
-    {30,1,1440,576,1728,625,54000000L,0x40,24,128,136,5,5,39,PROG,Vpos,Hneg},//1440x576@50Hz\r
-    {31,0,1920,1080,2640,1125,148500000L,0x17,528,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@50Hz\r
-    {32,0,1920,1080,2750,1125,74250000L,0x2E,638,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@24Hz\r
-    {33,0,1920,1080,2640,1125,74250000L,0x2E,528,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@25Hz\r
-    {34,0,1920,1080,2200,1125,74250000L,0x2E,88,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@30Hz\r
-\r
-    {35,2,2880,480,1716*2,525,108000000L,0x20,32*2,124*2,120*2,9,6,30,PROG,Vneg,Hneg},//2880x480@60Hz\r
-    {36,2,2880,480,1716*2,525,108000000L,0x20,32*2,124*2,120*2,9,6,30,PROG,Vneg,Hneg},//2880x480@60Hz\r
-    {37,1,2880,576,3456,625,108000000L,0x20,24*2,128*2,136*2,5,5,39,PROG,Vneg,Hneg},//2880x576@50Hz\r
-    {38,2,2880,576,3456,625,108000000L,0x20,24*2,128*2,136*2,5,5,39,PROG,Vneg,Hneg},//2880x576@50Hz\r
-\r
-    {39,0,1920,540,2304,625,72000000L,0x17,32,168,184,23,5,57,INTERLACE,Vneg,Hpos},//1920x1080@50Hz\r
-    // 100Hz\r
-    {40,0,1920,540,2640,562,148500000L,0x17,528,44,148,2,5,15,INTERLACE,Vpos,Hpos},//1920x1080(I)@100Hz\r
-    {41,0,1280,720,1980,750,148500000L,0x17,440,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@100Hz\r
-    {42,0,720,576,864,625,   54000000L,0x40,12,64,68,5,5,39,PROG,Vneg,Hneg},//720x576@100Hz\r
-    {43,0,720,576,864,625,   54000000L,0x40,12,64,68,5,5,39,PROG,Vneg,Hneg},//720x576@100Hz\r
-    {44,1,720,288,864,312,   27000000L,0x80,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@100Hz\r
-    {45,1,720,288,864,312,   27000000L,0x80,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@100Hz\r
-    // 120Hz\r
-    {46,0,1920,540,2200,562,148500000L,0x17,88,44,148,2,5,15,INTERLACE,Vpos,Hpos},//1920x1080(I)@120Hz\r
-    {47,0,1280,720,1650,750,148500000L,0x17,110,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@120Hz\r
-    {48,0, 720,480, 858,525, 54000000L,0x40,16,62,60,9,6,30,PROG,Vneg,Hneg},//720x480@120Hz\r
-    {49,0, 720,480, 858,525, 54000000L,0x40,16,62,60,9,6,30,PROG,Vneg,Hneg},//720x480@120Hz\r
-    {50,1, 720,240, 858,262, 27000000L,0x80,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@120Hz\r
-    {51,1, 720,240, 858,262, 27000000L,0x80,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@120Hz\r
-\r
-    // 200Hz\r
-    {52,0,720,576,864,625,108000000L,0x20,12,64,68,5,5,39,PROG,Vneg,Hneg},//720x576@200Hz\r
-    {53,0,720,576,864,625,108000000L,0x20,12,64,68,5,5,39,PROG,Vneg,Hneg},//720x576@200Hz\r
-    {54,1,720,288,864,312, 54000000L,0x40,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@200Hz\r
-    {55,1,720,288,864,312, 54000000L,0x40,12,63,69,2,3,19,INTERLACE,Vneg,Hneg},//1440x576(I)@200Hz\r
-    // 240Hz\r
-    {56,0,720,480,858,525,108000000L,0x20,16,62,60,9,6,30,PROG,Vneg,Hneg},//720x480@120Hz\r
-    {57,0,720,480,858,525,108000000L,0x20,16,62,60,9,6,30,PROG,Vneg,Hneg},//720x480@120Hz\r
-    {58,1,720,240,858,262, 54000000L,0x40,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@120Hz\r
-    {59,1,720,240,858,262, 54000000L,0x40,19,62,57,4,3,15,INTERLACE,Vneg,Hneg},//720x480(I)@120Hz\r
-    // 720p low resolution\r
-    {60,0,1280, 720,3300, 750, 59400000L,0x3A,1760,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@24Hz\r
-    {61,0,1280, 720,3960, 750, 74250000L,0x2E,2420,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@25Hz\r
-    {62,0,1280, 720,3300, 750, 74250000L,0x2E,1760,40,220,5,5,20,PROG,Vpos,Hpos},//1280x720@30Hz\r
-    // 1080p high refresh rate\r
-    {63,0,1920,1080,2200,1125,297000000L,0x0B, 88,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@120Hz\r
-    {64,0,1920,1080,2640,1125,297000000L,0x0B,528,44,148,4,5,36,PROG,Vpos,Hpos},//1920x1080@100Hz\r
-    // VESA mode\r
-    {0,0,640,350,832,445,31500000L,0x6D,32,64,96,32,3,60,PROG,Vneg,Hpos},// 640x350@85\r
-    {0,0,640,400,832,445,31500000L,0x6D,32,64,96,1,3,41,PROG,Vneg,Hneg},// 640x400@85\r
-    {0,0,832,624,1152,667,57283000L,0x3C,32,64,224,1,3,39,PROG,Vneg,Hneg},// 832x624@75Hz\r
-    {0,0,720,350,900,449,28322000L,0x7A,18,108,54,59,2,38,PROG,Vneg,Hneg},// 720x350@70Hz\r
-    {0,0,720,400,900,449,28322000L,0x7A,18,108,54,13,2,34,PROG,Vpos,Hneg},// 720x400@70Hz\r
-    {0,0,720,400,936,446,35500000L,0x61,36,72,108,1,3,42,PROG,Vpos,Hneg},// 720x400@85\r
-    {0,0,640,480,800,525,25175000L,0x89,16,96,48,10,2,33,PROG,Vneg,Hneg},// 640x480@60\r
-    {0,0,640,480,832,520,31500000L,0x6D,24,40,128,9,3,28,PROG,Vneg,Hneg},// 640x480@72\r
-    {0,0,640,480,840,500,31500000L,0x6D,16,64,120,1,3,16,PROG,Vneg,Hneg},// 640x480@75\r
-    {0,0,640,480,832,509,36000000L,0x60,56,56,80,1,3,25,PROG,Vneg,Hneg},// 640x480@85\r
-    {0,0,800,600,1024,625,36000000L,0x60,24,72,128,1,2,22,PROG,Vpos,Hpos},// 800x600@56\r
-    {0,0,800,600,1056,628,40000000L,0x56,40,128,88,1,4,23,PROG,Vpos,Hpos},// 800x600@60\r
-    {0,0,800,600,1040,666,50000000L,0x45,56,120,64,37,6,23,PROG,Vpos,Hpos},// 800x600@72\r
-    {0,0,800,600,1056,625,49500000L,0x45,16,80,160,1,3,21,PROG,Vpos,Hpos},// 800x600@75\r
-    {0,0,800,600,1048,631,56250000L,0x3D,32,64,152,1,3,27,PROG,Vpos,Hpos},// 800X600@85\r
-    {0,0,848,480,1088,517,33750000L,0x66,16,112,112,6,8,23,PROG,Vpos,Hpos},// 840X480@60\r
-    {0,0,1024,384,1264,408,44900000L,0x4C,8,176,56,0,4,20,INTERLACE,Vpos,Hpos},//1024x768(I)@87Hz\r
-    {0,0,1024,768,1344,806,65000000L,0x35,24,136,160,3,6,29,PROG,Vneg,Hneg},// 1024x768@60\r
-    {0,0,1024,768,1328,806,75000000L,0x2E,24,136,144,3,6,29,PROG,Vneg,Hneg},// 1024x768@70\r
-    {0,0,1024,768,1312,800,78750000L,0x2B,16,96,176,1,3,28,PROG,Vpos,Hpos},// 1024x768@75\r
-    {0,0,1024,768,1376,808,94500000L,0x24,48,96,208,1,3,36,PROG,Vpos,Hpos},// 1024x768@85\r
-    {0,0,1152,864,1600,900,108000000L,0x20,64,128,256,1,3,32,PROG,Vpos,Hpos},// 1152x864@75\r
-    {0,0,1280,768,1440,790,68250000L,0x32,48,32,80,3,7,12,PROG,Vneg,Hpos},// 1280x768@60-R\r
-    {0,0,1280,768,1664,798,79500000L,0x2B,64,128,192,3,7,20,PROG,Vpos,Hneg},// 1280x768@60\r
-    {0,0,1280,768,1696,805,102250000L,0x21,80,128,208,3,7,27,PROG,Vpos,Hneg},// 1280x768@75\r
-    {0,0,1280,768,1712,809,117500000L,0x1D,80,136,216,3,7,31,PROG,Vpos,Hneg},// 1280x768@85\r
-\r
-    {0,0,1280,800,1440, 823, 71000000L,0x31, 48, 32, 80,3,6,14,PROG,Vpos,Hneg},// 1280x800@60Hz\r
-    {0,0,1280,800,1680, 831, 83500000L,0x29, 72,128,200,3,6,22,PROG,Vpos,Hneg},// 1280x800@60Hz\r
-    {0,0,1280,800,1696, 838,106500000L,0x20, 80,128,208,3,6,29,PROG,Vpos,Hneg},// 1280x800@75Hz\r
-    {0,0,1280,800,1712, 843,122500000L,0x1C, 80,136,216,3,6,34,PROG,Vpos,Hneg},// 1280x800@85Hz\r
-\r
-\r
-       {0,0,1280,960,1800,1000,108000000L,0x20,96,112,312,1,3,36,PROG,Vpos,Hpos},// 1280x960@60\r
-    {0,0,1280,960,1728,1011,148500000L,0x17,64,160,224,1,3,47,PROG,Vpos,Hpos},// 1280x960@85\r
-    {0,0,1280,1024,1688,1066,108000000L,0x20,48,112,248,1,3,38,PROG,Vpos,Hpos},// 1280x1024@60\r
-    {0,0,1280,1024,1688,1066,135000000L,0x19,16,144,248,1,3,38,PROG,Vpos,Hpos},// 1280x1024@75\r
-    {0,0,1280,1024,1728,1072,157500000L,0x15,64,160,224,1,3,44,PROG,Vpos,Hpos},// 1280X1024@85\r
-    {0,0,1360,768,1792,795,85500000L,0x28,64,112,256,3,6,18,PROG,Vpos,Hpos},// 1360X768@60\r
-\r
-    {0,0,1366,768,1792,798,85500000L,0x28, 70,143,213,3,3,24,PROG,Vpos,Hpos},// 1366X768@60\r
-    {0,0,1366,768,1500,800,72000000L,0x30, 14, 56, 64,1,3,28,PROG,Vpos,Hpos},// 1360X768@60\r
-    {0,0,1400,1050,1560,1080,101000000L,0x22,48,32,80,3,4,23,PROG,Vneg,Hpos},// 1400x768@60-R\r
-    {0,0,1400,1050,1864,1089,121750000L,0x1C,88,144,232,3,4,32,PROG,Vpos,Hneg},// 1400x768@60\r
-    {0,0,1400,1050,1896,1099,156000000L,0x16,104,144,248,3,4,42,PROG,Vpos,Hneg},// 1400x1050@75\r
-    {0,0,1400,1050,1912,1105,179500000L,0x13,104,152,256,3,4,48,PROG,Vpos,Hneg},// 1400x1050@85\r
-    {0,0,1440,900,1600,926,88750000L,0x26,48,32,80,3,6,17,PROG,Vneg,Hpos},// 1440x900@60-R\r
-    {0,0,1440,900,1904,934,106500000L,0x20,80,152,232,3,6,25,PROG,Vpos,Hneg},// 1440x900@60\r
-    {0,0,1440,900,1936,942,136750000L,0x19,96,152,248,3,6,33,PROG,Vpos,Hneg},// 1440x900@75\r
-    {0,0,1440,900,1952,948,157000000L,0x16,104,152,256,3,6,39,PROG,Vpos,Hneg},// 1440x900@85\r
-    {0,0,1600,1200,2160,1250,162000000L,0x15,64,192,304,1,3,46,PROG,Vpos,Hpos},// 1600x1200@60\r
-    {0,0,1600,1200,2160,1250,175500000L,0x13,64,192,304,1,3,46,PROG,Vpos,Hpos},// 1600x1200@65\r
-    {0,0,1600,1200,2160,1250,189000000L,0x12,64,192,304,1,3,46,PROG,Vpos,Hpos},// 1600x1200@70\r
-    {0,0,1600,1200,2160,1250,202500000L,0x11,64,192,304,1,3,46,PROG,Vpos,Hpos},// 1600x1200@75\r
-    {0,0,1600,1200,2160,1250,229500000L,0x0F,64,192,304,1,3,46,PROG,Vpos,Hpos},// 1600x1200@85\r
-    {0,0,1680,1050,1840,1080,119000000L,0x1D,48,32,80,3,6,21,PROG,Vneg,Hpos},// 1680x1050@60-R\r
-    {0,0,1680,1050,2240,1089,146250000L,0x17,104,176,280,3,6,30,PROG,Vpos,Hneg},// 1680x1050@60\r
-    {0,0,1680,1050,2272,1099,187000000L,0x12,120,176,296,3,6,40,PROG,Vpos,Hneg},// 1680x1050@75\r
-    {0,0,1680,1050,2288,1105,214750000L,0x10,128,176,304,3,6,46,PROG,Vpos,Hneg},// 1680x1050@85\r
-    {0,0,1792,1344,2448,1394,204750000L,0x10,128,200,328,1,3,46,PROG,Vpos,Hneg},// 1792x1344@60\r
-    {0,0,1792,1344,2456,1417,261000000L,0x0D,96,216,352,1,3,69,PROG,Vpos,Hneg},// 1792x1344@75\r
-    {0,0,1856,1392,2528,1439,218250000L,0x0F,96,224,352,1,3,43,PROG,Vpos,Hneg},// 1856x1392@60\r
-    {0,0,1856,1392,2560,1500,288000000L,0x0C,128,224,352,1,3,104,PROG,Vpos,Hneg},// 1856x1392@75\r
-    {0,0,1920,1200,2080,1235,154000000L,0x16,48,32,80,3,6,26,PROG,Vneg,Hpos},// 1920x1200@60-R\r
-    {0,0,1920,1200,2592,1245,193250000L,0x11,136,200,336,3,6,36,PROG,Vpos,Hneg},// 1920x1200@60\r
-    {0,0,1920,1200,2608,1255,245250000L,0x0E,136,208,344,3,6,46,PROG,Vpos,Hneg},// 1920x1200@75\r
-    {0,0,1920,1200,2624,1262,281250000L,0x0C,144,208,352,3,6,53,PROG,Vpos,Hneg},// 1920x1200@85\r
-    {0,0,1920,1440,2600,1500,234000000L,0x0E,128,208,344,1,3,56,PROG,Vpos,Hneg},// 1920x1440@60\r
-    {0,0,1920,1440,2640,1500,297000000L,0x0B,144,224,352,1,3,56,PROG,Vpos,Hneg},// 1920x1440@75\r
-};\r
-#define     SizeofVMTable   (sizeof(s_VMTable)/sizeof(HDMI_VTiming))\r
-\r
-void HDMITX_MonitorInputVideoChange();\r
-void HDMITX_MonitorInputAudioChange();\r
-\r
-#else\r
-#define     SizeofVMTable    0\r
-#endif\r
-\r
-#define DIFF(a,b) (((a)>(b))?((a)-(b)):((b)-(a)))\r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-// EDID\r
-////////////////////////////////////////////////////////////////////////////////\r
-static _XDATA RX_CAP RxCapability ;\r
-static BOOL bChangeMode = FALSE ;\r
-static BOOL bChangeAudio = FALSE ;\r
-\r
-_XDATA unsigned char CommunBuff[128] ;\r
-// _XDATA AVI_InfoFrame AviInfo;\r
-// _XDATA Audio_InfoFrame AudioInfo ;\r
-// _XDATA VendorSpecific_InfoFrame VS_Info;\r
-_CODE BYTE CA[] = { 0,0,0, 02, 0x3, 0x7, 0xB, 0xF, 0x1F } ;\r
-////////////////////////////////////////////////////////////////////////////////\r
-// Program utility.\r
-////////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-BYTE bInputColorMode = INPUT_COLOR_MODE;\r
-BYTE OutputColorDepth = INPUT_COLOR_DEPTH ;\r
-BYTE bOutputColorMode = OUTPUT_COLOR_MODE ;\r
-\r
-BYTE iVideoModeSelect=0 ;\r
-\r
-ULONG VideoPixelClock ;\r
-BYTE VIC ; // 480p60\r
-BYTE pixelrep ; // no pixelrepeating\r
-HDMI_Aspec aspec ;\r
-HDMI_Colorimetry Colorimetry ;\r
-\r
-ULONG ulAudioSampleFS = INPUT_SAMPLE_FREQ_HZ ;\r
-// BYTE bAudioSampleFreq = INPUT_SAMPLE_FREQ ;\r
-BYTE bOutputAudioChannel = OUTPUT_CHANNEL ;\r
-\r
-BOOL bHDMIMode;\r
-BYTE bAudioEnable ;\r
-BYTE HPDStatus = FALSE;\r
-BYTE HPDChangeStatus = FALSE;\r
-BYTE bOutputAudioType=CNOFIG_INPUT_AUDIO_TYPE;\r
-////////////////////////////////////////////////////////////////////////////////\r
-// Function Prototype.\r
-////////////////////////////////////////////////////////////////////////////////\r
-BYTE ParseEDID();\r
-static BOOL ParseCEAEDID(BYTE *pCEAEDID);\r
-void ConfigAVIInfoFrame(BYTE VIC, BYTE pixelrep);\r
-void ConfigAudioInfoFrm();\r
-void Config_GeneralPurpose_Infoframe(BYTE *p3DInfoFrame);\r
-void ConfigfHdmiVendorSpecificInfoFrame(BYTE _3D_Stru);\r
-void InitHDMITX_Variable();\r
-void HDMITX_ChangeDisplayOption(HDMI_Video_Type VideoMode, HDMI_OutputColorMode OutputColorMode);\r
-void HDMITX_SetOutput();\r
-int HDMITX_DevLoopProc();\r
-////////////////////////////////////////////////////////////////////////////////\r
-// Function Body.\r
-////////////////////////////////////////////////////////////////////////////////\r
-\r
-void InitHDMITX_Variable()\r
-{\r
-       printk( "[%s]\n", __FUNCTION__);\r
-    HDMITX_InitTxDev(&InstanceData);\r
-       HPDStatus = FALSE;\r
-       HPDChangeStatus = FALSE;\r
-}\r
-\r
-BOOL AudioModeDetect(void)\r
-{\r
-    setHDMITX_AudioChannelEnable(bAudioEnable);\r
-    return  TRUE;\r
-}\r
-\r
-void HDMITX_ChangeColorDepth(BYTE colorDepth)\r
-{\r
-#ifdef IT6615\r
-       HDMITX_DEBUG_PRINTF(("OHDMITX_ChangeColorDepth(%02X)\n",(int)colorDepth)) ;\r
-    OutputColorDepth = colorDepth ;\r
-#else\r
-    OutputColorDepth = 0 ;\r
-#endif\r
-}\r
-\r
-void HDMITX_SetOutput()\r
-{\r
-    VIDEOPCLKLEVEL level ;\r
-    unsigned long TMDSClock = VideoPixelClock*(pixelrep+1);\r
-    HDMITX_DisableAudioOutput();\r
-       HDMITX_EnableHDCP(FALSE);\r
-\r
-    if( TMDSClock>80000000L )\r
-    {\r
-        level = PCLK_HIGH ;\r
-    }\r
-    else if(TMDSClock>20000000L)\r
-    {\r
-        level = PCLK_MEDIUM ;\r
-    }\r
-    else\r
-    {\r
-        level = PCLK_LOW ;\r
-    }\r
-#ifdef IT6615\r
-       HDMITX_DEBUG_PRINTF(("OutputColorDepth = %02X\n",(int)OutputColorDepth)) ;\r
-    setHDMITX_ColorDepthPhase(OutputColorDepth,0);\r
-#endif\r
-\r
-       setHDMITX_VideoSignalType(InstanceData.bInputVideoSignalType);\r
-    #ifdef SUPPORT_SYNCEMBEDDED\r
-       if(InstanceData.bInputVideoSignalType & T_MODE_SYNCEMB)\r
-       {\r
-           setHDMITX_SyncEmbeddedByVIC(VIC,InstanceData.bInputVideoSignalType);\r
-       }\r
-    #endif\r
-\r
-    HDMITX_DEBUG_PRINTF(("level = %d, ,bInputColorMode=%x,bOutputColorMode=%x,bHDMIMode=%x\n",(int)level,(int)bInputColorMode,(int)bOutputColorMode ,(int)bHDMIMode)) ;\r
-       HDMITX_EnableVideoOutput(level,bInputColorMode,bOutputColorMode ,bHDMIMode);\r
-\r
-    if( bHDMIMode )\r
-    {\r
-        #ifdef OUTPUT_3D_MODE\r
-        ConfigfHdmiVendorSpecificInfoFrame(OUTPUT_3D_MODE);\r
-        #endif\r
-        //HDMITX_EnableHDCP(TRUE);\r
-        ConfigAVIInfoFrame(VIC, pixelrep);\r
-\r
-        HDMITX_SetAudioOutput();\r
-\r
-        // if( bAudioEnable )\r
-        // {\r
-        //     ConfigAudioInfoFrm();\r
-        // #ifdef SUPPORT_HBR_AUDIO\r
-        //     HDMITX_EnableAudioOutput(T_AUDIO_HBR, CONFIG_INPUT_AUDIO_SPDIF, 768000L,8,NULL,TMDSClock);\r
-        // #else\r
-        //     // HDMITX_EnableAudioOutput(T_AUDIO_LPCM, FALSE, ulAudioSampleFS,OUTPUT_CHANNEL,NULL,TMDSClock);\r
-        //     HDMITX_EnableAudioOutput(CNOFIG_INPUT_AUDIO_TYPE, CONFIG_INPUT_AUDIO_SPDIF, ulAudioSampleFS,bOutputAudioChannel,NULL,TMDSClock);\r
-        // #endif\r
-        // }\r
-\r
-    }\r
-       else\r
-       {\r
-               HDMITX_EnableAVIInfoFrame(FALSE ,NULL);\r
-        HDMITX_EnableVSInfoFrame(FALSE,NULL);\r
-       }\r
-    setHDMITX_AVMute(FALSE);\r
-    bChangeMode = FALSE ;\r
-    DumpHDMITXReg() ;\r
-}\r
-\r
-void HDMITX_ChangeAudioOption(BYTE Option, BYTE channelNum, BYTE AudioFs)\r
-{\r
-\r
-    switch(Option )\r
-    {\r
-    case T_AUDIO_HBR :\r
-        bOutputAudioType = T_AUDIO_HBR ;\r
-        ulAudioSampleFS = 768000L ;\r
-        bOutputAudioChannel = 8 ;\r
-        return ;\r
-    case T_AUDIO_NLPCM :\r
-        bOutputAudioType = T_AUDIO_NLPCM ;\r
-        bOutputAudioChannel = 2 ;\r
-        break ;\r
-    default:\r
-        bOutputAudioType = T_AUDIO_LPCM ;\r
-        if( channelNum < 1 )\r
-        {\r
-            bOutputAudioChannel = 1 ;\r
-        }\r
-        else if( channelNum > 8 )\r
-        {\r
-            bOutputAudioChannel = 8 ;\r
-        }\r
-        else\r
-        {\r
-            bOutputAudioChannel = channelNum ;\r
-        }\r
-        break ;\r
-    }\r
-\r
-    switch(AudioFs)\r
-    {\r
-    case AUDFS_44p1KHz:\r
-        ulAudioSampleFS =  44100L ;\r
-        break ;\r
-    case AUDFS_88p2KHz:\r
-        ulAudioSampleFS =  88200L ;\r
-        break ;\r
-    case AUDFS_176p4KHz:\r
-        ulAudioSampleFS = 176400L ;\r
-        break ;\r
-\r
-    case AUDFS_48KHz:\r
-        ulAudioSampleFS =  48000L ;\r
-        break ;\r
-    case AUDFS_96KHz:\r
-        ulAudioSampleFS =  96000L ;\r
-        break ;\r
-    case AUDFS_192KHz:\r
-        ulAudioSampleFS = 192000L ;\r
-        break ;\r
-\r
-    case AUDFS_768KHz:\r
-        ulAudioSampleFS = 768000L ;\r
-        break ;\r
-\r
-    case AUDFS_32KHz:\r
-        ulAudioSampleFS =  32000L ;\r
-        break ;\r
-    default:\r
-        ulAudioSampleFS =  48000L ;\r
-        break ;\r
-    }\r
-    HDMITX_DEBUG_PRINTF(("HDMITX_ChangeAudioOption():bOutputAudioType = %02X, ulAudioSampleFS = %8ld, bOutputAudioChannel = %d\n",(int)bOutputAudioType,ulAudioSampleFS,(int)bOutputAudioChannel)) ;\r
-    bChangeAudio = TRUE ;\r
-}\r
-\r
-void HDMITX_SetAudioOutput()\r
-{\r
-       if( bAudioEnable )\r
-       {\r
-        ConfigAudioInfoFrm();\r
-        // HDMITX_EnableAudioOutput(T_AUDIO_LPCM, FALSE, ulAudioSampleFS,OUTPUT_CHANNEL,NULL,TMDSClock);\r
-        HDMITX_EnableAudioOutput(\r
-            //CNOFIG_INPUT_AUDIO_TYPE,\r
-            bOutputAudioType,\r
-            CONFIG_INPUT_AUDIO_SPDIF,\r
-            ulAudioSampleFS,\r
-            bOutputAudioChannel,\r
-            NULL, // pointer to cahnnel status.\r
-            VideoPixelClock*(pixelrep+1));\r
-        // if you have channel status , set here.\r
-        // setHDMITX_ChStat(BYTE ucIEC60958ChStat[]);\r
-        bChangeAudio = FALSE ;\r
-       }\r
-}\r
-\r
-int HDMITX_DevLoopProc()\r
-{\r
-    static BYTE DevLoopCount = 0 ;\r
-    CheckHDMITX(&HPDStatus,&HPDChangeStatus);\r
-\r
-    if( HPDChangeStatus )\r
-    {\r
-        if( HPDStatus )\r
-        {\r
-            HDMITX_PowerOn();\r
-            ParseEDID();\r
-            bOutputColorMode = F_MODE_RGB444;\r
-\r
-                       if( RxCapability.ValidHDMI )\r
-                       {\r
-                               bHDMIMode = TRUE ;\r
-                               bAudioEnable = TRUE ;\r
-#if 0\r
-                               if(RxCapability.VideoMode & (1<<6))\r
-                               {\r
-                                       bAudioEnable = TRUE ;\r
-                               }\r
-#endif\r
-                               if( RxCapability.VideoMode & (1<<5))\r
-                               {\r
-                                       bOutputColorMode &= ~F_MODE_CLRMOD_MASK ;\r
-                                       bOutputColorMode |= F_MODE_YUV444;\r
-                               }\r
-                               else if (RxCapability.VideoMode & (1<<4))\r
-                               {\r
-                                       bOutputColorMode &= ~F_MODE_CLRMOD_MASK ;\r
-                                       bOutputColorMode |= F_MODE_YUV422 ;\r
-                               }\r
-                               bOutputColorMode = F_MODE_RGB444;\r
-\r
-\r
-            #ifdef IT6615\r
-                if(RxCapability.dc.uc & (HDMI_DC_SUPPORT_36|HDMI_DC_SUPPORT_30))\r
-                {\r
-                   setHDMITX_ColorDepthPhase(OutputColorDepth,0);\r
-                }\r
-                else\r
-                {\r
-                    OutputColorDepth = B_TX_CD_NODEF;\r
-                }\r
-            #else\r
-                OutputColorDepth = B_TX_CD_NODEF;\r
-            #endif\r
-                       }\r
-                       else\r
-                       {\r
-                               bHDMIMode = FALSE ;\r
-                               bAudioEnable = FALSE ;\r
-                               OutputColorDepth = B_TX_CD_NODEF;\r
-                // HDMITX_DisableAudioOutput();\r
-                // HDMITX_DisableVideoOutput();\r
-            #ifdef SUPPORT_HDCP\r
-                HDMITX_EnableHDCP(FALSE);\r
-            #endif\r
-                       }\r
-               HDMITX_DEBUG_PRINTF(("HPD change HDMITX_SetOutput();\n"));\r
-            //HDMITX_SetOutput();\r
-            bChangeMode=TRUE;\r
-            bChangeAudio = TRUE ;\r
-        }\r
-        else\r
-        {\r
-            // unplug mode, ...\r
-               HDMITX_DEBUG_PRINTF(("HPD OFF HDMITX_DisableVideoOutput()\n"));\r
-            HDMITX_DisableVideoOutput();\r
-            HDMITX_PowerDown();\r
-            bChangeAudio = FALSE ;\r
-        }\r
-    }\r
-    else // no stable but need to process mode change procedure\r
-    {\r
-        if( DevLoopCount >= 20 )\r
-        {\r
-            DevLoopCount = 0 ;\r
-        }\r
-\r
-        #ifdef HDMITX_AUTO_MONITOR_INPUT\r
-        if( DevLoopCount == 0 )\r
-        {\r
-            HDMITX_MonitorInputVideoChange();\r
-            HDMITX_MonitorInputAudioChange();\r
-        }\r
-        #endif\r
-\r
-        if(HPDStatus)\r
-        {\r
-            #ifdef HDMITX_AUTO_MONITOR_INPUT\r
-            if( bChangeMode && ( VIC > 0 ) )\r
-            #else\r
-            if( bChangeMode )\r
-            #endif\r
-            {\r
-                       HDMITX_DEBUG_PRINTF(("Mode change HDMITX_SetOutput();\n"));\r
-                HDMITX_SetOutput();\r
-                // HDMITX_EnableHDCP(TRUE);\r
-\r
-                bChangeMode = FALSE ;\r
-            }\r
-            if(getHDMITX_LinkStatus())\r
-            {\r
-                // AudioModeDetect();\r
-                #ifdef SUPPORT_HDCP\r
-                if(getHDMITX_AuthenticationDone() ==FALSE)\r
-                {\r
-                    HDMITX_DEBUG_PRINTF(("getHDMITX_AuthenticationDone() ==FALSE\n") );\r
-                    HDMITX_EnableHDCP(TRUE);\r
-                    setHDMITX_AVMute(FALSE);\r
-                }\r
-                #endif\r
-            }\r
-\r
-            if(bChangeAudio)\r
-            {\r
-                HDMITX_SetAudioOutput() ;\r
-            }\r
-        }\r
-    }\r
-\r
-    DevLoopCount ++ ;\r
-    return HPDChangeStatus;\r
-}\r
-\r
-#ifdef HDMITX_AUTO_MONITOR_INPUT\r
-\r
-void HDMITX_MonitorInputAudioChange()\r
-{\r
-    static ULONG prevAudioSampleFS = 0 ;\r
-    LONG AudioFS ;\r
-\r
-    if( !bAudioEnable )\r
-    {\r
-        prevAudioSampleFS = 0 ;\r
-    }\r
-    else\r
-    {\r
-        AudioFS = CalcAudFS() ;\r
-        HDMITX_DEBUG_PRINTF1(("Audio Chagne, Audio clock = %ldHz\n",AudioFS)) ;\r
-        if( AudioFS > 188000L ) // 192KHz\r
-        {\r
-            ulAudioSampleFS = 192000L ;\r
-        }\r
-        else if( AudioFS > 144000L ) // 176.4KHz\r
-        {\r
-            ulAudioSampleFS = 176400L ;\r
-        }\r
-        else if( AudioFS >  93000L ) // 96KHz\r
-        {\r
-            ulAudioSampleFS = 96000L ;\r
-        }\r
-        else if( AudioFS >  80000L ) // 88.2KHz\r
-        {\r
-            ulAudioSampleFS = 88200L ;\r
-        }\r
-        else if( AudioFS >  45000L ) // 48 KHz\r
-        {\r
-            ulAudioSampleFS = 48000L ;\r
-        }\r
-        else if( AudioFS >  36000L ) // 44.1KHz\r
-        {\r
-            ulAudioSampleFS = 44100L ;\r
-        }\r
-        else                         // 32KHz\r
-        {\r
-            ulAudioSampleFS = 32000L ;\r
-        }\r
-\r
-        if(!bChangeMode)\r
-        {\r
-            if( ulAudioSampleFS != prevAudioSampleFS )\r
-            {\r
-                HDMITX_DEBUG_PRINTF(("ulAudioSampleFS = %ldHz -> %ldHz\n",ulAudioSampleFS,ulAudioSampleFS)) ;\r
-                ConfigAudioInfoFrm();\r
-                HDMITX_EnableAudioOutput(CNOFIG_INPUT_AUDIO_TYPE, CONFIG_INPUT_AUDIO_SPDIF, ulAudioSampleFS,OUTPUT_CHANNEL,NULL,0);\r
-                // HDMITX_EnableAudioOutput(T_AUDIO_LPCM, FALSE, ulAudioSampleFS,OUTPUT_CHANNEL,NULL,0);\r
-\r
-            }\r
-        }\r
-\r
-        prevAudioSampleFS = ulAudioSampleFS ;\r
-\r
-    }\r
-}\r
-\r
-int HDMITX_SearchVICIndex( ULONG PCLK, USHORT HTotal, USHORT VTotal, BYTE ScanMode )\r
-{\r
-    #define SEARCH_COUNT 4\r
-    unsigned long  pclkDiff;\r
-    int i;\r
-    char hit;\r
-    int iMax[SEARCH_COUNT]={0};\r
-    char hitMax[SEARCH_COUNT]={0};\r
-    char i2;\r
-\r
-    for( i = 0 ; i < SizeofVMTable; i++ )\r
-    {\r
-        if( s_VMTable[i].VIC == 0 ) break ;\r
-\r
-        hit=0;\r
-\r
-        if( ScanMode == s_VMTable[i].ScanMode )\r
-        {\r
-            hit++;\r
-\r
-            if( ScanMode == INTERLACE )\r
-            {\r
-                if( DIFF(VTotal/2, s_VMTable[i].VTotal) < 10 )\r
-                {\r
-                    hit++;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                if( DIFF(VTotal, s_VMTable[i].VTotal) < 10 )\r
-                {\r
-                    hit++;\r
-                }\r
-            }\r
-\r
-            if( hit == 2 ) // match scan mode and v-total\r
-            {\r
-                if( DIFF(HTotal, s_VMTable[i].HTotal) < 40 )\r
-                {\r
-                    hit++;\r
-\r
-                    pclkDiff = DIFF(PCLK, s_VMTable[i].PCLK);\r
-                    pclkDiff = (pclkDiff * 100) / s_VMTable[i].PCLK;\r
-\r
-                    if( pclkDiff < 100 )\r
-                    {\r
-                        hit += ( 100 - pclkDiff );\r
-                    }\r
-                }\r
-            }\r
-        }\r
-\r
-        HDMITX_DEBUG_PRINTF(("i = %d, hit = %d\n",i,(int)hit));\r
-\r
-        if( hit )\r
-        {\r
-            for( i2=0 ; i2<SEARCH_COUNT ; i2++ )\r
-            {\r
-                if( hitMax[i2] < hit )\r
-                {\r
-                    HDMITX_DEBUG_PRINTF(("replace iMax[%d] = %d => %d\n",(int)i2, iMax[i2], i ));\r
-                    hitMax[i2] = hit;\r
-                    iMax[i2]=i;\r
-                    break;\r
-                }\r
-            }\r
-        }\r
-    }\r
-\r
-    i=-1;\r
-    hit=0;\r
-    for( i2=0 ; i2<SEARCH_COUNT ; i2++ )\r
-    {\r
-        HDMITX_DEBUG_PRINTF(("[%d] i = %d, hit = %d\n",(int)i2, iMax[i2],(int)hitMax[i2]));\r
-        if( hitMax[i2] > hit )\r
-        {\r
-            hit = hitMax[i2];\r
-            i = iMax[i2];\r
-        }\r
-    }\r
-\r
-    if( hit > 2 )\r
-    {\r
-        HDMITX_DEBUG_PRINTF(("i = %d, hit = %d\n",i,(int)hit));\r
-        HDMITX_DEBUG_PRINTF((">> mode : %d %u x %u @%lu (%s)\n", (int)s_VMTable[i].VIC, s_VMTable[i].HActive, s_VMTable[i].VActive, s_VMTable[i].PCLK, (s_VMTable[i].ScanMode==0)?"i":"p" ));\r
-    }\r
-    else\r
-    {\r
-        i=-1;\r
-        HDMITX_DEBUG_PRINTF(("no matched\n"));\r
-    }\r
-\r
-    return i;\r
-}\r
-\r
-void HDMITX_MonitorInputVideoChange()\r
-{\r
-    static ULONG prevPCLK = 0 ;\r
-    static USHORT prevHTotal = 0 ;\r
-    static USHORT prevVTotal = 0 ;\r
-    static BYTE prevScanMode ;\r
-    ULONG currPCLK ;\r
-    ULONG diff ;\r
-    USHORT currHTotal, currVTotal ;\r
-    BYTE currScanMode ;\r
-       int i ;\r
-\r
-    currPCLK = CalcPCLK() ;\r
-    currHTotal = hdmitx_getInputHTotal() ;\r
-    currVTotal = hdmitx_getInputVTotal() ;\r
-    currScanMode = hdmitx_isInputInterlace() ? INTERLACE:PROG ;\r
-    diff = DIFF(currPCLK,prevPCLK);\r
-\r
-    HDMITX_DEBUG_PRINTF(("HDMITX_MonitorInputVideoChange : pclk=%lu, ht=%u, vt=%u, dif=%lu\n", currPCLK, currHTotal, currVTotal, diff ));\r
-\r
-    if( currHTotal == 0 || currVTotal == 0 || currPCLK == 0 )\r
-    {\r
-        bChangeMode = FALSE;\r
-               return ;\r
-    }\r
-\r
-    if( diff > currPCLK/20) // 5% torrenlance\r
-    {\r
-        bChangeMode = TRUE ;\r
-    }\r
-    else\r
-    {\r
-        diff = DIFF(currHTotal, prevHTotal) ;\r
-        if( diff > 20 )\r
-        {\r
-            bChangeMode = TRUE ;\r
-        }\r
-        diff = DIFF(currVTotal, prevVTotal) ;\r
-        if( diff > 20 )\r
-        {\r
-            bChangeMode = TRUE ;\r
-        }\r
-    }\r
-\r
-    if( bChangeMode )\r
-    {\r
-        HDMITX_DEBUG_PRINTF(("PCLK = %ld -> %ld\n",prevPCLK, currPCLK));\r
-        HDMITX_DEBUG_PRINTF(("HTotal = %d -> %d\n",prevHTotal, currHTotal));\r
-        HDMITX_DEBUG_PRINTF(("VTotal = %d -> %d\n",prevVTotal, currVTotal));\r
-        HDMITX_DEBUG_PRINTF(("ScanMode = %s -> %s\n",prevScanMode?"P":"I", currScanMode?"P":"I"));\r
-\r
-        HDMITX_DEBUG_PRINTF(("PCLK = %ld,(%dx%d) %s %s\n",currPCLK, currHTotal,currVTotal, (currScanMode==INTERLACE)?"INTERLACED":"PROGRESS",bChangeMode?"CHANGE MODE":"NO CHANGE MODE"));\r
-\r
-        setHDMITX_AVMute(TRUE);\r
-\r
-        #if 0\r
-        for( i = 0 ; (i < SizeofVMTable) && ( s_VMTable[i].VIC != 0 ); i++ )\r
-        {\r
-            if( s_VMTable[i].VIC == 0 ) break ;\r
-            if( DIFF(currPCLK, s_VMTable[i].PCLK) > (s_VMTable[i].PCLK/20))\r
-            {\r
-                continue ;\r
-            }\r
-            if( DIFF(currHTotal, s_VMTable[i].HTotal) > 40 )\r
-            {\r
-                continue ;\r
-            }\r
-            if( currScanMode != s_VMTable[i].ScanMode )\r
-            {\r
-                continue ;\r
-            }\r
-            if( currScanMode == INTERLACE )\r
-            {\r
-                if( DIFF(currVTotal/2, s_VMTable[i].VTotal) > 10 )\r
-                {\r
-                    continue ;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                if( DIFF(currVTotal, s_VMTable[i].VTotal) > 10 )\r
-                {\r
-                    continue ;\r
-                }\r
-            }\r
-            printf("i = %d, VIC = %d\n",i,(int)s_VMTable[i].VIC) ;\r
-\r
-            break ;\r
-        }\r
-        #else\r
-        i = HDMITX_SearchVICIndex( currPCLK, currHTotal, currVTotal, currScanMode );\r
-        #endif\r
-\r
-        if( i >= 0 )\r
-        {\r
-            VIC = s_VMTable[i].VIC;\r
-            pixelrep = s_VMTable[i].PixelRep ;\r
-            VideoPixelClock = currPCLK ;\r
-        }\r
-        else\r
-        {\r
-            VIC = 0;\r
-            pixelrep = 0;\r
-            VideoPixelClock = 0 ;\r
-        }\r
-    }\r
-\r
-    prevPCLK = currPCLK ;\r
-    prevHTotal = currHTotal ;\r
-    prevVTotal = currVTotal ;\r
-    prevScanMode = currScanMode ;\r
-\r
-}\r
-#endif // HDMITX_AUTO_MONITOR_INPUT\r
-\r
-void HDMITX_ChangeDisplayOption(HDMI_Video_Type OutputVideoTiming, HDMI_OutputColorMode OutputColorMode)\r
-{\r
-       printk( "[%s] Vic=%d\n", __FUNCTION__,OutputVideoTiming);\r
-   //HDMI_Video_Type  t=HDMI_480i60_16x9;\r
-    if((F_MODE_RGB444)==(bOutputColorMode&F_MODE_CLRMOD_MASK))//Force output RGB in RGB only case\r
-    {\r
-        OutputColorMode=F_MODE_RGB444;\r
-    }\r
-    else if ((F_MODE_YUV422)==(bOutputColorMode&F_MODE_CLRMOD_MASK))//YUV422 only\r
-    {\r
-        if(OutputColorMode==HDMI_YUV444){OutputColorMode=F_MODE_YUV422;}\r
-    }\r
-    else if ((F_MODE_YUV444)==(bOutputColorMode&F_MODE_CLRMOD_MASK))//YUV444 only\r
-    {\r
-        if(OutputColorMode==HDMI_YUV422){OutputColorMode=F_MODE_YUV444;}\r
-    }\r
-    switch(OutputVideoTiming)\r
-       {\r
-    case HDMI_640x480p60:\r
-        VIC = 1 ;\r
-        VideoPixelClock = 25000000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_4x3 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_480p60:\r
-        VIC = 2 ;\r
-        VideoPixelClock = 27000000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_4x3 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_480p60_16x9:\r
-        VIC = 3 ;\r
-        VideoPixelClock = 27000000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_720p60:\r
-        VIC = 4 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_1080i60:\r
-        VIC = 5 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_480i60:\r
-        VIC = 6 ;\r
-        VideoPixelClock = 13500000 ;\r
-        pixelrep = 1 ;\r
-        aspec = HDMI_4x3 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_480i60_16x9:\r
-        VIC = 7 ;\r
-        VideoPixelClock = 13500000 ;\r
-        pixelrep = 1 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_1080p60:\r
-        VIC = 16 ;\r
-        VideoPixelClock = 148500000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_576p50:\r
-        VIC = 17 ;\r
-        VideoPixelClock = 27000000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_4x3 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_576p50_16x9:\r
-        VIC = 18 ;\r
-        VideoPixelClock = 27000000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_720p50:\r
-        VIC = 19 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_1080i50:\r
-        VIC = 20 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_576i50:\r
-        VIC = 21 ;\r
-        VideoPixelClock = 13500000 ;\r
-        pixelrep = 1 ;\r
-        aspec = HDMI_4x3 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_576i50_16x9:\r
-        VIC = 22 ;\r
-        VideoPixelClock = 13500000 ;\r
-        pixelrep = 1 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU601 ;\r
-        break ;\r
-    case HDMI_1080p50:\r
-        VIC = 31 ;\r
-        VideoPixelClock = 148500000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_1080p24:\r
-        VIC = 32 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_1080p25:\r
-        VIC = 33 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-    case HDMI_1080p30:\r
-        VIC = 34 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-        break ;\r
-\r
-    case HDMI_720p30:\r
-        VIC = 0 ;\r
-        VideoPixelClock = 74250000 ;\r
-        pixelrep = 0 ;\r
-        aspec = HDMI_16x9 ;\r
-        Colorimetry = HDMI_ITU709 ;\r
-\r
-    #ifdef SUPPORT_SYNCEMBEDDED\r
-    /*\r
-        VTiming.HActive=1280 ;\r
-        VTiming.VActive=720 ;\r
-        VTiming.HTotal=3300 ;\r
-        VTiming.VTotal=750 ;\r
-        VTiming.PCLK=VideoPixelClock ;\r
-        VTiming.xCnt=0x2E ;\r
-        VTiming.HFrontPorch= 1760;\r
-        VTiming.HSyncWidth= 40 ;\r
-        VTiming.HBackPorch= 220 ;\r
-        VTiming.VFrontPorch= 5;\r
-        VTiming.VSyncWidth= 5 ;\r
-        VTiming.VBackPorch= 20 ;\r
-        VTiming.ScanMode=PROG ;\r
-        VTiming.VPolarity=Vneg ;\r
-        VTiming.HPolarity=Hneg ;\r
-    */\r
-    #endif\r
-        break ;\r
-    default:\r
-        bChangeMode = FALSE ;\r
-        return ;\r
-    }\r
-    switch(OutputColorMode)\r
-    {\r
-    case HDMI_YUV444:\r
-        bOutputColorMode = F_MODE_YUV444 ;\r
-        break ;\r
-    case HDMI_YUV422:\r
-        bOutputColorMode = F_MODE_YUV422 ;\r
-        break ;\r
-    case HDMI_RGB444:\r
-    default:\r
-        bOutputColorMode = F_MODE_RGB444 ;\r
-        break ;\r
-    }\r
-    if( Colorimetry == HDMI_ITU709 )\r
-    {\r
-        bInputColorMode |= F_VIDMODE_ITU709 ;\r
-    }\r
-    else\r
-    {\r
-        bInputColorMode &= ~F_VIDMODE_ITU709 ;\r
-    }\r
-    // if( Colorimetry != HDMI_640x480p60)\r
-    if( OutputVideoTiming != HDMI_640x480p60)\r
-    {\r
-        bInputColorMode |= F_VIDMODE_16_235 ;\r
-    }\r
-    else\r
-    {\r
-        bInputColorMode &= ~F_VIDMODE_16_235 ;\r
-    }\r
-    bChangeMode = TRUE ;\r
-}\r
-\r
-void ConfigAVIInfoFrame(BYTE VIC, BYTE pixelrep)\r
-{\r
-    AVI_InfoFrame *AviInfo;\r
-    AviInfo = (AVI_InfoFrame *)CommunBuff ;\r
-\r
-    AviInfo->pktbyte.AVI_HB[0] = AVI_INFOFRAME_TYPE|0x80 ;\r
-    AviInfo->pktbyte.AVI_HB[1] = AVI_INFOFRAME_VER ;\r
-    AviInfo->pktbyte.AVI_HB[2] = AVI_INFOFRAME_LEN ;\r
-\r
-    switch(bOutputColorMode)\r
-    {\r
-    case F_MODE_YUV444:\r
-        // AviInfo->info.ColorMode = 2 ;\r
-        AviInfo->pktbyte.AVI_DB[0] = (2<<5)|(1<<4);\r
-        break ;\r
-    case F_MODE_YUV422:\r
-        // AviInfo->info.ColorMode = 1 ;\r
-        AviInfo->pktbyte.AVI_DB[0] = (1<<5)|(1<<4);\r
-        break ;\r
-    case F_MODE_RGB444:\r
-    default:\r
-        // AviInfo->info.ColorMode = 0 ;\r
-        AviInfo->pktbyte.AVI_DB[0] = (0<<5)|(1<<4);\r
-        break ;\r
-    }\r
-    AviInfo->pktbyte.AVI_DB[1] = 8 ;\r
-    AviInfo->pktbyte.AVI_DB[1] |= (aspec != HDMI_16x9)?(1<<4):(2<<4); // 4:3 or 16:9\r
-    AviInfo->pktbyte.AVI_DB[1] |= (Colorimetry != HDMI_ITU709)?(1<<6):(2<<6); // 4:3 or 16:9\r
-    AviInfo->pktbyte.AVI_DB[2] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[3] = VIC ;\r
-    AviInfo->pktbyte.AVI_DB[4] =  pixelrep & 3 ;\r
-    AviInfo->pktbyte.AVI_DB[5] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[6] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[7] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[8] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[9] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[10] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[11] = 0 ;\r
-    AviInfo->pktbyte.AVI_DB[12] = 0 ;\r
-\r
-    HDMITX_EnableAVIInfoFrame(TRUE, (unsigned char *)AviInfo);\r
-}\r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-// Function: ConfigAudioInfoFrm\r
-// Parameter: NumChannel, number from 1 to 8\r
-// Return: ER_SUCCESS for successfull.\r
-// Remark: Evaluate. The speakerplacement is only for reference.\r
-//         For production, the caller of hdmitx_SetAudioInfoFrame should program\r
-//         Speaker placement by actual status.\r
-// Side-Effect:\r
-////////////////////////////////////////////////////////////////////////////////\r
-\r
-void ConfigAudioInfoFrm()\r
-{\r
-    int i ;\r
-\r
-    Audio_InfoFrame *AudioInfo ;\r
-    AudioInfo = (Audio_InfoFrame *)CommunBuff ;\r
-\r
-    HDMITX_DEBUG_PRINTF(("ConfigAudioInfoFrm(%d)\n",2));\r
-\r
-    AudioInfo->pktbyte.AUD_HB[0] = AUDIO_INFOFRAME_TYPE ;\r
-    AudioInfo->pktbyte.AUD_HB[1] = 1 ;\r
-    AudioInfo->pktbyte.AUD_HB[2] = AUDIO_INFOFRAME_LEN ;\r
-    AudioInfo->pktbyte.AUD_DB[0] = 1 ;\r
-    for( i = 1 ;i < AUDIO_INFOFRAME_LEN ; i++ )\r
-    {\r
-        AudioInfo->pktbyte.AUD_DB[i] = 0 ;\r
-    }\r
-    HDMITX_EnableAudioInfoFrame(TRUE, (unsigned char *)AudioInfo);\r
-}\r
-\r
-void ConfigfHdmiVendorSpecificInfoFrame(BYTE _3D_Stru)\r
-{\r
-    VendorSpecific_InfoFrame *VS_Info;\r
-\r
-    VS_Info=(VendorSpecific_InfoFrame *)CommunBuff ;\r
-\r
-    VS_Info->pktbyte.VS_HB[0] = VENDORSPEC_INFOFRAME_TYPE|0x80;\r
-    VS_Info->pktbyte.VS_HB[1] = VENDORSPEC_INFOFRAME_VER;\r
-    VS_Info->pktbyte.VS_HB[2] = (_3D_Stru == Side_by_Side)?6:5;\r
-    VS_Info->pktbyte.VS_DB[0] = 0x03;\r
-    VS_Info->pktbyte.VS_DB[1] = 0x0C;\r
-    VS_Info->pktbyte.VS_DB[2] = 0x00;\r
-    VS_Info->pktbyte.VS_DB[3] = 0x40;\r
-    switch(_3D_Stru)\r
-    {\r
-    case Side_by_Side:\r
-    case Frame_Pcaking:\r
-    case Top_and_Botton:\r
-        VS_Info->pktbyte.VS_DB[4] = (_3D_Stru<<4);\r
-        break;\r
-    default:\r
-        VS_Info->pktbyte.VS_DB[4] = (Frame_Pcaking<<4);\r
-        break ;\r
-    }\r
-    VS_Info->pktbyte.VS_DB[5] = 0x00;\r
-    HDMITX_EnableVSInfoFrame(TRUE,(BYTE *)VS_Info);\r
-}\r
-\r
-/////////////////////////////////////////////////////////////////////\r
-// ParseEDID()\r
-// Check EDID check sum and EDID 1.3 extended segment.\r
-/////////////////////////////////////////////////////////////////////\r
-\r
-BYTE ParseEDID()\r
-{\r
-    // collect the EDID ucdata of segment 0\r
-    _XDATA unsigned char *EDID_Buf;\r
-    BYTE CheckSum ;\r
-    BYTE BlockCount ;\r
-    BYTE err ;\r
-    BYTE bValidCEA = FALSE ;\r
-    BYTE i;\r
-    #if Debug_message\r
-        BYTE j ;\r
-    #endif // Debug_message\r
-\r
-    EDID_Buf = CommunBuff;\r
-    RxCapability.ValidCEA = FALSE ;\r
-    RxCapability.ValidHDMI = TRUE;\r
-    RxCapability.dc.uc = 0;\r
-\r
-    getHDMITX_EDIDBlock(0, EDID_Buf);\r
-#if Debug_message\r
-    for( j = 0 ; j < 128 ; j++ )\r
-    {\r
-           EDID_DEBUG_PRINTF(("%02X%c",(int)EDID_Buf[j],(7 == (j&7))?'\n':' '));\r
-    }\r
-#endif // Debug_message\r
-\r
-    for( i = 0, CheckSum = 0 ; i < 128 ; i++ )\r
-    {\r
-        CheckSum += EDID_Buf[i] ; CheckSum &= 0xFF ;\r
-    }\r
-                       //Eep_Write(0x80, 0x80, EDID_Buf);\r
-       if( CheckSum != 0 )\r
-       {\r
-               return FALSE ;\r
-       }\r
-       if( EDID_Buf[0] != 0x00 ||\r
-           EDID_Buf[1] != 0xFF ||\r
-           EDID_Buf[2] != 0xFF ||\r
-           EDID_Buf[3] != 0xFF ||\r
-           EDID_Buf[4] != 0xFF ||\r
-           EDID_Buf[5] != 0xFF ||\r
-           EDID_Buf[6] != 0xFF ||\r
-           EDID_Buf[7] != 0x00)\r
-    {\r
-        return FALSE ;\r
-    }\r
-    /*\r
-    for( i = 0 ; i < 128 ; i++ )\r
-    {\r
-        HDMITX_DEBUG_PRINTF(("%02X%c",(int)EDID_Buf[i],(7 == (i&7))?'\n':' '));\r
-    }\r
-    */\r
-\r
-    BlockCount = EDID_Buf[0x7E] ;\r
-\r
-    if( BlockCount == 0 )\r
-    {\r
-        return TRUE ; // do nothing.\r
-    }\r
-    else if ( BlockCount > 4 )\r
-    {\r
-        BlockCount = 4 ;\r
-    }\r
-     // read all segment for test\r
-    for( i = 1 ; i <= BlockCount ; i++ )\r
-    {\r
-        err = getHDMITX_EDIDBlock(i, EDID_Buf);\r
-\r
-        #if Debug_message\r
-        for( j = 0 ; j < 128 ; j++ )\r
-        {\r
-            EDID_DEBUG_PRINTF(("%02X%c",(int)EDID_Buf[j],(7 == (j&7))?'\n':' '));\r
-        }\r
-        #endif // Debug_message\r
-\r
-        if( err )\r
-        {\r
-           if( !bValidCEA && EDID_Buf[0] == 0x2 && EDID_Buf[1] == 0x3 )\r
-            {\r
-                err = ParseCEAEDID(EDID_Buf);\r
-                EDID_DEBUG_PRINTF(("err = %s\n",err?"SUCCESS":"FAIL"));\r
-                if( err )\r
-                {\r
-                    EDID_DEBUG_PRINTF(("RxCapability.IEEEOUI = %lx\n",RxCapability.IEEEOUI));\r
-\r
-                                   if(RxCapability.IEEEOUI==0x0c03)\r
-                                   {\r
-                                       RxCapability.ValidHDMI = TRUE ;\r
-                                       bValidCEA = TRUE ;\r
-                                       }\r
-                                   else\r
-                                   {\r
-                                       RxCapability.ValidHDMI = FALSE ;\r
-                                   }\r
-                }\r
-            }\r
-        }\r
-    }\r
-    return err ;\r
-}\r
-\r
-static BOOL ParseCEAEDID(BYTE *pCEAEDID)\r
-{\r
-    BYTE offset,End ;\r
-    BYTE count ;\r
-    BYTE tag ;\r
-    int i ;\r
-\r
-    if( pCEAEDID[0] != 0x02 || pCEAEDID[1] != 0x03 ) return FALSE ; // not a CEA BLOCK.\r
-    End = pCEAEDID[2]  ; // CEA description.\r
-\r
-    RxCapability.VDOMode[0] = 0x00 ;\r
-    RxCapability.VDOMode[1] = 0x00 ;\r
-    RxCapability.VDOMode[2] = 0x00 ;\r
-    RxCapability.VDOMode[3] = 0x00 ;\r
-    RxCapability.VDOMode[4] = 0x00 ;\r
-    RxCapability.VDOMode[5] = 0x00 ;\r
-    RxCapability.VDOMode[6] = 0x00 ;\r
-    RxCapability.VDOMode[7] = 0x00 ;\r
-    RxCapability.PA[0] = 0x00 ;\r
-    RxCapability.PA[1] = 0x00 ;\r
-\r
-    RxCapability.VideoMode = pCEAEDID[3] ;\r
-\r
-    RxCapability.NativeVDOMode = 0xff ;\r
-\r
-    for( offset = 4 ; offset < End ; )\r
-    {\r
-        tag = pCEAEDID[offset] >> 5 ;\r
-        count = pCEAEDID[offset] & 0x1f ;\r
-        switch( tag )\r
-        {\r
-        case 0x01: // Audio Data Block ;\r
-            RxCapability.AUDDesCount = count/3 ;\r
-            EDID_DEBUG_PRINTF(("RxCapability.AUDDesCount = %d\n",(int)RxCapability.AUDDesCount));\r
-            offset++ ;\r
-            for( i = 0 ; i < RxCapability.AUDDesCount && i < MAX_AUDDES_COUNT ; i++ )\r
-            {\r
-                RxCapability.AUDDes[i].uc[0] = pCEAEDID[offset+i*3] ;\r
-                RxCapability.AUDDes[i].uc[1] = pCEAEDID[offset+i*3+1] ;\r
-                RxCapability.AUDDes[i].uc[2] = pCEAEDID[offset+i*3+2] ;\r
-            }\r
-            offset += count ;\r
-            break ;\r
-\r
-        case 0x02: // Video Data Block ;\r
-            offset ++ ;\r
-            for( i = 0,RxCapability.NativeVDOMode = 0xff ; i < count ; i++)\r
-            {\r
-               BYTE VIC ;\r
-               VIC = pCEAEDID[offset+i] & (~0x80);\r
-               // if( FindModeTableEntryByVIC(VIC) != -1 )\r
-               if(VIC<64)\r
-               {\r
-                       RxCapability.VDOMode[VIC/8] |= (1<<(VIC%8));\r
-                       EDID_DEBUG_PRINTF(("VIC = %d, RxCapability.VDOMode[%d]=%02X\n",(int)VIC,(int)VIC/8,(int)RxCapability.VDOMode[VIC/8] ));\r
-                       if(( pCEAEDID[offset+i] & 0x80 )&&(RxCapability.NativeVDOMode==0xFF))\r
-                       {\r
-                           RxCapability.NativeVDOMode = VIC ;\r
-                           EDID_DEBUG_PRINTF(("native = %d\n",RxCapability.NativeVDOMode));\r
-                       }\r
-               }\r
-            }\r
-            offset += count ;\r
-            break ;\r
-\r
-        case 0x03: // Vendor Specific Data Block ;\r
-            offset ++ ;\r
-            RxCapability.IEEEOUI = (ULONG)pCEAEDID[offset+2] ;\r
-            RxCapability.IEEEOUI <<= 8 ;\r
-            RxCapability.IEEEOUI += (ULONG)pCEAEDID[offset+1] ;\r
-            RxCapability.IEEEOUI <<= 8 ;\r
-            RxCapability.IEEEOUI += (ULONG)pCEAEDID[offset] ;\r
-            EDID_DEBUG_PRINTF(("IEEEOUI = %02X %02X %02X %lx",(int)pCEAEDID[offset+2],(int)pCEAEDID[offset+1],(int)pCEAEDID[offset],RxCapability.IEEEOUI));\r
-                       if( RxCapability.IEEEOUI== 0x0C03)\r
-                       {\r
-                               BYTE nextoffset ;\r
-                               RxCapability.PA[0] = pCEAEDID[offset+3] ;\r
-                               RxCapability.PA[1] = pCEAEDID[offset+4] ;\r
-                   if(count>5)\r
-                   {\r
-                       RxCapability.dc.uc = pCEAEDID[offset+5]&0x70;\r
-                   }\r
-                   if(count>6)\r
-                   {\r
-                       RxCapability.MaxTMDSClock = pCEAEDID[offset+6];\r
-                   }\r
-                               if(count>7)\r
-                               {\r
-                                       nextoffset = 8 ;\r
-                                       if(pCEAEDID[offset+7] & 0x80) { nextoffset += 2 ; }  // latency\r
-                                       if(pCEAEDID[offset+7] & 0x40) { nextoffset += 2 ; }  // interlace latency\r
-                                       if(pCEAEDID[offset+7] & 0x20) {\r
-                                               EDID_DEBUG_PRINTF(("next offset = %d",(int)nextoffset));\r
-                                               RxCapability.Valid3D = (pCEAEDID[offset+nextoffset] & 0x80)?TRUE:FALSE ;\r
-                                       }  // interlace latency\r
-\r
-                               }\r
-                       }\r
-            offset += count ; // ignore the remaind.\r
-\r
-            break ;\r
-\r
-        case 0x04: // Speaker Data Block ;\r
-            offset ++ ;\r
-            RxCapability.SpeakerAllocBlk.uc[0] = pCEAEDID[offset] ;\r
-            RxCapability.SpeakerAllocBlk.uc[1] = pCEAEDID[offset+1] ;\r
-            RxCapability.SpeakerAllocBlk.uc[2] = pCEAEDID[offset+2] ;\r
-            offset += 3 ;\r
-            break ;\r
-        case 0x05: // VESA Data Block ;\r
-            offset += count+1 ;\r
-            break ;\r
-        case 0x07: // Extended Data Block ;\r
-            offset += count+1 ; //ignore\r
-            break ;\r
-        default:\r
-            offset += count+1 ; // ignore\r
-        }\r
-    }\r
-    RxCapability.ValidCEA = TRUE ;\r
-    return TRUE ;\r
-}\r
diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.h b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.h
deleted file mode 100755 (executable)
index df7c3e7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-///*****************************************\r
-//  Copyright (C) 2009-2014\r
-//  ITE Tech. Inc. All Rights Reserved\r
-//  Proprietary and Confidential\r
-///*****************************************\r
-//   @file   <hdmitx_sys.h>\r
-//   @author Jau-Chih.Tseng@ite.com.tw\r
-//   @date   2012/12/20\r
-//   @fileversion: ITE_HDMITX_SAMPLE_3.14\r
-//******************************************/\r
-\r
-#ifndef _HDMITX_SYS_H_\r
-#define _HDMITX_SYS_H_\r
-#include "cat66121_hdmi_hw.h"\r
-#endif // _HDMITX_SYS_H_\r
index 0ec9ecae8762dbfb26919c5888195249ec125f88..e4e37ae2dfc83f420bbc50e305d4f2943a173a45 100755 (executable)
@@ -22,7 +22,7 @@
     #define _IDATA idata\r
     typedef bit BOOL ;\r
 #else\r
-    #define _CODE const\r
+    #define _CODE //const\r
     #define _DATA\r
     #define _IDATA\r
     #define _XDATA\r
index e0e6bf4b67ff6c01484f0dc72591cbd7241d7d06..a6b1fcdfa571ae6ad06c4e61dd2aae72d91f0580 100755 (executable)
@@ -42,7 +42,7 @@ static int hdmi_set_enable(struct rk_display_device *device, int enable)
        else {
                if(hdmi->irq)
                        enable_irq(hdmi->irq);
-               #if defined(CONFIG_HDMI_RK610) || defined(CONFIG_HDMI_RK2928)
+               #if defined(CONFIG_HDMI_RK610) || defined(CONFIG_HDMI_RK2928) || defined(CONFIG_HDMI_CAT66121)
                        queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
                #endif
                mutex_unlock(&hdmi->enable_mutex);