diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-08-13 10:11:32 -0400 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-11-21 09:50:00 -0500 |
commit | 7a4fcf91c83ad76d30ee876615d5fd35ef907e32 (patch) | |
tree | fa5df13092b397a1348afca1bc08cb1319cb0cbe /arch/arm/mach-shmobile/board-ag5evm.c | |
parent | 0707330b337cec85d7b393303e82f0fad5dc4c00 (diff) |
ARM: mach-shmobile: ag5evm: Add LCDC tx_dev field to platform data
Reference the MIPI-DSI transceiver in the LCDC platform data and make
sure it gets registered before the LCDC.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/board-ag5evm.c')
-rw-r--r-- | arch/arm/mach-shmobile/board-ag5evm.c | 157 |
1 files changed, 80 insertions, 77 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index 25eb88a923e6..52b5e64eb6b9 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -213,6 +213,84 @@ static struct platform_device irda_device = { | |||
213 | .num_resources = ARRAY_SIZE(irda_resources), | 213 | .num_resources = ARRAY_SIZE(irda_resources), |
214 | }; | 214 | }; |
215 | 215 | ||
216 | /* MIPI-DSI */ | ||
217 | static struct resource mipidsi0_resources[] = { | ||
218 | [0] = { | ||
219 | .name = "DSI0", | ||
220 | .start = 0xfeab0000, | ||
221 | .end = 0xfeab3fff, | ||
222 | .flags = IORESOURCE_MEM, | ||
223 | }, | ||
224 | [1] = { | ||
225 | .name = "DSI0", | ||
226 | .start = 0xfeab4000, | ||
227 | .end = 0xfeab7fff, | ||
228 | .flags = IORESOURCE_MEM, | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | static int sh_mipi_set_dot_clock(struct platform_device *pdev, | ||
233 | void __iomem *base, | ||
234 | int enable) | ||
235 | { | ||
236 | struct clk *pck, *phy; | ||
237 | int ret; | ||
238 | |||
239 | pck = clk_get(&pdev->dev, "dsip_clk"); | ||
240 | if (IS_ERR(pck)) { | ||
241 | ret = PTR_ERR(pck); | ||
242 | goto sh_mipi_set_dot_clock_pck_err; | ||
243 | } | ||
244 | |||
245 | phy = clk_get(&pdev->dev, "dsiphy_clk"); | ||
246 | if (IS_ERR(phy)) { | ||
247 | ret = PTR_ERR(phy); | ||
248 | goto sh_mipi_set_dot_clock_phy_err; | ||
249 | } | ||
250 | |||
251 | if (enable) { | ||
252 | clk_set_rate(pck, clk_round_rate(pck, 24000000)); | ||
253 | clk_set_rate(phy, clk_round_rate(pck, 510000000)); | ||
254 | clk_enable(pck); | ||
255 | clk_enable(phy); | ||
256 | } else { | ||
257 | clk_disable(pck); | ||
258 | clk_disable(phy); | ||
259 | } | ||
260 | |||
261 | ret = 0; | ||
262 | |||
263 | clk_put(phy); | ||
264 | sh_mipi_set_dot_clock_phy_err: | ||
265 | clk_put(pck); | ||
266 | sh_mipi_set_dot_clock_pck_err: | ||
267 | return ret; | ||
268 | } | ||
269 | |||
270 | static struct sh_mobile_lcdc_info lcdc0_info; | ||
271 | |||
272 | static struct sh_mipi_dsi_info mipidsi0_info = { | ||
273 | .data_format = MIPI_RGB888, | ||
274 | .lcd_chan = &lcdc0_info.ch[0], | ||
275 | .lane = 2, | ||
276 | .vsynw_offset = 20, | ||
277 | .clksrc = 1, | ||
278 | .flags = SH_MIPI_DSI_HSABM | | ||
279 | SH_MIPI_DSI_SYNC_PULSES_MODE | | ||
280 | SH_MIPI_DSI_HSbyteCLK, | ||
281 | .set_dot_clock = sh_mipi_set_dot_clock, | ||
282 | }; | ||
283 | |||
284 | static struct platform_device mipidsi0_device = { | ||
285 | .name = "sh-mipi-dsi", | ||
286 | .num_resources = ARRAY_SIZE(mipidsi0_resources), | ||
287 | .resource = mipidsi0_resources, | ||
288 | .id = 0, | ||
289 | .dev = { | ||
290 | .platform_data = &mipidsi0_info, | ||
291 | }, | ||
292 | }; | ||
293 | |||
216 | static unsigned char lcd_backlight_seq[3][2] = { | 294 | static unsigned char lcd_backlight_seq[3][2] = { |
217 | { 0x04, 0x07 }, | 295 | { 0x04, 0x07 }, |
218 | { 0x23, 0x80 }, | 296 | { 0x23, 0x80 }, |
@@ -275,6 +353,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = { | |||
275 | .display_on = lcd_backlight_on, | 353 | .display_on = lcd_backlight_on, |
276 | .display_off = lcd_backlight_reset, | 354 | .display_off = lcd_backlight_reset, |
277 | }, | 355 | }, |
356 | .tx_dev = &mipidsi0_device, | ||
278 | } | 357 | } |
279 | }; | 358 | }; |
280 | 359 | ||
@@ -302,82 +381,6 @@ static struct platform_device lcdc0_device = { | |||
302 | }, | 381 | }, |
303 | }; | 382 | }; |
304 | 383 | ||
305 | /* MIPI-DSI */ | ||
306 | static struct resource mipidsi0_resources[] = { | ||
307 | [0] = { | ||
308 | .name = "DSI0", | ||
309 | .start = 0xfeab0000, | ||
310 | .end = 0xfeab3fff, | ||
311 | .flags = IORESOURCE_MEM, | ||
312 | }, | ||
313 | [1] = { | ||
314 | .name = "DSI0", | ||
315 | .start = 0xfeab4000, | ||
316 | .end = 0xfeab7fff, | ||
317 | .flags = IORESOURCE_MEM, | ||
318 | }, | ||
319 | }; | ||
320 | |||
321 | static int sh_mipi_set_dot_clock(struct platform_device *pdev, | ||
322 | void __iomem *base, | ||
323 | int enable) | ||
324 | { | ||
325 | struct clk *pck, *phy; | ||
326 | int ret; | ||
327 | |||
328 | pck = clk_get(&pdev->dev, "dsip_clk"); | ||
329 | if (IS_ERR(pck)) { | ||
330 | ret = PTR_ERR(pck); | ||
331 | goto sh_mipi_set_dot_clock_pck_err; | ||
332 | } | ||
333 | |||
334 | phy = clk_get(&pdev->dev, "dsiphy_clk"); | ||
335 | if (IS_ERR(phy)) { | ||
336 | ret = PTR_ERR(phy); | ||
337 | goto sh_mipi_set_dot_clock_phy_err; | ||
338 | } | ||
339 | |||
340 | if (enable) { | ||
341 | clk_set_rate(pck, clk_round_rate(pck, 24000000)); | ||
342 | clk_set_rate(phy, clk_round_rate(pck, 510000000)); | ||
343 | clk_enable(pck); | ||
344 | clk_enable(phy); | ||
345 | } else { | ||
346 | clk_disable(pck); | ||
347 | clk_disable(phy); | ||
348 | } | ||
349 | |||
350 | ret = 0; | ||
351 | |||
352 | clk_put(phy); | ||
353 | sh_mipi_set_dot_clock_phy_err: | ||
354 | clk_put(pck); | ||
355 | sh_mipi_set_dot_clock_pck_err: | ||
356 | return ret; | ||
357 | } | ||
358 | |||
359 | static struct sh_mipi_dsi_info mipidsi0_info = { | ||
360 | .data_format = MIPI_RGB888, | ||
361 | .lcd_chan = &lcdc0_info.ch[0], | ||
362 | .lane = 2, | ||
363 | .vsynw_offset = 20, | ||
364 | .clksrc = 1, | ||
365 | .flags = SH_MIPI_DSI_HSABM | | ||
366 | SH_MIPI_DSI_SYNC_PULSES_MODE | | ||
367 | SH_MIPI_DSI_HSbyteCLK, | ||
368 | .set_dot_clock = sh_mipi_set_dot_clock, | ||
369 | }; | ||
370 | |||
371 | static struct platform_device mipidsi0_device = { | ||
372 | .name = "sh-mipi-dsi", | ||
373 | .num_resources = ARRAY_SIZE(mipidsi0_resources), | ||
374 | .resource = mipidsi0_resources, | ||
375 | .id = 0, | ||
376 | .dev = { | ||
377 | .platform_data = &mipidsi0_info, | ||
378 | }, | ||
379 | }; | ||
380 | |||
381 | /* Fixed 2.8V regulators to be used by SDHI0 */ | 384 | /* Fixed 2.8V regulators to be used by SDHI0 */ |
382 | static struct regulator_consumer_supply fixed2v8_power_consumers[] = | 385 | static struct regulator_consumer_supply fixed2v8_power_consumers[] = |
383 | { | 386 | { |
@@ -531,8 +534,8 @@ static struct platform_device *ag5evm_devices[] __initdata = { | |||
531 | &fsi_device, | 534 | &fsi_device, |
532 | &mmc_device, | 535 | &mmc_device, |
533 | &irda_device, | 536 | &irda_device, |
534 | &lcdc0_device, | ||
535 | &mipidsi0_device, | 537 | &mipidsi0_device, |
538 | &lcdc0_device, | ||
536 | &sdhi0_device, | 539 | &sdhi0_device, |
537 | &sdhi1_device, | 540 | &sdhi1_device, |
538 | }; | 541 | }; |