it66121 hdmi: update drivers
authoryzq <yzq@rock-chips.com>
Thu, 14 Mar 2013 06:29:06 +0000 (14:29 +0800)
committeryzq <yzq@rock-chips.com>
Thu, 14 Mar 2013 06:29:06 +0000 (14:29 +0800)
1、support HDCP
2、if edid read err,assume sink as HDMI
3、add device_id distinguish

13 files changed:
drivers/video/rockchip/hdmi/chips/cat66121/Kconfig
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_sys.c
drivers/video/rockchip/hdmi/chips/cat66121/config.h
drivers/video/rockchip/hdmi/chips/cat66121/debug.h
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.c
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.c
drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c
drivers/video/rockchip/hdmi/chips/cat66121/sha1.c
drivers/video/rockchip/hdmi/chips/cat66121/sha1.h

index 8b137891791fe96927ad78e64b0aad7bded08bdc..457a6ee27023d0d27bd76297f9f57eb09c09725c 100755 (executable)
@@ -1 +1,9 @@
+config SUPPORT_HDCP
+       bool "HDCP support"
+        depends on HDMI_CAT66121
+        default n
+       help
+         HDCP Interface. This adds the High Definition Content Protection Interface.
+         See http://www.digital-cp.com/ for HDCP specification.
+
 
index be259dd185d6c3dcc860d32072d856a58f11edcf..d701e3b0eec5a5f3d0c74283404728c4ef2f88ff 100755 (executable)
@@ -5,5 +5,6 @@ obj-$(CONFIG_HDMI_CAT66121)       += cat66121_hdmi.o \
                                        hdmitx_sys.o \
                                        hdmitx_hdcp.o \
                                        hdmitx_input.o \
-                                       hdmitx_drv.o
+                                       hdmitx_drv.o \
+                                       sha1.o
 
index aa7dbdccf4e0869d74c9e26dd915505a4f620f37..9f7d74f3620d7018be57d0a08b075d11a205ee85 100755 (executable)
@@ -84,7 +84,7 @@ static void cat66121_irq_work_func(struct work_struct *work)
                                hdmi->hdcp_irq_cb(0);
                }
                #ifndef HDMI_USE_IRQ
-               queue_delayed_work(cat66121_hdmi->workqueue, &cat66121_hdmi->delay_work, 50);
+               queue_delayed_work(cat66121_hdmi->workqueue, &cat66121_hdmi->delay_work, 100);
                #endif
        }
 }
@@ -177,6 +177,12 @@ static int cat66121_hdmi_i2c_probe(struct i2c_client *client,const struct i2c_de
                rc = -ENXIO;
                goto err_request_lcdc;
        }
+       if(cat66121_detect_device()!=1){
+               dev_err(hdmi->dev, "can't find it6610 device \n");
+               rc = -ENXIO;
+               goto err_request_lcdc;
+       }
+
        hdmi->xscale = 100;
        hdmi->yscale = 100;
        hdmi->insert = cat66121_hdmi_sys_insert;
index 509f762c31c27fb96a6fcc205ba06991f5953aa3..2d0f79194c5439a02251b55d473eb2f427019862 100755 (executable)
@@ -24,6 +24,7 @@ struct cat66121_hdmi_pdata {
 
 extern struct cat66121_hdmi_pdata *cat66121_hdmi;
 
+extern int cat66121_detect_device(void);
 extern int cat66121_hdmi_sys_init(void);
 extern void cat66121_hdmi_interrupt(void);
 extern int cat66121_hdmi_sys_detect_hpd(void);
index 46b558bd1f44351f3ceba3e61ac95610e8142b48..15f7abdfb189717e229faaeff7223d58d714dadb 100755 (executable)
@@ -131,6 +131,26 @@ SYS_STATUS HDMITX_SetI2C_Byte(BYTE Reg,BYTE Mask,BYTE 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) )
+               return 1;
+
+       printk("CAT66121: Reg[0-3] = 0x[%02x].[%02x].[%02x].[%02x]\n",
+                          VendorID0, VendorID1, DeviceID0, DeviceID1);
+       printk("[CAT66121] Device not found!\n");
+
+       return 0;
+}
 int cat66121_hdmi_sys_init(void)
 {
        hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
@@ -144,24 +164,21 @@ int cat66121_hdmi_sys_init(void)
 
 void cat66121_hdmi_interrupt()
 {
-       char interrupt = 0;
-
-       hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
-       if(hdmi->state == HDMI_SLEEP)
-               hdmi->state = WAIT_HOTPLUG;
-       queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));   
+       if(HDMITX_DevLoopProc()){
+               if(hdmi->state == HDMI_SLEEP)
+                       hdmi->state = WAIT_HOTPLUG;
+               queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, msecs_to_jiffies(10));   
+       }
 }
 
 int cat66121_hdmi_sys_detect_hpd(void)
 {
-       char hdmi_status = 0;
-       hdmi_dbg(hdmi->dev, "[%s]\n", __FUNCTION__);
-       //      BYTE sysstat;
+       char HPD= 0;
+       BYTE sysstat;
+       sysstat = HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS);
 
-       //sysstat = HDMITX_ReadI2C_Byte(REG_SYS_STATUS) ;   
-       //*hpdstatus = ((sysstat & B_HPDETECT) == B_HPDETECT)?TRUE:FALSE ;
-       hdmi_status = HDMITX_DevLoopProc();
-       if(hdmi_status)
+       HPD = ((sysstat & B_TX_HPDETECT) == B_TX_HPDETECT)?TRUE:FALSE;
+       if(HPD)
                return HDMI_HPD_ACTIVED;
        else
                return HDMI_HPD_REMOVED;
index 11f0f2875efe791670c9cdd77f0c3b414da48834..aa3f068ec590bc49d8d6107daf3afb0574c04a7b 100644 (file)
@@ -141,7 +141,21 @@ static int cat66121_hdmi_i2c_read_reg(char reg, char *val)
  ******************************/
 int cat66121_detect_device(void)
 {
-       printk(">>>%s \n",__func__);
+       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;
 }
 
index b30af5e15a7be0c6031af0a7cb5c4a81c7705053..6ef47c8341b01e540bcf18488a4acccb8ba31214 100755 (executable)
 //******************************************/
 #ifndef _CONFIG_H_
 #define _CONFIG_H_
-#pragma message("config.h")
+//#pragma message("config.h")
 
 #ifdef EXTERN_HDCPROM
 #pragma message("Defined EXTERN_HDCPROM")
 #endif // EXTERN_HDCPROM
 
 #define SUPPORT_EDID
-//#define SUPPORT_HDCP
-//#define SUPPORT_SHA
 //#define SUPPORT_AUDIO_MONITOR
 #define AudioOutDelayCnt 250
 
+#ifdef CONFIG_SUPPORT_HDCP
+#define SUPPORT_HDCP
+#define SUPPORT_SHA
+#endif
 
 
 //////////////////////////////////////////////////////////////////////////////////////////
index 82481fd271cab2e7677b23c87eff72d05da67117..81211dadd4ea076457d35fa053e40171aff71acc 100755 (executable)
 //******************************************/\r
 #ifndef _DEBUG_H_\r
 #define _DEBUG_H_\r
-#define Debug_message 0\r
-\r
-#pragma message("debug.h")\r
 \r
-#ifndef Debug_message\r
+#ifdef CONFIG_RK_HDMI_DEBUG\r
 #define Debug_message 1\r
+#else\r
+#define Debug_message 0\r
 #endif\r
 \r
+//#pragma message("debug.h")\r
+\r
 #if Debug_message\r
 \r
     #define HDMITX_DEBUG_PRINTF(x)  printk x\r
index eba36ed1f7ea581f41e2311563890bf116a7b82e..88bd80da963853e4069a4f0246c336149513c42a 100755 (executable)
@@ -86,7 +86,7 @@ _CODE RegSetEntry HDMITX_Init_Table[] = {
     {0x05, 0xC0, 0x40},\r
     {REG_TX_INT_MASK1, 0xFF, ~(B_TX_RXSEN_MASK|B_TX_HPD_MASK)},\r
     {REG_TX_INT_MASK2, 0xFF, ~(B_TX_KSVLISTCHK_MASK|B_TX_AUTH_DONE_MASK|B_TX_AUTH_FAIL_MASK)},\r
-    {REG_TX_INT_MASK3, 0xFF, ~(B_TX_VIDSTABLE_MASK)},\r
+    {REG_TX_INT_MASK3, 0xFF, ~(0x0)},\r
     {0x0C, 0xFF, 0xFF},\r
     {0x0D, 0xFF, 0xFF},\r
     {0x0E, 0x03, 0x03},\r
@@ -504,8 +504,9 @@ BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)
         }\r
         #endif // SUPPORT_HDCP\r
 \r
-               /*\r
+#if 1\r
                intdata3 = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT3);\r
+        HDMITX_DEBUG_PRINTF(("INT_Handler: reg%X = %X\n",(int)REG_TX_INT_STAT3,(int)intdata3));\r
                if(intdata3 & B_TX_INT_VIDSTABLE)\r
                {\r
                        sysstat = HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS);\r
@@ -514,19 +515,19 @@ BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)
                                hdmitx_FireAFE();\r
                        }\r
                }\r
-               */\r
+#endif\r
         intdata3= HDMITX_ReadI2C_Byte(0xEE);\r
         if( intdata3 )\r
         {\r
             HDMITX_WriteI2C_Byte(0xEE,intdata3); // clear ext interrupt ;\r
             HDMITX_DEBUG_PRINTF(("%s%s%s%s%s%s%s\n",\r
-                (intdata3&0x40)?"video parameter change ":"",\r
-                (intdata3&0x20)?"HDCP Pj check done ":"",\r
-                (intdata3&0x10)?"HDCP Ri check done ":"",\r
-                (intdata3&0x8)? "DDC bus hang ":"",\r
-                (intdata3&0x4)? "Video input FIFO auto reset ":"",\r
-                (intdata3&0x2)? "No audio input interrupt  ":"",\r
-                (intdata3&0x1)? "Audio decode error interrupt ":""));\r
+                (intdata3&0x40)?"video parameter change \n":"",\r
+                (intdata3&0x20)?"HDCP Pj check done \n":"",\r
+                (intdata3&0x10)?"HDCP Ri check done \n":"",\r
+                (intdata3&0x8)? "DDC bus hang \n":"",\r
+                (intdata3&0x4)? "Video input FIFO auto reset \n":"",\r
+                (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
index 6e0c0a33c3b85e38770a661ae96121189945f21f..4f49796639666ff4101025c7c8c31c712ef0a485 100755 (executable)
@@ -10,6 +10,7 @@
 //******************************************/\r
 #include "hdmitx.h"\r
 #include "hdmitx_drv.h"\r
+#include "sha1.h"\r
 \r
 static BYTE countbit(BYTE b);\r
 \r
@@ -30,10 +31,11 @@ BOOL HDMITX_EnableHDCP(BYTE bEnable)
     {\r
         if(ER_FAIL == hdmitx_hdcp_Authenticate())\r
         {\r
-            //printf("ER_FAIL == hdmitx_hdcp_Authenticate\n");\r
+            printk("ER_FAIL == hdmitx_hdcp_Authenticate\n");\r
             hdmitx_hdcp_ResetAuth();\r
                        return FALSE ;\r
         }\r
+            HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Authenticate SUCCESS\n"));\r
     }\r
     else\r
     {\r
@@ -661,7 +663,7 @@ SYS_STATUS hdmitx_hdcp_CheckSHA(BYTE pM0[],USHORT BStatus,BYTE pKSVList[],int cD
         }\r
     }\r
     */\r
-    //SHA_Simple(SHABuff,n,V);\r
+    SHA_Simple(SHABuff,n,V);\r
     for(i = 0 ; i < 20 ; i++)\r
     {\r
         if(V[i] != Vr[i])\r
index e0dfd4b659df05cddbe9bcac6944d540806b0edb..6b939e29afbd1fdaa4dded229acf48de74f0ff6f 100755 (executable)
@@ -459,11 +459,13 @@ int HDMITX_DevLoopProc()
                        if( RxCapability.ValidHDMI )\r
                        {\r
                                bHDMIMode = TRUE ;\r
-\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
@@ -565,7 +567,7 @@ int HDMITX_DevLoopProc()
     }\r
 \r
     DevLoopCount ++ ;\r
-    return HPDStatus;\r
+    return HPDChangeStatus;\r
 }\r
 \r
 #ifdef HDMITX_AUTO_MONITOR_INPUT\r
@@ -1169,10 +1171,16 @@ BYTE ParseEDID()
 \r
     EDID_Buf = CommunBuff;\r
     RxCapability.ValidCEA = FALSE ;\r
-    RxCapability.ValidHDMI = 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
index 2cfd6d2840929f3545d9785b4c278d75733400f6..55b5d7f4c7139ab5f3106cd9c9213bc8abe94a04 100755 (executable)
@@ -9,8 +9,6 @@
 //   @fileversion: COMMON_FILE_1.01\r
 //******************************************/\r
 \r
-#include <stdio.h>\r
-//#include <stdlib.h>\r
 #include "sha1.h"\r
 \r
 \r
index 19c18c4e049f92a1440c0ac23d08c58a3ba68cd0..bc17860c5aa1eee64f622695f582465262cd3ae4 100755 (executable)
 #ifndef _SHA_1_H_\r
 #define _SHA_1_H_\r
 \r
-#ifdef _MCU_8051_\r
-    #include "Mcu.h"\r
-#endif\r
-\r
-#include <string.h>\r
-\r
-#if Debug_message\r
-    #include <stdio.h>\r
-#endif\r
-\r
 #include "config.h"\r
 #include "typedef.h"\r
 \r