diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-05-29 08:34:06 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-03-19 05:03:10 -0400 |
commit | fcc900a6e4e786062201f816977aced847d9c615 (patch) | |
tree | dd7556296c381c4fb24bb4bab6c2e41a1f6ba52a /drivers/video | |
parent | 0b8879f4714b6d372f240555d8366c8c3ea45c32 (diff) |
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>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/displays-new/connector-analog-tv.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c index ccd9073f706f..5c840325def4 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/omap2/displays-new/connector-analog-tv.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/of.h> | ||
15 | 16 | ||
16 | #include <video/omapdss.h> | 17 | #include <video/omapdss.h> |
17 | #include <video/omap-panel-data.h> | 18 | #include <video/omap-panel-data.h> |
@@ -42,6 +43,12 @@ static const struct omap_video_timings tvc_pal_timings = { | |||
42 | .interlace = true, | 43 | .interlace = true, |
43 | }; | 44 | }; |
44 | 45 | ||
46 | static const struct of_device_id tvc_of_match[]; | ||
47 | |||
48 | struct tvc_of_data { | ||
49 | enum omap_dss_venc_type connector_type; | ||
50 | }; | ||
51 | |||
45 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) | 52 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) |
46 | 53 | ||
47 | static int tvc_connect(struct omap_dss_device *dssdev) | 54 | static int tvc_connect(struct omap_dss_device *dssdev) |
@@ -91,8 +98,12 @@ static int tvc_enable(struct omap_dss_device *dssdev) | |||
91 | 98 | ||
92 | in->ops.atv->set_timings(in, &ddata->timings); | 99 | in->ops.atv->set_timings(in, &ddata->timings); |
93 | 100 | ||
94 | in->ops.atv->set_type(in, ddata->connector_type); | 101 | if (!ddata->dev->of_node) { |
95 | in->ops.atv->invert_vid_out_polarity(in, ddata->invert_polarity); | 102 | in->ops.atv->set_type(in, ddata->connector_type); |
103 | |||
104 | in->ops.atv->invert_vid_out_polarity(in, | ||
105 | ddata->invert_polarity); | ||
106 | } | ||
96 | 107 | ||
97 | r = in->ops.atv->enable(in); | 108 | r = in->ops.atv->enable(in); |
98 | if (r) | 109 | if (r) |
@@ -205,6 +216,23 @@ static int tvc_probe_pdata(struct platform_device *pdev) | |||
205 | return 0; | 216 | return 0; |
206 | } | 217 | } |
207 | 218 | ||
219 | static int tvc_probe_of(struct platform_device *pdev) | ||
220 | { | ||
221 | struct panel_drv_data *ddata = platform_get_drvdata(pdev); | ||
222 | struct device_node *node = pdev->dev.of_node; | ||
223 | struct omap_dss_device *in; | ||
224 | |||
225 | in = omapdss_of_find_source_for_first_ep(node); | ||
226 | if (IS_ERR(in)) { | ||
227 | dev_err(&pdev->dev, "failed to find video source\n"); | ||
228 | return PTR_ERR(in); | ||
229 | } | ||
230 | |||
231 | ddata->in = in; | ||
232 | |||
233 | return 0; | ||
234 | } | ||
235 | |||
208 | static int tvc_probe(struct platform_device *pdev) | 236 | static int tvc_probe(struct platform_device *pdev) |
209 | { | 237 | { |
210 | struct panel_drv_data *ddata; | 238 | struct panel_drv_data *ddata; |
@@ -222,6 +250,10 @@ static int tvc_probe(struct platform_device *pdev) | |||
222 | r = tvc_probe_pdata(pdev); | 250 | r = tvc_probe_pdata(pdev); |
223 | if (r) | 251 | if (r) |
224 | return r; | 252 | return r; |
253 | } else if (pdev->dev.of_node) { | ||
254 | r = tvc_probe_of(pdev); | ||
255 | if (r) | ||
256 | return r; | ||
225 | } else { | 257 | } else { |
226 | return -ENODEV; | 258 | return -ENODEV; |
227 | } | 259 | } |
@@ -263,12 +295,19 @@ static int __exit tvc_remove(struct platform_device *pdev) | |||
263 | return 0; | 295 | return 0; |
264 | } | 296 | } |
265 | 297 | ||
298 | static const struct of_device_id tvc_of_match[] = { | ||
299 | { .compatible = "omapdss,svideo-connector", }, | ||
300 | { .compatible = "omapdss,composite-video-connector", }, | ||
301 | {}, | ||
302 | }; | ||
303 | |||
266 | static struct platform_driver tvc_connector_driver = { | 304 | static struct platform_driver tvc_connector_driver = { |
267 | .probe = tvc_probe, | 305 | .probe = tvc_probe, |
268 | .remove = __exit_p(tvc_remove), | 306 | .remove = __exit_p(tvc_remove), |
269 | .driver = { | 307 | .driver = { |
270 | .name = "connector-analog-tv", | 308 | .name = "connector-analog-tv", |
271 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
310 | .of_match_table = tvc_of_match, | ||
272 | }, | 311 | }, |
273 | }; | 312 | }; |
274 | 313 | ||