struct dp_dev *dp_dev = hdmi_drv->property->priv;
if (cdn_dp_connector_detect(dp_dev->dp))
- return HDMI_HPD_ACTIVED;
+ return HDMI_HPD_ACTIVATED;
return HDMI_HPD_REMOVED;
}
}
static struct device_attribute cec_attrs[] = {
- __ATTR(logic, S_IRUGO | S_IWUSR, cec_logic_show, cec_logic_store),
- __ATTR(phy, S_IRUGO | S_IWUSR, cec_phy_show, cec_phy_store),
- __ATTR(enable, S_IRUGO | S_IWUSR, cec_enable_show, cec_enable_store),
+ __ATTR(logic, 0644, cec_logic_show, cec_logic_store),
+ __ATTR(phy, 0644, cec_phy_show, cec_phy_store),
+ __ATTR(enable, 0644, cec_enable_show, cec_enable_store),
__ATTR(stat, S_IRUGO, cec_state_show, NULL),
};
#define MAX_CMD_SIZE 16
struct cec_framedata {
- char srcdestaddr; /* Source in upper nybble, dest in lower nybble */
- char opcode;
- char args[MAX_CMD_SIZE];
- char argcount;
+ u8 srcdestaddr; /* Source in upper nybble, dest in lower nybble */
+ u8 opcode;
+ u8 args[MAX_CMD_SIZE];
+ u8 argcount;
char returnval;
};
hdmi->ops->remove(hdmi);
if (hdmi->property->feature & SUPPORT_CEC)
rockchip_hdmi_cec_set_pa(0);
- if (hdmi->hotplug == HDMI_HPD_ACTIVED) {
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED) {
screen.type = SCREEN_HDMI;
rk_fb_switch_screen(&screen, 0, hdmi->lcdc->id);
}
if (!hdmi->sleep) {
if (hdmi->ops->enable)
hdmi->ops->enable(hdmi);
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_wq_insert(hdmi);
}
}
break;
case HDMI_DISABLE_CTL:
if (hdmi->enable) {
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_wq_set_output(hdmi,
HDMI_VIDEO_MUTE |
HDMI_AUDIO_MUTE);
break;
case HDMI_SUSPEND_CTL:
if (!hdmi->sleep) {
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_wq_set_output(hdmi,
HDMI_VIDEO_MUTE |
HDMI_AUDIO_MUTE);
HDMIDBG(2, "hdmi_work_queue() - hpd is %d hotplug is %d\n",
hpd, hdmi->hotplug);
if (hpd != hdmi->hotplug) {
- if (hpd == HDMI_HPD_ACTIVED) {
+ if (hpd == HDMI_HPD_ACTIVATED) {
hdmi->hotplug = hpd;
hdmi_wq_insert(hdmi);
- } else if (hdmi->hotplug == HDMI_HPD_ACTIVED) {
+ } else if (hdmi->hotplug == HDMI_HPD_ACTIVATED) {
hdmi_wq_remove(hdmi);
}
hdmi->hotplug = hpd;
case HDMI_MUTE_AUDIO:
case HDMI_UNMUTE_AUDIO:
if (hdmi->mute & HDMI_AUDIO_MUTE ||
- hdmi->hotplug != HDMI_HPD_ACTIVED)
+ hdmi->hotplug != HDMI_HPD_ACTIVATED)
break;
if (event == HDMI_MUTE_AUDIO)
hdmi_wq_set_output(hdmi, hdmi->mute |
hdmi_wq_set_output(hdmi, hdmi->mute);
break;
case HDMI_ENABLE_HDCP:
- if (hdmi->hotplug == HDMI_HPD_ACTIVED && hdmi->ops->hdcp_cb)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED && hdmi->ops->hdcp_cb)
hdmi->ops->hdcp_cb(hdmi);
break;
case HDMI_HDCP_AUTH_2ND:
- if (hdmi->hotplug == HDMI_HPD_ACTIVED &&
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED &&
hdmi->ops->hdcp_auth2nd)
hdmi->ops->hdcp_auth2nd(hdmi);
break;
kfree(hdmi->edid.specs->modedb);
kfree(hdmi->edid.specs);
}
- kfree(hdmi);
-
ref_info[hdmi->id].ref = 0;
ref_info[hdmi->id].hdmi = NULL;
+ kfree(hdmi);
hdmi = NULL;
}
continue;
hdmi = ref_info[i].hdmi;
memcpy(&hdmi->audio, audio, sizeof(struct hdmi_audio));
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_submit_work(hdmi, HDMI_SET_AUDIO, 0, 0);
}
return 0;
{
struct hdmi *hdmi = device->priv_data;
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
return 1;
else
return 0;
if (vic && hdmi->vic != vic) {
hdmi->vic = vic;
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_submit_work(hdmi, HDMI_SET_VIDEO, 0, 0);
}
return 0;
if (hdmi->mode_3d != mode) {
hdmi->mode_3d = mode;
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_submit_work(hdmi, HDMI_SET_3D, 0, 0);
}
return 0;
else
return 0;
} else {
+ pr_err("%s unknown event\n", __func__);
return -1;
}
- if (hdmi->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED)
hdmi_submit_work(hdmi, HDMI_SET_COLOR, 0, 0);
return 0;
}
static int hdmi_get_debug(struct rk_display_device *device, char *buf)
{
struct hdmi *hdmi = device->priv_data;
- char *buff;
+ u8 *buff;
int i, j, len = 0;
if (!hdmi)
#define HDMI_VIDEO_DMT BIT(9)
#define HDMI_VIDEO_YUV420 BIT(10)
#define HDMI_VIDEO_DISCRETE_VR BIT(11)
+
#define HDMI_VIC_MASK (0xFF)
#define HDMI_TYPE_MASK (0xFF << 8)
#define HDMI_MAX_ID 4
HDMI_HPD_INSERT, /* HDMI is connected, but HDP is low
* or TMDS link is not pull up to 3.3V.
*/
- HDMI_HPD_ACTIVED /* HDMI is connected, all singnal
+ HDMI_HPD_ACTIVATED /* HDMI is connected, all singnal
* is normal
*/
};
unsigned int audio_num; /*Device supported audio type number*/
unsigned int status; /*EDID read status, success or failed*/
- char *raw[HDMI_MAX_EDID_BLOCK]; /*Raw EDID Data*/
+ u8 *raw[HDMI_MAX_EDID_BLOCK]; /*Raw EDID Data*/
union {
u8 data[5];
struct hdmi_hdr hdrinfo;
#define HDMI_AUDIO_DEFAULT_RATE HDMI_AUDIO_FS_44100
#define HDMI_AUDIO_DEFAULT_WORDLENGTH HDMI_AUDIO_WORD_LENGTH_16bit
-
extern int hdmi_dbg_level;
#define HDMIDBG(x, format, ...) do { \
if (unlikely(hdmi_dbg_level >= x)) \
match = of_match_node(rockchip_hdmiv1_dt_ids, np);
if (!match)
- return PTR_ERR(match);
+ return -EINVAL;
if (!strcmp(match->compatible, "rockchip,rk3036-hdmi")) {
hdmi_dev->soctype = HDMI_SOC_RK3036;
sizeof(struct hdmi_dev),
GFP_KERNEL);
if (!hdmi_dev) {
- dev_err(hdmi_dev->dev, ">>rk_hdmi kmalloc fail!");
+ dev_err(&pdev->dev, ">>rk_hdmi kmalloc fail!");
return -ENOMEM;
}
hdmi_dev->dev = &pdev->dev;
if (hdmi_dev->irq)
disable_irq(hdmi_dev->irq);
mutex_unlock(&hdmi_drv->lock);
- if (hdmi_drv->hotplug == HDMI_HPD_ACTIVED)
+ if (hdmi_drv->hotplug == HDMI_HPD_ACTIVATED)
hdmi_drv->ops->setmute(hdmi_drv,
HDMI_VIDEO_MUTE |
HDMI_AUDIO_MUTE);
hdmi_readl(hdmi_dev, HDMI_STATUS, &value);
value &= m_HOTPLUG;
if (value == m_HOTPLUG)
- return HDMI_HPD_ACTIVED;
+ return HDMI_HPD_ACTIVATED;
else if (value)
return HDMI_HPD_INSERT;
else
unsigned char format)
{
struct hdmi_dev *hdmi_dev = hdmi->property->priv;
- char info[SIZE_VSI_INFOFRAME];
+ u8 info[SIZE_VSI_INFOFRAME];
int i;
HDMIDBG(2, "[%s] vic_3d %d format %d.\n", __func__, vic_3d, format);
{
int i;
int avi_color_mode;
- char info[SIZE_AVI_INFOFRAME];
+ u8 info[SIZE_AVI_INFOFRAME];
struct hdmi_dev *hdmi_dev = hdmi_drv->property->priv;
memset(info, 0, SIZE_AVI_INFOFRAME);
if ((vic == HDMI_720X480I_60HZ_4_3) ||
(vic == HDMI_720X576I_50HZ_4_3) ||
(vic == HDMI_720X480I_60HZ_16_9) ||
- (vic == HDMI_720X480I_60HZ_16_9))
+ (vic == HDMI_720X576I_50HZ_16_9))
info[8] = 1;
else
info[8] = 0;
static void rockchip_hdmiv1_config_aai(struct hdmi *hdmi_drv)
{
int i;
- char info[SIZE_AUDIO_INFOFRAME];
+ u8 info[SIZE_AUDIO_INFOFRAME];
struct hdmi_dev *hdmi_dev = hdmi_drv->property->priv;
memset(info, 0, SIZE_AUDIO_INFOFRAME);
hdmi_writel(hdmi_dev, 0xce, 0x01);
}
- if (mutestatus && (m_AUDIO_MUTE | m_VIDEO_BLACK)) {
+ if (mutestatus == (m_AUDIO_MUTE | m_VIDEO_BLACK)) {
hdmi_msk_reg(hdmi_dev, AV_MUTE,
m_AUDIO_MUTE |
m_AUDIO_PD |
}
if ((hdmi_dev->clk_on & HDMI_PCLK_ON) &&
- (hdmi_dev->pclk)) {
+ hdmi_dev->pclk) {
clk_disable_unprepare(hdmi_dev->pclk);
hdmi_dev->clk_on &= ~HDMI_PCLK_ON;
}
if ((hdmi_dev->clk_on & HDMI_HDCPCLK_ON) &&
- (hdmi_dev->hdcp_clk)) {
+ hdmi_dev->hdcp_clk) {
clk_disable_unprepare(hdmi_dev->hdcp_clk);
hdmi_dev->clk_on &= ~HDMI_HDCPCLK_ON;
}
match = of_match_node(rk_hdmi_dt_ids, np);
if (!match)
- return PTR_ERR(match);
+ return -EINVAL;
if (!strcmp(match->compatible, "rockchip,rk3288-hdmi")) {
hdmi_dev->soctype = HDMI_SOC_RK3288;
unregister_early_suspend(&hdmi_dev->early_suspend);
#endif
hdmi = hdmi_dev->hdmi;
- if (hdmi->hotplug == HDMI_HPD_ACTIVED &&
+ if (hdmi->hotplug == HDMI_HPD_ACTIVATED &&
hdmi->ops->setmute)
hdmi->ops->setmute(hdmi, HDMI_VIDEO_MUTE);
+ pm_runtime_disable(hdmi_dev->dev);
}
- pm_runtime_disable(hdmi_dev->dev);
}
static struct platform_driver rockchip_hdmiv2_driver = {
{
struct hdmi_dev *hdmi_dev = hdmi->property->priv;
int i, count;
- char *data = (char *)frame;
+ u8 *data = (u8 *)frame;
if (((hdmi_dev->clk_on & HDMI_PCLK_ON) == 0) || !frame)
return -1;
((word) >> (32 - (bits))))
void sha_processblock(struct sha_t *sha)
{
- const unsigned K[] = {
+ const unsigned int K[] = {
/* constants defined in SHA-1 */
0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 };
- unsigned W[80]; /* word sequence */
- unsigned A, B, C, D, E; /* word buffers */
- unsigned temp = 0;
+ unsigned int W[80]; /* word sequence */
+ unsigned int A, B, C, D, E; /* word buffers */
+ unsigned int temp = 0;
int t = 0;
/* Initialize the first 16 words in the array W */
for (t = 0; t < 80; t++) {
if (t < 16) {
- W[t] = ((unsigned)sha->mblock[t * 4 + 0]) << 24;
- W[t] |= ((unsigned)sha->mblock[t * 4 + 1]) << 16;
- W[t] |= ((unsigned)sha->mblock[t * 4 + 2]) << 8;
- W[t] |= ((unsigned)sha->mblock[t * 4 + 3]) << 0;
+ W[t] = ((unsigned int)sha->mblock[t * 4 + 0]) << 24;
+ W[t] |= ((unsigned int)sha->mblock[t * 4 + 1]) << 16;
+ W[t] |= ((unsigned int)sha->mblock[t * 4 + 2]) << 8;
+ W[t] |= ((unsigned int)sha->mblock[t * 4 + 3]) << 0;
} else {
A = W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16];
W[t] = shacircularshift(1, A);
return count;
}
-static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR,
- hdcp_enable_read, hdcp_enable_write);
+
+static DEVICE_ATTR(enable, 0644, hdcp_enable_read, hdcp_enable_write);
static ssize_t hdcp_trytimes_read(struct device *device,
struct device_attribute *attr, char *buf)
return count;
}
-static DEVICE_ATTR(trytimes, S_IRUGO | S_IWUSR,
- hdcp_trytimes_read, hdcp_trytimes_wrtie);
+
+static DEVICE_ATTR(trytimes, 0644, hdcp_trytimes_read, hdcp_trytimes_wrtie);
static int hdcp_init(struct hdmi *hdmi)
{
error2:
misc_deregister(&mdev);
error1:
- kfree(hdcp->keys);
- kfree(hdcp->invalidkeys);
kfree(hdcp);
error0:
return ret;
void rockchip_hdmiv2_hdcp_init(struct hdmi *hdmi)
{
pr_info("%s", __func__);
- if (!hdcp)
+
+ if (!hdcp) {
hdcp_init(hdmi);
- else {
+ } else {
if (hdcp->keys)
hdcp_load_key(hdmi, hdcp->keys);
else
static void rockchip_hdmiv2_powerdown(struct hdmi_dev *hdmi_dev)
{
hdmi_msk_reg(hdmi_dev, PHY_MASK, m_PHY_LOCK, v_PHY_LOCK(1));
+
if (hdmi_dev->soctype != HDMI_SOC_RK322X) {
hdmi_msk_reg(hdmi_dev, PHY_CONF0,
m_PDDQ_SIG | m_TXPWRON_SIG |
}
}
- if (i != hdmi_dev->phy_table_size) {
+ if (i != hdmi_dev->phy_table_size && hdmi_dev->phy_table) {
if (hdmi_dev->phy_table[i].slopeboost) {
rockchip_hdmiv2_write_phy(hdmi_dev,
EXT_PHY_SIGNAL_CTRL, 0xff);
if (hdmi_dev->tmdsclk <= hdmi_dev->phy_table[i].maxfreq)
break;
}
- if (i == hdmi_dev->phy_table_size) {
+ if (i != hdmi_dev->phy_table_size && hdmi_dev->phy_table) {
+ stat = v_OVERRIDE(1) | v_TX_SYMON(1) | v_CLK_SYMON(1) |
+ v_PREEMPHASIS(hdmi_dev->phy_table[i].pre_emphasis) |
+ v_SLOPEBOOST(hdmi_dev->phy_table[i].slopeboost);
+ rockchip_hdmiv2_write_phy(hdmi_dev, PHYTX_CLKSYMCTRL, stat);
+
+ stat = v_SUP_CLKLVL(hdmi_dev->phy_table[i].clk_level) |
+ v_SUP_TXLVL(hdmi_dev->phy_table[i].data0_level);
+ rockchip_hdmiv2_write_phy(hdmi_dev, PHYTX_VLEVCTRL, stat);
+ } else {
pr_info("%s use default phy settings\n", __func__);
rockchip_hdmiv2_write_phy(hdmi_dev, PHYTX_CLKSYMCTRL,
v_OVERRIDE(1) | v_SLOPEBOOST(0) |
PHYTX_VLEVCTRL,
v_SUP_TXLVL(18) |
v_SUP_CLKLVL(17));
- } else {
- stat = v_OVERRIDE(1) | v_TX_SYMON(1) | v_CLK_SYMON(1) |
- v_PREEMPHASIS(hdmi_dev->phy_table[i].pre_emphasis) |
- v_SLOPEBOOST(hdmi_dev->phy_table[i].slopeboost);
- rockchip_hdmiv2_write_phy(hdmi_dev, PHYTX_CLKSYMCTRL, stat);
-
- stat = v_SUP_CLKLVL(hdmi_dev->phy_table[i].clk_level) |
- v_SUP_TXLVL(hdmi_dev->phy_table[i].data0_level);
- rockchip_hdmiv2_write_phy(hdmi_dev, PHYTX_VLEVCTRL, stat);
}
if (hdmi_dev->tmdsclk > 340000000)
map_code = VIDEO_RGB444_8BIT;
break;
}
- map_code += (vpara->color_input == HDMI_COLOR_YCBCR444) ?
- 8 : 0;
}
/* Set Data enable signal from external
value = hdmi_readl(hdmi_dev, PHY_STAT0);
HDMIDBG(2, "[%s] reg%x value %02x\n", __func__, PHY_STAT0, value);
if (value & m_PHY_HPD)
- return HDMI_HPD_ACTIVED;
+ return HDMI_HPD_ACTIVATED;
return HDMI_HPD_REMOVED;
}
}
#define HDR_LSB(n) ((n) & 0xff)
-#define HDR_MSB(n) (((n) & 0xff) >> 8)
+#define HDR_MSB(n) (((n) & 0xff00) >> 8)
static void hdmi_dev_config_hdr(struct hdmi_dev *hdmi_dev,
int eotf,
HDMI_VIDEO_FORMAT_NORMAL);
}
hdmi_dev_config_hdr(hdmi_dev, vpara->eotf, NULL);
- dev_info(hdmi->dev, "[%s] sucess output HDMI.\n", __func__);
+ dev_info(hdmi->dev, "[%s] success output HDMI.\n", __func__);
} else {
dev_info(hdmi->dev, "[%s] success output DVI.\n", __func__);
}
HDMIDBG(2, "%s\n", __func__);
if (!hdmi->uboot)
hdmi_writel(hdmi_dev, MC_CLKDIS, m_HDCPCLK_DISABLE);
+
return HDMI_ERROR_SUCCESS;
}
rockchip_hdmiv2_powerdown(hdmi_dev);
} else {
hdmi->hotplug = hdmi_dev_detect_hotplug(hdmi);
- if (hdmi->hotplug != HDMI_HPD_ACTIVED)
+ if (hdmi->hotplug != HDMI_HPD_ACTIVATED)
hdmi->uboot = 0;
}
/*mute unnecessary interrupt, only enable hpd*/
char vp_stat0 = hdmi_readl(hdmi_dev, IH_VP_STAT0);
char cec_int = hdmi_readl(hdmi_dev, IH_CEC_STAT0);
char hdcp_int = hdmi_readl(hdmi_dev, A_APIINTSTAT);
- char hdcp2_int = hdmi_readl(hdmi_dev, HDCP2REG_STAT);
+ u8 hdcp2_int = hdmi_readl(hdmi_dev, HDCP2REG_STAT);
/*clear interrupt*/
hdmi_writel(hdmi_dev, IH_FC_STAT0, fc_stat0);
};
#define m_OUTPUT_SEL (0x03 << 0)
-#define v_OUTPUT_SEL(n) ((n & 0x03) << 0)
+#define v_OUTPUT_SEL(n) (((n) & 0x03) << 0)
#define VP_MASK 0x0807
#define m_OINTFULL_REPET BIT(7)
#define m_AUDIO_SAMPLE_RATE (0x0f << 0)
#define v_AUDIO_SAMPLE_RATE(n) (((n) & 0x0f) << 0)
#define m_AUDIO_ORI_SAMPLE_RATE (0x0f << 4)
-#define v_AUDIO_ORI_SAMPLE_RATE(n) (((~n) & 0x0f) << 4)
+#define v_AUDIO_ORI_SAMPLE_RATE(n) (((~(n)) & 0x0f) << 4)
+
#define m_AUDIO_WORD_LENGTH (0x0f << 0)
#define v_AUDIO_WORD_LENGTH(n) (((n) & 0x0f) << 0)
u8 pclk_divider_d;
u8 vco_div_5;
u8 ppll_nd;
- u8 ppll_nf;
+ u16 ppll_nf;
u8 ppll_no;
};
mutex_lock(&dev_drv->switch_screen);
#if defined(CONFIG_RK_HDMI)
if ((rk_fb->disp_mode == ONE_DUAL) &&
- (hdmi_get_hotplug() == HDMI_HPD_ACTIVED)) {
+ (hdmi_get_hotplug() == HDMI_HPD_ACTIVATED)) {
pr_info("hdmi is connect , not blank lcdc\n");
} else
#endif