devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@debian.org>
To: "Sebastian Reichel" <sre@ring0.de>,
	"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
	"Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>
Cc: Rob Herring <rob.herring@calxeda.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Rob Landley <rob@landley.net>,
	linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
	devicetree@vger.kernel.org, Sebastian Reichel <sre@debian.org>
Subject: [PATCH 2/4] OMAPDSS: ACX565AKM: Add DT support
Date: Fri, 13 Dec 2013 19:17:28 +0100	[thread overview]
Message-ID: <1386958650-2404-3-git-send-email-sre@debian.org> (raw)
In-Reply-To: <1386958650-2404-1-git-send-email-sre@debian.org>

This adds DT support to the ACX565AKM panel driver.

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

diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c
index d94f35d..942b8d4 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>
@@ -531,7 +533,9 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
 	dev_dbg(&ddata->spi->dev, "%s\n", __func__);
 
 	in->ops.sdi->set_timings(in, &ddata->videomode);
-	in->ops.sdi->set_datapairs(in, ddata->datapairs);
+
+	if (ddata->datapairs >= 0)
+		in->ops.sdi->set_datapairs(in, ddata->datapairs);
 
 	r = in->ops.sdi->enable(in);
 	if (r) {
@@ -710,6 +714,30 @@ 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);
+
+	ddata->datapairs = -1;
+	ddata->in = omapdss_of_find_source_for_first_ep(np);
+	if (IS_ERR(ddata->in)) {
+		dev_err(&spi->dev, "failed to find video source\n");
+		return PTR_ERR(ddata->in);
+	}
+
+	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;
@@ -737,7 +765,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.5.1


  parent reply	other threads:[~2013-12-13 18:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 18:17 [PATCH 0/4] OMAPDSS: DT support for N900 panel Sebastian Reichel
2013-12-13 18:17 ` [PATCH 1/4] OMAPDSS: Add DT support to SDI Sebastian Reichel
2013-12-13 18:17 ` Sebastian Reichel [this message]
2013-12-13 18:17 ` [PATCH 3/4] ARM: OMAP: rx51: DT boot: disable legacy dss init Sebastian Reichel
2013-12-13 18:17 ` [PATCH 4/4] ARM: dts: omap3-n900: Add display support Sebastian Reichel
2013-12-17  7:37 ` [PATCH 0/4] OMAPDSS: DT support for N900 panel Tomi Valkeinen
2013-12-17 17:14   ` Sebastian Reichel
2013-12-17 17:29     ` Tomi Valkeinen
2013-12-18 21:55       ` Sebastian Reichel
2013-12-19  0:51         ` Sebastian Reichel
2013-12-19  5:30           ` Tomi Valkeinen
2013-12-19 10:08             ` Sebastian Reichel
     [not found]               ` <20131219100840.GA923-SfvFxonMDyemK9LvCR3Hrw@public.gmane.org>
2013-12-19 13:56                 ` Sebastian Reichel
2013-12-19 16:42                   ` Tony Lindgren
2013-12-19 17:00                     ` Sebastian Reichel
2013-12-19 18:34                       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386958650-2404-3-git-send-email-sre@debian.org \
    --to=sre@debian.org \
    --cc=bcousson@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=sre@ring0.de \
    --cc=swarren@wwwdotorg.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).