From 7dda34952260b80e52f9b5ea4fed3b1cef5845eb Mon Sep 17 00:00:00 2001 From: yzq Date: Thu, 14 Mar 2013 14:29:06 +0800 Subject: [PATCH] =?utf8?q?it66121=20hdmi:=20update=20drivers=20=091?= =?utf8?q?=E3=80=81support=20HDCP=20=092=E3=80=81if=20edid=20read=20err,as?= =?utf8?q?sume=20sink=20as=20HDMI=20=093=E3=80=81add=20device=5Fid=20disti?= =?utf8?q?nguish?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../rockchip/hdmi/chips/cat66121/Kconfig | 8 ++++ .../rockchip/hdmi/chips/cat66121/Makefile | 3 +- .../hdmi/chips/cat66121/cat66121_hdmi.c | 8 +++- .../hdmi/chips/cat66121/cat66121_hdmi.h | 1 + .../hdmi/chips/cat66121/cat66121_hdmi_hw.c | 43 +++++++++++++------ .../hdmi/chips/cat66121/cat66121_sys.c | 16 ++++++- .../rockchip/hdmi/chips/cat66121/config.h | 8 ++-- .../rockchip/hdmi/chips/cat66121/debug.h | 9 ++-- .../rockchip/hdmi/chips/cat66121/hdmitx_drv.c | 21 ++++----- .../hdmi/chips/cat66121/hdmitx_hdcp.c | 6 ++- .../rockchip/hdmi/chips/cat66121/hdmitx_sys.c | 14 ++++-- .../video/rockchip/hdmi/chips/cat66121/sha1.c | 2 - .../video/rockchip/hdmi/chips/cat66121/sha1.h | 10 ----- 13 files changed, 99 insertions(+), 50 deletions(-) diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/Kconfig b/drivers/video/rockchip/hdmi/chips/cat66121/Kconfig index 8b137891791f..457a6ee27023 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/Kconfig +++ b/drivers/video/rockchip/hdmi/chips/cat66121/Kconfig @@ -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. + diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/Makefile b/drivers/video/rockchip/hdmi/chips/cat66121/Makefile index be259dd185d6..d701e3b0eec5 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/Makefile +++ b/drivers/video/rockchip/hdmi/chips/cat66121/Makefile @@ -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 diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c index aa7dbdccf4e0..9f7d74f3620d 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.c @@ -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; diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.h b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.h index 509f762c31c2..2d0f79194c54 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.h +++ b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi.h @@ -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); diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi_hw.c b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi_hw.c index 46b558bd1f44..15f7abdfb189 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi_hw.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_hdmi_hw.c @@ -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; diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c index 11f0f2875efe..aa3f068ec590 100644 --- a/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/cat66121_sys.c @@ -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; } diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/config.h b/drivers/video/rockchip/hdmi/chips/cat66121/config.h index b30af5e15a7b..6ef47c8341b0 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/config.h +++ b/drivers/video/rockchip/hdmi/chips/cat66121/config.h @@ -10,18 +10,20 @@ //******************************************/ #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 ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/debug.h b/drivers/video/rockchip/hdmi/chips/cat66121/debug.h index 82481fd271ca..81211dadd4ea 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/debug.h +++ b/drivers/video/rockchip/hdmi/chips/cat66121/debug.h @@ -10,14 +10,15 @@ //******************************************/ #ifndef _DEBUG_H_ #define _DEBUG_H_ -#define Debug_message 0 - -#pragma message("debug.h") -#ifndef Debug_message +#ifdef CONFIG_RK_HDMI_DEBUG #define Debug_message 1 +#else +#define Debug_message 0 #endif +//#pragma message("debug.h") + #if Debug_message #define HDMITX_DEBUG_PRINTF(x) printk x diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.c b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.c index eba36ed1f7ea..88bd80da9638 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_drv.c @@ -86,7 +86,7 @@ _CODE RegSetEntry HDMITX_Init_Table[] = { {0x05, 0xC0, 0x40}, {REG_TX_INT_MASK1, 0xFF, ~(B_TX_RXSEN_MASK|B_TX_HPD_MASK)}, {REG_TX_INT_MASK2, 0xFF, ~(B_TX_KSVLISTCHK_MASK|B_TX_AUTH_DONE_MASK|B_TX_AUTH_FAIL_MASK)}, - {REG_TX_INT_MASK3, 0xFF, ~(B_TX_VIDSTABLE_MASK)}, + {REG_TX_INT_MASK3, 0xFF, ~(0x0)}, {0x0C, 0xFF, 0xFF}, {0x0D, 0xFF, 0xFF}, {0x0E, 0x03, 0x03}, @@ -504,8 +504,9 @@ BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange) } #endif // SUPPORT_HDCP - /* +#if 1 intdata3 = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT3); + HDMITX_DEBUG_PRINTF(("INT_Handler: reg%X = %X\n",(int)REG_TX_INT_STAT3,(int)intdata3)); if(intdata3 & B_TX_INT_VIDSTABLE) { sysstat = HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS); @@ -514,19 +515,19 @@ BYTE CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange) hdmitx_FireAFE(); } } - */ +#endif intdata3= HDMITX_ReadI2C_Byte(0xEE); if( intdata3 ) { HDMITX_WriteI2C_Byte(0xEE,intdata3); // clear ext interrupt ; HDMITX_DEBUG_PRINTF(("%s%s%s%s%s%s%s\n", - (intdata3&0x40)?"video parameter change ":"", - (intdata3&0x20)?"HDCP Pj check done ":"", - (intdata3&0x10)?"HDCP Ri check done ":"", - (intdata3&0x8)? "DDC bus hang ":"", - (intdata3&0x4)? "Video input FIFO auto reset ":"", - (intdata3&0x2)? "No audio input interrupt ":"", - (intdata3&0x1)? "Audio decode error interrupt ":"")); + (intdata3&0x40)?"video parameter change \n":"", + (intdata3&0x20)?"HDCP Pj check done \n":"", + (intdata3&0x10)?"HDCP Ri check done \n":"", + (intdata3&0x8)? "DDC bus hang \n":"", + (intdata3&0x4)? "Video input FIFO auto reset \n":"", + (intdata3&0x2)? "No audio input interrupt \n":"", + (intdata3&0x1)? "Audio decode error interrupt \n":"")); } HDMITX_WriteI2C_Byte(REG_TX_INT_CLR0,0xFF); HDMITX_WriteI2C_Byte(REG_TX_INT_CLR1,0xFF); diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.c b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.c index 6e0c0a33c3b8..4f4979663966 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_hdcp.c @@ -10,6 +10,7 @@ //******************************************/ #include "hdmitx.h" #include "hdmitx_drv.h" +#include "sha1.h" static BYTE countbit(BYTE b); @@ -30,10 +31,11 @@ BOOL HDMITX_EnableHDCP(BYTE bEnable) { if(ER_FAIL == hdmitx_hdcp_Authenticate()) { - //printf("ER_FAIL == hdmitx_hdcp_Authenticate\n"); + printk("ER_FAIL == hdmitx_hdcp_Authenticate\n"); hdmitx_hdcp_ResetAuth(); return FALSE ; } + HDCP_DEBUG_PRINTF(("hdmitx_hdcp_Authenticate SUCCESS\n")); } else { @@ -661,7 +663,7 @@ SYS_STATUS hdmitx_hdcp_CheckSHA(BYTE pM0[],USHORT BStatus,BYTE pKSVList[],int cD } } */ - //SHA_Simple(SHABuff,n,V); + SHA_Simple(SHABuff,n,V); for(i = 0 ; i < 20 ; i++) { if(V[i] != Vr[i]) diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c index e0dfd4b659df..6b939e29afbd 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/hdmitx_sys.c @@ -459,11 +459,13 @@ int HDMITX_DevLoopProc() if( RxCapability.ValidHDMI ) { bHDMIMode = TRUE ; - + bAudioEnable = TRUE ; +#if 0 if(RxCapability.VideoMode & (1<<6)) { bAudioEnable = TRUE ; } +#endif if( RxCapability.VideoMode & (1<<5)) { bOutputColorMode &= ~F_MODE_CLRMOD_MASK ; @@ -565,7 +567,7 @@ int HDMITX_DevLoopProc() } DevLoopCount ++ ; - return HPDStatus; + return HPDChangeStatus; } #ifdef HDMITX_AUTO_MONITOR_INPUT @@ -1169,10 +1171,16 @@ BYTE ParseEDID() EDID_Buf = CommunBuff; RxCapability.ValidCEA = FALSE ; - RxCapability.ValidHDMI = FALSE ; + RxCapability.ValidHDMI = TRUE; RxCapability.dc.uc = 0; getHDMITX_EDIDBlock(0, EDID_Buf); +#if Debug_message + for( j = 0 ; j < 128 ; j++ ) + { + EDID_DEBUG_PRINTF(("%02X%c",(int)EDID_Buf[j],(7 == (j&7))?'\n':' ')); + } +#endif // Debug_message for( i = 0, CheckSum = 0 ; i < 128 ; i++ ) { diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/sha1.c b/drivers/video/rockchip/hdmi/chips/cat66121/sha1.c index 2cfd6d284092..55b5d7f4c713 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/sha1.c +++ b/drivers/video/rockchip/hdmi/chips/cat66121/sha1.c @@ -9,8 +9,6 @@ // @fileversion: COMMON_FILE_1.01 //******************************************/ -#include -//#include #include "sha1.h" diff --git a/drivers/video/rockchip/hdmi/chips/cat66121/sha1.h b/drivers/video/rockchip/hdmi/chips/cat66121/sha1.h index 19c18c4e049f..bc17860c5aa1 100755 --- a/drivers/video/rockchip/hdmi/chips/cat66121/sha1.h +++ b/drivers/video/rockchip/hdmi/chips/cat66121/sha1.h @@ -12,16 +12,6 @@ #ifndef _SHA_1_H_ #define _SHA_1_H_ -#ifdef _MCU_8051_ - #include "Mcu.h" -#endif - -#include - -#if Debug_message - #include -#endif - #include "config.h" #include "typedef.h" -- 2.34.1