diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-07-30 03:36:29 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-03-19 05:03:09 -0400 |
commit | 2cbe2304ba65d5096907a419beebab98c4bd19df (patch) | |
tree | dcdf11521edff2ecd9fffbbde8a5e5e387f9938e | |
parent | cfa71144df6d9eb3a15f58383ef3c7d507f113f3 (diff) |
OMAPDSS: connector-dvi: Add DT support
Add DT support for connector-dvi.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
-rw-r--r-- | drivers/video/omap2/displays-new/connector-dvi.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays-new/connector-dvi.c b/drivers/video/omap2/displays-new/connector-dvi.c index b6c50904038e..d5fb77147f9e 100644 --- a/drivers/video/omap2/displays-new/connector-dvi.c +++ b/drivers/video/omap2/displays-new/connector-dvi.c | |||
@@ -277,6 +277,37 @@ static int dvic_probe_pdata(struct platform_device *pdev) | |||
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
279 | 279 | ||
280 | static int dvic_probe_of(struct platform_device *pdev) | ||
281 | { | ||
282 | struct panel_drv_data *ddata = platform_get_drvdata(pdev); | ||
283 | struct device_node *node = pdev->dev.of_node; | ||
284 | struct omap_dss_device *in; | ||
285 | struct device_node *adapter_node; | ||
286 | struct i2c_adapter *adapter; | ||
287 | |||
288 | in = omapdss_of_find_source_for_first_ep(node); | ||
289 | if (IS_ERR(in)) { | ||
290 | dev_err(&pdev->dev, "failed to find video source\n"); | ||
291 | return PTR_ERR(in); | ||
292 | } | ||
293 | |||
294 | ddata->in = in; | ||
295 | |||
296 | adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); | ||
297 | if (adapter_node) { | ||
298 | adapter = of_find_i2c_adapter_by_node(adapter_node); | ||
299 | if (adapter == NULL) { | ||
300 | dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n"); | ||
301 | omap_dss_put_device(ddata->in); | ||
302 | return -EPROBE_DEFER; | ||
303 | } | ||
304 | |||
305 | ddata->i2c_adapter = adapter; | ||
306 | } | ||
307 | |||
308 | return 0; | ||
309 | } | ||
310 | |||
280 | static int dvic_probe(struct platform_device *pdev) | 311 | static int dvic_probe(struct platform_device *pdev) |
281 | { | 312 | { |
282 | struct panel_drv_data *ddata; | 313 | struct panel_drv_data *ddata; |
@@ -293,6 +324,10 @@ static int dvic_probe(struct platform_device *pdev) | |||
293 | r = dvic_probe_pdata(pdev); | 324 | r = dvic_probe_pdata(pdev); |
294 | if (r) | 325 | if (r) |
295 | return r; | 326 | return r; |
327 | } else if (pdev->dev.of_node) { | ||
328 | r = dvic_probe_of(pdev); | ||
329 | if (r) | ||
330 | return r; | ||
296 | } else { | 331 | } else { |
297 | return -ENODEV; | 332 | return -ENODEV; |
298 | } | 333 | } |
@@ -342,12 +377,20 @@ static int __exit dvic_remove(struct platform_device *pdev) | |||
342 | return 0; | 377 | return 0; |
343 | } | 378 | } |
344 | 379 | ||
380 | static const struct of_device_id dvic_of_match[] = { | ||
381 | { .compatible = "omapdss,dvi-connector", }, | ||
382 | {}, | ||
383 | }; | ||
384 | |||
385 | MODULE_DEVICE_TABLE(of, dvic_of_match); | ||
386 | |||
345 | static struct platform_driver dvi_connector_driver = { | 387 | static struct platform_driver dvi_connector_driver = { |
346 | .probe = dvic_probe, | 388 | .probe = dvic_probe, |
347 | .remove = __exit_p(dvic_remove), | 389 | .remove = __exit_p(dvic_remove), |
348 | .driver = { | 390 | .driver = { |
349 | .name = "connector-dvi", | 391 | .name = "connector-dvi", |
350 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
393 | .of_match_table = dvic_of_match, | ||
351 | }, | 394 | }, |
352 | }; | 395 | }; |
353 | 396 | ||