diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-05-16 12:39:29 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-05-20 14:39:47 +0300 |
commit | b36250d8b5a390ffc395c9c2cd5c39f722a276f4 (patch) | |
tree | fd20567448ed076f1f8d9db2b479d2d4670f2ace /drivers | |
parent | c594b057413d0ec6b0ef3881ae7c78b3bb1240f8 (diff) |
OMAPDSS: panel NEC-NL8048HL11 DT support
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c index 996fa004b48c..3595f111aa35 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c @@ -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"); |