提交 cdeeaca2 编写于 作者: T Tomi Valkeinen

OMAPDSS: panel-dsi-cm: Add DT support

Add DT support for panel-dsi-cm.
Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: NArchit Taneja <archit@ti.com>
上级 6274a619
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/of_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>
...@@ -595,10 +597,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata) ...@@ -595,10 +597,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
.lp_clk_max = 10000000, .lp_clk_max = 10000000,
}; };
r = in->ops.dsi->configure_pins(in, &ddata->pin_config); if (ddata->pin_config.num_pins > 0) {
if (r) { r = in->ops.dsi->configure_pins(in, &ddata->pin_config);
dev_err(&ddata->pdev->dev, "failed to configure DSI pins\n"); if (r) {
goto err0; dev_err(&ddata->pdev->dev,
"failed to configure DSI pins\n");
goto err0;
}
} }
r = in->ops.dsi->set_config(in, &dsi_config); r = in->ops.dsi->set_config(in, &dsi_config);
...@@ -1156,6 +1161,41 @@ static int dsicm_probe_pdata(struct platform_device *pdev) ...@@ -1156,6 +1161,41 @@ static int dsicm_probe_pdata(struct platform_device *pdev)
return 0; return 0;
} }
static int dsicm_probe_of(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in;
int gpio;
gpio = of_get_named_gpio(node, "reset-gpios", 0);
if (!gpio_is_valid(gpio)) {
dev_err(&pdev->dev, "failed to parse reset gpio\n");
return gpio;
}
ddata->reset_gpio = gpio;
gpio = of_get_named_gpio(node, "te-gpios", 0);
if (gpio_is_valid(gpio) || gpio == -ENOENT) {
ddata->ext_te_gpio = gpio;
} else {
dev_err(&pdev->dev, "failed to parse TE gpio\n");
return 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;
/* TODO: ulps, backlight */
return 0;
}
static int dsicm_probe(struct platform_device *pdev) static int dsicm_probe(struct platform_device *pdev)
{ {
struct backlight_properties props; struct backlight_properties props;
...@@ -1178,6 +1218,10 @@ static int dsicm_probe(struct platform_device *pdev) ...@@ -1178,6 +1218,10 @@ static int dsicm_probe(struct platform_device *pdev)
r = dsicm_probe_pdata(pdev); r = dsicm_probe_pdata(pdev);
if (r) if (r)
return r; return r;
} else if (pdev->dev.of_node) {
r = dsicm_probe_of(pdev);
if (r)
return r;
} else { } else {
return -ENODEV; return -ENODEV;
} }
...@@ -1320,12 +1364,20 @@ static int __exit dsicm_remove(struct platform_device *pdev) ...@@ -1320,12 +1364,20 @@ static int __exit dsicm_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id dsicm_of_match[] = {
{ .compatible = "omapdss,panel-dsi-cm", },
{},
};
MODULE_DEVICE_TABLE(of, dsicm_of_match);
static struct platform_driver dsicm_driver = { static struct platform_driver dsicm_driver = {
.probe = dsicm_probe, .probe = dsicm_probe,
.remove = __exit_p(dsicm_remove), .remove = __exit_p(dsicm_remove),
.driver = { .driver = {
.name = "panel-dsi-cm", .name = "panel-dsi-cm",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = dsicm_of_match,
}, },
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册