Commit 3d6df062 authored by Archit Taneja's avatar Archit Taneja Committed by Rob Clark

drm/msm: mdp4 lvds: get panel node via of graph parsing

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.

v3
- Fix return value checks of of_graph_* calls.
Tested-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent f7009d26
...@@ -241,22 +241,37 @@ int mdp4_enable(struct mdp4_kms *mdp4_kms) ...@@ -241,22 +241,37 @@ int mdp4_enable(struct mdp4_kms *mdp4_kms)
} }
#ifdef CONFIG_OF #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; struct drm_panel *panel = NULL;
n = of_parse_phandle(dev->dev->of_node, name, 0); endpoint = of_graph_get_next_endpoint(np, NULL);
if (n) { if (!endpoint) {
panel = of_drm_find_panel(n); dev_err(dev->dev, "no valid endpoint\n");
if (!panel) return ERR_PTR(-ENODEV);
panel = ERR_PTR(-EPROBE_DEFER); }
panel_node = of_graph_get_remote_port_parent(endpoint);
if (!panel_node) {
dev_err(dev->dev, "no valid panel node\n");
of_node_put(endpoint);
return ERR_PTR(-ENODEV);
}
of_node_put(endpoint);
panel = of_drm_find_panel(panel_node);
if (!panel) {
of_node_put(panel_node);
return ERR_PTR(-EPROBE_DEFER);
} }
return panel; return panel;
} }
#else #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? // ??? maybe use a module param to specify which panel is attached?
} }
...@@ -294,7 +309,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) ...@@ -294,7 +309,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms)
* Setup the LCDC/LVDS path: RGB2 -> DMA_P -> LCDC -> LVDS: * 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)) { if (IS_ERR(panel)) {
ret = PTR_ERR(panel); ret = PTR_ERR(panel);
dev_err(dev->dev, "failed to detect LVDS panel: %d\n", ret); dev_err(dev->dev, "failed to detect LVDS panel: %d\n", ret);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/iommu.h> #include <linux/iommu.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/of_graph.h>
#include <asm/sizes.h> #include <asm/sizes.h>
#ifndef CONFIG_OF #ifndef CONFIG_OF
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment