aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Hugues Husson <phh@phh.me>2017-11-25 15:18:44 -0500
committerArchit Taneja <architt@codeaurora.org>2017-11-30 00:25:49 -0500
commitebe32c3e282a62974b190b9d514864fc0d56716e (patch)
tree4fc6c4d274211916e57b2f3acbb46109fb0954ac
parent1b6fba458c0a2e8513071330972c4c587b7d28cc (diff)
drm/bridge: synopsys/dw-hdmi: Enable cec clock
Support the "cec" optional clock. The documentation already mentions "cec" optional clock and it is used by several boards, but currently the driver doesn't enable it, thus preventing cec from working on those boards. And even worse: a /dev/cecX device will appear for those boards, but it won't be functioning without configuring this clock. Changes: v4: - Change commit message to stress the importance of this patch v3: - Drop useless braces v2: - Separate ENOENT errors from others - Propagate other errors (especially -EPROBE_DEFER) Signed-off-by: Pierre-Hugues Husson <phh@phh.me> Signed-off-by: Archit Taneja <architt@codeaurora.org> Link: https://patchwork.freedesktop.org/patch/msgid/20171125201844.11353-1-phh@phh.me
-rw-r--r--drivers/gpu/drm/bridge/synopsys/dw-hdmi.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index bf14214fa464..b72259bf6e2f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -138,6 +138,7 @@ struct dw_hdmi {
138 struct device *dev; 138 struct device *dev;
139 struct clk *isfr_clk; 139 struct clk *isfr_clk;
140 struct clk *iahb_clk; 140 struct clk *iahb_clk;
141 struct clk *cec_clk;
141 struct dw_hdmi_i2c *i2c; 142 struct dw_hdmi_i2c *i2c;
142 143
143 struct hdmi_data_info hdmi_data; 144 struct hdmi_data_info hdmi_data;
@@ -2382,6 +2383,26 @@ __dw_hdmi_probe(struct platform_device *pdev,
2382 goto err_isfr; 2383 goto err_isfr;
2383 } 2384 }
2384 2385
2386 hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec");
2387 if (PTR_ERR(hdmi->cec_clk) == -ENOENT) {
2388 hdmi->cec_clk = NULL;
2389 } else if (IS_ERR(hdmi->cec_clk)) {
2390 ret = PTR_ERR(hdmi->cec_clk);
2391 if (ret != -EPROBE_DEFER)
2392 dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n",
2393 ret);
2394
2395 hdmi->cec_clk = NULL;
2396 goto err_iahb;
2397 } else {
2398 ret = clk_prepare_enable(hdmi->cec_clk);
2399 if (ret) {
2400 dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n",
2401 ret);
2402 goto err_iahb;
2403 }
2404 }
2405
2385 /* Product and revision IDs */ 2406 /* Product and revision IDs */
2386 hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8) 2407 hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8)
2387 | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0); 2408 | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0);
@@ -2518,6 +2539,8 @@ err_iahb:
2518 cec_notifier_put(hdmi->cec_notifier); 2539 cec_notifier_put(hdmi->cec_notifier);
2519 2540
2520 clk_disable_unprepare(hdmi->iahb_clk); 2541 clk_disable_unprepare(hdmi->iahb_clk);
2542 if (hdmi->cec_clk)
2543 clk_disable_unprepare(hdmi->cec_clk);
2521err_isfr: 2544err_isfr:
2522 clk_disable_unprepare(hdmi->isfr_clk); 2545 clk_disable_unprepare(hdmi->isfr_clk);
2523err_res: 2546err_res:
@@ -2541,6 +2564,8 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
2541 2564
2542 clk_disable_unprepare(hdmi->iahb_clk); 2565 clk_disable_unprepare(hdmi->iahb_clk);
2543 clk_disable_unprepare(hdmi->isfr_clk); 2566 clk_disable_unprepare(hdmi->isfr_clk);
2567 if (hdmi->cec_clk)
2568 clk_disable_unprepare(hdmi->cec_clk);
2544 2569
2545 if (hdmi->i2c) 2570 if (hdmi->i2c)
2546 i2c_del_adapter(&hdmi->i2c->adap); 2571 i2c_del_adapter(&hdmi->i2c->adap);