diff mbox

[1/5] OMAPDSS: ACX565AKM: Add basic DT support

Message ID 1385240244-28629-2-git-send-email-sre@debian.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Reichel Nov. 23, 2013, 8:57 p.m. UTC
This adds basic DT support to the ACX565AKM panel driver.

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

Patch

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;
 	}