OMAP: DSS2: remove unneeded fck enable/disables
[deliverable/linux.git] / arch / arm / mach-omap2 / display.c
CommitLineData
b7ee79ab
SS
1/*
2 * OMAP2plus display device setup / initialization.
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
5 * Senthilvadivu Guruswamy
6 * Sumit Semwal
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24
a0b38cc4 25#include <video/omapdss.h>
cf07f531
SG
26#include <plat/omap_hwmod.h>
27#include <plat/omap_device.h>
700dee78 28#include <plat/omap-pm.h>
b7ee79ab
SS
29
30static struct platform_device omap_display_device = {
31 .name = "omapdss",
32 .id = -1,
33 .dev = {
34 .platform_data = NULL,
35 },
36};
37
cf07f531
SG
38static struct omap_device_pm_latency omap_dss_latency[] = {
39 [0] = {
40 .deactivate_func = omap_device_idle_hwmods,
41 .activate_func = omap_device_enable_hwmods,
42 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
43 },
44};
45
179e0453
AT
46struct omap_dss_hwmod_data {
47 const char *oh_name;
48 const char *dev_name;
49 const int id;
50};
51
52static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initdata = {
53 { "dss_core", "omapdss_dss", -1 },
54 { "dss_dispc", "omapdss_dispc", -1 },
55 { "dss_rfbi", "omapdss_rfbi", -1 },
56 { "dss_venc", "omapdss_venc", -1 },
57};
58
59static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = {
60 { "dss_core", "omapdss_dss", -1 },
61 { "dss_dispc", "omapdss_dispc", -1 },
62 { "dss_rfbi", "omapdss_rfbi", -1 },
63 { "dss_venc", "omapdss_venc", -1 },
64 { "dss_dsi1", "omapdss_dsi1", -1 },
65};
66
67static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = {
68 { "dss_core", "omapdss_dss", -1 },
69 { "dss_dispc", "omapdss_dispc", -1 },
70 { "dss_rfbi", "omapdss_rfbi", -1 },
71 { "dss_venc", "omapdss_venc", -1 },
72 { "dss_dsi1", "omapdss_dsi1", -1 },
73 { "dss_dsi2", "omapdss_dsi2", -1 },
74 { "dss_hdmi", "omapdss_hdmi", -1 },
75};
76
b7ee79ab
SS
77int __init omap_display_init(struct omap_dss_board_info *board_data)
78{
79 int r = 0;
cf07f531
SG
80 struct omap_hwmod *oh;
81 struct omap_device *od;
179e0453 82 int i, oh_count;
cf07f531 83 struct omap_display_platform_data pdata;
179e0453 84 const struct omap_dss_hwmod_data *curr_dss_hwmod;
cf07f531
SG
85
86 memset(&pdata, 0, sizeof(pdata));
87
179e0453
AT
88 if (cpu_is_omap24xx()) {
89 curr_dss_hwmod = omap2_dss_hwmod_data;
90 oh_count = ARRAY_SIZE(omap2_dss_hwmod_data);
91 } else if (cpu_is_omap34xx()) {
92 curr_dss_hwmod = omap3_dss_hwmod_data;
93 oh_count = ARRAY_SIZE(omap3_dss_hwmod_data);
94 } else {
95 curr_dss_hwmod = omap4_dss_hwmod_data;
96 oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
97 }
545376e7 98
cf07f531 99 pdata.board_data = board_data;
700dee78
TV
100 pdata.board_data->get_context_loss_count =
101 omap_pm_get_dev_context_loss_count;
cf07f531
SG
102
103 for (i = 0; i < oh_count; i++) {
179e0453 104 oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
cf07f531 105 if (!oh) {
179e0453
AT
106 pr_err("Could not look up %s\n",
107 curr_dss_hwmod[i].oh_name);
cf07f531
SG
108 return -ENODEV;
109 }
fd4b34f6 110
179e0453
AT
111 od = omap_device_build(curr_dss_hwmod[i].dev_name,
112 curr_dss_hwmod[i].id, oh, &pdata,
cf07f531
SG
113 sizeof(struct omap_display_platform_data),
114 omap_dss_latency,
115 ARRAY_SIZE(omap_dss_latency), 0);
116
117 if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n",
179e0453 118 curr_dss_hwmod[i].oh_name))
cf07f531
SG
119 return -ENODEV;
120 }
b7ee79ab
SS
121 omap_display_device.dev.platform_data = board_data;
122
123 r = platform_device_register(&omap_display_device);
124 if (r < 0)
125 printk(KERN_ERR "Unable to register OMAP-Display device\n");
126
127 return r;
128}
This page took 0.054341 seconds and 5 git commands to generate.