aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenthilvadivu Guruswamy <svadivu@ti.com>2011-01-24 01:22:02 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-03-11 08:46:21 -0500
commitc8aac01b7bd1109795586db11ea7f12ab1e2d163 (patch)
treeea58a702e4f3fe550548daa724c2ee71dd5ac1b7
parent30ea50c9f5166a375b4dc0109d18a5d21bab5711 (diff)
OMAP2, 3: DSS2: DSI: create platform_driver, move init, exit to driver
Hwmod adaptation design requires each of the DSS HW IP to be a platform driver. So a platform_driver for DSI is created and init exit methods are moved from core.c to its driver probe,remove. pdev member has to be maintained by its own drivers. Also, vdds_dsi regulator handling is copied to dsi.c, since vdds_dsi regulator is needed by dpi_init() too. Board files are updated accordingly to add 2 instances of vdds_dsi regulator. DSI platform driver is registered from inside omap_dss_probe, in the order desired. 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>
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c10
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c10
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c10
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c10
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c10
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c10
-rw-r--r--drivers/video/omap2/dss/core.c8
-rw-r--r--drivers/video/omap2/dss/dsi.c64
-rw-r--r--drivers/video/omap2/dss/dss.h8
11 files changed, 107 insertions, 35 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 652e7c38c62e..75814ae4dd07 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -401,6 +401,7 @@ static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
401/* VPLL2 for digital video outputs */ 401/* VPLL2 for digital video outputs */
402static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = { 402static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
403 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 403 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
404 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
404}; 405};
405 406
406static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = { 407static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index b64774b3d82c..e102e143afb1 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -277,8 +277,10 @@ static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
277 .setup = devkit8000_twl_gpio_setup, 277 .setup = devkit8000_twl_gpio_setup,
278}; 278};
279 279
280static struct regulator_consumer_supply devkit8000_vpll1_supply = 280static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = {
281 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 281 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
282 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
283};
282 284
283/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ 285/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
284static struct regulator_init_data devkit8000_vmmc1 = { 286static struct regulator_init_data devkit8000_vmmc1 = {
@@ -319,8 +321,8 @@ static struct regulator_init_data devkit8000_vpll1 = {
319 .valid_ops_mask = REGULATOR_CHANGE_MODE 321 .valid_ops_mask = REGULATOR_CHANGE_MODE
320 | REGULATOR_CHANGE_STATUS, 322 | REGULATOR_CHANGE_STATUS,
321 }, 323 },
322 .num_consumer_supplies = 1, 324 .num_consumer_supplies = ARRAY_SIZE(devkit8000_vpll1_supplies),
323 .consumer_supplies = &devkit8000_vpll1_supply, 325 .consumer_supplies = devkit8000_vpll1_supplies,
324}; 326};
325 327
326/* VAUX4 for ads7846 and nubs */ 328/* VAUX4 for ads7846 and nubs */
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index c4b3c1c47ec6..12b3e41b6f78 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -485,8 +485,10 @@ static struct omap_dss_board_info igep2_dss_data = {
485 .default_device = &igep2_dvi_device, 485 .default_device = &igep2_dvi_device,
486}; 486};
487 487
488static struct regulator_consumer_supply igep2_vpll2_supply = 488static struct regulator_consumer_supply igep2_vpll2_supplies[] = {
489 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 489 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
490 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
491};
490 492
491static struct regulator_init_data igep2_vpll2 = { 493static struct regulator_init_data igep2_vpll2 = {
492 .constraints = { 494 .constraints = {
@@ -499,8 +501,8 @@ static struct regulator_init_data igep2_vpll2 = {
499 .valid_ops_mask = REGULATOR_CHANGE_MODE 501 .valid_ops_mask = REGULATOR_CHANGE_MODE
500 | REGULATOR_CHANGE_STATUS, 502 | REGULATOR_CHANGE_STATUS,
501 }, 503 },
502 .num_consumer_supplies = 1, 504 .num_consumer_supplies = ARRAY_SIZE(igep2_vpll2_supplies),
503 .consumer_supplies = &igep2_vpll2_supply, 505 .consumer_supplies = igep2_vpll2_supplies,
504}; 506};
505 507
506static void __init igep2_display_init(void) 508static void __init igep2_display_init(void)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 2fad38f9e683..e663c43fe039 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -234,8 +234,10 @@ static struct omap_dss_board_info beagle_dss_data = {
234static struct regulator_consumer_supply beagle_vdac_supply = 234static struct regulator_consumer_supply beagle_vdac_supply =
235 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"); 235 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
236 236
237static struct regulator_consumer_supply beagle_vdvi_supply = 237static struct regulator_consumer_supply beagle_vdvi_supplies[] = {
238 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 238 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
239 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
240};
239 241
240static void __init beagle_display_init(void) 242static void __init beagle_display_init(void)
241{ 243{
@@ -422,8 +424,8 @@ static struct regulator_init_data beagle_vpll2 = {
422 .valid_ops_mask = REGULATOR_CHANGE_MODE 424 .valid_ops_mask = REGULATOR_CHANGE_MODE
423 | REGULATOR_CHANGE_STATUS, 425 | REGULATOR_CHANGE_STATUS,
424 }, 426 },
425 .num_consumer_supplies = 1, 427 .num_consumer_supplies = ARRAY_SIZE(beagle_vdvi_supplies),
426 .consumer_supplies = &beagle_vdvi_supply, 428 .consumer_supplies = beagle_vdvi_supplies,
427}; 429};
428 430
429static struct twl4030_usb_data beagle_usb_data = { 431static struct twl4030_usb_data beagle_usb_data = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index a6564b41b97a..5800db31e561 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -560,8 +560,10 @@ static struct regulator_init_data omap3_evm_vdac = {
560}; 560};
561 561
562/* VPLL2 for digital video outputs */ 562/* VPLL2 for digital video outputs */
563static struct regulator_consumer_supply omap3_evm_vpll2_supply = 563static struct regulator_consumer_supply omap3_evm_vpll2_supplies[] = {
564 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 564 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
565 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
566};
565 567
566static struct regulator_init_data omap3_evm_vpll2 = { 568static struct regulator_init_data omap3_evm_vpll2 = {
567 .constraints = { 569 .constraints = {
@@ -573,8 +575,8 @@ static struct regulator_init_data omap3_evm_vpll2 = {
573 .valid_ops_mask = REGULATOR_CHANGE_MODE 575 .valid_ops_mask = REGULATOR_CHANGE_MODE
574 | REGULATOR_CHANGE_STATUS, 576 | REGULATOR_CHANGE_STATUS,
575 }, 577 },
576 .num_consumer_supplies = 1, 578 .num_consumer_supplies = ARRAY_SIZE(omap3_evm_vpll2_supplies),
577 .consumer_supplies = &omap3_evm_vpll2_supply, 579 .consumer_supplies = omap3_evm_vpll2_supplies,
578}; 580};
579 581
580/* ads7846 on SPI */ 582/* ads7846 on SPI */
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 37de418edd2a..131a58dd3c96 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -347,6 +347,7 @@ static struct regulator_consumer_supply pandora_vdda_dac_supply =
347static struct regulator_consumer_supply pandora_vdds_supplies[] = { 347static struct regulator_consumer_supply pandora_vdds_supplies[] = {
348 REGULATOR_SUPPLY("vdds_sdi", "omapdss"), 348 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
349 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 349 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
350 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
350}; 351};
351 352
352static struct regulator_consumer_supply pandora_vcc_lcd_supply = 353static struct regulator_consumer_supply pandora_vcc_lcd_supply =
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index bd0eed858078..d1163a80f843 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -457,8 +457,10 @@ static struct regulator_init_data omap3_stalker_vdac = {
457}; 457};
458 458
459/* VPLL2 for digital video outputs */ 459/* VPLL2 for digital video outputs */
460static struct regulator_consumer_supply omap3_stalker_vpll2_supply = 460static struct regulator_consumer_supply omap3_stalker_vpll2_supplies[] = {
461 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 461 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
462 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
463};
462 464
463static struct regulator_init_data omap3_stalker_vpll2 = { 465static struct regulator_init_data omap3_stalker_vpll2 = {
464 .constraints = { 466 .constraints = {
@@ -471,8 +473,8 @@ static struct regulator_init_data omap3_stalker_vpll2 = {
471 .valid_ops_mask = REGULATOR_CHANGE_MODE 473 .valid_ops_mask = REGULATOR_CHANGE_MODE
472 | REGULATOR_CHANGE_STATUS, 474 | REGULATOR_CHANGE_STATUS,
473 }, 475 },
474 .num_consumer_supplies = 1, 476 .num_consumer_supplies = ARRAY_SIZE(omap3_stalker_vpll2_supplies),
475 .consumer_supplies = &omap3_stalker_vpll2_supply, 477 .consumer_supplies = omap3_stalker_vpll2_supplies,
476}; 478};
477 479
478static struct twl4030_platform_data omap3stalker_twldata = { 480static struct twl4030_platform_data omap3stalker_twldata = {
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 405400c4762b..8dee7549fbdf 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -226,8 +226,10 @@ static struct omap2_hsmmc_info mmc[] = {
226 {} /* Terminator */ 226 {} /* Terminator */
227}; 227};
228 228
229static struct regulator_consumer_supply zoom_vpll2_supply = 229static struct regulator_consumer_supply zoom_vpll2_supplies[] = {
230 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 230 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
231 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
232};
231 233
232static struct regulator_consumer_supply zoom_vdda_dac_supply = 234static struct regulator_consumer_supply zoom_vdda_dac_supply =
233 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"); 235 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
@@ -241,8 +243,8 @@ static struct regulator_init_data zoom_vpll2 = {
241 .valid_ops_mask = REGULATOR_CHANGE_MODE 243 .valid_ops_mask = REGULATOR_CHANGE_MODE
242 | REGULATOR_CHANGE_STATUS, 244 | REGULATOR_CHANGE_STATUS,
243 }, 245 },
244 .num_consumer_supplies = 1, 246 .num_consumer_supplies = ARRAY_SIZE(zoom_vpll2_supplies),
245 .consumer_supplies = &zoom_vpll2_supply, 247 .consumer_supplies = zoom_vpll2_supplies,
246}; 248};
247 249
248static struct regulator_init_data zoom_vdac = { 250static struct regulator_init_data zoom_vdac = {
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 57c6303cb1cd..3f7a5fcd1142 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -222,9 +222,9 @@ static int omap_dss_probe(struct platform_device *pdev)
222 goto err_sdi; 222 goto err_sdi;
223 } 223 }
224 224
225 r = dsi_init(pdev); 225 r = dsi_init_platform_driver();
226 if (r) { 226 if (r) {
227 DSSERR("Failed to initialize DSI\n"); 227 DSSERR("Failed to initialize DSI platform driver\n");
228 goto err_dsi; 228 goto err_dsi;
229 } 229 }
230 } 230 }
@@ -259,7 +259,7 @@ err_register:
259 dss_uninitialize_debugfs(); 259 dss_uninitialize_debugfs();
260err_debugfs: 260err_debugfs:
261 if (cpu_is_omap34xx()) 261 if (cpu_is_omap34xx())
262 dsi_exit(); 262 dsi_uninit_platform_driver();
263err_dsi: 263err_dsi:
264 if (cpu_is_omap34xx()) 264 if (cpu_is_omap34xx())
265 sdi_exit(); 265 sdi_exit();
@@ -290,7 +290,7 @@ static int omap_dss_remove(struct platform_device *pdev)
290 dpi_exit(); 290 dpi_exit();
291 rfbi_uninit_platform_driver(); 291 rfbi_uninit_platform_driver();
292 if (cpu_is_omap34xx()) { 292 if (cpu_is_omap34xx()) {
293 dsi_exit(); 293 dsi_uninit_platform_driver();
294 sdi_exit(); 294 sdi_exit();
295 } 295 }
296 296
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index ddf3a0560822..fa85f1adba2a 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -222,6 +222,7 @@ struct dsi_irq_stats {
222 222
223static struct 223static struct
224{ 224{
225 struct platform_device *pdev;
225 void __iomem *base; 226 void __iomem *base;
226 227
227 struct dsi_clock_info current_cinfo; 228 struct dsi_clock_info current_cinfo;
@@ -292,6 +293,20 @@ static inline u32 dsi_read_reg(const struct dsi_reg idx)
292 return __raw_readl(dsi.base + idx.idx); 293 return __raw_readl(dsi.base + idx.idx);
293} 294}
294 295
296static struct regulator *dsi_get_vdds_dsi(void)
297{
298 struct regulator *reg;
299
300 if (dsi.vdds_dsi_reg != NULL)
301 return dsi.vdds_dsi_reg;
302
303 reg = regulator_get(&dsi.pdev->dev, "vdds_dsi");
304 if (!IS_ERR(reg))
305 dsi.vdds_dsi_reg = reg;
306
307 return reg;
308}
309
295 310
296void dsi_save_context(void) 311void dsi_save_context(void)
297{ 312{
@@ -3238,7 +3253,7 @@ void dsi_wait_dsi2_pll_active(void)
3238 DSSERR("DSI2 PLL clock not active\n"); 3253 DSSERR("DSI2 PLL clock not active\n");
3239} 3254}
3240 3255
3241int dsi_init(struct platform_device *pdev) 3256static int dsi_init(struct platform_device *pdev)
3242{ 3257{
3243 u32 rev; 3258 u32 rev;
3244 int r; 3259 int r;
@@ -3275,7 +3290,7 @@ int dsi_init(struct platform_device *pdev)
3275 goto err1; 3290 goto err1;
3276 } 3291 }
3277 3292
3278 dsi.vdds_dsi_reg = dss_get_vdds_dsi(); 3293 dsi.vdds_dsi_reg = dsi_get_vdds_dsi();
3279 if (IS_ERR(dsi.vdds_dsi_reg)) { 3294 if (IS_ERR(dsi.vdds_dsi_reg)) {
3280 DSSERR("can't get VDDS_DSI regulator\n"); 3295 DSSERR("can't get VDDS_DSI regulator\n");
3281 r = PTR_ERR(dsi.vdds_dsi_reg); 3296 r = PTR_ERR(dsi.vdds_dsi_reg);
@@ -3298,8 +3313,13 @@ err1:
3298 return r; 3313 return r;
3299} 3314}
3300 3315
3301void dsi_exit(void) 3316static void dsi_exit(void)
3302{ 3317{
3318 if (dsi.vdds_dsi_reg != NULL) {
3319 regulator_put(dsi.vdds_dsi_reg);
3320 dsi.vdds_dsi_reg = NULL;
3321 }
3322
3303 iounmap(dsi.base); 3323 iounmap(dsi.base);
3304 3324
3305 destroy_workqueue(dsi.workqueue); 3325 destroy_workqueue(dsi.workqueue);
@@ -3307,3 +3327,41 @@ void dsi_exit(void)
3307 DSSDBG("omap_dsi_exit\n"); 3327 DSSDBG("omap_dsi_exit\n");
3308} 3328}
3309 3329
3330/* DSI1 HW IP initialisation */
3331static int omap_dsi1hw_probe(struct platform_device *pdev)
3332{
3333 int r;
3334 dsi.pdev = pdev;
3335 r = dsi_init(pdev);
3336 if (r) {
3337 DSSERR("Failed to initialize DSI\n");
3338 goto err_dsi;
3339 }
3340err_dsi:
3341 return r;
3342}
3343
3344static int omap_dsi1hw_remove(struct platform_device *pdev)
3345{
3346 dsi_exit();
3347 return 0;
3348}
3349
3350static struct platform_driver omap_dsi1hw_driver = {
3351 .probe = omap_dsi1hw_probe,
3352 .remove = omap_dsi1hw_remove,
3353 .driver = {
3354 .name = "omapdss_dsi1",
3355 .owner = THIS_MODULE,
3356 },
3357};
3358
3359int dsi_init_platform_driver(void)
3360{
3361 return platform_driver_register(&omap_dsi1hw_driver);
3362}
3363
3364void dsi_uninit_platform_driver(void)
3365{
3366 return platform_driver_unregister(&omap_dsi1hw_driver);
3367}
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 931385185dc6..981d247c30f2 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -261,8 +261,8 @@ static inline void sdi_exit(void)
261 261
262/* DSI */ 262/* DSI */
263#ifdef CONFIG_OMAP2_DSS_DSI 263#ifdef CONFIG_OMAP2_DSS_DSI
264int dsi_init(struct platform_device *pdev); 264int dsi_init_platform_driver(void);
265void dsi_exit(void); 265void dsi_uninit_platform_driver(void);
266 266
267void dsi_dump_clocks(struct seq_file *s); 267void dsi_dump_clocks(struct seq_file *s);
268void dsi_dump_irqs(struct seq_file *s); 268void dsi_dump_irqs(struct seq_file *s);
@@ -287,11 +287,11 @@ void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
287void dsi_wait_dsi1_pll_active(void); 287void dsi_wait_dsi1_pll_active(void);
288void dsi_wait_dsi2_pll_active(void); 288void dsi_wait_dsi2_pll_active(void);
289#else 289#else
290static inline int dsi_init(struct platform_device *pdev) 290static inline int dsi_init_platform_driver(void)
291{ 291{
292 return 0; 292 return 0;
293} 293}
294static inline void dsi_exit(void) 294static inline void dsi_uninit_platform_driver(void)
295{ 295{
296} 296}
297static inline void dsi_wait_dsi1_pll_active(void) 297static inline void dsi_wait_dsi1_pll_active(void)