aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/dss/dss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss/dss.c')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss.c77
1 files changed, 17 insertions, 60 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index 14887d5b02e5..fa99ec72d832 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -38,6 +38,7 @@
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/of.h>
+#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <linux/suspend.h>
#include <linux/component.h>
@@ -117,14 +118,6 @@ static const char * const dss_generic_clk_source_names[] = {
[DSS_CLK_SRC_HDMI_PLL] = "HDMI PLL",
};
-static bool dss_initialized;
-
-bool omapdss_is_initialized(void)
-{
- return dss_initialized;
-}
-EXPORT_SYMBOL(omapdss_is_initialized);
-
static inline void dss_write_reg(const struct dss_reg idx, u32 val)
{
__raw_writel(val, dss.base + idx.idx);
@@ -1043,32 +1036,14 @@ static int dss_init_ports(struct platform_device *pdev)
{
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
- int r;
-
- if (parent == NULL)
- return 0;
-
- port = omapdss_of_get_next_port(parent, NULL);
- if (!port)
- return 0;
-
- if (dss.feat->num_ports == 0)
- return 0;
-
- do {
- enum omap_display_type port_type;
- u32 reg;
-
- r = of_property_read_u32(port, "reg", &reg);
- if (r)
- reg = 0;
+ int i;
- if (reg >= dss.feat->num_ports)
+ for (i = 0; i < dss.feat->num_ports; i++) {
+ port = of_graph_get_port_by_id(parent, i);
+ if (!port)
continue;
- port_type = dss.feat->ports[reg];
-
- switch (port_type) {
+ switch (dss.feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
dpi_init_port(pdev, port);
break;
@@ -1078,7 +1053,7 @@ static int dss_init_ports(struct platform_device *pdev)
default:
break;
}
- } while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
+ }
return 0;
}
@@ -1087,32 +1062,14 @@ static void dss_uninit_ports(struct platform_device *pdev)
{
struct device_node *parent = pdev->dev.of_node;
struct device_node *port;
+ int i;
- if (parent == NULL)
- return;
-
- port = omapdss_of_get_next_port(parent, NULL);
- if (!port)
- return;
-
- if (dss.feat->num_ports == 0)
- return;
-
- do {
- enum omap_display_type port_type;
- u32 reg;
- int r;
-
- r = of_property_read_u32(port, "reg", &reg);
- if (r)
- reg = 0;
-
- if (reg >= dss.feat->num_ports)
+ for (i = 0; i < dss.feat->num_ports; i++) {
+ port = of_graph_get_port_by_id(parent, i);
+ if (!port)
continue;
- port_type = dss.feat->ports[reg];
-
- switch (port_type) {
+ switch (dss.feat->ports[i]) {
case OMAP_DISPLAY_TYPE_DPI:
dpi_uninit_port(port);
break;
@@ -1122,7 +1079,7 @@ static void dss_uninit_ports(struct platform_device *pdev)
default:
break;
}
- } while ((port = omapdss_of_get_next_port(parent, port)) != NULL);
+ }
}
static int dss_video_pll_probe(struct platform_device *pdev)
@@ -1254,8 +1211,7 @@ static int dss_bind(struct device *dev)
dss.lcd_clk_source[1] = DSS_CLK_SRC_FCK;
rev = dss_read_reg(DSS_REVISION);
- printk(KERN_INFO "OMAP DSS rev %d.%d\n",
- FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
+ pr_info("OMAP DSS rev %d.%d\n", FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
dss_runtime_put();
@@ -1267,7 +1223,8 @@ static int dss_bind(struct device *dev)
pm_set_vt_switch(0);
- dss_initialized = true;
+ omapdss_gather_components(dev);
+ omapdss_set_is_initialized(true);
return 0;
@@ -1291,7 +1248,7 @@ static void dss_unbind(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
- dss_initialized = false;
+ omapdss_set_is_initialized(false);
component_unbind_all(&pdev->dev, NULL);