void rk616_hdcp_disable(void) { // Diable HDCP Interrupt hdmi_writel(HDCP_INT_MASK1, 0x00); // Stop and Reset HDCP hdmi_msk_reg(HDCP_CTRL1, m_ENCRYPT_ENABLE | m_AUTH_STOP | m_HDCP_RESET, v_ENCRYPT_ENABLE(0) | v_AUTH_STOP(1) | v_HDCP_RESET(1) ); }
int rk3036_hdcp_start_authentication(void) { int temp; int retry = 0; int tmds_clk; tmds_clk = hdmi_dev->driver.tmdsclk; if (hdcp->keys == NULL) { HDCP_WARN("HDCP: key is not loaded\n"); return HDCP_KEY_ERR; } if (rk3036_hdcp_key_check(hdcp->keys) == HDCP_KEY_INVALID) { HDCP_WARN("loaded HDCP key is incorrect\n"); return HDCP_KEY_ERR; } if (tmds_clk > (HDMI_SYS_FREG_CLK << 2)) { /*Select TMDS CLK to configure regs*/ hdmi_msk_reg(hdmi_dev, SYS_CTRL, m_REG_CLK_SOURCE, v_REG_CLK_SOURCE_TMDS); } else { hdmi_msk_reg(hdmi_dev, SYS_CTRL, m_REG_CLK_SOURCE, v_REG_CLK_SOURCE_SYS); } hdmi_writel(hdmi_dev, HDCP_TIMER_100MS, 0x28); hdmi_readl(hdmi_dev, HDCP_KEY_STATUS, &temp); while ((temp & m_KEY_READY) == 0) { if (retry > 1000) { HDCP_WARN("HDCP: loaded key error\n"); return HDCP_KEY_ERR; } rk3036_hdcp_load_key2mem(hdcp->keys); msleep(1); hdmi_readl(hdmi_dev, HDCP_KEY_STATUS, &temp); retry++; } /*Config DDC bus clock: ddc_clk = reg_clk/4*(reg 0x4c 0x4b)*/ retry = hdmi_dev->hclk_rate/(HDCP_DDC_CLK << 2); hdmi_writel(hdmi_dev, DDC_CLK_L, retry & 0xFF); hdmi_writel(hdmi_dev, DDC_CLK_H, (retry >> 8) & 0xFF); hdmi_writel(hdmi_dev, HDCP_CTRL2, 0x67); /*Enable interrupt*/ hdmi_writel(hdmi_dev, HDCP_INT_MASK1, m_INT_HDCP_ERR | m_INT_BKSV_READY | m_INT_BKSV_UPDATE | m_INT_AUTH_SUCCESS | m_INT_AUTH_READY); hdmi_writel(hdmi_dev, HDCP_INT_MASK2, 0x00); /*Start authentication*/ hdmi_msk_reg(hdmi_dev, HDCP_CTRL1, m_AUTH_START | m_ENCRYPT_ENABLE | m_ADVANED_ENABLE | m_AUTH_STOP | m_HDCP_RESET, v_AUTH_START(1) | v_ENCRYPT_ENABLE(1) | v_ADVANED_ENABLE(0) | v_AUTH_STOP(0) | v_HDCP_RESET(0)); if (tmds_clk <= (HDMI_SYS_FREG_CLK << 2)) { hdmi_msk_reg(hdmi_dev, SYS_CTRL, m_REG_CLK_SOURCE, v_REG_CLK_SOURCE_TMDS); } return HDCP_OK; }
void rk610_hdcp_disable(void) { char temp; // Diable HDCP Interrupt HDCPWrReg(HDCP_INT_MASK1, 0x00); // Stop and Reset HDCP HDCPMskReg(temp, HDCP_CTRL1, m_ENCRYPT_ENABLE | m_AUTH_STOP | m_HDCP_RESET, v_ENCRYPT_ENABLE(0) | v_AUTH_STOP(1) | v_HDCP_RESET(1) ) }
int rk616_hdcp_check_bksv(void) { int i, j; int temp = 0, bksv[5]; char *invalidkey; for(i = 0; i < 5; i++) { hdmi_readl(HDCP_KSV_BYTE0 + (4 - i), &temp); bksv[i] = temp & 0xFF; } DBG("bksv is 0x%02x%02x%02x%02x%02x", bksv[0], bksv[1], bksv[2], bksv[3], bksv[4]); temp = 0; for (i = 0; i < 5; i++) { for (j = 0; j < 8; j++) { if (bksv[i] & 0x01) { temp++; } bksv[i] >>= 1; } } if (temp != 20) return HDCP_KSV_ERR; for(i = 0; i < hdcp->invalidkey; i++) { invalidkey = hdcp->invalidkeys + i *5; if(memcmp(bksv, invalidkey, 5) == 0) { printk(KERN_ERR "HDCP: BKSV was revocated!!!\n"); hdmi_msk_reg(HDCP_CTRL1, m_BKSV_INVALID | m_ENCRYPT_ENABLE, v_BKSV_INVALID(1) | v_ENCRYPT_ENABLE(1)); return HDCP_KSV_ERR; } } hdmi_msk_reg(HDCP_CTRL1, m_BKSV_VALID | m_ENCRYPT_ENABLE, v_BKSV_VALID(1) | v_ENCRYPT_ENABLE(1)); return HDCP_OK; }
int rk610_hdcp_start_authentication(void) { char temp; int retry = 0; if(hdcp->keys == NULL) { printk(KERN_ERR "HDCP: key is not loaded\n"); return HDCP_KEY_ERR; } // Select TMDS CLK to configure regs HDCPMskReg(temp, SYS_CTRL, m_REG_CLK_SOURCE, v_REG_CLK_SOURCE_TMDS); temp = HDCPRdReg(HDCP_KEY_STATUS); while( ( temp & m_KEY_READY) == 0 ) { if(retry > 10) { printk(KERN_ERR "HDCP: loaded key error\n"); return HDCP_KEY_ERR; } rk610_hdcp_load_key2mem(hdcp->keys); msleep(1); temp = HDCPRdReg(HDCP_KEY_STATUS); } // Config DDC bus clock: ddc_clk = reg_clk/4*(reg 0x4c 0x4b) DBG("TMDS frequency %d", rk610_hdmi->frequency); retry = rk610_hdmi->frequency/(HDCP_DDC_CLK*4); HDCPWrReg(DDC_CLK_L, retry & 0xFF); HDCPWrReg(DDC_CLK_H, (retry >> 8) & 0xFF); HDCPWrReg(HDCP_CTRL2, 0x00); //Enable interrupt HDCPWrReg(HDCP_INT_MASK1, m_INT_HDCP_ERR | m_INT_BKSV_READY | m_INT_BKSV_UPDATE | m_INT_AUTH_SUCCESS | m_INT_AUTH_READY); // HDCPWrReg(HDCP_INT_MASK2, 0xFF); //Start authentication HDCPMskReg(temp, HDCP_CTRL1, m_AUTH_START | m_ENCRYPT_ENABLE | m_ADVANED_ENABLE, v_AUTH_START(1) | v_ENCRYPT_ENABLE(1) | v_ADVANED_ENABLE(0)); return HDCP_OK; }
int rk616_hdcp_start_authentication(void) { int temp; int retry = 0; if(hdcp->keys == NULL) { printk(KERN_ERR "HDCP: key is not loaded\n"); return HDCP_KEY_ERR; } if(rk616_hdcp_key_check(hdcp->keys) == HDCP_KEY_INVALID){ printk(KERN_ERR "loaded HDCP key is incorrect\n"); return HDCP_KEY_ERR; } if (hdmi->tmdsclk > (HDMI_SYS_FREG_CLK << 2)) { // Select TMDS CLK to configure regs hdmi_msk_reg(SYS_CTRL, m_REG_CLK_SOURCE, v_REG_CLK_SOURCE_TMDS); } hdmi_readl(HDCP_KEY_STATUS,&temp); while( ( temp & m_KEY_READY) == 0 ) { if(retry > 1000) { printk(KERN_ERR "HDCP: loaded key error\n"); return HDCP_KEY_ERR; } rk616_hdcp_load_key2mem(hdcp->keys); msleep(1); hdmi_readl(HDCP_KEY_STATUS,&temp); retry++; } // Config DDC bus clock: ddc_clk = reg_clk/4*(reg 0x4c 0x4b) retry = hdmi->tmdsclk/(HDCP_DDC_CLK << 2); hdmi_writel(DDC_CLK_L, retry & 0xFF); hdmi_writel(DDC_CLK_H, (retry >> 8) & 0xFF); hdmi_writel(HDCP_CTRL2, 0x77); //Enable interrupt hdmi_writel(HDCP_INT_MASK1, m_INT_HDCP_ERR | m_INT_BKSV_READY | m_INT_BKSV_UPDATE | m_INT_AUTH_SUCCESS | m_INT_AUTH_READY); hdmi_writel(HDCP_INT_MASK2, 0x00); //Start authentication hdmi_msk_reg(HDCP_CTRL1, m_AUTH_START | m_ENCRYPT_ENABLE | m_ADVANED_ENABLE, v_AUTH_START(1) | v_ENCRYPT_ENABLE(1) | v_ADVANED_ENABLE(0)); if (hdmi->tmdsclk <= (HDMI_SYS_FREG_CLK << 2)) { hdmi_msk_reg(SYS_CTRL, m_REG_CLK_SOURCE, v_REG_CLK_SOURCE_TMDS); } return HDCP_OK; }