[PATCH 2/4] OMAPDSS: ACX565AKM: Add DT support
STALE4669d
From: Sebastian Reichel <hidden>
Date: 2013-12-13 18:17:28
Also in:
linux-fbdev, linux-omap
Subsystem:
framebuffer layer, the rest · Maintainers:
Helge Deller, Linus Torvalds
This adds DT support to the ACX565AKM panel driver. Signed-off-by: Sebastian Reichel <redacted> --- .../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