From: Archit Taneja <architt@codeaurora.org> To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/msm: mdp4 lvds: get panel node via of graph parsing Date: Mon, 22 Jun 2015 20:24:21 +0530 [thread overview] Message-ID: <1434984861-22948-4-git-send-email-architt@codeaurora.org> (raw) In-Reply-To: <1434984861-22948-1-git-send-email-architt@codeaurora.org> We currently get the output connected to LVDS by looking for a phandle called 'qcom,lvds-panel' under the mdp DT node. Use the more standard of_graph approach to create an lvds output port, and retrieve the panel node from the port's endpoint data. Signed-off-by: Archit Taneja <architt@codeaurora.org> --- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 32 +++++++++++++++++++++++--------- drivers/gpu/drm/msm/msm_drv.h | 1 + 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index 531e4ac..cf72eda 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c @@ -241,22 +241,36 @@ int mdp4_enable(struct mdp4_kms *mdp4_kms) } #ifdef CONFIG_OF -static struct drm_panel *detect_panel(struct drm_device *dev, const char *name) +static struct drm_panel *detect_panel(struct drm_device *dev) { - struct device_node *n; + struct device_node *endpoint, *panel_node; + struct device_node *np = dev->dev->of_node; struct drm_panel *panel = NULL; - n = of_parse_phandle(dev->dev->of_node, name, 0); - if (n) { - panel = of_drm_find_panel(n); - if (!panel) - panel = ERR_PTR(-EPROBE_DEFER); + endpoint = of_graph_get_next_endpoint(np, NULL); + if (IS_ERR(endpoint)) { + dev_err(dev->dev, "no valid endpoint\n"); + return ERR_CAST(endpoint); } + of_node_put(endpoint); + + panel_node = of_graph_get_remote_port_parent(endpoint); + if (IS_ERR(panel_node)) { + dev_err(dev->dev, "no valid panel node\n"); + return ERR_CAST(panel_node); + } + + of_node_put(panel_node); + + panel = of_drm_find_panel(panel_node); + if (IS_ERR(panel)) + panel = ERR_PTR(-EPROBE_DEFER); + return panel; } #else -static struct drm_panel *detect_panel(struct drm_device *dev, const char *name) +static struct drm_panel *detect_panel(struct drm_device *dev) { // ??? maybe use a module param to specify which panel is attached? } @@ -294,7 +308,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) * Setup the LCDC/LVDS path: RGB2 -> DMA_P -> LCDC -> LVDS: */ - panel = detect_panel(dev, "qcom,lvds-panel"); + panel = detect_panel(dev); if (IS_ERR(panel)) { ret = PTR_ERR(panel); dev_err(dev->dev, "failed to detect LVDS panel: %d\n", ret); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index e7c5ea1..0cbeb1d 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -30,6 +30,7 @@ #include <linux/list.h> #include <linux/iommu.h> #include <linux/types.h> +#include <linux/of_graph.h> #include <asm/sizes.h> #ifndef CONFIG_OF -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Archit Taneja <architt@codeaurora.org> To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: robdclark@gmail.com, hali@codeaurora.org, linux-kernel@vger.kernel.org, Archit Taneja <architt@codeaurora.org> Subject: [PATCH 3/3] drm/msm: mdp4 lvds: get panel node via of graph parsing Date: Mon, 22 Jun 2015 20:24:21 +0530 [thread overview] Message-ID: <1434984861-22948-4-git-send-email-architt@codeaurora.org> (raw) In-Reply-To: <1434984861-22948-1-git-send-email-architt@codeaurora.org> We currently get the output connected to LVDS by looking for a phandle called 'qcom,lvds-panel' under the mdp DT node. Use the more standard of_graph approach to create an lvds output port, and retrieve the panel node from the port's endpoint data. Signed-off-by: Archit Taneja <architt@codeaurora.org> --- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 32 +++++++++++++++++++++++--------- drivers/gpu/drm/msm/msm_drv.h | 1 + 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index 531e4ac..cf72eda 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c @@ -241,22 +241,36 @@ int mdp4_enable(struct mdp4_kms *mdp4_kms) } #ifdef CONFIG_OF -static struct drm_panel *detect_panel(struct drm_device *dev, const char *name) +static struct drm_panel *detect_panel(struct drm_device *dev) { - struct device_node *n; + struct device_node *endpoint, *panel_node; + struct device_node *np = dev->dev->of_node; struct drm_panel *panel = NULL; - n = of_parse_phandle(dev->dev->of_node, name, 0); - if (n) { - panel = of_drm_find_panel(n); - if (!panel) - panel = ERR_PTR(-EPROBE_DEFER); + endpoint = of_graph_get_next_endpoint(np, NULL); + if (IS_ERR(endpoint)) { + dev_err(dev->dev, "no valid endpoint\n"); + return ERR_CAST(endpoint); } + of_node_put(endpoint); + + panel_node = of_graph_get_remote_port_parent(endpoint); + if (IS_ERR(panel_node)) { + dev_err(dev->dev, "no valid panel node\n"); + return ERR_CAST(panel_node); + } + + of_node_put(panel_node); + + panel = of_drm_find_panel(panel_node); + if (IS_ERR(panel)) + panel = ERR_PTR(-EPROBE_DEFER); + return panel; } #else -static struct drm_panel *detect_panel(struct drm_device *dev, const char *name) +static struct drm_panel *detect_panel(struct drm_device *dev) { // ??? maybe use a module param to specify which panel is attached? } @@ -294,7 +308,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) * Setup the LCDC/LVDS path: RGB2 -> DMA_P -> LCDC -> LVDS: */ - panel = detect_panel(dev, "qcom,lvds-panel"); + panel = detect_panel(dev); if (IS_ERR(panel)) { ret = PTR_ERR(panel); dev_err(dev->dev, "failed to detect LVDS panel: %d\n", ret); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index e7c5ea1..0cbeb1d 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -30,6 +30,7 @@ #include <linux/list.h> #include <linux/iommu.h> #include <linux/types.h> +#include <linux/of_graph.h> #include <asm/sizes.h> #ifndef CONFIG_OF -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2015-06-22 14:54 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-22 14:54 [PATCH 0/3] drm/msm: Use device graph to parse connected panels Archit Taneja 2015-06-22 14:54 ` Archit Taneja 2015-06-22 14:54 ` [PATCH 1/3] drm/msm: dsi host: add missing of_node_put() Archit Taneja 2015-06-22 14:54 ` Archit Taneja 2015-06-22 16:00 ` Srinivas Kandagatla 2015-06-22 16:00 ` Srinivas Kandagatla 2015-06-23 5:02 ` Archit Taneja 2015-06-23 5:02 ` Archit Taneja 2015-06-22 14:54 ` [PATCH 2/3] drm/msm: dsi host: Use device graph parsing to parse connected panel Archit Taneja 2015-06-22 14:54 ` Archit Taneja 2015-06-22 14:54 ` Archit Taneja [this message] 2015-06-22 14:54 ` [PATCH 3/3] drm/msm: mdp4 lvds: get panel node via of graph parsing 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=1434984861-22948-4-git-send-email-architt@codeaurora.org \ --to=architt@codeaurora.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.