OMAPDSS: panel NEC-NL8048HL11 DT support
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 16 May 2014 09:39:29 +0000 (12:39 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 20 May 2014 11:39:47 +0000 (14:39 +0300)
We don't have any working boards using this panel right now, and the
panel driver looks odd compared to the panel specs. For example, the
panel spec does not mention any QVGA pin.

So, while this patch adds DT support to the driver, it's not really
supported and there are not bindings documentation for the panel until
someone can verify how the panel actually works.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Erik Gilling <konkers@android.com>
drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c

index 996fa004b48ce6e961eca92e93df70ce7b9c4d8b..3595f111aa350c89896b01d1cccfcc89af9740be 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/spi/spi.h>
 #include <linux/fb.h>
 #include <linux/gpio.h>
+#include <linux/of_gpio.h>
 
 #include <video/omapdss.h>
 #include <video/omap-panel-data.h>
@@ -156,7 +157,8 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
        if (omapdss_device_is_enabled(dssdev))
                return 0;
 
-       in->ops.dpi->set_data_lines(in, ddata->data_lines);
+       if (ddata->data_lines)
+               in->ops.dpi->set_data_lines(in, ddata->data_lines);
        in->ops.dpi->set_timings(in, &ddata->videomode);
 
        r = in->ops.dpi->enable(in);
@@ -258,6 +260,34 @@ static int nec_8048_probe_pdata(struct spi_device *spi)
        return 0;
 }
 
+static int nec_8048_probe_of(struct spi_device *spi)
+{
+       struct device_node *node = spi->dev.of_node;
+       struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
+       struct omap_dss_device *in;
+       int gpio;
+
+       gpio = of_get_named_gpio(node, "reset-gpios", 0);
+       if (!gpio_is_valid(gpio)) {
+               dev_err(&spi->dev, "failed to parse enable gpio\n");
+               return gpio;
+       }
+       ddata->res_gpio = gpio;
+
+       /* XXX the panel spec doesn't mention any QVGA pin?? */
+       ddata->qvga_gpio = -ENOENT;
+
+       in = omapdss_of_find_source_for_first_ep(node);
+       if (IS_ERR(in)) {
+               dev_err(&spi->dev, "failed to find video source\n");
+               return PTR_ERR(in);
+       }
+
+       ddata->in = in;
+
+       return 0;
+}
+
 static int nec_8048_probe(struct spi_device *spi)
 {
        struct panel_drv_data *ddata;
@@ -289,6 +319,10 @@ static int nec_8048_probe(struct spi_device *spi)
                r = nec_8048_probe_pdata(spi);
                if (r)
                        return r;
+       } else if (spi->dev.of_node) {
+               r = nec_8048_probe_of(spi);
+               if (r)
+                       return r;
        } else {
                return -ENODEV;
        }
@@ -377,11 +411,19 @@ static SIMPLE_DEV_PM_OPS(nec_8048_pm_ops, nec_8048_suspend,
 #define NEC_8048_PM_OPS NULL
 #endif
 
+static const struct of_device_id nec_8048_of_match[] = {
+       { .compatible = "omapdss,nec,nl8048hl11", },
+       {},
+};
+
+MODULE_DEVICE_TABLE(of, nec_8048_of_match);
+
 static struct spi_driver nec_8048_driver = {
        .driver = {
                .name   = "panel-nec-nl8048hl11",
                .owner  = THIS_MODULE,
                .pm     = NEC_8048_PM_OPS,
+               .of_match_table = nec_8048_of_match,
        },
        .probe  = nec_8048_probe,
        .remove = nec_8048_remove,
@@ -389,6 +431,7 @@ static struct spi_driver nec_8048_driver = {
 
 module_spi_driver(nec_8048_driver);
 
+MODULE_ALIAS("spi:nec,nl8048hl11");
 MODULE_AUTHOR("Erik Gilling <konkers@android.com>");
 MODULE_DESCRIPTION("NEC-NL8048HL11 Driver");
 MODULE_LICENSE("GPL");
This page took 0.029575 seconds and 5 git commands to generate.