aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c')
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
index 875b40263b33..de78ab0caaa8 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
@@ -17,6 +17,7 @@
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/of_gpio.h>
20 21
21#include <video/omapdss.h> 22#include <video/omapdss.h>
22#include <video/omap-panel-data.h> 23#include <video/omap-panel-data.h>
@@ -376,7 +377,8 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev)
376 if (omapdss_device_is_enabled(dssdev)) 377 if (omapdss_device_is_enabled(dssdev))
377 return 0; 378 return 0;
378 379
379 in->ops.dpi->set_data_lines(in, ddata->data_lines); 380 if (ddata->data_lines)
381 in->ops.dpi->set_data_lines(in, ddata->data_lines);
380 in->ops.dpi->set_timings(in, &ddata->videomode); 382 in->ops.dpi->set_timings(in, &ddata->videomode);
381 383
382 r = in->ops.dpi->enable(in); 384 r = in->ops.dpi->enable(in);
@@ -489,6 +491,31 @@ static int tpo_td043_probe_pdata(struct spi_device *spi)
489 return 0; 491 return 0;
490} 492}
491 493
494static int tpo_td043_probe_of(struct spi_device *spi)
495{
496 struct device_node *node = spi->dev.of_node;
497 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
498 struct omap_dss_device *in;
499 int gpio;
500
501 gpio = of_get_named_gpio(node, "reset-gpios", 0);
502 if (!gpio_is_valid(gpio)) {
503 dev_err(&spi->dev, "failed to parse enable gpio\n");
504 return gpio;
505 }
506 ddata->nreset_gpio = gpio;
507
508 in = omapdss_of_find_source_for_first_ep(node);
509 if (IS_ERR(in)) {
510 dev_err(&spi->dev, "failed to find video source\n");
511 return PTR_ERR(in);
512 }
513
514 ddata->in = in;
515
516 return 0;
517}
518
492static int tpo_td043_probe(struct spi_device *spi) 519static int tpo_td043_probe(struct spi_device *spi)
493{ 520{
494 struct panel_drv_data *ddata; 521 struct panel_drv_data *ddata;
@@ -518,6 +545,10 @@ static int tpo_td043_probe(struct spi_device *spi)
518 r = tpo_td043_probe_pdata(spi); 545 r = tpo_td043_probe_pdata(spi);
519 if (r) 546 if (r)
520 return r; 547 return r;
548 } else if (spi->dev.of_node) {
549 r = tpo_td043_probe_of(spi);
550 if (r)
551 return r;
521 } else { 552 } else {
522 return -ENODEV; 553 return -ENODEV;
523 } 554 }
@@ -629,11 +660,19 @@ static int tpo_td043_spi_resume(struct device *dev)
629static SIMPLE_DEV_PM_OPS(tpo_td043_spi_pm, 660static SIMPLE_DEV_PM_OPS(tpo_td043_spi_pm,
630 tpo_td043_spi_suspend, tpo_td043_spi_resume); 661 tpo_td043_spi_suspend, tpo_td043_spi_resume);
631 662
663static const struct of_device_id tpo_td043_of_match[] = {
664 { .compatible = "omapdss,tpo,td043mtea1", },
665 {},
666};
667
668MODULE_DEVICE_TABLE(of, tpo_td043_of_match);
669
632static struct spi_driver tpo_td043_spi_driver = { 670static struct spi_driver tpo_td043_spi_driver = {
633 .driver = { 671 .driver = {
634 .name = "panel-tpo-td043mtea1", 672 .name = "panel-tpo-td043mtea1",
635 .owner = THIS_MODULE, 673 .owner = THIS_MODULE,
636 .pm = &tpo_td043_spi_pm, 674 .pm = &tpo_td043_spi_pm,
675 .of_match_table = tpo_td043_of_match,
637 }, 676 },
638 .probe = tpo_td043_probe, 677 .probe = tpo_td043_probe,
639 .remove = tpo_td043_remove, 678 .remove = tpo_td043_remove,
@@ -641,6 +680,7 @@ static struct spi_driver tpo_td043_spi_driver = {
641 680
642module_spi_driver(tpo_td043_spi_driver); 681module_spi_driver(tpo_td043_spi_driver);
643 682
683MODULE_ALIAS("spi:tpo,td043mtea1");
644MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>"); 684MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>");
645MODULE_DESCRIPTION("TPO TD043MTEA1 LCD Driver"); 685MODULE_DESCRIPTION("TPO TD043MTEA1 LCD Driver");
646MODULE_LICENSE("GPL"); 686MODULE_LICENSE("GPL");