diff options
author | Sebastian Reichel <sre@debian.org> | 2013-12-13 13:17:28 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-03-19 05:03:11 -0400 |
commit | 6e7efe4eb86e493ea10d1568a6497aa931ff5221 (patch) | |
tree | d9464431d30e49cc2e3e5d537cee62ca98cc45c7 | |
parent | fcc900a6e4e786062201f816977aced847d9c615 (diff) |
OMAPDSS: acx565akm: Add DT support
Add DT support for panel-sony-acx565akm
Signed-off-by: Sebastian Reichel <sre@debian.org>
[tomi.valkeinen@ti.com: some modifications]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
-rw-r--r-- | drivers/video/omap2/displays-new/panel-sony-acx565akm.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c index 8e97d06921ff..906220c20186 100644 --- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/backlight.h> | 30 | #include <linux/backlight.h> |
31 | #include <linux/fb.h> | 31 | #include <linux/fb.h> |
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/of.h> | ||
34 | #include <linux/of_gpio.h> | ||
33 | 35 | ||
34 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
35 | #include <video/omap-panel-data.h> | 37 | #include <video/omap-panel-data.h> |
@@ -547,7 +549,9 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) | |||
547 | dev_dbg(&ddata->spi->dev, "%s\n", __func__); | 549 | dev_dbg(&ddata->spi->dev, "%s\n", __func__); |
548 | 550 | ||
549 | in->ops.sdi->set_timings(in, &ddata->videomode); | 551 | in->ops.sdi->set_timings(in, &ddata->videomode); |
550 | in->ops.sdi->set_datapairs(in, ddata->datapairs); | 552 | |
553 | if (ddata->datapairs > 0) | ||
554 | in->ops.sdi->set_datapairs(in, ddata->datapairs); | ||
551 | 555 | ||
552 | r = in->ops.sdi->enable(in); | 556 | r = in->ops.sdi->enable(in); |
553 | if (r) { | 557 | if (r) { |
@@ -726,6 +730,22 @@ static int acx565akm_probe_pdata(struct spi_device *spi) | |||
726 | return 0; | 730 | return 0; |
727 | } | 731 | } |
728 | 732 | ||
733 | static int acx565akm_probe_of(struct spi_device *spi) | ||
734 | { | ||
735 | struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); | ||
736 | struct device_node *np = spi->dev.of_node; | ||
737 | |||
738 | ddata->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); | ||
739 | |||
740 | ddata->in = omapdss_of_find_source_for_first_ep(np); | ||
741 | if (IS_ERR(ddata->in)) { | ||
742 | dev_err(&spi->dev, "failed to find video source\n"); | ||
743 | return PTR_ERR(ddata->in); | ||
744 | } | ||
745 | |||
746 | return 0; | ||
747 | } | ||
748 | |||
729 | static int acx565akm_probe(struct spi_device *spi) | 749 | static int acx565akm_probe(struct spi_device *spi) |
730 | { | 750 | { |
731 | struct panel_drv_data *ddata; | 751 | struct panel_drv_data *ddata; |
@@ -753,7 +773,12 @@ static int acx565akm_probe(struct spi_device *spi) | |||
753 | r = acx565akm_probe_pdata(spi); | 773 | r = acx565akm_probe_pdata(spi); |
754 | if (r) | 774 | if (r) |
755 | return r; | 775 | return r; |
776 | } else if (spi->dev.of_node) { | ||
777 | r = acx565akm_probe_of(spi); | ||
778 | if (r) | ||
779 | return r; | ||
756 | } else { | 780 | } else { |
781 | dev_err(&spi->dev, "platform data missing!\n"); | ||
757 | return -ENODEV; | 782 | return -ENODEV; |
758 | } | 783 | } |
759 | 784 | ||
@@ -864,10 +889,16 @@ static int acx565akm_remove(struct spi_device *spi) | |||
864 | return 0; | 889 | return 0; |
865 | } | 890 | } |
866 | 891 | ||
892 | static const struct of_device_id acx565akm_of_match[] = { | ||
893 | { .compatible = "omapdss,sony,acx565akm", }, | ||
894 | {}, | ||
895 | }; | ||
896 | |||
867 | static struct spi_driver acx565akm_driver = { | 897 | static struct spi_driver acx565akm_driver = { |
868 | .driver = { | 898 | .driver = { |
869 | .name = "acx565akm", | 899 | .name = "acx565akm", |
870 | .owner = THIS_MODULE, | 900 | .owner = THIS_MODULE, |
901 | .of_match_table = acx565akm_of_match, | ||
871 | }, | 902 | }, |
872 | .probe = acx565akm_probe, | 903 | .probe = acx565akm_probe, |
873 | .remove = acx565akm_remove, | 904 | .remove = acx565akm_remove, |