aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-02-20 04:50:06 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-11 07:44:51 -0400
commit00928eaf52007ee4e1fb7dc860bc02a56c125bb4 (patch)
treef5e4b086bf57243d1d5b1ae7f38891c26b473263
parente23d83b0c92bbe30d1fe9d5c0b972e50c6593946 (diff)
OMAPDSS: clean up the omapdss platform data mess
The omapdss pdata handling is a mess. This is more evident when trying to use device tree for DSS, as we don't have platform data anymore in that case. This patch cleans the pdata handling by: - Remove struct omap_display_platform_data. It was used just as a wrapper for struct omap_dss_board_info. - Pass the platform data only to omapdss device. The drivers for omap dss hwmods do not need the platform data. This should also work better for DT, as we can create omapdss device programmatically in generic omap boot code, and thus we can pass the pdata to it. - Create dss functions for get_ctx_loss_count and dsi_enable/disable_pads that the dss hwmod drivers can call. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--arch/arm/mach-omap2/display.c39
-rw-r--r--drivers/video/omap2/dss/core.c35
-rw-r--r--drivers/video/omap2/dss/dispc.c21
-rw-r--r--drivers/video/omap2/dss/dsi.c17
-rw-r--r--drivers/video/omap2/dss/dss.h3
-rw-r--r--drivers/video/omap2/dss/hdmi.c2
-rw-r--r--include/video/omapdss.h5
7 files changed, 62 insertions, 60 deletions
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 60cded4738a0..07232fd7ab17 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -191,10 +191,24 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
191 struct omap_hwmod *oh; 191 struct omap_hwmod *oh;
192 struct platform_device *pdev; 192 struct platform_device *pdev;
193 int i, oh_count; 193 int i, oh_count;
194 struct omap_display_platform_data pdata;
195 const struct omap_dss_hwmod_data *curr_dss_hwmod; 194 const struct omap_dss_hwmod_data *curr_dss_hwmod;
196 195
197 memset(&pdata, 0, sizeof(pdata)); 196 /* create omapdss device */
197
198 board_data->dsi_enable_pads = omap_dsi_enable_pads;
199 board_data->dsi_disable_pads = omap_dsi_disable_pads;
200 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
201 board_data->set_min_bus_tput = omap_dss_set_min_bus_tput;
202
203 omap_display_device.dev.platform_data = board_data;
204
205 r = platform_device_register(&omap_display_device);
206 if (r < 0) {
207 pr_err("Unable to register omapdss device\n");
208 return r;
209 }
210
211 /* create devices for dss hwmods */
198 212
199 if (cpu_is_omap24xx()) { 213 if (cpu_is_omap24xx()) {
200 curr_dss_hwmod = omap2_dss_hwmod_data; 214 curr_dss_hwmod = omap2_dss_hwmod_data;
@@ -207,16 +221,6 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
207 oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); 221 oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
208 } 222 }
209 223
210 if (board_data->dsi_enable_pads == NULL)
211 board_data->dsi_enable_pads = omap_dsi_enable_pads;
212 if (board_data->dsi_disable_pads == NULL)
213 board_data->dsi_disable_pads = omap_dsi_disable_pads;
214
215 pdata.board_data = board_data;
216 pdata.board_data->get_context_loss_count =
217 omap_pm_get_dev_context_loss_count;
218 pdata.board_data->set_min_bus_tput = omap_dss_set_min_bus_tput;
219
220 for (i = 0; i < oh_count; i++) { 224 for (i = 0; i < oh_count; i++) {
221 oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); 225 oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
222 if (!oh) { 226 if (!oh) {
@@ -226,21 +230,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
226 } 230 }
227 231
228 pdev = omap_device_build(curr_dss_hwmod[i].dev_name, 232 pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
229 curr_dss_hwmod[i].id, oh, &pdata, 233 curr_dss_hwmod[i].id, oh,
230 sizeof(struct omap_display_platform_data), 234 NULL, 0,
231 NULL, 0, 0); 235 NULL, 0, 0);
232 236
233 if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", 237 if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
234 curr_dss_hwmod[i].oh_name)) 238 curr_dss_hwmod[i].oh_name))
235 return -ENODEV; 239 return -ENODEV;
236 } 240 }
237 omap_display_device.dev.platform_data = board_data;
238 241
239 r = platform_device_register(&omap_display_device); 242 return 0;
240 if (r < 0)
241 printk(KERN_ERR "Unable to register OMAP-Display device\n");
242
243 return r;
244} 243}
245 244
246static void dispc_disable_outputs(void) 245static void dispc_disable_outputs(void)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 64cb8aa49b26..b37b6f484c08 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -87,6 +87,41 @@ struct regulator *dss_get_vdds_sdi(void)
87 return reg; 87 return reg;
88} 88}
89 89
90int dss_get_ctx_loss_count(struct device *dev)
91{
92 struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
93 int cnt;
94
95 if (!board_data->get_context_loss_count)
96 return -ENOENT;
97
98 cnt = board_data->get_context_loss_count(dev);
99
100 WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt);
101
102 return cnt;
103}
104
105int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
106{
107 struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
108
109 if (!board_data->dsi_enable_pads)
110 return -ENOENT;
111
112 return board_data->dsi_enable_pads(dsi_id, lane_mask);
113}
114
115void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask)
116{
117 struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
118
119 if (!board_data->dsi_enable_pads)
120 return;
121
122 return board_data->dsi_disable_pads(dsi_id, lane_mask);
123}
124
90int dss_set_min_bus_tput(struct device *dev, unsigned long tput) 125int dss_set_min_bus_tput(struct device *dev, unsigned long tput)
91{ 126{
92 struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; 127 struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 727e15b29a14..2c43119b5ade 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx)
131 return __raw_readl(dispc.base + idx); 131 return __raw_readl(dispc.base + idx);
132} 132}
133 133
134static int dispc_get_ctx_loss_count(void)
135{
136 struct device *dev = &dispc.pdev->dev;
137 struct omap_display_platform_data *pdata = dev->platform_data;
138 struct omap_dss_board_info *board_data = pdata->board_data;
139 int cnt;
140
141 if (!board_data->get_context_loss_count)
142 return -ENOENT;
143
144 cnt = board_data->get_context_loss_count(dev);
145
146 WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt);
147
148 return cnt;
149}
150
151#define SR(reg) \ 134#define SR(reg) \
152 dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) 135 dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
153#define RR(reg) \ 136#define RR(reg) \
@@ -251,7 +234,7 @@ static void dispc_save_context(void)
251 if (dss_has_feature(FEAT_CORE_CLK_DIV)) 234 if (dss_has_feature(FEAT_CORE_CLK_DIV))
252 SR(DIVISOR); 235 SR(DIVISOR);
253 236
254 dispc.ctx_loss_cnt = dispc_get_ctx_loss_count(); 237 dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev);
255 dispc.ctx_valid = true; 238 dispc.ctx_valid = true;
256 239
257 DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); 240 DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt);
@@ -266,7 +249,7 @@ static void dispc_restore_context(void)
266 if (!dispc.ctx_valid) 249 if (!dispc.ctx_valid)
267 return; 250 return;
268 251
269 ctx = dispc_get_ctx_loss_count(); 252 ctx = dss_get_ctx_loss_count(&dispc.pdev->dev);
270 253
271 if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) 254 if (ctx >= 0 && ctx == dispc.ctx_loss_cnt)
272 return; 255 return;
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a243e65b870f..d18c8e290c85 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -261,9 +261,6 @@ struct dsi_data {
261 struct clk *dss_clk; 261 struct clk *dss_clk;
262 struct clk *sys_clk; 262 struct clk *sys_clk;
263 263
264 int (*enable_pads)(int dsi_id, unsigned lane_mask);
265 void (*disable_pads)(int dsi_id, unsigned lane_mask);
266
267 struct dsi_clock_info current_cinfo; 264 struct dsi_clock_info current_cinfo;
268 265
269 bool vdds_dsi_enabled; 266 bool vdds_dsi_enabled;
@@ -2306,7 +2303,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev)