From: xuhuicong Date: Tue, 20 Jun 2017 03:40:43 +0000 (+0800) Subject: drm: bridge: dw-hdmi: set hdcp1x_enable in the dts so uboot can visit X-Git-Tag: release-20171130_firefly~4^2~324 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e0da313aa4689dbe1c39046e246d4916abaa6e3f;p=firefly-linux-kernel-4.4.55.git drm: bridge: dw-hdmi: set hdcp1x_enable in the dts so uboot can visit Change-Id: Ibaf91c5beac2355e5c270f1edb69a63795dbff6a Signed-off-by: xuhuicong --- diff --git a/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt b/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt index 5eb6f94aaaad..8160c7fda810 100644 --- a/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt +++ b/Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt @@ -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 { diff --git a/drivers/gpu/drm/bridge/dw-hdmi-hdcp.c b/drivers/gpu/drm/bridge/dw-hdmi-hdcp.c index 05401f85ad15..f093ad69f0a0 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi-hdcp.c +++ b/drivers/gpu/drm/bridge/dw-hdmi-hdcp.c @@ -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; diff --git a/drivers/gpu/drm/bridge/dw-hdmi-hdcp.h b/drivers/gpu/drm/bridge/dw-hdmi-hdcp.h index e63c1dcb68b1..abedb49e3de1 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi-hdcp.h +++ b/drivers/gpu/drm/bridge/dw-hdmi-hdcp.h @@ -26,7 +26,7 @@ struct hdcp_keys { }; struct dw_hdcp { - int enable; + bool enable; int retry_times; int remaining_times; char *seeds; diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index 2bf94b87a596..168c2765b035 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -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;