This adds basic DT support to the ACX565AKM panel driver.

Signed-off-by: Sebastian Reichel <s...@debian.org>
---
 .../omap2/displays-new/panel-sony-acx565akm.c      | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c 
b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c
index e6d56f7..5d3fb9d 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 @@
 #include <linux/backlight.h>
 #include <linux/fb.h>
 #include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
 
 #include <video/omapdss.h>
 #include <video/omap-panel-data.h>
@@ -711,6 +713,28 @@ static int acx565akm_probe_pdata(struct spi_device *spi)
        return 0;
 }
 
+static int acx565akm_probe_of(struct spi_device *spi)
+{
+       struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
+       struct device_node *np = spi->dev.of_node;
+       struct omap_dss_device *dssdev;
+       int ret;
+
+       ddata->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
+
+       /* TODO: there is currently no DT binding for omapdss, so
+        *       we use sdi.0 with 2 data lanes per default. */
+       ddata->in = omap_dss_find_output("sdi.0");
+       ddata->datapairs = 2;
+
+       dssdev = &ddata->dssdev;
+       ret = of_property_read_string(np, "label", &dssdev->name);
+       if (ret < 0)
+               return ret;
+
+       return 0;
+}
+
 static int acx565akm_probe(struct spi_device *spi)
 {
        struct panel_drv_data *ddata;
@@ -738,7 +762,12 @@ static int acx565akm_probe(struct spi_device *spi)
                r = acx565akm_probe_pdata(spi);
                if (r)
                        return r;
+       } else if (spi->dev.of_node) {
+               r = acx565akm_probe_of(spi);
+               if (r)
+                       return r;
        } else {
+               dev_err(&spi->dev, "platform data missing!\n");
                return -ENODEV;
        }
 
-- 
1.8.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to