diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-07-30 03:35:30 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-03-19 05:03:09 -0400 |
commit | cfa71144df6d9eb3a15f58383ef3c7d507f113f3 (patch) | |
tree | 20d63f16fa7d46788c67245270a2f9f98c0f778d /drivers/video | |
parent | cdeeaca2a11d31d11e50590c6ddcee5e322ed6a4 (diff) |
OMAPDSS: encoder-tfp410: Add DT support
Add DT support for encoder-tfp410.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/displays-new/encoder-tfp410.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/drivers/video/omap2/displays-new/encoder-tfp410.c b/drivers/video/omap2/displays-new/encoder-tfp410.c index 4a291e756be9..b4e9a42a79e6 100644 --- a/drivers/video/omap2/displays-new/encoder-tfp410.c +++ b/drivers/video/omap2/displays-new/encoder-tfp410.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/of_gpio.h> | ||
16 | 17 | ||
17 | #include <video/omapdss.h> | 18 | #include <video/omapdss.h> |
18 | #include <video/omap-panel-data.h> | 19 | #include <video/omap-panel-data.h> |
@@ -82,7 +83,8 @@ static int tfp410_enable(struct omap_dss_device *dssdev) | |||
82 | return 0; | 83 | return 0; |
83 | 84 | ||
84 | in->ops.dpi->set_timings(in, &ddata->timings); | 85 | in->ops.dpi->set_timings(in, &ddata->timings); |
85 | in->ops.dpi->set_data_lines(in, ddata->data_lines); | 86 | if (ddata->data_lines) |
87 | in->ops.dpi->set_data_lines(in, ddata->data_lines); | ||
86 | 88 | ||
87 | r = in->ops.dpi->enable(in); | 89 | r = in->ops.dpi->enable(in); |
88 | if (r) | 90 | if (r) |
@@ -179,6 +181,33 @@ static int tfp410_probe_pdata(struct platform_device *pdev) | |||
179 | return 0; | 181 | return 0; |
180 | } | 182 | } |
181 | 183 | ||
184 | static int tfp410_probe_of(struct platform_device *pdev) | ||
185 | { | ||
186 | struct panel_drv_data *ddata = platform_get_drvdata(pdev); | ||
187 | struct device_node *node = pdev->dev.of_node; | ||
188 | struct omap_dss_device *in; | ||
189 | int gpio; | ||
190 | |||
191 | gpio = of_get_named_gpio(node, "powerdown-gpios", 0); | ||
192 | |||
193 | if (gpio_is_valid(gpio) || gpio == -ENOENT) { | ||
194 | ddata->pd_gpio = gpio; | ||
195 | } else { | ||
196 | dev_err(&pdev->dev, "failed to parse PD gpio\n"); | ||
197 | return gpio; | ||
198 | } | ||
199 | |||
200 | in = omapdss_of_find_source_for_first_ep(node); | ||
201 | if (IS_ERR(in)) { | ||
202 | dev_err(&pdev->dev, "failed to find video source\n"); | ||
203 | return PTR_ERR(in); | ||
204 | } | ||
205 | |||
206 | ddata->in = in; | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
182 | static int tfp410_probe(struct platform_device *pdev) | 211 | static int tfp410_probe(struct platform_device *pdev) |
183 | { | 212 | { |
184 | struct panel_drv_data *ddata; | 213 | struct panel_drv_data *ddata; |
@@ -195,6 +224,10 @@ static int tfp410_probe(struct platform_device *pdev) | |||
195 | r = tfp410_probe_pdata(pdev); | 224 | r = tfp410_probe_pdata(pdev); |
196 | if (r) | 225 | if (r) |
197 | return r; | 226 | return r; |
227 | } else if (pdev->dev.of_node) { | ||
228 | r = tfp410_probe_of(pdev); | ||
229 | if (r) | ||
230 | return r; | ||
198 | } else { | 231 | } else { |
199 | return -ENODEV; | 232 | return -ENODEV; |
200 | } | 233 | } |
@@ -251,12 +284,20 @@ static int __exit tfp410_remove(struct platform_device *pdev) | |||
251 | return 0; | 284 | return 0; |
252 | } | 285 | } |
253 | 286 | ||
287 | static const struct of_device_id tfp410_of_match[] = { | ||
288 | { .compatible = "omapdss,ti,tfp410", }, | ||
289 | {}, | ||
290 | }; | ||
291 | |||
292 | MODULE_DEVICE_TABLE(of, tfp410_of_match); | ||
293 | |||
254 | static struct platform_driver tfp410_driver = { | 294 | static struct platform_driver tfp410_driver = { |
255 | .probe = tfp410_probe, | 295 | .probe = tfp410_probe, |
256 | .remove = __exit_p(tfp410_remove), | 296 | .remove = __exit_p(tfp410_remove), |
257 | .driver = { | 297 | .driver = { |
258 | .name = "tfp410", | 298 | .name = "tfp410", |
259 | .owner = THIS_MODULE, | 299 | .owner = THIS_MODULE, |
300 | .of_match_table = tfp410_of_match, | ||
260 | }, | 301 | }, |
261 | }; | 302 | }; |
262 | 303 | ||