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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Laurent Pinchart
2018-03-02 22:13:06 +02:00
committad av Tomi Valkeinen
förälder c87193267d
incheckning 27d624527d
10 ändrade filer med 120 tillägg och 14 borttagningar

Visa fil

@@ -731,7 +731,7 @@ static const struct component_ops hdmi4_component_ops = {
* Probe & Remove, Suspend & Resume
*/
static void hdmi4_init_output(struct omap_hdmi *hdmi)
static int hdmi4_init_output(struct omap_hdmi *hdmi)
{
struct omap_dss_device *out = &hdmi->output;
@@ -744,13 +744,24 @@ static void hdmi4_init_output(struct omap_hdmi *hdmi)
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 hdmi4_uninit_output(struct omap_hdmi *hdmi)
{
struct omap_dss_device *out = &hdmi->output;
if (out->next)
omapdss_device_put(out->next);
omapdss_device_unregister(out);
}
@@ -820,7 +831,9 @@ static int hdmi4_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
hdmi4_init_output(hdmi);
r = hdmi4_init_output(hdmi);
if (r)
goto err_pm_disable;
r = component_add(&pdev->dev, &hdmi4_component_ops);
if (r)
@@ -830,6 +843,7 @@ static int hdmi4_probe(struct platform_device *pdev)
err_uninit_output:
hdmi4_uninit_output(hdmi);
err_pm_disable:
pm_runtime_disable(&pdev->dev);
err_free:
kfree(hdmi);