aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorSenthilvadivu Guruswamy <svadivu@ti.com>2011-01-24 01:21:56 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-03-11 08:46:19 -0500
commitcf07f5316215972e987c63b0a75a922c89813781 (patch)
tree08abe66ffc6427af41ee43df0847598ce7eee8df /arch/arm/mach-omap2
parent8ba775ca0d375ab42404ffd7a1a38326a7b21321 (diff)
OMAP2,3: DSS2: Build omap_device for each DSS HWIP
Looks up the hwmod database for each of the given DSS HW IP and builds omap_device which inturn does the platform device register for each of DSS HW IP Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com> Signed-off-by: Sumit Semwal <sumit.semwal@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/display.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index b18db84b034..ee8303037d3 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -23,6 +23,8 @@
23#include <linux/err.h> 23#include <linux/err.h>
24 24
25#include <plat/display.h> 25#include <plat/display.h>
26#include <plat/omap_hwmod.h>
27#include <plat/omap_device.h>
26 28
27static struct platform_device omap_display_device = { 29static struct platform_device omap_display_device = {
28 .name = "omapdss", 30 .name = "omapdss",
@@ -32,9 +34,59 @@ static struct platform_device omap_display_device = {
32 }, 34 },
33}; 35};
34 36
37static struct omap_device_pm_latency omap_dss_latency[] = {
38 [0] = {
39 .deactivate_func = omap_device_idle_hwmods,
40 .activate_func = omap_device_enable_hwmods,
41 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
42 },
43};
44
35int __init omap_display_init(struct omap_dss_board_info *board_data) 45int __init omap_display_init(struct omap_dss_board_info *board_data)
36{ 46{
37 int r = 0; 47 int r = 0;
48 struct omap_hwmod *oh;
49 struct omap_device *od;
50 int i;
51 struct omap_display_platform_data pdata;
52
53 /*
54 * omap: valid DSS hwmod names
55 * omap2,3: dss_core, dss_dispc, dss_rfbi, dss_venc
56 * omap3: dss_dsi1
57 */
58 char *oh_name[] = { "dss_core", "dss_dispc", "dss_rfbi", "dss_venc",
59 "dss_dsi1" };
60 char *dev_name[] = { "omapdss_dss", "omapdss_dispc", "omapdss_rfbi",
61 "omapdss_venc", "omapdss_dsi1" };
62 int oh_count;
63
64 memset(&pdata, 0, sizeof(pdata));
65
66 if (cpu_is_omap24xx())
67 oh_count = ARRAY_SIZE(oh_name) - 1;
68 /* last hwmod dev in oh_name is not available for omap2 */
69 else
70 oh_count = ARRAY_SIZE(oh_name);
71
72 pdata.board_data = board_data;
73 pdata.board_data->get_last_off_on_transaction_id = NULL;
74
75 for (i = 0; i < oh_count; i++) {
76 oh = omap_hwmod_lookup(oh_name[i]);
77 if (!oh) {
78 pr_err("Could not look up %s\n", oh_name[i]);
79 return -ENODEV;
80 }
81 od = omap_device_build(dev_name[i], -1, oh, &pdata,
82 sizeof(struct omap_display_platform_data),
83 omap_dss_latency,
84 ARRAY_SIZE(omap_dss_latency), 0);
85
86 if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n",
87 oh_name[i]))
88 return -ENODEV;
89 }
38 omap_display_device.dev.platform_data = board_data; 90 omap_display_device.dev.platform_data = board_data;
39 91
40 r = platform_device_register(&omap_display_device); 92 r = platform_device_register(&omap_display_device);