Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8604889f authored by Neil Armstrong's avatar Neil Armstrong Committed by Sean Paul
Browse files

drm/meson: Fix driver bind when only CVBS is available



While introducing HDMI support, component matching on connectors node
were bypassed since no driver would actually bind on the DT node.
But when only a CVBS connector is present, only a single node is found
in the graph, but ignored and a NULL match table is given to the
component code.

This code permits bypassing the components framework by binding directly
the DRM driver when no components needs to be loaded.

Fixes: a41e82e6 ("drm/meson: Add support for components")
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1496067352-8733-1-git-send-email-narmstrong@baylibre.com
parent b2cc3c80
Loading
Loading
Loading
Loading
+15 −5
Original line number Original line Diff line number Diff line
@@ -152,7 +152,7 @@ static struct regmap_config meson_regmap_config = {
	.max_register   = 0x1000,
	.max_register   = 0x1000,
};
};


static int meson_drv_bind(struct device *dev)
static int meson_drv_bind_master(struct device *dev, bool has_components)
{
{
	struct platform_device *pdev = to_platform_device(dev);
	struct platform_device *pdev = to_platform_device(dev);
	struct meson_drm *priv;
	struct meson_drm *priv;
@@ -233,11 +233,13 @@ static int meson_drv_bind(struct device *dev)
	if (ret)
	if (ret)
		goto free_drm;
		goto free_drm;


	if (has_components) {
		ret = component_bind_all(drm->dev, drm);
		ret = component_bind_all(drm->dev, drm);
		if (ret) {
		if (ret) {
			dev_err(drm->dev, "Couldn't bind all components\n");
			dev_err(drm->dev, "Couldn't bind all components\n");
			goto free_drm;
			goto free_drm;
		}
		}
	}


	ret = meson_plane_create(priv);
	ret = meson_plane_create(priv);
	if (ret)
	if (ret)
@@ -276,6 +278,11 @@ static int meson_drv_bind(struct device *dev)
	return ret;
	return ret;
}
}


static int meson_drv_bind(struct device *dev)
{
	return meson_drv_bind_master(dev, true);
}

static void meson_drv_unbind(struct device *dev)
static void meson_drv_unbind(struct device *dev)
{
{
	struct drm_device *drm = dev_get_drvdata(dev);
	struct drm_device *drm = dev_get_drvdata(dev);
@@ -357,6 +364,9 @@ static int meson_drv_probe(struct platform_device *pdev)
		count += meson_probe_remote(pdev, &match, np, remote);
		count += meson_probe_remote(pdev, &match, np, remote);
	}
	}


	if (count && !match)
		return meson_drv_bind_master(&pdev->dev, false);

	/* If some endpoints were found, initialize the nodes */
	/* If some endpoints were found, initialize the nodes */
	if (count) {
	if (count) {
		dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count);
		dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count);