From 4307a0e7db70f7af4a6bb926a7f1dd7869e2f90a Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Tue, 22 Nov 2016 16:01:28 +0800 Subject: [PATCH] video: rockchip: hdmi: v2: fix some format check error Change-Id: I3432060aed93ccf8745fa7afebd0a5322f8d4121 Signed-off-by: Zheng Yang (cherry picked from commit d3dfca100edae96339c2a9b7674dd3b715f2b18e) --- drivers/video/rockchip/dp/rockchip_dp.c | 2 +- .../video/rockchip/hdmi/rockchip-hdmi-cec.c | 6 ++-- .../video/rockchip/hdmi/rockchip-hdmi-cec.h | 8 ++--- .../video/rockchip/hdmi/rockchip-hdmi-core.c | 23 ++++++------ .../video/rockchip/hdmi/rockchip-hdmi-sysfs.c | 11 +++--- drivers/video/rockchip/hdmi/rockchip-hdmi.h | 6 ++-- .../hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c | 6 ++-- .../hdmi/rockchip-hdmiv1/rockchip_hdmiv1_hw.c | 12 +++---- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c | 10 +++--- .../rockchip-hdmiv2/rockchip_hdmiv2_cec.c | 2 +- .../rockchip-hdmiv2/rockchip_hdmiv2_hdcp.c | 31 ++++++++-------- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c | 36 +++++++++---------- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h | 7 ++-- drivers/video/rockchip/rk_fb.c | 2 +- 14 files changed, 81 insertions(+), 81 deletions(-) diff --git a/drivers/video/rockchip/dp/rockchip_dp.c b/drivers/video/rockchip/dp/rockchip_dp.c index 0e14cf392e44..74f20fcdf2a3 100644 --- a/drivers/video/rockchip/dp/rockchip_dp.c +++ b/drivers/video/rockchip/dp/rockchip_dp.c @@ -91,7 +91,7 @@ static int rockchip_dp_detect_hotplug(struct hdmi *hdmi_drv) 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; } diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c index af160dc7b830..78bba0431ba0 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c @@ -187,9 +187,9 @@ static ssize_t cec_state_show(struct device *dev, } 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), }; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.h b/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.h index 31328784b68c..97130cda1618 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.h +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.h @@ -136,10 +136,10 @@ enum { #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; }; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c index c8e97df92c33..c3f396ddb898 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c @@ -362,7 +362,7 @@ static void hdmi_wq_remove(struct hdmi *hdmi) 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); } @@ -416,7 +416,7 @@ static void hdmi_work_queue(struct work_struct *work) 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); } } @@ -430,7 +430,7 @@ static void hdmi_work_queue(struct work_struct *work) 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); @@ -444,7 +444,7 @@ static void hdmi_work_queue(struct work_struct *work) 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); @@ -461,10 +461,10 @@ static void hdmi_work_queue(struct work_struct *work) 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; @@ -494,7 +494,7 @@ static void hdmi_work_queue(struct work_struct *work) 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 | @@ -533,11 +533,11 @@ static void hdmi_work_queue(struct work_struct *work) 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; @@ -674,10 +674,9 @@ void rockchip_hdmi_unregister(struct hdmi *hdmi) 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; } @@ -704,7 +703,7 @@ int hdmi_config_audio(struct hdmi_audio *audio) 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; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-sysfs.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-sysfs.c index 8167698e252a..37162320b05a 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-sysfs.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-sysfs.c @@ -32,7 +32,7 @@ static int hdmi_get_status(struct rk_display_device *device) { struct hdmi *hdmi = device->priv_data; - if (hdmi->hotplug == HDMI_HPD_ACTIVED) + if (hdmi->hotplug == HDMI_HPD_ACTIVATED) return 1; else return 0; @@ -65,7 +65,7 @@ static int hdmi_set_mode(struct rk_display_device *device, 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; @@ -121,7 +121,7 @@ static int hdmi_set_3dmode(struct rk_display_device *device, int mode) 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; @@ -267,9 +267,10 @@ static int hdmi_set_color(struct rk_display_device *device, 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; } @@ -534,7 +535,7 @@ static int hdmi_show_sink_info(struct hdmi *hdmi, char *buf, int len) 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) diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/drivers/video/rockchip/hdmi/rockchip-hdmi.h index a003bd6788c6..f44f336921d3 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi.h +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi.h @@ -14,6 +14,7 @@ #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 @@ -237,7 +238,7 @@ enum hdmi_hotpulg_status { 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 */ }; @@ -384,7 +385,7 @@ struct hdmi_edid { 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; @@ -571,7 +572,6 @@ struct hdmi { #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)) \ diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c index b11380fd25f2..e7cda3e67fb0 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c @@ -221,7 +221,7 @@ static int rockchip_hdmiv1_parse_dt(struct hdmi_dev *hdmi_dev) 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; @@ -271,7 +271,7 @@ static int rockchip_hdmiv1_probe(struct platform_device *pdev) 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; @@ -404,7 +404,7 @@ static void rockchip_hdmiv1_shutdown(struct platform_device *pdev) 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); diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1_hw.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1_hw.c index ad031629b3fb..a4501f23fb79 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1_hw.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1_hw.c @@ -96,7 +96,7 @@ int rockchip_hdmiv1_detect_hotplug(struct hdmi *hdmi_drv) 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 @@ -427,7 +427,7 @@ static int rockchip_hdmiv1_config_vsi(struct hdmi *hdmi, 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); @@ -497,7 +497,7 @@ static void rockchip_hdmiv1_config_avi(struct hdmi *hdmi_drv, { 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); @@ -526,7 +526,7 @@ static void rockchip_hdmiv1_config_avi(struct hdmi *hdmi_drv, 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; @@ -711,7 +711,7 @@ static int rockchip_hdmiv1_config_video(struct hdmi *hdmi_drv, 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); @@ -847,7 +847,7 @@ int rockchip_hdmiv1_control_output(struct hdmi *hdmi_drv, int enable) 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 | diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c index aee9656e30a8..d8c1f1e4c02f 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c @@ -299,13 +299,13 @@ static int rockchip_hdmiv2_clk_disable(struct hdmi_dev *hdmi_dev) } 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; } @@ -488,7 +488,7 @@ static int rockchip_hdmiv2_parse_dt(struct hdmi_dev *hdmi_dev) 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; @@ -798,11 +798,11 @@ static void rockchip_hdmiv2_shutdown(struct platform_device *pdev) 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 = { diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_cec.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_cec.c index 28c77b3a838b..3c7279400c69 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_cec.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_cec.c @@ -19,7 +19,7 @@ static int rockchip_hdmiv2_cec_readframe(struct hdmi *hdmi, { 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; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hdcp.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hdcp.c index d5216ac0af06..d47b8e21c257 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hdcp.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hdcp.c @@ -69,21 +69,21 @@ static void sha_reset(struct sha_t *sha) ((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); @@ -567,8 +567,8 @@ static ssize_t hdcp_enable_write(struct device *device, 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) @@ -598,8 +598,8 @@ static ssize_t hdcp_trytimes_wrtie(struct device *device, 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) { @@ -657,8 +657,6 @@ error3: error2: misc_deregister(&mdev); error1: - kfree(hdcp->keys); - kfree(hdcp->invalidkeys); kfree(hdcp); error0: return ret; @@ -667,9 +665,10 @@ error0: 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 diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c index 9f3cd60a0e81..39ccf057c72c 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c @@ -440,6 +440,7 @@ static const struct phy_mpll_config_tab *get_phy_mpll_tab( 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 | @@ -618,7 +619,7 @@ static int ext_phy_config(struct hdmi_dev *hdmi_dev) } } - 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); @@ -782,7 +783,16 @@ static int rockchip_hdmiv2_config_phy(struct hdmi_dev *hdmi_dev) 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) | @@ -802,15 +812,6 @@ static int rockchip_hdmiv2_config_phy(struct hdmi_dev *hdmi_dev) 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) @@ -1202,8 +1203,6 @@ static int rockchip_hdmiv2_video_sampler(struct hdmi_dev *hdmi_dev, map_code = VIDEO_RGB444_8BIT; break; } - map_code += (vpara->color_input == HDMI_COLOR_YCBCR444) ? - 8 : 0; } /* Set Data enable signal from external @@ -1401,7 +1400,7 @@ static int hdmi_dev_detect_hotplug(struct hdmi *hdmi) 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; } @@ -1609,7 +1608,7 @@ static int hdmi_dev_config_vsi(struct hdmi *hdmi, } #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, @@ -1798,7 +1797,7 @@ static int hdmi_dev_config_video(struct hdmi *hdmi, struct hdmi_video *vpara) 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__); } @@ -2122,6 +2121,7 @@ static int hdmi_dev_insert(struct hdmi *hdmi) HDMIDBG(2, "%s\n", __func__); if (!hdmi->uboot) hdmi_writel(hdmi_dev, MC_CLKDIS, m_HDCPCLK_DISABLE); + return HDMI_ERROR_SUCCESS; } @@ -2216,7 +2216,7 @@ void rockchip_hdmiv2_dev_initial(struct hdmi_dev *hdmi_dev) 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*/ @@ -2257,7 +2257,7 @@ irqreturn_t rockchip_hdmiv2_dev_irq(int irq, void *priv) 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); diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h index 592d771cb075..7aa1ce46a047 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h @@ -385,7 +385,7 @@ enum { }; #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) @@ -645,7 +645,8 @@ enum { #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) @@ -1700,7 +1701,7 @@ struct ext_pll_config_tab { u8 pclk_divider_d; u8 vco_div_5; u8 ppll_nd; - u8 ppll_nf; + u16 ppll_nf; u8 ppll_no; }; diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 49fb77db091f..88a396c76b6c 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -3066,7 +3066,7 @@ static int rk_fb_blank(int blank_mode, struct fb_info *info) 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 -- 2.34.1