mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-16 02:44:26 +08:00
OMAPDSS: connector-analog-tv: Add DT support
Add DT support for connector-analog-tv. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Archit Taneja <archit@ti.com>
This commit is contained in:
parent
0b8879f471
commit
fcc900a6e4
@ -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);
|
||||
|
||||
in->ops.atv->set_type(in, ddata->connector_type);
|
||||
in->ops.atv->invert_vid_out_polarity(in, ddata->invert_polarity);
|
||||
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);
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user