]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
arm: mach-shmobile: Add LCDC tx_dev field to platform data
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sun, 11 Sep 2011 21:30:45 +0000 (23:30 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 12 Mar 2012 21:40:46 +0000 (22:40 +0100)
Make sure the transmitter devices get registered before the associated
LCDC devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-mackerel.c

index adab85de84769dd69d364a524f30ddf7aa448d3f..6c65b8b2cdf6ace5c0f7bb07359af5fcecd42d36 100644 (file)
@@ -437,82 +437,6 @@ static struct platform_device usb1_host_device = {
        .resource       = usb1_host_resources,
 };
 
-static const struct fb_videomode ap4evb_lcdc_modes[] = {
-       {
-#ifdef CONFIG_AP4EVB_QHD
-               .name           = "R63302(QHD)",
-               .xres           = 544,
-               .yres           = 961,
-               .left_margin    = 72,
-               .right_margin   = 600,
-               .hsync_len      = 16,
-               .upper_margin   = 8,
-               .lower_margin   = 8,
-               .vsync_len      = 2,
-               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
-#else
-               .name           = "WVGA Panel",
-               .xres           = 800,
-               .yres           = 480,
-               .left_margin    = 220,
-               .right_margin   = 110,
-               .hsync_len      = 70,
-               .upper_margin   = 20,
-               .lower_margin   = 5,
-               .vsync_len      = 5,
-               .sync           = 0,
-#endif
-       },
-};
-static struct sh_mobile_meram_cfg lcd_meram_cfg = {
-       .icb[0] = {
-               .marker_icb     = 28,
-               .cache_icb      = 24,
-               .meram_offset   = 0x0,
-               .meram_size     = 0x40,
-       },
-       .icb[1] = {
-               .marker_icb     = 29,
-               .cache_icb      = 25,
-               .meram_offset   = 0x40,
-               .meram_size     = 0x40,
-       },
-};
-
-static struct sh_mobile_lcdc_info lcdc_info = {
-       .meram_dev = &meram_info,
-       .ch[0] = {
-               .chan = LCDC_CHAN_MAINLCD,
-               .fourcc = V4L2_PIX_FMT_RGB565,
-               .lcd_cfg = ap4evb_lcdc_modes,
-               .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
-               .meram_cfg = &lcd_meram_cfg,
-       }
-};
-
-static struct resource lcdc_resources[] = {
-       [0] = {
-               .name   = "LCDC",
-               .start  = 0xfe940000, /* P4-only space */
-               .end    = 0xfe943fff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = intcs_evt2irq(0x580),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device lcdc_device = {
-       .name           = "sh_mobile_lcdc_fb",
-       .num_resources  = ARRAY_SIZE(lcdc_resources),
-       .resource       = lcdc_resources,
-       .dev    = {
-               .platform_data  = &lcdc_info,
-               .coherent_dma_mask = ~0,
-       },
-};
-
 /*
  * QHD display
  */
@@ -593,6 +517,8 @@ static struct resource mipidsi0_resources[] = {
        },
 };
 
+static struct sh_mobile_lcdc_info lcdc_info;
+
 static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
        .lcd_chan       = &lcdc_info.ch[0],
@@ -619,6 +545,86 @@ static struct platform_device *qhd_devices[] __initdata = {
 };
 #endif /* CONFIG_AP4EVB_QHD */
 
+/* LCDC0 */
+static const struct fb_videomode ap4evb_lcdc_modes[] = {
+       {
+#ifdef CONFIG_AP4EVB_QHD
+               .name           = "R63302(QHD)",
+               .xres           = 544,
+               .yres           = 961,
+               .left_margin    = 72,
+               .right_margin   = 600,
+               .hsync_len      = 16,
+               .upper_margin   = 8,
+               .lower_margin   = 8,
+               .vsync_len      = 2,
+               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+#else
+               .name           = "WVGA Panel",
+               .xres           = 800,
+               .yres           = 480,
+               .left_margin    = 220,
+               .right_margin   = 110,
+               .hsync_len      = 70,
+               .upper_margin   = 20,
+               .lower_margin   = 5,
+               .vsync_len      = 5,
+               .sync           = 0,
+#endif
+       },
+};
+static struct sh_mobile_meram_cfg lcd_meram_cfg = {
+       .icb[0] = {
+               .marker_icb     = 28,
+               .cache_icb      = 24,
+               .meram_offset   = 0x0,
+               .meram_size     = 0x40,
+       },
+       .icb[1] = {
+               .marker_icb     = 29,
+               .cache_icb      = 25,
+               .meram_offset   = 0x40,
+               .meram_size     = 0x40,
+       },
+};
+
+static struct sh_mobile_lcdc_info lcdc_info = {
+       .meram_dev = &meram_info,
+       .ch[0] = {
+               .chan = LCDC_CHAN_MAINLCD,
+               .fourcc = V4L2_PIX_FMT_RGB565,
+               .lcd_cfg = ap4evb_lcdc_modes,
+               .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
+               .meram_cfg = &lcd_meram_cfg,
+#ifdef CONFIG_AP4EVB_QHD
+               .tx_dev = &mipidsi0_device,
+#endif
+       }
+};
+
+static struct resource lcdc_resources[] = {
+       [0] = {
+               .name   = "LCDC",
+               .start  = 0xfe940000, /* P4-only space */
+               .end    = 0xfe943fff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = intcs_evt2irq(0x580),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device lcdc_device = {
+       .name           = "sh_mobile_lcdc_fb",
+       .num_resources  = ARRAY_SIZE(lcdc_resources),
+       .resource       = lcdc_resources,
+       .dev    = {
+               .platform_data  = &lcdc_info,
+               .coherent_dma_mask = ~0,
+       },
+};
+
 /* FSI */
 #define IRQ_FSI                evt2irq(0x1840)
 static int __fsi_set_rate(struct clk *clk, long rate, int enable)
@@ -798,6 +804,61 @@ static struct platform_device fsi_ak4643_device = {
        },
 };
 
+/* LCDC1 */
+static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
+                               unsigned long *parent_freq);
+
+static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info;
+
+static struct sh_mobile_hdmi_info hdmi_info = {
+       .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
+       .flags = HDMI_SND_SRC_SPDIF,
+       .clk_optimize_parent = ap4evb_clk_optimize,
+};
+
+static struct resource hdmi_resources[] = {
+       [0] = {
+               .name   = "HDMI",
+               .start  = 0xe6be0000,
+               .end    = 0xe6be00ff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
+               .start  = evt2irq(0x17e0),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device hdmi_device = {
+       .name           = "sh-mobile-hdmi",
+       .num_resources  = ARRAY_SIZE(hdmi_resources),
+       .resource       = hdmi_resources,
+       .id             = -1,
+       .dev    = {
+               .platform_data  = &hdmi_info,
+       },
+};
+
+static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
+                               unsigned long *parent_freq)
+{
+       struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
+       long error;
+
+       if (IS_ERR(hdmi_ick)) {
+               int ret = PTR_ERR(hdmi_ick);
+               pr_err("Cannot get HDMI ICK: %d\n", ret);
+               return ret;
+       }
+
+       error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
+
+       clk_put(hdmi_ick);
+
+       return error;
+}
+
 static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
        .icb[0] = {
                .marker_icb     = 30,
@@ -823,6 +884,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
                .clock_divider = 1,
                .flags = LCDC_FLAGS_DWPOL,
                .meram_cfg = &hdmi_meram_cfg,
+               .tx_dev = &hdmi_device,
        }
 };
 
@@ -850,63 +912,10 @@ static struct platform_device lcdc1_device = {
        },
 };
 
-static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
-                               unsigned long *parent_freq);
-
-
-static struct sh_mobile_hdmi_info hdmi_info = {
-       .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
-       .flags = HDMI_SND_SRC_SPDIF,
-       .clk_optimize_parent = ap4evb_clk_optimize,
-};
-
-static struct resource hdmi_resources[] = {
-       [0] = {
-               .name   = "HDMI",
-               .start  = 0xe6be0000,
-               .end    = 0xe6be00ff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
-               .start  = evt2irq(0x17e0),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device hdmi_device = {
-       .name           = "sh-mobile-hdmi",
-       .num_resources  = ARRAY_SIZE(hdmi_resources),
-       .resource       = hdmi_resources,
-       .id             = -1,
-       .dev    = {
-               .platform_data  = &hdmi_info,
-       },
-};
-
 static struct platform_device fsi_hdmi_device = {
        .name           = "sh_fsi2_b_hdmi",
 };
 
-static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
-                               unsigned long *parent_freq)
-{
-       struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
-       long error;
-
-       if (IS_ERR(hdmi_ick)) {
-               int ret = PTR_ERR(hdmi_ick);
-               pr_err("Cannot get HDMI ICK: %d\n", ret);
-               return ret;
-       }
-
-       error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
-
-       clk_put(hdmi_ick);
-
-       return error;
-}
-
 static struct gpio_led ap4evb_leds[] = {
        {
                .name                   = "led4",
@@ -1041,9 +1050,9 @@ static struct platform_device *ap4evb_devices[] __initdata = {
        &fsi_ak4643_device,
        &fsi_hdmi_device,
        &sh_mmcif_device,
-       &lcdc1_device,
-       &lcdc_device,
        &hdmi_device,
+       &lcdc_device,
+       &lcdc1_device,
        &ceu_device,
        &ap4evb_camera,
        &meram_device,
index 1e02293901976bb32269e7db0ed620e9b8caa5b2..740f022fd7be9bd097a391ddd5ef257287d14e9d 100644 (file)
@@ -426,6 +426,38 @@ static struct platform_device lcdc_device = {
        },
 };
 
+/* HDMI */
+static struct sh_mobile_lcdc_info hdmi_lcdc_info;
+
+static struct sh_mobile_hdmi_info hdmi_info = {
+       .lcd_chan       = &hdmi_lcdc_info.ch[0],
+       .flags          = HDMI_SND_SRC_SPDIF,
+};
+
+static struct resource hdmi_resources[] = {
+       [0] = {
+               .name   = "HDMI",
+               .start  = 0xe6be0000,
+               .end    = 0xe6be00ff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
+               .start  = evt2irq(0x17e0),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device hdmi_device = {
+       .name           = "sh-mobile-hdmi",
+       .num_resources  = ARRAY_SIZE(hdmi_resources),
+       .resource       = hdmi_resources,
+       .id             = -1,
+       .dev    = {
+               .platform_data  = &hdmi_info,
+       },
+};
+
 static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
        .icb[0] = {
                .marker_icb     = 30,
@@ -440,7 +472,7 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
                .meram_size     = 0x100,
        },
 };
-/* HDMI */
+
 static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
        .meram_dev = &mackerel_meram_info,
        .clock_source = LCDC_CLK_EXTERNAL,
@@ -451,6 +483,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
                .clock_divider = 1,
                .flags = LCDC_FLAGS_DWPOL,
                .meram_cfg = &hdmi_meram_cfg,
+               .tx_dev = &hdmi_device,
        }
 };
 
@@ -478,35 +511,6 @@ static struct platform_device hdmi_lcdc_device = {
        },
 };
 
-static struct sh_mobile_hdmi_info hdmi_info = {
-       .lcd_chan       = &hdmi_lcdc_info.ch[0],
-       .flags          = HDMI_SND_SRC_SPDIF,
-};
-
-static struct resource hdmi_resources[] = {
-       [0] = {
-               .name   = "HDMI",
-               .start  = 0xe6be0000,
-               .end    = 0xe6be00ff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
-               .start  = evt2irq(0x17e0),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device hdmi_device = {
-       .name           = "sh-mobile-hdmi",
-       .num_resources  = ARRAY_SIZE(hdmi_resources),
-       .resource       = hdmi_resources,
-       .id             = -1,
-       .dev    = {
-               .platform_data  = &hdmi_info,
-       },
-};
-
 static struct platform_device fsi_hdmi_device = {
        .name           = "sh_fsi2_b_hdmi",
 };
@@ -1275,8 +1279,8 @@ static struct platform_device *mackerel_devices[] __initdata = {
        &sh_mmcif_device,
        &ceu_device,
        &mackerel_camera,
-       &hdmi_lcdc_device,
        &hdmi_device,
+       &hdmi_lcdc_device,
        &meram_device,
 };