aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-11 17:30:45 -0400
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-12 17:40:46 -0400
commita1022adbdff45c76dea27f89cdb3d77e76b75620 (patch)
treec26694aeb014e8fbe37f0a91d3817c1f4d68bb3d /arch/arm
parent9a2985e7f943678154f5761dad753f1987c2fdd0 (diff)
arm: mach-shmobile: Add LCDC tx_dev field to platform data
Make sure the transmitter devices get registered before the associated LCDC devices. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c271
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c66
2 files changed, 175 insertions, 162 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index adab85de8476..6c65b8b2cdf6 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -437,82 +437,6 @@ static struct platform_device usb1_host_device = {
437 .resource = usb1_host_resources, 437 .resource = usb1_host_resources,
438}; 438};
439 439
440static const struct fb_videomode ap4evb_lcdc_modes[] = {
441 {
442#ifdef CONFIG_AP4EVB_QHD
443 .name = "R63302(QHD)",
444 .xres = 544,
445 .yres = 961,
446 .left_margin = 72,
447 .right_margin = 600,
448 .hsync_len = 16,
449 .upper_margin = 8,
450 .lower_margin = 8,
451 .vsync_len = 2,
452 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
453#else
454 .name = "WVGA Panel",
455 .xres = 800,
456 .yres = 480,
457 .left_margin = 220,
458 .right_margin = 110,
459 .hsync_len = 70,
460 .upper_margin = 20,
461 .lower_margin = 5,
462 .vsync_len = 5,
463 .sync = 0,
464#endif
465 },
466};
467static struct sh_mobile_meram_cfg lcd_meram_cfg = {
468 .icb[0] = {
469 .marker_icb = 28,
470 .cache_icb = 24,
471 .meram_offset = 0x0,
472 .meram_size = 0x40,
473 },
474 .icb[1] = {
475 .marker_icb = 29,
476 .cache_icb = 25,
477 .meram_offset = 0x40,
478 .meram_size = 0x40,
479 },
480};
481
482static struct sh_mobile_lcdc_info lcdc_info = {
483 .meram_dev = &meram_info,
484 .ch[0] = {
485 .chan = LCDC_CHAN_MAINLCD,
486 .fourcc = V4L2_PIX_FMT_RGB565,
487 .lcd_cfg = ap4evb_lcdc_modes,
488 .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
489 .meram_cfg = &lcd_meram_cfg,
490 }
491};
492
493static struct resource lcdc_resources[] = {
494 [0] = {
495 .name = "LCDC",
496 .start = 0xfe940000, /* P4-only space */
497 .end = 0xfe943fff,
498 .flags = IORESOURCE_MEM,
499 },
500 [1] = {
501 .start = intcs_evt2irq(0x580),
502 .flags = IORESOURCE_IRQ,
503 },
504};
505
506static struct platform_device lcdc_device = {
507 .name = "sh_mobile_lcdc_fb",
508 .num_resources = ARRAY_SIZE(lcdc_resources),
509 .resource = lcdc_resources,
510 .dev = {
511 .platform_data = &lcdc_info,
512 .coherent_dma_mask = ~0,
513 },
514};
515
516/* 440/*
517 * QHD display 441 * QHD display
518 */ 442 */
@@ -593,6 +517,8 @@ static struct resource mipidsi0_resources[] = {
593 }, 517 },
594}; 518};
595 519
520static struct sh_mobile_lcdc_info lcdc_info;
521
596static struct sh_mipi_dsi_info mipidsi0_info = { 522static struct sh_mipi_dsi_info mipidsi0_info = {
597 .data_format = MIPI_RGB888, 523 .data_format = MIPI_RGB888,
598 .lcd_chan = &lcdc_info.ch[0], 524 .lcd_chan = &lcdc_info.ch[0],
@@ -619,6 +545,86 @@ static struct platform_device *qhd_devices[] __initdata = {
619}; 545};
620#endif /* CONFIG_AP4EVB_QHD */ 546#endif /* CONFIG_AP4EVB_QHD */
621 547
548/* LCDC0 */
549static const struct fb_videomode ap4evb_lcdc_modes[] = {
550 {
551#ifdef CONFIG_AP4EVB_QHD
552 .name = "R63302(QHD)",
553 .xres = 544,
554 .yres = 961,
555 .left_margin = 72,
556 .right_margin = 600,
557 .hsync_len = 16,
558 .upper_margin = 8,
559 .lower_margin = 8,
560 .vsync_len = 2,
561 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
562#else
563 .name = "WVGA Panel",
564 .xres = 800,
565 .yres = 480,
566 .left_margin = 220,
567 .right_margin = 110,
568 .hsync_len = 70,
569 .upper_margin = 20,
570 .lower_margin = 5,
571 .vsync_len = 5,
572 .sync = 0,
573#endif
574 },
575};
576static struct sh_mobile_meram_cfg lcd_meram_cfg = {
577 .icb[0] = {
578 .marker_icb = 28,
579 .cache_icb = 24,
580 .meram_offset = 0x0,
581 .meram_size = 0x40,
582 },
583 .icb[1] = {
584 .marker_icb = 29,
585 .cache_icb = 25,
586 .meram_offset = 0x40,
587 .meram_size = 0x40,
588 },
589};
590
591static struct sh_mobile_lcdc_info lcdc_info = {
592 .meram_dev = &meram_info,
593 .ch[0] = {
594 .chan = LCDC_CHAN_MAINLCD,
595 .fourcc = V4L2_PIX_FMT_RGB565,
596 .lcd_cfg = ap4evb_lcdc_modes,
597 .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
598 .meram_cfg = &lcd_meram_cfg,
599#ifdef CONFIG_AP4EVB_QHD
600 .tx_dev = &mipidsi0_device,
601#endif
602 }
603};
604
605static struct resource lcdc_resources[] = {
606 [0] = {
607 .name = "LCDC",
608 .start = 0xfe940000, /* P4-only space */
609 .end = 0xfe943fff,
610 .flags = IORESOURCE_MEM,
611 },
612 [1] = {
613 .start = intcs_evt2irq(0x580),
614 .flags = IORESOURCE_IRQ,
615 },
616};
617
618static struct platform_device lcdc_device = {
619 .name = "sh_mobile_lcdc_fb",
620 .num_resources = ARRAY_SIZE(lcdc_resources),
621 .resource = lcdc_resources,
622 .dev = {
623 .platform_data = &lcdc_info,
624 .coherent_dma_mask = ~0,
625 },
626};
627
622/* FSI */ 628/* FSI */
623#define IRQ_FSI evt2irq(0x1840) 629#define IRQ_FSI evt2irq(0x1840)
624static int __fsi_set_rate(struct clk *clk, long rate, int enable) 630static int __fsi_set_rate(struct clk *clk, long rate, int enable)
@@ -798,6 +804,61 @@ static struct platform_device fsi_ak4643_device = {
798 }, 804 },
799}; 805};
800 806
807/* LCDC1 */
808static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
809 unsigned long *parent_freq);
810
811static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info;
812
813static struct sh_mobile_hdmi_info hdmi_info = {
814 .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
815 .flags = HDMI_SND_SRC_SPDIF,
816 .clk_optimize_parent = ap4evb_clk_optimize,
817};
818
819static struct resource hdmi_resources[] = {
820 [0] = {
821 .name = "HDMI",
822 .start = 0xe6be0000,
823 .end = 0xe6be00ff,
824 .flags = IORESOURCE_MEM,
825 },
826 [1] = {
827 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
828 .start = evt2irq(0x17e0),
829 .flags = IORESOURCE_IRQ,
830 },
831};
832
833static struct platform_device hdmi_device = {
834 .name = "sh-mobile-hdmi",
835 .num_resources = ARRAY_SIZE(hdmi_resources),
836 .resource = hdmi_resources,
837 .id = -1,
838 .dev = {
839 .platform_data = &hdmi_info,
840 },
841};
842
843static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
844 unsigned long *parent_freq)
845{
846 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
847 long error;
848
849 if (IS_ERR(hdmi_ick)) {
850 int ret = PTR_ERR(hdmi_ick);
851 pr_err("Cannot get HDMI ICK: %d\n", ret);
852 return ret;
853 }
854
855 error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
856
857 clk_put(hdmi_ick);
858
859 return error;
860}
861
801static struct sh_mobile_meram_cfg hdmi_meram_cfg = { 862static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
802 .icb[0] = { 863 .icb[0] = {
803 .marker_icb = 30, 864 .marker_icb = 30,
@@ -823,6 +884,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
823 .clock_divider = 1, 884 .clock_divider = 1,
824 .flags = LCDC_FLAGS_DWPOL, 885 .flags = LCDC_FLAGS_DWPOL,
825 .meram_cfg = &hdmi_meram_cfg, 886 .meram_cfg = &hdmi_meram_cfg,
887 .tx_dev = &hdmi_device,
826 } 888 }
827}; 889};
828 890
@@ -850,63 +912,10 @@ static struct platform_device lcdc1_device = {
850 }, 912 },
851}; 913};
852 914
853static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
854 unsigned long *parent_freq);
855
856
857static struct sh_mobile_hdmi_info hdmi_info = {
858 .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
859 .flags = HDMI_SND_SRC_SPDIF,
860 .clk_optimize_parent = ap4evb_clk_optimize,
861};
862
863static struct resource hdmi_resources[] = {
864 [0] = {
865 .name = "HDMI",
866 .start = 0xe6be0000,
867 .end = 0xe6be00ff,
868 .flags = IORESOURCE_MEM,
869 },
870 [1] = {
871 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
872 .start = evt2irq(0x17e0),
873 .flags = IORESOURCE_IRQ,
874 },
875};
876
877static struct platform_device hdmi_device = {
878 .name = "sh-mobile-hdmi",
879 .num_resources = ARRAY_SIZE(hdmi_resources),
880 .resource = hdmi_resources,
881 .id = -1,
882 .dev = {
883 .platform_data = &hdmi_info,
884 },
885};
886
887static struct platform_device fsi_hdmi_device = { 915static struct platform_device fsi_hdmi_device = {
888 .name = "sh_fsi2_b_hdmi", 916 .name = "sh_fsi2_b_hdmi",
889}; 917};
890 918
891static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
892 unsigned long *parent_freq)
893{
894 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
895 long error;
896
897 if (IS_ERR(hdmi_ick)) {
898 int ret = PTR_ERR(hdmi_ick);
899 pr_err("Cannot get HDMI ICK: %d\n", ret);
900 return ret;
901 }
902
903 error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
904
905 clk_put(hdmi_ick);
906
907 return error;
908}
909
910static struct gpio_led ap4evb_leds[] = { 919static struct gpio_led ap4evb_leds[] = {
911 { 920 {
912 .name = "led4", 921 .name = "led4",
@@ -1041,9 +1050,9 @@ static struct platform_device *ap4evb_devices[] __initdata = {
1041 &fsi_ak4643_device, 1050 &fsi_ak4643_device,
1042 &fsi_hdmi_device, 1051 &fsi_hdmi_device,
1043 &sh_mmcif_device, 1052 &sh_mmcif_device,
1044 &lcdc1_device,
1045 &lcdc_device,
1046 &hdmi_device, 1053 &hdmi_device,
1054 &lcdc_device,
1055 &lcdc1_device,
1047 &ceu_device, 1056 &ceu_device,
1048 &ap4evb_camera, 1057 &ap4evb_camera,
1049 &meram_device, 1058 &meram_device,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 1e0229390197..740f022fd7be 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -426,6 +426,38 @@ static struct platform_device lcdc_device = {
426 }, 426 },
427}; 427};
428 428
429/* HDMI */
430static struct sh_mobile_lcdc_info hdmi_lcdc_info;
431
432static struct sh_mobile_hdmi_info hdmi_info = {
433 .lcd_chan = &hdmi_lcdc_info.ch[0],
434 .flags = HDMI_SND_SRC_SPDIF,
435};
436
437static struct resource hdmi_resources[] = {
438 [0] = {
439 .name = "HDMI",
440 .start = 0xe6be0000,
441 .end = 0xe6be00ff,
442 .flags = IORESOURCE_MEM,
443 },
444 [1] = {
445 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
446 .start = evt2irq(0x17e0),
447 .flags = IORESOURCE_IRQ,
448 },
449};
450
451static struct platform_device hdmi_device = {
452 .name = "sh-mobile-hdmi",
453 .num_resources = ARRAY_SIZE(hdmi_resources),
454 .resource = hdmi_resources,
455 .id = -1,
456 .dev = {
457 .platform_data = &hdmi_info,
458 },
459};
460
429static struct sh_mobile_meram_cfg hdmi_meram_cfg = { 461static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
430 .icb[0] = { 462 .icb[0] = {
431 .marker_icb = 30, 463 .marker_icb = 30,
@@ -440,7 +472,7 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
440 .meram_size = 0x100, 472 .meram_size = 0x100,
441 }, 473 },
442}; 474};
443/* HDMI */ 475
444static struct sh_mobile_lcdc_info hdmi_lcdc_info = { 476static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
445 .meram_dev = &mackerel_meram_info, 477 .meram_dev = &mackerel_meram_info,
446 .clock_source = LCDC_CLK_EXTERNAL, 478 .clock_source = LCDC_CLK_EXTERNAL,
@@ -451,6 +483,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
451 .clock_divider = 1, 483 .clock_divider = 1,
452 .flags = LCDC_FLAGS_DWPOL, 484 .flags = LCDC_FLAGS_DWPOL,
453 .meram_cfg = &hdmi_meram_cfg, 485 .meram_cfg = &hdmi_meram_cfg,
486 .tx_dev = &hdmi_device,
454 } 487 }
455}; 488};
456 489
@@ -478,35 +511,6 @@ static struct platform_device hdmi_lcdc_device = {
478 }, 511 },
479}; 512};
480 513
481static struct sh_mobile_hdmi_info hdmi_info = {
482 .lcd_chan = &hdmi_lcdc_info.ch[0],
483 .flags = HDMI_SND_SRC_SPDIF,
484};
485
486static struct resource hdmi_resources[] = {
487 [0] = {
488 .name = "HDMI",
489 .start = 0xe6be0000,
490 .end = 0xe6be00ff,
491 .flags = IORESOURCE_MEM,
492 },
493 [1] = {
494 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
495 .start = evt2irq(0x17e0),
496 .flags = IORESOURCE_IRQ,
497 },
498};
499
500static struct platform_device hdmi_device = {
501 .name = "sh-mobile-hdmi",
502 .num_resources = ARRAY_SIZE(hdmi_resources),
503 .resource = hdmi_resources,
504 .id = -1,
505 .dev = {
506 .platform_data = &hdmi_info,
507 },
508};
509
510static struct platform_device fsi_hdmi_device = { 514static struct platform_device fsi_hdmi_device = {
511 .name = "sh_fsi2_b_hdmi", 515 .name = "sh_fsi2_b_hdmi",
512}; 516};
@@ -1275,8 +1279,8 @@ static struct platform_device *mackerel_devices[] __initdata = {
1275 &sh_mmcif_device, 1279 &sh_mmcif_device,
1276 &ceu_device, 1280 &ceu_device,
1277 &mackerel_camera, 1281 &mackerel_camera,
1278 &hdmi_lcdc_device,
1279 &hdmi_device, 1282 &hdmi_device,
1283 &hdmi_lcdc_device,
1280 &meram_device, 1284 &meram_device,
1281}; 1285};
1282 1286