aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-07-30 03:37:17 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-03-19 05:03:10 -0400
commit5e4c89c018751e831b2687b926bd956a16a4a777 (patch)
tree30e4e79c5cf134889944adb62260b7c1205a5412
parent2cbe2304ba65d5096907a419beebab98c4bd19df (diff)
OMAPDSS: encoder-tpd12s015: Add DT support
Add DT support for encoder-tpd12s015. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Archit Taneja <archit@ti.com>
-rw-r--r--drivers/video/omap2/displays-new/encoder-tpd12s015.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/omap2/displays-new/encoder-tpd12s015.c
index d5c936cb217f..7e33686171e3 100644
--- a/drivers/video/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/omap2/displays-new/encoder-tpd12s015.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/of_gpio.h>
18 19
19#include <video/omapdss.h> 20#include <video/omapdss.h>
20#include <video/omap-panel-data.h> 21#include <video/omap-panel-data.h>
@@ -289,6 +290,49 @@ static int tpd_probe_pdata(struct platform_device *pdev)
289 return 0; 290 return 0;
290} 291}
291 292
293static int tpd_probe_of(struct platform_device *pdev)
294{
295 struct panel_drv_data *ddata = platform_get_drvdata(pdev);
296 struct device_node *node = pdev->dev.of_node;
297 struct omap_dss_device *in;
298 int gpio;
299
300 /* CT CP HPD GPIO */
301 gpio = of_get_gpio(node, 0);
302 if (!gpio_is_valid(gpio)) {
303 dev_err(&pdev->dev, "failed to parse CT CP HPD gpio\n");
304 return gpio;
305 }
306 ddata->ct_cp_hpd_gpio = gpio;
307
308 /* LS OE GPIO */
309 gpio = of_get_gpio(node, 1);
310 if (gpio_is_valid(gpio) || gpio == -ENOENT) {
311 ddata->ls_oe_gpio = gpio;
312 } else {
313 dev_err(&pdev->dev, "failed to parse LS OE gpio\n");
314 return gpio;
315 }
316
317 /* HPD GPIO */
318 gpio = of_get_gpio(node, 2);
319 if (!gpio_is_valid(gpio)) {
320 dev_err(&pdev->dev, "failed to parse HPD gpio\n");
321 return gpio;
322 }
323 ddata->hpd_gpio = gpio;
324
325 in = omapdss_of_find_source_for_first_ep(node);
326 if (IS_ERR(in)) {
327 dev_err(&pdev->dev, "failed to find video source\n");
328 return PTR_ERR(in);
329 }
330
331 ddata->in = in;
332
333 return 0;
334}
335
292static int tpd_probe(struct platform_device *pdev) 336static int tpd_probe(struct platform_device *pdev)
293{ 337{
294 struct omap_dss_device *in, *dssdev; 338 struct omap_dss_device *in, *dssdev;
@@ -307,6 +351,10 @@ static int tpd_probe(struct platform_device *pdev)
307 r = tpd_probe_pdata(pdev); 351 r = tpd_probe_pdata(pdev);
308 if (r) 352 if (r)
309 return r; 353 return r;
354 } else if (pdev->dev.of_node) {
355 r = tpd_probe_of(pdev);
356 if (r)
357 return r;
310 } else { 358 } else {
311 return -ENODEV; 359 return -ENODEV;
312 } 360 }
@@ -379,12 +427,20 @@ static int __exit tpd_remove(struct platform_device *pdev)
379 return 0; 427 return 0;
380} 428}
381 429
430static const struct of_device_id tpd_of_match[] = {
431 { .compatible = "omapdss,ti,tpd12s015", },
432 {},
433};
434
435MODULE_DEVICE_TABLE(of, tpd_of_match);
436
382static struct platform_driver tpd_driver = { 437static struct platform_driver tpd_driver = {
383 .probe = tpd_probe, 438 .probe = tpd_probe,
384 .remove = __exit_p(tpd_remove), 439 .remove = __exit_p(tpd_remove),
385 .driver = { 440 .driver = {
386 .name = "tpd12s015", 441 .name = "tpd12s015",
387 .owner = THIS_MODULE, 442 .owner = THIS_MODULE,
443 .of_match_table = tpd_of_match,
388 }, 444 },
389}; 445};
390 446