From 27d624527d99265c2df999af3615ff71c29d06f4 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 2 Mar 2018 22:13:06 +0200 Subject: drm/omap: dss: Acquire next dssdev at probe time Look up the next dssdev at probe time based on device tree links for all DSS outputs and encoders. This will be used to reverse the order of the dssdev connect and disconnect call chains. Signed-off-by: Laurent Pinchart Reviewed-by: Sebastian Reichel Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dsi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/dss/dsi.c') diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index ab0426fab22e..631bf5805649 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c @@ -5165,7 +5165,7 @@ static const struct component_ops dsi_component_ops = { * Probe & Remove, Suspend & Resume */ -static void dsi_init_output(struct dsi_data *dsi) +static int dsi_init_output(struct dsi_data *dsi) { struct omap_dss_device *out = &dsi->output; @@ -5180,13 +5180,24 @@ static void dsi_init_output(struct dsi_data *dsi) out->owner = THIS_MODULE; out->of_ports = BIT(0); + out->next = omapdss_of_find_connected_device(out->dev->of_node, 0); + if (IS_ERR(out->next)) { + if (PTR_ERR(out->next) != -EPROBE_DEFER) + dev_err(out->dev, "failed to find video sink\n"); + return PTR_ERR(out->next); + } + omapdss_device_register(out); + + return 0; } static void dsi_uninit_output(struct dsi_data *dsi) { struct omap_dss_device *out = &dsi->output; + if (out->next) + omapdss_device_put(out->next); omapdss_device_unregister(out); } @@ -5431,7 +5442,9 @@ static int dsi_probe(struct platform_device *pdev) else dsi->num_lanes_supported = 3; - dsi_init_output(dsi); + r = dsi_init_output(dsi); + if (r) + goto err_pm_disable; r = dsi_probe_of(dsi); if (r) { @@ -5451,6 +5464,7 @@ static int dsi_probe(struct platform_device *pdev) err_uninit_output: dsi_uninit_output(dsi); +err_pm_disable: pm_runtime_disable(dev); return r; } -- cgit v1.2.3