diff options
-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"); |