From: Archit Taneja <architt@codeaurora.org>
To: robdclark@gmail.com
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
Archit Taneja <architt@codeaurora.org>
Subject: [PATCH 08/13] drm/msm/hdmi: Make hdmi core get its phy
Date: Thu, 21 Jan 2016 12:39:36 +0530 [thread overview]
Message-ID: <1453360181-31738-9-git-send-email-architt@codeaurora.org> (raw)
In-Reply-To: <1453360181-31738-1-git-send-email-architt@codeaurora.org>
Make hdmi core get its phy by parsing the qcom,hdmi-phy phandle. The core
will use this phy reference to enable/disable phy. The driver defers probe
until phy isn't available.
Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
drivers/gpu/drm/msm/hdmi/hdmi.c | 40 ++++++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/msm/hdmi/hdmi.h | 2 ++
2 files changed, 42 insertions(+)
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 0fe5411..61b191d 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -81,12 +81,46 @@ static void hdmi_destroy(struct hdmi *hdmi)
if (phy)
phy->funcs->destroy(phy);
+ if (hdmi->phy_dev) {
+ put_device(hdmi->phy_dev);
+ hdmi->phy = NULL;
+ hdmi->phy_dev = NULL;
+ }
+
if (hdmi->i2c)
hdmi_i2c_destroy(hdmi->i2c);
platform_set_drvdata(hdmi->pdev, NULL);
}
+static int hdmi_get_phy(struct hdmi *hdmi)
+{
+ struct platform_device *pdev = hdmi->pdev;
+ struct platform_device *phy_pdev;
+ struct device_node *phy_node;
+
+ phy_node = of_parse_phandle(pdev->dev.of_node, "qcom,hdmi-phy", 0);
+ if (!phy_node) {
+ dev_err(&pdev->dev, "cannot find phy device\n");
+ return -ENXIO;
+ }
+
+ phy_pdev = of_find_device_by_node(phy_node);
+ if (phy_pdev)
+ hdmi->phy = platform_get_drvdata(phy_pdev);
+
+ of_node_put(phy_node);
+
+ if (!phy_pdev || !hdmi->phy) {
+ dev_err(&pdev->dev, "phy driver is not ready\n");
+ return -EPROBE_DEFER;
+ }
+
+ hdmi->phy_dev = get_device(&phy_pdev->dev);
+
+ return 0;
+}
+
/* construct hdmi at bind/probe time, grab all the resources. If
* we are to EPROBE_DEFER we want to do it here, rather than later
* at modeset_init() time
@@ -230,6 +264,12 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
goto fail;
}
+ ret = hdmi_get_phy(hdmi);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get phy\n");
+ goto fail;
+ }
+
hdmi->hdcp_ctrl = hdmi_hdcp_init(hdmi);
if (IS_ERR(hdmi->hdcp_ctrl)) {
dev_warn(&pdev->dev, "failed to init hdcp: disabled\n");
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h
index 3404235..45347d5 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.h
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.h
@@ -70,6 +70,8 @@ struct hdmi {
struct clk **pwr_clks;
struct hdmi_phy *phy;
+ struct device *phy_dev;
+
struct i2c_adapter *i2c;
struct drm_connector *connector;
struct drm_bridge *bridge;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2016-01-21 7:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-21 7:09 [PATCH 00/13] drm/msm/hdmi: HDMI support on MSM8996 Archit Taneja
2016-01-21 7:09 ` [PATCH 01/13] drm/msm/dsi: Create separate Makefile/Kconfig Archit Taneja
2016-01-21 7:09 ` [PATCH 02/13] drm/msm/hdmi: " Archit Taneja
2016-01-21 7:09 ` [PATCH 03/13] drm/msm/edp: " Archit Taneja
2016-01-21 7:09 ` [PATCH 04/13] drm/msm/hdmi: Clean up connector gpio usage Archit Taneja
2016-01-21 7:09 ` [PATCH 05/13] drm/msm/hdmi: Fix connector detect when there is no hpd gpio Archit Taneja
2016-01-21 7:09 ` [PATCH 06/13] drm/msm/hdmi: Update generated headers to split PHY/PLL offsets Archit Taneja
2016-01-21 7:09 ` [PATCH 07/13] drm/msm/hdmi: Create a separate hdmi phy driver Archit Taneja
2016-01-21 7:09 ` Archit Taneja [this message]
2016-01-21 7:09 ` [PATCH 09/13] drm/msm/hdmi: Manage hdmi PLL through " Archit Taneja
2016-01-21 7:09 ` [PATCH 10/13] drm/msm/hdmi: Convert phy files according to new design Archit Taneja
2016-01-21 7:09 ` [PATCH 11/13] drm/msm/hdmi: Update generated headers for hdmi 8996 phy Archit Taneja
2016-01-21 7:09 ` [PATCH 12/13] drm/msm/hdmi: HDMI 8996 PHY/PLL support Archit Taneja
2016-01-21 7:09 ` [PATCH 13/13] dt/bindings: drm/msm/hdmi: Add hdmi phy bindings Archit Taneja
2016-01-21 23:26 ` Rob Herring
2016-01-25 7:40 ` Archit Taneja
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453360181-31738-9-git-send-email-architt@codeaurora.org \
--to=architt@codeaurora.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=robdclark@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).