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

Commit fcc900a6 authored by Tomi Valkeinen's avatar Tomi Valkeinen
Browse files

OMAPDSS: connector-analog-tv: Add DT support



Add DT support for connector-analog-tv.

Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarArchit Taneja <archit@ti.com>
parent 0b8879f4
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>

#include <video/omapdss.h>
#include <video/omap-panel-data.h>
@@ -42,6 +43,12 @@ static const struct omap_video_timings tvc_pal_timings = {
	.interlace	= true,
};

static const struct of_device_id tvc_of_match[];

struct tvc_of_data {
	enum omap_dss_venc_type connector_type;
};

#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)

static int tvc_connect(struct omap_dss_device *dssdev)
@@ -91,8 +98,12 @@ static int tvc_enable(struct omap_dss_device *dssdev)

	in->ops.atv->set_timings(in, &ddata->timings);

	if (!ddata->dev->of_node) {
		in->ops.atv->set_type(in, ddata->connector_type);
	in->ops.atv->invert_vid_out_polarity(in, ddata->invert_polarity);

		in->ops.atv->invert_vid_out_polarity(in,
			ddata->invert_polarity);
	}

	r = in->ops.atv->enable(in);
	if (r)
@@ -205,6 +216,23 @@ static int tvc_probe_pdata(struct platform_device *pdev)
	return 0;
}

static int tvc_probe_of(struct platform_device *pdev)
{
	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
	struct device_node *node = pdev->dev.of_node;
	struct omap_dss_device *in;

	in = omapdss_of_find_source_for_first_ep(node);
	if (IS_ERR(in)) {
		dev_err(&pdev->dev, "failed to find video source\n");
		return PTR_ERR(in);
	}

	ddata->in = in;

	return 0;
}

static int tvc_probe(struct platform_device *pdev)
{
	struct panel_drv_data *ddata;
@@ -222,6 +250,10 @@ static int tvc_probe(struct platform_device *pdev)
		r = tvc_probe_pdata(pdev);
		if (r)
			return r;
	} else if (pdev->dev.of_node) {
		r = tvc_probe_of(pdev);
		if (r)
			return r;
	} else {
		return -ENODEV;
	}
@@ -263,12 +295,19 @@ static int __exit tvc_remove(struct platform_device *pdev)
	return 0;
}

static const struct of_device_id tvc_of_match[] = {
	{ .compatible = "omapdss,svideo-connector", },
	{ .compatible = "omapdss,composite-video-connector", },
	{},
};

static struct platform_driver tvc_connector_driver = {
	.probe	= tvc_probe,
	.remove	= __exit_p(tvc_remove),
	.driver	= {
		.name	= "connector-analog-tv",
		.owner	= THIS_MODULE,
		.of_match_table = tvc_of_match,
	},
};