drm: bridge: dw-hdmi: set hdcp1x_enable in the dts so uboot can visit
authorxuhuicong <xhc@rock-chips.com>
Tue, 20 Jun 2017 03:40:43 +0000 (11:40 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 23 Jun 2017 07:51:56 +0000 (15:51 +0800)
Change-Id: Ibaf91c5beac2355e5c270f1edb69a63795dbff6a
Signed-off-by: xuhuicong <xhc@rock-chips.com>
Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt
drivers/gpu/drm/bridge/dw-hdmi-hdcp.c
drivers/gpu/drm/bridge/dw-hdmi-hdcp.h
drivers/gpu/drm/bridge/dw-hdmi.c

index 5eb6f94aaaadfd679525e5ad2a45eaaa7c3983d8..8160c7fda810a2eb6b5b1bb8961680a98067a3ce 100644 (file)
@@ -24,6 +24,7 @@ Optional properties
 - reg-io-width: the width of the reg:1,4, default set to 1 if not present
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
 - clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+- hdcp1x-enable: enable hdcp1.x, enable if defined, disable if not defined
 
 Example:
        hdmi: hdmi@0120000 {
index 05401f85ad151edd7ebb08762990a59a0e4911d0..f093ad69f0a0f75f8098eb54007ea07f3fa2c847 100644 (file)
@@ -552,9 +552,6 @@ static void dw_hdmi_hdcp_isr(struct dw_hdcp *hdcp, int hdcp_int)
        }
        if (hdcp_int & 0x40) {
                hdcp->status = DW_HDCP_AUTH_FAIL;
-               if (hdcp->enable != 2)
-                       return;
-
                if (hdcp->remaining_times > 1)
                        hdcp->remaining_times--;
                else if (hdcp->remaining_times == 1)
@@ -572,7 +569,7 @@ static void dw_hdmi_hdcp_isr(struct dw_hdcp *hdcp, int hdcp_int)
 static ssize_t hdcp_enable_read(struct device *device,
                                struct device_attribute *attr, char *buf)
 {
-       int enable = 0;
+       bool enable = 0;
        struct dw_hdcp *hdcp = g_hdcp;
 
        if (hdcp)
@@ -585,16 +582,16 @@ static ssize_t hdcp_enable_write(struct device *device,
                                 struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       int enable;
+       bool enable;
        struct dw_hdcp *hdcp = g_hdcp;
 
        if (!hdcp)
                return -EINVAL;
 
-       if (kstrtoint(buf, 0, &enable))
+       if (kstrtobool(buf, &enable))
                return -EINVAL;
 
-       if ((enable >= 0) && (hdcp->enable != enable)) {
+       if (hdcp->enable != enable) {
                if (enable) {
                        hdcp->enable = enable;
                        if (hdcp->read(hdcp->hdmi, HDMI_PHY_STAT0) &
@@ -705,15 +702,12 @@ static int dw_hdmi_hdcp_probe(struct platform_device *pdev)
                goto error2;
        }
 
-       if (!(hdcp->read(hdcp->hdmi, HDMI_MC_CLKDIS) &
-           HDMI_MC_CLKDIS_HDCPCLK_MASK))
-               hdcp->enable = 1;
-
+       /* retry time if hdcp auth fail. unlimited time if set 0 */
+       hdcp->retry_times = 0;
        hdcp->dev = &pdev->dev;
        hdcp->hdcp_start = dw_hdmi_hdcp_start;
        hdcp->hdcp_stop = dw_hdmi_hdcp_stop;
        hdcp->hdcp_isr = dw_hdmi_hdcp_isr;
-       hdcp->retry_times = 3;
        dev_dbg(hdcp->dev, "%s success\n", __func__);
        return 0;
 
index e63c1dcb68b17d076b8485ced4fd36228b274a84..abedb49e3de1252079d073e8fb674e5eaaf50d7e 100644 (file)
@@ -26,7 +26,7 @@ struct hdcp_keys {
 };
 
 struct dw_hdcp {
-       int enable;
+       bool enable;
        int retry_times;
        int remaining_times;
        char *seeds;
index 2bf94b87a59690ad5e19dd0daf9908b06ba0faff..168c2765b03568ce54cf5d8e04b293354239c4c3 100644 (file)
@@ -2780,7 +2780,7 @@ static void dw_hdmi_register_debugfs(struct device *dev, struct dw_hdmi *hdmi)
 }
 
 static void dw_hdmi_register_hdcp(struct device *dev, struct dw_hdmi *hdmi,
-                                 u32 val)
+                                 u32 val, bool hdcp1x_enable)
 {
        struct dw_hdcp hdmi_hdcp = {
                .hdmi = hdmi,
@@ -2788,7 +2788,7 @@ static void dw_hdmi_register_hdcp(struct device *dev, struct dw_hdmi *hdmi,
                .read = hdmi_readb,
                .regs = hdmi->regs,
                .reg_io_width = val,
-               .enable = 0,
+               .enable = hdcp1x_enable,
        };
        struct platform_device_info hdcp_device_info = {
                .parent = dev,
@@ -2824,6 +2824,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
        u32 val = 1;
        u8 config0;
        u8 config3;
+       bool hdcp1x_enable = 0;
 
        hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
        if (!hdmi)
@@ -3028,7 +3029,10 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
        dev_set_drvdata(dev, hdmi);
 
        dw_hdmi_register_debugfs(dev, hdmi);
-       dw_hdmi_register_hdcp(dev, hdmi, val);
+
+       if (of_property_read_bool(np, "hdcp1x-enable"))
+               hdcp1x_enable = 1;
+       dw_hdmi_register_hdcp(dev, hdmi, val, hdcp1x_enable);
 
        return 0;