OMAPDSS: encoder-tpd12s015: Add DT support
Add DT support for encoder-tpd12s015. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Archit Taneja <archit@ti.com>
This commit is contained in:
Родитель
2cbe2304ba
Коммит
5e4c89c018
|
@ -15,6 +15,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/of_gpio.h>
|
||||||
|
|
||||||
#include <video/omapdss.h>
|
#include <video/omapdss.h>
|
||||||
#include <video/omap-panel-data.h>
|
#include <video/omap-panel-data.h>
|
||||||
|
@ -289,6 +290,49 @@ static int tpd_probe_pdata(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tpd_probe_of(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
||||||
|
struct device_node *node = pdev->dev.of_node;
|
||||||
|
struct omap_dss_device *in;
|
||||||
|
int gpio;
|
||||||
|
|
||||||
|
/* CT CP HPD GPIO */
|
||||||
|
gpio = of_get_gpio(node, 0);
|
||||||
|
if (!gpio_is_valid(gpio)) {
|
||||||
|
dev_err(&pdev->dev, "failed to parse CT CP HPD gpio\n");
|
||||||
|
return gpio;
|
||||||
|
}
|
||||||
|
ddata->ct_cp_hpd_gpio = gpio;
|
||||||
|
|
||||||
|
/* LS OE GPIO */
|
||||||
|
gpio = of_get_gpio(node, 1);
|
||||||
|
if (gpio_is_valid(gpio) || gpio == -ENOENT) {
|
||||||
|
ddata->ls_oe_gpio = gpio;
|
||||||
|
} else {
|
||||||
|
dev_err(&pdev->dev, "failed to parse LS OE gpio\n");
|
||||||
|
return gpio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HPD GPIO */
|
||||||
|
gpio = of_get_gpio(node, 2);
|
||||||
|
if (!gpio_is_valid(gpio)) {
|
||||||
|
dev_err(&pdev->dev, "failed to parse HPD gpio\n");
|
||||||
|
return gpio;
|
||||||
|
}
|
||||||
|
ddata->hpd_gpio = gpio;
|
||||||
|
|
||||||
|
in = omapdss_of_find_source_for_first_ep(node);
|
||||||
|
if (IS_ERR(in)) {
|
||||||
|
dev_err(&pdev->dev, "failed to find video source\n");
|
||||||
|
return PTR_ERR(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
ddata->in = in;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tpd_probe(struct platform_device *pdev)
|
static int tpd_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct omap_dss_device *in, *dssdev;
|
struct omap_dss_device *in, *dssdev;
|
||||||
|
@ -307,6 +351,10 @@ static int tpd_probe(struct platform_device *pdev)
|
||||||
r = tpd_probe_pdata(pdev);
|
r = tpd_probe_pdata(pdev);
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
} else if (pdev->dev.of_node) {
|
||||||
|
r = tpd_probe_of(pdev);
|
||||||
|
if (r)
|
||||||
|
return r;
|
||||||
} else {
|
} else {
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
@ -379,12 +427,20 @@ static int __exit tpd_remove(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id tpd_of_match[] = {
|
||||||
|
{ .compatible = "omapdss,ti,tpd12s015", },
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_DEVICE_TABLE(of, tpd_of_match);
|
||||||
|
|
||||||
static struct platform_driver tpd_driver = {
|
static struct platform_driver tpd_driver = {
|
||||||
.probe = tpd_probe,
|
.probe = tpd_probe,
|
||||||
.remove = __exit_p(tpd_remove),
|
.remove = __exit_p(tpd_remove),
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "tpd12s015",
|
.name = "tpd12s015",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.of_match_table = tpd_of_match,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче