it66121 hdmi: update drivers

1、support HDCP
	2、if edid read err,assume sink as HDMI
	3、add device_id distinguish
This commit is contained in:
yzq
2013-03-14 14:29:06 +08:00
parent 8283fc01e8
commit 7dda349522
13 changed files with 99 additions and 50 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View 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;
}

View File

@@ -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
//////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -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

View File

@@ -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);

View File

@@ -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])

View File

@@ -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++ )
{

View File

@@ -9,8 +9,6 @@
// @fileversion: COMMON_FILE_1.01
//******************************************/
#include <stdio.h>
//#include <stdlib.h>
#include "sha1.h"

View File

@@ -12,16 +12,6 @@
#ifndef _SHA_1_H_
#define _SHA_1_H_
#ifdef _MCU_8051_
#include "Mcu.h"
#endif
#include <string.h>
#if Debug_message
#include <stdio.h>
#endif
#include "config.h"
#include "typedef.h"