OMAPDSS: connector-dvi: Add DT support
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 30 Jul 2013 07:36:29 +0000 (10:36 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 19 Mar 2014 09:03:09 +0000 (11:03 +0200)
Add DT support for connector-dvi.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Archit Taneja <archit@ti.com>
drivers/video/omap2/displays-new/connector-dvi.c

index b6c50904038efcce92c9b324d846a16bfa07a4ef..d5fb77147f9eefe995a8f4bba28d2750ef53915c 100644 (file)
@@ -277,6 +277,37 @@ static int dvic_probe_pdata(struct platform_device *pdev)
        return 0;
 }
 
+static int dvic_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;
+       struct device_node *adapter_node;
+       struct i2c_adapter *adapter;
+
+       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;
+
+       adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0);
+       if (adapter_node) {
+               adapter = of_find_i2c_adapter_by_node(adapter_node);
+               if (adapter == NULL) {
+                       dev_err(&pdev->dev, "failed to parse ddc-i2c-bus\n");
+                       omap_dss_put_device(ddata->in);
+                       return -EPROBE_DEFER;
+               }
+
+               ddata->i2c_adapter = adapter;
+       }
+
+       return 0;
+}
+
 static int dvic_probe(struct platform_device *pdev)
 {
        struct panel_drv_data *ddata;
@@ -293,6 +324,10 @@ static int dvic_probe(struct platform_device *pdev)
                r = dvic_probe_pdata(pdev);
                if (r)
                        return r;
+       } else if (pdev->dev.of_node) {
+               r = dvic_probe_of(pdev);
+               if (r)
+                       return r;
        } else {
                return -ENODEV;
        }
@@ -342,12 +377,20 @@ static int __exit dvic_remove(struct platform_device *pdev)
        return 0;
 }
 
+static const struct of_device_id dvic_of_match[] = {
+       { .compatible = "omapdss,dvi-connector", },
+       {},
+};
+
+MODULE_DEVICE_TABLE(of, dvic_of_match);
+
 static struct platform_driver dvi_connector_driver = {
        .probe  = dvic_probe,
        .remove = __exit_p(dvic_remove),
        .driver = {
                .name   = "connector-dvi",
                .owner  = THIS_MODULE,
+               .of_match_table = dvic_of_match,
        },
 };
 
This page took 0.025733 seconds and 5 git commands to generate.