diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-07-30 03:34:16 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-03-19 05:03:09 -0400 |
commit | cdeeaca2a11d31d11e50590c6ddcee5e322ed6a4 (patch) | |
tree | dd2f7f11e2d4c90830b78cf495944c7ce64e72f5 | |
parent | 6274a619780e62610edcec12cead023053767a6f (diff) |
OMAPDSS: panel-dsi-cm: Add DT support
Add DT support for panel-dsi-cm.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
-rw-r--r-- | drivers/video/omap2/displays-new/panel-dsi-cm.c | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/drivers/video/omap2/displays-new/panel-dsi-cm.c b/drivers/video/omap2/displays-new/panel-dsi-cm.c index b7baafe83aa3..a647e94c8b08 100644 --- a/drivers/video/omap2/displays-new/panel-dsi-cm.c +++ b/drivers/video/omap2/displays-new/panel-dsi-cm.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | #include <linux/of_device.h> | ||
26 | #include <linux/of_gpio.h> | ||
25 | 27 | ||
26 | #include <video/omapdss.h> | 28 | #include <video/omapdss.h> |
27 | #include <video/omap-panel-data.h> | 29 | #include <video/omap-panel-data.h> |
@@ -595,10 +597,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata) | |||
595 | .lp_clk_max = 10000000, | 597 | .lp_clk_max = 10000000, |
596 | }; | 598 | }; |
597 | 599 | ||
598 | r = in->ops.dsi->configure_pins(in, &ddata->pin_config); | 600 | if (ddata->pin_config.num_pins > 0) { |
599 | if (r) { | 601 | r = in->ops.dsi->configure_pins(in, &ddata->pin_config); |
600 | dev_err(&ddata->pdev->dev, "failed to configure DSI pins\n"); | 602 | if (r) { |
601 | goto err0; | 603 | dev_err(&ddata->pdev->dev, |
604 | "failed to configure DSI pins\n"); | ||
605 | goto err0; | ||
606 | } | ||
602 | } | 607 | } |
603 | 608 | ||
604 | r = in->ops.dsi->set_config(in, &dsi_config); | 609 | r = in->ops.dsi->set_config(in, &dsi_config); |
@@ -1156,6 +1161,41 @@ static int dsicm_probe_pdata(struct platform_device *pdev) | |||
1156 | return 0; | 1161 | return 0; |
1157 | } | 1162 | } |
1158 | 1163 | ||
1164 | static int dsicm_probe_of(struct platform_device *pdev) | ||
1165 | { | ||
1166 | struct device_node *node = pdev->dev.of_node; | ||
1167 | struct panel_drv_data *ddata = platform_get_drvdata(pdev); | ||
1168 | struct omap_dss_device *in; | ||
1169 | int gpio; | ||
1170 | |||
1171 | gpio = of_get_named_gpio(node, "reset-gpios", 0); | ||
1172 | if (!gpio_is_valid(gpio)) { | ||
1173 | dev_err(&pdev->dev, "failed to parse reset gpio\n"); | ||
1174 | return gpio; | ||
1175 | } | ||
1176 | ddata->reset_gpio = gpio; | ||
1177 | |||
1178 | gpio = of_get_named_gpio(node, "te-gpios", 0); | ||
1179 | if (gpio_is_valid(gpio) || gpio == -ENOENT) { | ||
1180 | ddata->ext_te_gpio = gpio; | ||
1181 | } else { | ||
1182 | dev_err(&pdev->dev, "failed to parse TE gpio\n"); | ||
1183 | return gpio; | ||
1184 | } | ||
1185 | |||
1186 | in = omapdss_of_find_source_for_first_ep(node); | ||
1187 | if (IS_ERR(in)) { | ||
1188 | dev_err(&pdev->dev, "failed to find video source\n"); | ||
1189 | return PTR_ERR(in); | ||
1190 | } | ||
1191 | |||
1192 | ddata->in = in; | ||
1193 | |||
1194 | /* TODO: ulps, backlight */ | ||
1195 | |||
1196 | return 0; | ||
1197 | } | ||
1198 | |||
1159 | static int dsicm_probe(struct platform_device *pdev) | 1199 | static int dsicm_probe(struct platform_device *pdev) |
1160 | { | 1200 | { |
1161 | struct backlight_properties props; | 1201 | struct backlight_properties props; |
@@ -1178,6 +1218,10 @@ static int dsicm_probe(struct platform_device *pdev) | |||
1178 | r = dsicm_probe_pdata(pdev); | 1218 | r = dsicm_probe_pdata(pdev); |
1179 | if (r) | 1219 | if (r) |
1180 | return r; | 1220 | return r; |
1221 | } else if (pdev->dev.of_node) { | ||
1222 | r = dsicm_probe_of(pdev); | ||
1223 | if (r) | ||
1224 | return r; | ||
1181 | } else { | 1225 | } else { |
1182 | return -ENODEV; | 1226 | return -ENODEV; |
1183 | } | 1227 | } |
@@ -1320,12 +1364,20 @@ static int __exit dsicm_remove(struct platform_device *pdev) | |||
1320 | return 0; | 1364 | return 0; |
1321 | } | 1365 | } |
1322 | 1366 | ||
1367 | static const struct of_device_id dsicm_of_match[] = { | ||
1368 | { .compatible = "omapdss,panel-dsi-cm", }, | ||
1369 | {}, | ||
1370 | }; | ||
1371 | |||
1372 | MODULE_DEVICE_TABLE(of, dsicm_of_match); | ||
1373 | |||
1323 | static struct platform_driver dsicm_driver = { | 1374 | static struct platform_driver dsicm_driver = { |
1324 | .probe = dsicm_probe, | 1375 | .probe = dsicm_probe, |
1325 | .remove = __exit_p(dsicm_remove), | 1376 | .remove = __exit_p(dsicm_remove), |
1326 | .driver = { | 1377 | .driver = { |
1327 | .name = "panel-dsi-cm", | 1378 | .name = "panel-dsi-cm", |
1328 | .owner = THIS_MODULE, | 1379 | .owner = THIS_MODULE, |
1380 | .of_match_table = dsicm_of_match, | ||
1329 | }, | 1381 | }, |
1330 | }; | 1382 | }; |
1331 | 1383 | ||