From 134d22eb58b72c4fe5e6ca3ebcaccd4975f06842 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 9 Sep 2011 16:08:02 +0200 Subject: sh_mobile_hdmi: Remove platform data lcd_dev field The field is used to print debug messages only. Remove it. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ap4evb.c | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index eeb4d9664584..adab85de8476 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -856,7 +856,6 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, static struct sh_mobile_hdmi_info hdmi_info = { .lcd_chan = &sh_mobile_lcdc1_info.ch[0], - .lcd_dev = &lcdc1_device.dev, .flags = HDMI_SND_SRC_SPDIF, .clk_optimize_parent = ap4evb_clk_optimize, }; -- cgit v1.2.3 From a1022adbdff45c76dea27f89cdb3d77e76b75620 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2011 23:30:45 +0200 Subject: 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 --- arch/arm/mach-shmobile/board-ap4evb.c | 271 +++++++++++++++++--------------- arch/arm/mach-shmobile/board-mackerel.c | 66 ++++---- 2 files changed, 175 insertions(+), 162 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') 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 = { .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, 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 = { }, }; +/* 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, }; -- cgit v1.2.3 From e2543c5ab299c67ddfb73a36eca4da6574259ab9 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2011 23:30:45 +0200 Subject: arm: mach-shmobile: Don't initialize the hdmi_info lcd_chan field The field is unused and will be removed. Don't initialize it. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ap4evb.c | 3 --- arch/arm/mach-shmobile/board-mackerel.c | 3 --- 2 files changed, 6 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 6c65b8b2cdf6..22e192574625 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -808,10 +808,7 @@ static struct platform_device fsi_ak4643_device = { 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, }; diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 740f022fd7be..f275a817939c 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -427,10 +427,7 @@ 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, }; -- cgit v1.2.3 From afaad83b9c0d24eac88535cc5a8c6019f0c45bcb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2011 22:59:04 +0200 Subject: fbdev: sh_mobile_lcdc: Merge board_cfg and lcd_size_cfg into panel_cfg Update board code accordingly. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ag5evm.c | 6 +++--- arch/arm/mach-shmobile/board-ap4evb.c | 8 ++++---- arch/arm/mach-shmobile/board-bonito.c | 2 +- arch/arm/mach-shmobile/board-mackerel.c | 6 ++++-- arch/sh/boards/mach-ap325rxa/setup.c | 6 ++---- arch/sh/boards/mach-ecovec24/setup.c | 2 +- arch/sh/boards/mach-kfr2r09/setup.c | 4 +--- arch/sh/boards/mach-migor/setup.c | 8 +++----- arch/sh/boards/mach-se/7724/setup.c | 2 +- drivers/video/sh_mobile_lcdcfb.c | 35 ++++++++++++++++----------------- include/video/sh_mobile_lcdc.h | 12 ++++------- 11 files changed, 41 insertions(+), 50 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index 7108c5da6077..199b3b958f42 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c @@ -252,12 +252,12 @@ static struct sh_mobile_lcdc_info lcdc0_info = { .interface_type = RGB24, .clock_divider = 1, .flags = LCDC_FLAGS_DWPOL, - .lcd_size_cfg.width = 44, - .lcd_size_cfg.height = 79, .fourcc = V4L2_PIX_FMT_RGB565, .lcd_cfg = lcdc0_modes, .num_cfg = ARRAY_SIZE(lcdc0_modes), - .board_cfg = { + .panel_cfg = { + .width = 44, + .height = 79, .display_on = lcd_backlight_on, .display_off = lcd_backlight_reset, }, diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 22e192574625..2cb6c39dd62a 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -1360,8 +1360,8 @@ static void __init ap4evb_init(void) lcdc_info.ch[0].interface_type = RGB24; lcdc_info.ch[0].clock_divider = 1; lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; - lcdc_info.ch[0].lcd_size_cfg.width = 44; - lcdc_info.ch[0].lcd_size_cfg.height = 79; + lcdc_info.ch[0].panel_cfg.width = 44; + lcdc_info.ch[0].panel_cfg.height = 79; platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices)); @@ -1402,8 +1402,8 @@ static void __init ap4evb_init(void) lcdc_info.ch[0].interface_type = RGB18; lcdc_info.ch[0].clock_divider = 3; lcdc_info.ch[0].flags = 0; - lcdc_info.ch[0].lcd_size_cfg.width = 152; - lcdc_info.ch[0].lcd_size_cfg.height = 91; + lcdc_info.ch[0].panel_cfg.width = 152; + lcdc_info.ch[0].panel_cfg.height = 91; /* enable TouchScreen */ irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c index 4d2201622323..9cd9408b851b 100644 --- a/arch/arm/mach-shmobile/board-bonito.c +++ b/arch/arm/mach-shmobile/board-bonito.c @@ -247,7 +247,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = { .flags = 0, .lcd_cfg = &lcdc0_mode, .num_cfg = 1, - .lcd_size_cfg = { + .panel_cfg = { .width = 152, .height = 91, }, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 123232329a88..9228cc555b46 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -389,8 +389,10 @@ static struct sh_mobile_lcdc_info lcdc_info = { .interface_type = RGB24, .clock_divider = 3, .flags = 0, - .lcd_size_cfg.width = 152, - .lcd_size_cfg.height = 91, + .panel_cfg = { + .width = 152, + .height = 91, + }, .bl_info = { .name = "sh_mobile_lcdc_bl", .max_brightness = 1, diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index d0d2401c3cbc..a87b7f42f120 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -213,11 +213,9 @@ static struct sh_mobile_lcdc_info lcdc_info = { .clock_divider = 1, .lcd_cfg = ap325rxa_lcdc_modes, .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes), - .lcd_size_cfg = { /* 7.0 inch */ - .width = 152, + .panel_cfg = { + .width = 152, /* 7.0 inch */ .height = 91, - }, - .board_cfg = { .display_on = ap320_wvga_power_on, .display_off = ap320_wvga_power_off, }, diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 769aab3fa379..41767451ead1 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -327,7 +327,7 @@ static struct sh_mobile_lcdc_info lcdc_info = { .interface_type = RGB18, .chan = LCDC_CHAN_MAINLCD, .fourcc = V4L2_PIX_FMT_RGB565, - .lcd_size_cfg = { /* 7.0 inch */ + .panel_cfg = { /* 7.0 inch */ .width = 152, .height = 91, }, diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index 5b382e1afaea..77d5a60d64fd 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c @@ -150,11 +150,9 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { .flags = LCDC_FLAGS_DWPOL, .lcd_cfg = kfr2r09_lcdc_modes, .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes), - .lcd_size_cfg = { + .panel_cfg = { .width = 35, .height = 58, - }, - .board_cfg = { .setup_sys = kfr2r09_lcd_setup, .start_transfer = kfr2r09_lcd_start, .display_on = kfr2r09_lcd_on, diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index d37ba2720527..93a1c9109abc 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c @@ -248,7 +248,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { .clock_divider = 2, .lcd_cfg = migor_lcd_modes, .num_cfg = ARRAY_SIZE(migor_lcd_modes), - .lcd_size_cfg = { /* 7.0 inch */ + .panel_cfg = { /* 7.0 inch */ .width = 152, .height = 91, }, @@ -262,11 +262,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { .clock_divider = 10, .lcd_cfg = migor_lcd_modes, .num_cfg = ARRAY_SIZE(migor_lcd_modes), - .lcd_size_cfg = { /* 2.4 inch */ - .width = 49, + .panel_cfg = { + .width = 49, /* 2.4 inch */ .height = 37, - }, - .board_cfg = { .setup_sys = migor_lcd_qvga_setup, }, .sys_bus_cfg = { diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 5e25dbe726e2..a468398bfb34 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -182,7 +182,7 @@ static struct sh_mobile_lcdc_info lcdc_info = { .chan = LCDC_CHAN_MAINLCD, .fourcc = V4L2_PIX_FMT_RGB565, .clock_divider = 1, - .lcd_size_cfg = { /* 7.0 inch */ + .panel_cfg = { /* 7.0 inch */ .width = 152, .height = 91, }, diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index adfffd6b7ec1..9e44988155a4 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -289,7 +289,7 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info, struct list_head *pagelist) { struct sh_mobile_lcdc_chan *ch = info->par; - struct sh_mobile_lcdc_board_cfg *bcfg = &ch->cfg.board_cfg; + struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg; /* enable clocks before accessing hardware */ sh_mobile_lcdc_clk_on(ch->lcdc); @@ -314,13 +314,13 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info, /* trigger panel update */ dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); - if (bcfg->start_transfer) - bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); + if (panel->start_transfer) + panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); } else { - if (bcfg->start_transfer) - bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); + if (panel->start_transfer) + panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); } } @@ -335,7 +335,7 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info) static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) { - struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg; + struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg; if (ch->tx_dev) { if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0) @@ -343,16 +343,16 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) } /* HDMI must be enabled before LCDC configuration */ - if (board_cfg->display_on) - board_cfg->display_on(); + if (panel->display_on) + panel->display_on(); } static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) { - struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg; + struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg; - if (board_cfg->display_off) - board_cfg->display_off(); + if (panel->display_off) + panel->display_off(); if (ch->tx_dev) ch->tx_dev->ops->display_off(ch->tx_dev); @@ -687,16 +687,15 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0); for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { - struct sh_mobile_lcdc_board_cfg *board_cfg; + struct sh_mobile_lcdc_panel_cfg *panel; ch = &priv->ch[k]; if (!ch->enabled) continue; - board_cfg = &ch->cfg.board_cfg; - if (board_cfg->setup_sys) { - ret = board_cfg->setup_sys(ch, - &sh_mobile_lcdc_sys_bus_ops); + panel = &ch->cfg.panel_cfg; + if (panel->setup_sys) { + ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops); if (ret) return ret; } @@ -1654,8 +1653,8 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, */ var = &info->var; fb_videomode_to_var(var, mode); - var->width = cfg->lcd_size_cfg.width; - var->height = cfg->lcd_size_cfg.height; + var->width = cfg->panel_cfg.width; + var->height = cfg->panel_cfg.height; var->yres_virtual = var->yres * 2; var->activate = FB_ACTIVATE_NOW; diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index ecde6aad6f29..4f0fb559ea87 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h @@ -147,7 +147,9 @@ struct sh_mobile_lcdc_sys_bus_ops { unsigned long (*read_data)(void *handle); }; -struct sh_mobile_lcdc_board_cfg { +struct sh_mobile_lcdc_panel_cfg { + unsigned long width; /* Panel width in mm */ + unsigned long height; /* Panel height in mm */ int (*setup_sys)(void *sys_ops_handle, struct sh_mobile_lcdc_sys_bus_ops *sys_ops); void (*start_transfer)(void *sys_ops_handle, @@ -156,11 +158,6 @@ struct sh_mobile_lcdc_board_cfg { void (*display_off)(void); }; -struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */ - unsigned long width; - unsigned long height; -}; - /* backlight info */ struct sh_mobile_lcdc_bl_info { const char *name; @@ -178,8 +175,7 @@ struct sh_mobile_lcdc_chan_cfg { unsigned long flags; /* LCDC_FLAGS_... */ const struct fb_videomode *lcd_cfg; int num_cfg; - struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; - struct sh_mobile_lcdc_board_cfg board_cfg; + struct sh_mobile_lcdc_panel_cfg panel_cfg; struct sh_mobile_lcdc_bl_info bl_info; struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ struct sh_mobile_meram_cfg *meram_cfg; -- cgit v1.2.3 From 93ff259846a774ff37dca54792c5a3a6425882c0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 29 Nov 2011 14:33:41 +0100 Subject: fbdev: sh_mobile_lcdc: Rename (lcd|num)_cfg (lcd|num)_modes The struct sh_mobile_lcdc_chan_cfg platform data contains a list of video modes. Name the lcd_cfg and num_cfg fields to reflect that they describe video modes. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ag5evm.c | 4 ++-- arch/arm/mach-shmobile/board-ap4evb.c | 4 ++-- arch/arm/mach-shmobile/board-bonito.c | 4 ++-- arch/arm/mach-shmobile/board-mackerel.c | 4 ++-- arch/sh/boards/mach-ap325rxa/setup.c | 4 ++-- arch/sh/boards/mach-ecovec24/setup.c | 8 +++---- arch/sh/boards/mach-kfr2r09/setup.c | 4 ++-- arch/sh/boards/mach-migor/setup.c | 8 +++---- arch/sh/boards/mach-se/7724/setup.c | 8 +++---- drivers/video/sh_mipi_dsi.c | 38 ++++++++++++++++----------------- drivers/video/sh_mobile_lcdcfb.c | 20 ++++++++--------- include/video/sh_mobile_lcdc.h | 4 ++-- 12 files changed, 55 insertions(+), 55 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index 199b3b958f42..33dad1da9310 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c @@ -253,8 +253,8 @@ static struct sh_mobile_lcdc_info lcdc0_info = { .clock_divider = 1, .flags = LCDC_FLAGS_DWPOL, .fourcc = V4L2_PIX_FMT_RGB565, - .lcd_cfg = lcdc0_modes, - .num_cfg = ARRAY_SIZE(lcdc0_modes), + .lcd_modes = lcdc0_modes, + .num_modes = ARRAY_SIZE(lcdc0_modes), .panel_cfg = { .width = 44, .height = 79, diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 2cb6c39dd62a..80b943029815 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -593,8 +593,8 @@ static struct sh_mobile_lcdc_info lcdc_info = { .ch[0] = { .chan = LCDC_CHAN_MAINLCD, .fourcc = V4L2_PIX_FMT_RGB565, - .lcd_cfg = ap4evb_lcdc_modes, - .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes), + .lcd_modes = ap4evb_lcdc_modes, + .num_modes = ARRAY_SIZE(ap4evb_lcdc_modes), .meram_cfg = &lcd_meram_cfg, #ifdef CONFIG_AP4EVB_QHD .tx_dev = &mipidsi0_device, diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c index 9cd9408b851b..fb90f0898d9c 100644 --- a/arch/arm/mach-shmobile/board-bonito.c +++ b/arch/arm/mach-shmobile/board-bonito.c @@ -245,8 +245,8 @@ static struct sh_mobile_lcdc_info lcdc0_info = { .interface_type = RGB24, .clock_divider = 5, .flags = 0, - .lcd_cfg = &lcdc0_mode, - .num_cfg = 1, + .lcd_modes = &lcdc0_mode, + .num_modes = 1, .panel_cfg = { .width = 152, .height = 91, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 9228cc555b46..aff7df8ccc30 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -384,8 +384,8 @@ static struct sh_mobile_lcdc_info lcdc_info = { .ch[0] = { .chan = LCDC_CHAN_MAINLCD, .fourcc = V4L2_PIX_FMT_RGB565, - .lcd_cfg = mackerel_lcdc_modes, - .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), + .lcd_modes = mackerel_lcdc_modes, + .num_modes = ARRAY_SIZE(mackerel_lcdc_modes), .interface_type = RGB24, .clock_divider = 3, .flags = 0, diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index a87b7f42f120..8cf02e343333 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -211,8 +211,8 @@ static struct sh_mobile_lcdc_info lcdc_info = { .fourcc = V4L2_PIX_FMT_RGB565, .interface_type = RGB18, .clock_divider = 1, - .lcd_cfg = ap325rxa_lcdc_modes, - .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes), + .lcd_modes = ap325rxa_lcdc_modes, + .num_modes = ARRAY_SIZE(ap325rxa_lcdc_modes), .panel_cfg = { .width = 152, /* 7.0 inch */ .height = 91, diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 41767451ead1..0b08230546e7 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -1114,8 +1114,8 @@ static int __init arch_setup(void) /* DVI */ lcdc_info.clock_source = LCDC_CLK_EXTERNAL; lcdc_info.ch[0].clock_divider = 1; - lcdc_info.ch[0].lcd_cfg = ecovec_dvi_modes; - lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_dvi_modes); + lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes; + lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes); gpio_set_value(GPIO_PTA2, 1); gpio_set_value(GPIO_PTU1, 1); @@ -1123,8 +1123,8 @@ static int __init arch_setup(void) /* Panel */ lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; lcdc_info.ch[0].clock_divider = 2; - lcdc_info.ch[0].lcd_cfg = ecovec_lcd_modes; - lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_lcd_modes); + lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes; + lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes); gpio_set_value(GPIO_PTR1, 1); diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index 77d5a60d64fd..d04a55d3b877 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c @@ -148,8 +148,8 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { .interface_type = SYS18, .clock_divider = 6, .flags = LCDC_FLAGS_DWPOL, - .lcd_cfg = kfr2r09_lcdc_modes, - .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes), + .lcd_modes = kfr2r09_lcdc_modes, + .num_modes = ARRAY_SIZE(kfr2r09_lcdc_modes), .panel_cfg = { .width = 35, .height = 58, diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index 93a1c9109abc..ff6f69c6906e 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c @@ -246,8 +246,8 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { .fourcc = V4L2_PIX_FMT_RGB565, .interface_type = RGB16, .clock_divider = 2, - .lcd_cfg = migor_lcd_modes, - .num_cfg = ARRAY_SIZE(migor_lcd_modes), + .lcd_modes = migor_lcd_modes, + .num_modes = ARRAY_SIZE(migor_lcd_modes), .panel_cfg = { /* 7.0 inch */ .width = 152, .height = 91, @@ -260,8 +260,8 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { .fourcc = V4L2_PIX_FMT_RGB565, .interface_type = SYS16A, .clock_divider = 10, - .lcd_cfg = migor_lcd_modes, - .num_cfg = ARRAY_SIZE(migor_lcd_modes), + .lcd_modes = migor_lcd_modes, + .num_modes = ARRAY_SIZE(migor_lcd_modes), .panel_cfg = { .width = 49, /* 2.4 inch */ .height = 37, diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index a468398bfb34..9bf528b4ae21 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -886,12 +886,12 @@ static int __init devices_setup(void) if (sw & SW41_B) { /* 720p */ - lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes; - lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes); + lcdc_info.ch[0].lcd_modes = lcdc_720p_modes; + lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_720p_modes); } else { /* VGA */ - lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes; - lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes); + lcdc_info.ch[0].lcd_modes = lcdc_vga_modes; + lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_vga_modes); } if (sw & SW41_A) { diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 5ff3742aeb08..42ad0f707e88 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c @@ -147,77 +147,77 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, pctype = 0; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; - linelength = ch->lcd_cfg[0].xres * 3; + linelength = ch->lcd_modes[0].xres * 3; yuv = false; break; case MIPI_RGB565: pctype = 1; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; - linelength = ch->lcd_cfg[0].xres * 2; + linelength = ch->lcd_modes[0].xres * 2; yuv = false; break; case MIPI_RGB666_LP: pctype = 2; datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; - linelength = ch->lcd_cfg[0].xres * 3; + linelength = ch->lcd_modes[0].xres * 3; yuv = false; break; case MIPI_RGB666: pctype = 3; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; - linelength = (ch->lcd_cfg[0].xres * 18 + 7) / 8; + linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8; yuv = false; break; case MIPI_BGR888: pctype = 8; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; - linelength = ch->lcd_cfg[0].xres * 3; + linelength = ch->lcd_modes[0].xres * 3; yuv = false; break; case MIPI_BGR565: pctype = 9; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; - linelength = ch->lcd_cfg[0].xres * 2; + linelength = ch->lcd_modes[0].xres * 2; yuv = false; break; case MIPI_BGR666_LP: pctype = 0xa; datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; - linelength = ch->lcd_cfg[0].xres * 3; + linelength = ch->lcd_modes[0].xres * 3; yuv = false; break; case MIPI_BGR666: pctype = 0xb; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; - linelength = (ch->lcd_cfg[0].xres * 18 + 7) / 8; + linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8; yuv = false; break; case MIPI_YUYV: pctype = 4; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; - linelength = ch->lcd_cfg[0].xres * 2; + linelength = ch->lcd_modes[0].xres * 2; yuv = true; break; case MIPI_UYVY: pctype = 5; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; - linelength = ch->lcd_cfg[0].xres * 2; + linelength = ch->lcd_modes[0].xres * 2; yuv = true; break; case MIPI_YUV420_L: pctype = 6; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; - linelength = (ch->lcd_cfg[0].xres * 12 + 7) / 8; + linelength = (ch->lcd_modes[0].xres * 12 + 7) / 8; yuv = true; break; case MIPI_YUV420: @@ -225,7 +225,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; /* Length of U/V line */ - linelength = (ch->lcd_cfg[0].xres + 1) / 2; + linelength = (ch->lcd_modes[0].xres + 1) / 2; yuv = true; break; default: @@ -294,7 +294,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, */ iowrite32(0x00000006, mipi->linkbase + DTCTR); /* VSYNC width = 2 (<< 17) */ - iowrite32((ch->lcd_cfg[0].vsync_len << pdata->vsynw_offset) | + iowrite32((ch->lcd_modes[0].vsync_len << pdata->vsynw_offset) | (pdata->clksrc << 16) | (pctype << 12) | datatype, mipi->linkbase + VMCTR1); @@ -328,7 +328,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, top = linelength << 16; /* RGBLEN */ bottom = 0x00000001; if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */ - bottom = (pdata->lane * ch->lcd_cfg[0].hsync_len) - 10; + bottom = (pdata->lane * ch->lcd_modes[0].hsync_len) - 10; iowrite32(top | bottom , mipi->linkbase + VMLEN1); /* @@ -348,18 +348,18 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, div = 2; if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */ - top = ch->lcd_cfg[0].hsync_len + ch->lcd_cfg[0].left_margin; + top = ch->lcd_modes[0].hsync_len + ch->lcd_modes[0].left_margin; top = ((pdata->lane * top / div) - 10) << 16; } if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */ - bottom = ch->lcd_cfg[0].right_margin; + bottom = ch->lcd_modes[0].right_margin; bottom = (pdata->lane * bottom / div) - 12; } - bpp = linelength / ch->lcd_cfg[0].xres; /* byte / pixel */ + bpp = linelength / ch->lcd_modes[0].xres; /* byte / pixel */ if ((pdata->lane / div) > bpp) { - tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */ - tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */ + tmp = ch->lcd_modes[0].xres / bpp; /* output cycle */ + tmp = ch->lcd_modes[0].xres - tmp; /* (input - output) cycle */ delay = (pdata->lane * tmp); } diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 422fcfd3cf28..ab7b17975846 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -1191,8 +1191,8 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in * distance between two modes is defined as the size of the * non-overlapping parts of the two rectangles. */ - for (i = 0; i < ch->cfg.num_cfg; ++i) { - const struct fb_videomode *mode = &ch->cfg.lcd_cfg[i]; + for (i = 0; i < ch->cfg.num_modes; ++i) { + const struct fb_videomode *mode = &ch->cfg.lcd_modes[i]; unsigned int dist; /* We can only round up. */ @@ -1211,7 +1211,7 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in } /* If no available mode can be used, return an error. */ - if (ch->cfg.num_cfg != 0) { + if (ch->cfg.num_modes != 0) { if (best_dist == (unsigned int)-1) return -EINVAL; @@ -1671,7 +1671,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, struct fb_var_screeninfo *var; struct fb_info *info; unsigned int max_size; - int num_cfg; + int num_modes; void *buf; int ret; int i; @@ -1698,7 +1698,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, max_mode = NULL; max_size = 0; - for (i = 0, mode = cfg->lcd_cfg; i < cfg->num_cfg; i++, mode++) { + for (i = 0, mode = cfg->lcd_modes; i < cfg->num_modes; i++, mode++) { unsigned int size = mode->yres * mode->xres; /* NV12/NV21 buffers must have even number of lines */ @@ -1722,15 +1722,15 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, max_mode->xres, max_mode->yres); /* Create the mode list. */ - if (cfg->lcd_cfg == NULL) { + if (cfg->lcd_modes == NULL) { mode = &default_720p; - num_cfg = 1; + num_modes = 1; } else { - mode = cfg->lcd_cfg; - num_cfg = cfg->num_cfg; + mode = cfg->lcd_modes; + num_modes = cfg->num_modes; } - fb_videomode_to_modelist(mode, num_cfg, &info->modelist); + fb_videomode_to_modelist(mode, num_modes, &info->modelist); /* Initialize the transmitter device if present. */ if (cfg->tx_dev) { diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index 4f0fb559ea87..484b0a2d7b2f 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h @@ -173,8 +173,8 @@ struct sh_mobile_lcdc_chan_cfg { int interface_type; /* selects RGBn or SYSn I/F, see above */ int clock_divider; unsigned long flags; /* LCDC_FLAGS_... */ - const struct fb_videomode *lcd_cfg; - int num_cfg; + const struct fb_videomode *lcd_modes; + int num_modes; struct sh_mobile_lcdc_panel_cfg panel_cfg; struct sh_mobile_lcdc_bl_info bl_info; struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ -- cgit v1.2.3 From e71504d579945932e283b7d4ea07b4942248bc20 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2011 23:30:45 +0200 Subject: arm: mach-shmobile: Split MERAM resources into regs and meram The MERAM resource currently combines both the registers space and the MERAM space. Only the register space needs to be ioremapped, split the resource to make that possible. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ap4evb.c | 14 ++++++++++---- arch/arm/mach-shmobile/board-mackerel.c | 8 +++++++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 80b943029815..63498fbdfd12 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -258,10 +258,16 @@ static struct sh_mobile_meram_info meram_info = { static struct resource meram_resources[] = { [0] = { - .name = "MERAM", - .start = 0xe8000000, - .end = 0xe81fffff, - .flags = IORESOURCE_MEM, + .name = "regs", + .start = 0xe8000000, + .end = 0xe807ffff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = "meram", + .start = 0xe8080000, + .end = 0xe81fffff, + .flags = IORESOURCE_MEM, }, }; diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index aff7df8ccc30..17ba6bccf97b 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -318,8 +318,14 @@ static struct sh_mobile_meram_info mackerel_meram_info = { static struct resource meram_resources[] = { [0] = { - .name = "MERAM", + .name = "regs", .start = 0xe8000000, + .end = 0xe807ffff, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = "meram", + .start = 0xe8080000, .end = 0xe81fffff, .flags = IORESOURCE_MEM, }, -- cgit v1.2.3 From 974d250be2c70c7bf899275b23b241685d4ed7f8 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 19 Sep 2011 11:40:31 +0200 Subject: fbdev: sh_mobile_meram: Use genalloc to manage MERAM allocation Instead of requiring the users to hardcode MERAM allocation in platform data, allocate blocks at runtime using genalloc. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ap4evb.c | 4 -- arch/arm/mach-shmobile/board-mackerel.c | 4 -- drivers/video/Kconfig | 1 + drivers/video/sh_mobile_meram.c | 112 ++++++++++++++++++++------------ include/video/sh_mobile_meram.h | 1 - 5 files changed, 71 insertions(+), 51 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 63498fbdfd12..7b902277f145 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -583,13 +583,11 @@ 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, }, }; @@ -866,13 +864,11 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { .marker_icb = 30, .cache_icb = 26, - .meram_offset = 0x80, .meram_size = 0x100, }, .icb[1] = { .marker_icb = 31, .cache_icb = 27, - .meram_offset = 0x180, .meram_size = 0x100, }, }; diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 17ba6bccf97b..0c0fd4f0c308 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -373,13 +373,11 @@ 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, }, }; @@ -465,13 +463,11 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { .marker_icb = 30, .cache_icb = 26, - .meram_offset = 0x80, .meram_size = 0x100, }, .icb[1] = { .marker_icb = 31, .cache_icb = 27, - .meram_offset = 0x180, .meram_size = 0x100, }, }; diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 8951cbd2d2fc..a43594243186 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -2016,6 +2016,7 @@ config FB_SH_MOBILE_HDMI config FB_SH_MOBILE_MERAM tristate "SuperH Mobile MERAM read ahead support for LCDC" depends on FB_SH_MOBILE_LCDC + select GENERIC_ALLOCATOR default y ---help--- Enable MERAM support for the SH-Mobile LCD controller. diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c index 30a3305ba366..92dc9bd5b667 100644 --- a/drivers/video/sh_mobile_meram.c +++ b/drivers/video/sh_mobile_meram.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -105,15 +106,17 @@ static const unsigned long icb_regs[] = { /* * sh_mobile_meram_icb - MERAM ICB information * @regs: Registers cache - * @region: Start and end addresses of the MERAM region + * @offset: MERAM block offset + * @size: MERAM block size in bytes * @cache_unit: Bytes to cache per ICB * @pixelformat: Video pixel format of the data stored in the ICB * @current_reg: Which of Start Address Register A (0) or B (1) is in use */ struct sh_mobile_meram_icb { unsigned long regs[ICB_REGS_SIZE]; + unsigned long offset; + unsigned int size; - unsigned long region; unsigned int cache_unit; unsigned int pixelformat; unsigned int current_reg; @@ -124,21 +127,27 @@ struct sh_mobile_meram_icb { /* * sh_mobile_meram_priv - MERAM device * @base: Registers base address + * @meram: MERAM physical address * @regs: Registers cache * @lock: Protects used_icb and icbs * @used_icb: Bitmask of used ICBs * @icbs: ICBs + * @pool: Allocation pool to manage the MERAM */ struct sh_mobile_meram_priv { void __iomem *base; + unsigned long meram; unsigned long regs[MERAM_REGS_SIZE]; struct mutex lock; unsigned long used_icb; struct sh_mobile_meram_icb icbs[MERAM_ICB_NUM]; + + struct gen_pool *pool; }; /* settings */ +#define MERAM_GRANULARITY 1024 #define MERAM_SEC_LINE 15 #define MERAM_LINE_WIDTH 2048 @@ -175,18 +184,10 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off) * Allocation */ -#define MERAM_CACHE_START(p) ((p) >> 16) -#define MERAM_CACHE_END(p) ((p) & 0xffff) -#define MERAM_CACHE_SET(o, s) ((((o) & 0xffff) << 16) | \ - (((o) + (s) - 1) & 0xffff)) - /* Check if there's no overlaps in MERAM allocation. */ static int meram_check_overlap(struct sh_mobile_meram_priv *priv, const struct sh_mobile_meram_icb_cfg *new) { - unsigned int used_start, used_end, meram_start, meram_end; - unsigned int i; - /* valid ICB? */ if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f) return 1; @@ -195,43 +196,40 @@ static int meram_check_overlap(struct sh_mobile_meram_priv *priv, test_bit(new->cache_icb, &priv->used_icb)) return 1; - for (i = 0; i < MERAM_ICB_NUM; i++) { - if (!test_bit(i, &priv->used_icb)) - continue; - - used_start = MERAM_CACHE_START(priv->icbs[i].region); - used_end = MERAM_CACHE_END(priv->icbs[i].region); - meram_start = new->meram_offset; - meram_end = new->meram_offset + new->meram_size; - - if ((meram_start >= used_start && meram_start < used_end) || - (meram_end > used_start && meram_end < used_end)) - return 1; - } - return 0; } -/* Mark the specified ICB as used. */ -static void meram_mark(struct sh_mobile_meram_priv *priv, +/* Allocate memory for the ICBs and mark them as used. */ +static int meram_alloc(struct sh_mobile_meram_priv *priv, const struct sh_mobile_meram_icb_cfg *new, int pixelformat) { + struct sh_mobile_meram_icb *marker = &priv->icbs[new->marker_icb]; + unsigned long mem; + + mem = gen_pool_alloc(priv->pool, new->meram_size * 1024); + if (mem == 0) + return -ENOMEM; + __set_bit(new->marker_icb, &priv->used_icb); __set_bit(new->cache_icb, &priv->used_icb); - priv->icbs[new->marker_icb].region = MERAM_CACHE_SET(new->meram_offset, - new->meram_size); - priv->icbs[new->cache_icb].region = MERAM_CACHE_SET(new->meram_offset, - new->meram_size); - priv->icbs[new->marker_icb].current_reg = 1; - priv->icbs[new->marker_icb].pixelformat = pixelformat; + marker->offset = mem - priv->meram; + marker->size = new->meram_size * 1024; + marker->current_reg = 1; + marker->pixelformat = pixelformat; + + return 0; } /* Unmark the specified ICB as used. */ -static void meram_unmark(struct sh_mobile_meram_priv *priv, - const struct sh_mobile_meram_icb_cfg *icb) +static void meram_free(struct sh_mobile_meram_priv *priv, + const struct sh_mobile_meram_icb_cfg *icb) { + struct sh_mobile_meram_icb *marker = &priv->icbs[icb->marker_icb]; + + gen_pool_free(priv->pool, priv->meram + marker->offset, marker->size); + __clear_bit(icb->marker_icb, &priv->used_icb); __clear_bit(icb->cache_icb, &priv->used_icb); } @@ -302,6 +300,7 @@ static int meram_init(struct sh_mobile_meram_priv *priv, unsigned int xres, unsigned int yres, unsigned int *out_pitch) { + struct sh_mobile_meram_icb *marker = &priv->icbs[icb->marker_icb]; unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres); unsigned long bnm; unsigned int lcdc_pitch; @@ -356,11 +355,11 @@ static int meram_init(struct sh_mobile_meram_priv *priv, * we also split the allocated MERAM buffer between two ICBs. */ meram_write_icb(priv->base, icb->cache_icb, MExxCTL, - MERAM_MExxCTL_VAL(icb->marker_icb, icb->meram_offset) | + MERAM_MExxCTL_VAL(icb->marker_icb, marker->offset) | MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM | MExxCTL_MD_FB); meram_write_icb(priv->base, icb->marker_icb, MExxCTL, - MERAM_MExxCTL_VAL(icb->cache_icb, icb->meram_offset + + MERAM_MExxCTL_VAL(icb->cache_icb, marker->offset + icb->meram_size / 2) | MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM | MExxCTL_MD_FB); @@ -454,10 +453,18 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata, goto err; } - /* we now register the ICB */ - meram_mark(priv, &cfg->icb[0], pixelformat); - if (is_nvcolor(pixelformat)) - meram_mark(priv, &cfg->icb[1], pixelformat); + /* We now register the ICBs and allocate the MERAM regions. */ + error = meram_alloc(priv, &cfg->icb[0], pixelformat); + if (error < 0) + goto err; + + if (is_nvcolor(pixelformat)) { + error = meram_alloc(priv, &cfg->icb[1], pixelformat); + if (error < 0) { + meram_free(priv, &cfg->icb[0]); + goto err; + } + } /* initialize MERAM */ meram_init(priv, &cfg->icb[0], xres, yres, &out_pitch); @@ -497,10 +504,10 @@ static int sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, /* deinit & unmark */ if (is_nvcolor(icb->pixelformat)) { meram_deinit(priv, &cfg->icb[1]); - meram_unmark(priv, &cfg->icb[1]); + meram_free(priv, &cfg->icb[1]); } meram_deinit(priv, &cfg->icb[0]); - meram_unmark(priv, &cfg->icb[0]); + meram_free(priv, &cfg->icb[0]); mutex_unlock(&priv->lock); @@ -626,6 +633,7 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev) pdata->priv = priv; pdata->pdev = pdev; + /* Request memory regions and remap the registers. */ if (!request_mem_region(regs->start, resource_size(regs), pdev->name)) { dev_err(&pdev->dev, "MERAM registers region already claimed\n"); error = -EBUSY; @@ -646,6 +654,20 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev) goto err_ioremap; } + priv->meram = meram->start; + + /* Create and initialize the MERAM memory pool. */ + priv->pool = gen_pool_create(ilog2(MERAM_GRANULARITY), -1); + if (priv->pool == NULL) { + error = -ENOMEM; + goto err_genpool; + } + + error = gen_pool_add(priv->pool, meram->start, resource_size(meram), + -1); + if (error < 0) + goto err_genpool; + /* initialize ICB addressing mode */ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1) meram_write_reg(priv->base, MEVCR1, MEVCR1_AMD1); @@ -657,6 +679,10 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev) return 0; +err_genpool: + if (priv->pool) + gen_pool_destroy(priv->pool); + iounmap(priv->base); err_ioremap: release_mem_region(meram->start, resource_size(meram)); err_req_meram: @@ -677,6 +703,8 @@ static int sh_mobile_meram_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); + gen_pool_destroy(priv->pool); + iounmap(priv->base); release_mem_region(meram->start, resource_size(meram)); release_mem_region(regs->start, resource_size(regs)); diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h index 05ca3f92de10..f7700fcb054a 100644 --- a/include/video/sh_mobile_meram.h +++ b/include/video/sh_mobile_meram.h @@ -28,7 +28,6 @@ struct sh_mobile_meram_info { struct sh_mobile_meram_icb_cfg { unsigned int marker_icb; /* ICB # for Marker ICB */ unsigned int cache_icb; /* ICB # for Cache ICB */ - unsigned int meram_offset; /* MERAM Buffer Offset to use */ unsigned int meram_size; /* MERAM Buffer Size to use */ }; -- cgit v1.2.3 From b0a49d98fa4315c17a098cb60ccc626645ed9756 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2011 23:30:45 +0200 Subject: arm: mach-shmobile: Don't set MERAM ICB numbers in platform data The marker and cache ICBs are now allocated automatically, there's no need to specify them manually anymore. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ap4evb.c | 8 -------- arch/arm/mach-shmobile/board-mackerel.c | 8 -------- 2 files changed, 16 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 7b902277f145..714955e8b313 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -581,13 +581,9 @@ static const struct fb_videomode ap4evb_lcdc_modes[] = { }; static struct sh_mobile_meram_cfg lcd_meram_cfg = { .icb[0] = { - .marker_icb = 28, - .cache_icb = 24, .meram_size = 0x40, }, .icb[1] = { - .marker_icb = 29, - .cache_icb = 25, .meram_size = 0x40, }, }; @@ -862,13 +858,9 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, static struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { - .marker_icb = 30, - .cache_icb = 26, .meram_size = 0x100, }, .icb[1] = { - .marker_icb = 31, - .cache_icb = 27, .meram_size = 0x100, }, }; diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 0c0fd4f0c308..a6ad4a4bd6f7 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -371,13 +371,9 @@ static int mackerel_get_brightness(void) static struct sh_mobile_meram_cfg lcd_meram_cfg = { .icb[0] = { - .marker_icb = 28, - .cache_icb = 24, .meram_size = 0x40, }, .icb[1] = { - .marker_icb = 29, - .cache_icb = 25, .meram_size = 0x40, }, }; @@ -461,13 +457,9 @@ static struct platform_device hdmi_device = { static struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { - .marker_icb = 30, - .cache_icb = 26, .meram_size = 0x100, }, .icb[1] = { - .marker_icb = 31, - .cache_icb = 27, .meram_size = 0x100, }, }; -- cgit v1.2.3 From c241a0e0c27882ecab1df57a44d202db6e02012c Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 11 Sep 2011 23:30:45 +0200 Subject: arm: mach-shmobile: Constify sh_mobile_meram_cfg structures The structures, passed to the sh_mobile_lcdcfb driver through platform data, are read only by the driver. Make them const. Signed-off-by: Laurent Pinchart --- arch/arm/mach-shmobile/board-ap4evb.c | 5 +++-- arch/arm/mach-shmobile/board-mackerel.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 714955e8b313..d4cc2dec5734 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -579,7 +579,8 @@ static const struct fb_videomode ap4evb_lcdc_modes[] = { #endif }, }; -static struct sh_mobile_meram_cfg lcd_meram_cfg = { + +static const struct sh_mobile_meram_cfg lcd_meram_cfg = { .icb[0] = { .meram_size = 0x40, }, @@ -856,7 +857,7 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, return error; } -static struct sh_mobile_meram_cfg hdmi_meram_cfg = { +static const struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { .meram_size = 0x100, }, diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index a6ad4a4bd6f7..e761b280a602 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -369,7 +369,7 @@ static int mackerel_get_brightness(void) return gpio_get_value(GPIO_PORT31); } -static struct sh_mobile_meram_cfg lcd_meram_cfg = { +static const struct sh_mobile_meram_cfg lcd_meram_cfg = { .icb[0] = { .meram_size = 0x40, }, @@ -455,7 +455,7 @@ static struct platform_device hdmi_device = { }, }; -static struct sh_mobile_meram_cfg hdmi_meram_cfg = { +static const struct sh_mobile_meram_cfg hdmi_meram_cfg = { .icb[0] = { .meram_size = 0x100, }, -- cgit v1.2.3 From 8f9c60f2e29717155227f225b557d3f1fda442bd Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Mar 2012 18:34:10 -0700 Subject: fbdev: sh_mipi_dsi: add extra phyctrl for sh_mipi_dsi_info sh_mipi uses some clocks, but the method of setup depends on CPU. Current SuperH (like sh73a0) can control all of these clocks by CPG (Clock Pulse Generator). It means we can control it by clock framework only. But on sh7372, it needs CPG settings AND sh_mipi PHYCTRL::PLLDS, and only sh7372 has PHYCTRL::PLLDS. But on current sh_mipi driver, PHYCTRL::PLLDS of sh7372 was overwrote since the callback timing of clock setting was changed by c2658b70f06108361aa5024798f9c1bf47c73374 (fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()). To solve this issue, this patch adds extra .phyctrl. This patch adds detail explanation for unclear mipi settings and fixup wrong PHYCTRL::PLLDS value for ap4evb (0xb -> 0x6). Signed-off-by: Kuninori Morimoto Signed-off-by: Florian Tobias Schandinat --- arch/arm/mach-shmobile/board-ap4evb.c | 12 +++++++++--- drivers/video/sh_mipi_dsi.c | 2 +- include/video/sh_mipi_dsi.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'arch/arm/mach-shmobile/board-ap4evb.c') diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 82483d5f200c..581ec66eef96 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -486,20 +486,25 @@ static struct platform_device keysc_device = { }; /* MIPI-DSI */ -#define PHYCTRL 0x0070 static int sh_mipi_set_dot_clock(struct platform_device *pdev, void __iomem *base, int enable) { struct clk *pck = clk_get(&pdev->dev, "dsip_clk"); - void __iomem *phy = base + PHYCTRL; if (IS_ERR(pck)) return PTR_ERR(pck); if (enable) { + /* + * DSIPCLK = 24MHz + * D-PHY = DSIPCLK * ((0x6*2)+1) = 312MHz (see .phyctrl) + * HsByteCLK = D-PHY/8 = 39MHz + * + * X * Y * FPS = + * (544+72+600+16) * (961+8+8+2) * 30 = 36.1MHz + */ clk_set_rate(pck, clk_round_rate(pck, 24000000)); - iowrite32(ioread32(phy) | (0xb << 8), phy); clk_enable(pck); } else { clk_disable(pck); @@ -530,6 +535,7 @@ static struct sh_mipi_dsi_info mipidsi0_info = { .lcd_chan = &lcdc_info.ch[0], .lane = 2, .vsynw_offset = 17, + .phyctrl = 0x6 << 8, .flags = SH_MIPI_DSI_SYNC_PULSES_MODE | SH_MIPI_DSI_HSbyteCLK, .set_dot_clock = sh_mipi_set_dot_clock, diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 42ad0f707e88..4c6b84488561 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c @@ -273,7 +273,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, iowrite32(0x00000001, base + PHYCTRL); udelay(200); /* Deassert resets, power on */ - iowrite32(0x03070001, base + PHYCTRL); + iowrite32(0x03070001 | pdata->phyctrl, base + PHYCTRL); /* * Default = ULPS enable | diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h index 434d56b4a1a5..06c67fbc4eee 100644 --- a/include/video/sh_mipi_dsi.h +++ b/include/video/sh_mipi_dsi.h @@ -51,6 +51,7 @@ struct sh_mipi_dsi_info { int lane; unsigned long flags; u32 clksrc; + u32 phyctrl; /* for extra setting */ unsigned int vsynw_offset; int (*set_dot_clock)(struct platform_device *pdev, void __iomem *base, -- cgit v1.2.3