提交 f9b4a5ce 编写于 作者: F Florian Tobias Schandinat

Merge branch 'for-next' of git://linuxtv.org/pinchartl/fbdev into fbdev-next

...@@ -229,16 +229,6 @@ static void lcd_backlight_reset(void) ...@@ -229,16 +229,6 @@ static void lcd_backlight_reset(void)
gpio_set_value(GPIO_PORT235, 1); gpio_set_value(GPIO_PORT235, 1);
} }
static void lcd_on(void *board_data, struct fb_info *info)
{
lcd_backlight_on();
}
static void lcd_off(void *board_data)
{
lcd_backlight_reset();
}
/* LCDC0 */ /* LCDC0 */
static const struct fb_videomode lcdc0_modes[] = { static const struct fb_videomode lcdc0_modes[] = {
{ {
...@@ -262,14 +252,14 @@ static struct sh_mobile_lcdc_info lcdc0_info = { ...@@ -262,14 +252,14 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
.interface_type = RGB24, .interface_type = RGB24,
.clock_divider = 1, .clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL, .flags = LCDC_FLAGS_DWPOL,
.lcd_size_cfg.width = 44,
.lcd_size_cfg.height = 79,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.lcd_cfg = lcdc0_modes, .lcd_modes = lcdc0_modes,
.num_cfg = ARRAY_SIZE(lcdc0_modes), .num_modes = ARRAY_SIZE(lcdc0_modes),
.board_cfg = { .panel_cfg = {
.display_on = lcd_on, .width = 44,
.display_off = lcd_off, .height = 79,
.display_on = lcd_backlight_on,
.display_off = lcd_backlight_reset,
}, },
} }
}; };
......
...@@ -258,10 +258,16 @@ static struct sh_mobile_meram_info meram_info = { ...@@ -258,10 +258,16 @@ static struct sh_mobile_meram_info meram_info = {
static struct resource meram_resources[] = { static struct resource meram_resources[] = {
[0] = { [0] = {
.name = "MERAM", .name = "regs",
.start = 0xe8000000, .start = 0xe8000000,
.end = 0xe81fffff, .end = 0xe807ffff,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
},
[1] = {
.name = "meram",
.start = 0xe8080000,
.end = 0xe81fffff,
.flags = IORESOURCE_MEM,
}, },
}; };
...@@ -437,82 +443,6 @@ static struct platform_device usb1_host_device = { ...@@ -437,82 +443,6 @@ static struct platform_device usb1_host_device = {
.resource = usb1_host_resources, .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 * QHD display
*/ */
...@@ -593,6 +523,8 @@ static struct resource mipidsi0_resources[] = { ...@@ -593,6 +523,8 @@ static struct resource mipidsi0_resources[] = {
}, },
}; };
static struct sh_mobile_lcdc_info lcdc_info;
static struct sh_mipi_dsi_info mipidsi0_info = { static struct sh_mipi_dsi_info mipidsi0_info = {
.data_format = MIPI_RGB888, .data_format = MIPI_RGB888,
.lcd_chan = &lcdc_info.ch[0], .lcd_chan = &lcdc_info.ch[0],
...@@ -619,6 +551,81 @@ static struct platform_device *qhd_devices[] __initdata = { ...@@ -619,6 +551,81 @@ static struct platform_device *qhd_devices[] __initdata = {
}; };
#endif /* CONFIG_AP4EVB_QHD */ #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 const struct sh_mobile_meram_cfg lcd_meram_cfg = {
.icb[0] = {
.meram_size = 0x40,
},
.icb[1] = {
.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_modes = ap4evb_lcdc_modes,
.num_modes = 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 */ /* FSI */
#define IRQ_FSI evt2irq(0x1840) #define IRQ_FSI evt2irq(0x1840)
static int __fsi_set_rate(struct clk *clk, long rate, int enable) static int __fsi_set_rate(struct clk *clk, long rate, int enable)
...@@ -798,65 +805,11 @@ static struct platform_device fsi_ak4643_device = { ...@@ -798,65 +805,11 @@ static struct platform_device fsi_ak4643_device = {
}, },
}; };
static struct sh_mobile_meram_cfg hdmi_meram_cfg = { /* LCDC1 */
.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,
},
};
static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
.clock_source = LCDC_CLK_EXTERNAL,
.meram_dev = &meram_info,
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565,
.interface_type = RGB24,
.clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL,
.meram_cfg = &hdmi_meram_cfg,
}
};
static struct resource lcdc1_resources[] = {
[0] = {
.name = "LCDC1",
.start = 0xfe944000,
.end = 0xfe947fff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = intcs_evt2irq(0x1780),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device lcdc1_device = {
.name = "sh_mobile_lcdc_fb",
.num_resources = ARRAY_SIZE(lcdc1_resources),
.resource = lcdc1_resources,
.id = 1,
.dev = {
.platform_data = &sh_mobile_lcdc1_info,
.coherent_dma_mask = ~0,
},
};
static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
unsigned long *parent_freq); unsigned long *parent_freq);
static struct sh_mobile_hdmi_info hdmi_info = { 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, .flags = HDMI_SND_SRC_SPDIF,
.clk_optimize_parent = ap4evb_clk_optimize, .clk_optimize_parent = ap4evb_clk_optimize,
}; };
...@@ -885,10 +838,6 @@ static struct platform_device hdmi_device = { ...@@ -885,10 +838,6 @@ static struct platform_device hdmi_device = {
}, },
}; };
static struct platform_device fsi_hdmi_device = {
.name = "sh_fsi2_b_hdmi",
};
static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
unsigned long *parent_freq) unsigned long *parent_freq)
{ {
...@@ -908,6 +857,57 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, ...@@ -908,6 +857,57 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
return error; return error;
} }
static const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
.icb[0] = {
.meram_size = 0x100,
},
.icb[1] = {
.meram_size = 0x100,
},
};
static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
.clock_source = LCDC_CLK_EXTERNAL,
.meram_dev = &meram_info,
.ch[0] = {
.chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565,
.interface_type = RGB24,
.clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL,
.meram_cfg = &hdmi_meram_cfg,
.tx_dev = &hdmi_device,
}
};
static struct resource lcdc1_resources[] = {
[0] = {
.name = "LCDC1",
.start = 0xfe944000,
.end = 0xfe947fff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = intcs_evt2irq(0x1780),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device lcdc1_device = {
.name = "sh_mobile_lcdc_fb",
.num_resources = ARRAY_SIZE(lcdc1_resources),
.resource = lcdc1_resources,
.id = 1,
.dev = {
.platform_data = &sh_mobile_lcdc1_info,
.coherent_dma_mask = ~0,
},
};
static struct platform_device fsi_hdmi_device = {
.name = "sh_fsi2_b_hdmi",
};
static struct gpio_led ap4evb_leds[] = { static struct gpio_led ap4evb_leds[] = {
{ {
.name = "led4", .name = "led4",
...@@ -1042,9 +1042,9 @@ static struct platform_device *ap4evb_devices[] __initdata = { ...@@ -1042,9 +1042,9 @@ static struct platform_device *ap4evb_devices[] __initdata = {
&fsi_ak4643_device, &fsi_ak4643_device,
&fsi_hdmi_device, &fsi_hdmi_device,
&sh_mmcif_device, &sh_mmcif_device,
&lcdc1_device,
&lcdc_device,
&hdmi_device, &hdmi_device,
&lcdc_device,
&lcdc1_device,
&ceu_device, &ceu_device,
&ap4evb_camera, &ap4evb_camera,
&meram_device, &meram_device,
...@@ -1355,8 +1355,8 @@ static void __init ap4evb_init(void) ...@@ -1355,8 +1355,8 @@ static void __init ap4evb_init(void)
lcdc_info.ch[0].interface_type = RGB24; lcdc_info.ch[0].interface_type = RGB24;
lcdc_info.ch[0].clock_divider = 1; lcdc_info.ch[0].clock_divider = 1;
lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
lcdc_info.ch[0].lcd_size_cfg.width = 44; lcdc_info.ch[0].panel_cfg.width = 44;
lcdc_info.ch[0].lcd_size_cfg.height = 79; lcdc_info.ch[0].panel_cfg.height = 79;
platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices)); platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
...@@ -1397,8 +1397,8 @@ static void __init ap4evb_init(void) ...@@ -1397,8 +1397,8 @@ static void __init ap4evb_init(void)
lcdc_info.ch[0].interface_type = RGB18; lcdc_info.ch[0].interface_type = RGB18;
lcdc_info.ch[0].clock_divider = 3; lcdc_info.ch[0].clock_divider = 3;
lcdc_info.ch[0].flags = 0; lcdc_info.ch[0].flags = 0;
lcdc_info.ch[0].lcd_size_cfg.width = 152; lcdc_info.ch[0].panel_cfg.width = 152;
lcdc_info.ch[0].lcd_size_cfg.height = 91; lcdc_info.ch[0].panel_cfg.height = 91;
/* enable TouchScreen */ /* enable TouchScreen */
irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
......
...@@ -245,9 +245,9 @@ static struct sh_mobile_lcdc_info lcdc0_info = { ...@@ -245,9 +245,9 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
.interface_type = RGB24, .interface_type = RGB24,
.clock_divider = 5, .clock_divider = 5,
.flags = 0, .flags = 0,
.lcd_cfg = &lcdc0_mode, .lcd_modes = &lcdc0_mode,
.num_cfg = 1, .num_modes = 1,
.lcd_size_cfg = { .panel_cfg = {
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
......
...@@ -318,8 +318,14 @@ static struct sh_mobile_meram_info mackerel_meram_info = { ...@@ -318,8 +318,14 @@ static struct sh_mobile_meram_info mackerel_meram_info = {
static struct resource meram_resources[] = { static struct resource meram_resources[] = {
[0] = { [0] = {
.name = "MERAM", .name = "regs",
.start = 0xe8000000, .start = 0xe8000000,
.end = 0xe807ffff,
.flags = IORESOURCE_MEM,
},
[1] = {
.name = "meram",
.start = 0xe8080000,
.end = 0xe81fffff, .end = 0xe81fffff,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, },
...@@ -351,29 +357,23 @@ static struct fb_videomode mackerel_lcdc_modes[] = { ...@@ -351,29 +357,23 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
}, },
}; };
static int mackerel_set_brightness(void *board_data, int brightness) static int mackerel_set_brightness(int brightness)
{ {
gpio_set_value(GPIO_PORT31, brightness); gpio_set_value(GPIO_PORT31, brightness);
return 0; return 0;
} }
static int mackerel_get_brightness(void *board_data) static int mackerel_get_brightness(void)
{ {
return gpio_get_value(GPIO_PORT31); 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] = { .icb[0] = {
.marker_icb = 28,
.cache_icb = 24,
.meram_offset = 0x0,
.meram_size = 0x40, .meram_size = 0x40,
}, },
.icb[1] = { .icb[1] = {
.marker_icb = 29,
.cache_icb = 25,
.meram_offset = 0x40,
.meram_size = 0x40, .meram_size = 0x40,
}, },
}; };
...@@ -384,20 +384,20 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -384,20 +384,20 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.ch[0] = { .ch[0] = {
.chan = LCDC_CHAN_MAINLCD, .chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.lcd_cfg = mackerel_lcdc_modes, .lcd_modes = mackerel_lcdc_modes,
.num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), .num_modes = ARRAY_SIZE(mackerel_lcdc_modes),
.interface_type = RGB24, .interface_type = RGB24,
.clock_divider = 3, .clock_divider = 3,
.flags = 0, .flags = 0,
.lcd_size_cfg.width = 152, .panel_cfg = {
.lcd_size_cfg.height = 91, .width = 152,
.board_cfg = { .height = 91,
.set_brightness = mackerel_set_brightness,
.get_brightness = mackerel_get_brightness,
}, },
.bl_info = { .bl_info = {
.name = "sh_mobile_lcdc_bl", .name = "sh_mobile_lcdc_bl",
.max_brightness = 1, .max_brightness = 1,
.set_brightness = mackerel_set_brightness,
.get_brightness = mackerel_get_brightness,
}, },
.meram_cfg = &lcd_meram_cfg, .meram_cfg = &lcd_meram_cfg,
} }
...@@ -426,21 +426,44 @@ static struct platform_device lcdc_device = { ...@@ -426,21 +426,44 @@ static struct platform_device lcdc_device = {
}, },
}; };
static struct sh_mobile_meram_cfg hdmi_meram_cfg = { /* HDMI */
static struct sh_mobile_hdmi_info hdmi_info = {
.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 const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
.icb[0] = { .icb[0] = {
.marker_icb = 30,
.cache_icb = 26,
.meram_offset = 0x80,
.meram_size = 0x100, .meram_size = 0x100,
}, },
.icb[1] = { .icb[1] = {
.marker_icb = 31,
.cache_icb = 27,
.meram_offset = 0x180,
.meram_size = 0x100, .meram_size = 0x100,
}, },
}; };
/* HDMI */
static struct sh_mobile_lcdc_info hdmi_lcdc_info = { static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
.meram_dev = &mackerel_meram_info, .meram_dev = &mackerel_meram_info,
.clock_source = LCDC_CLK_EXTERNAL, .clock_source = LCDC_CLK_EXTERNAL,
...@@ -451,6 +474,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = { ...@@ -451,6 +474,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
.clock_divider = 1, .clock_divider = 1,
.flags = LCDC_FLAGS_DWPOL, .flags = LCDC_FLAGS_DWPOL,
.meram_cfg = &hdmi_meram_cfg, .meram_cfg = &hdmi_meram_cfg,
.tx_dev = &hdmi_device,
} }
}; };
...@@ -478,36 +502,6 @@ static struct platform_device hdmi_lcdc_device = { ...@@ -478,36 +502,6 @@ static struct platform_device hdmi_lcdc_device = {
}, },
}; };
static struct sh_mobile_hdmi_info hdmi_info = {
.lcd_chan = &hdmi_lcdc_info.ch[0],
.lcd_dev = &hdmi_lcdc_device.dev,
.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 = { static struct platform_device fsi_hdmi_device = {
.name = "sh_fsi2_b_hdmi", .name = "sh_fsi2_b_hdmi",
}; };
...@@ -1276,8 +1270,8 @@ static struct platform_device *mackerel_devices[] __initdata = { ...@@ -1276,8 +1270,8 @@ static struct platform_device *mackerel_devices[] __initdata = {
&sh_mmcif_device, &sh_mmcif_device,
&ceu_device, &ceu_device,
&mackerel_camera, &mackerel_camera,
&hdmi_lcdc_device,
&hdmi_device, &hdmi_device,
&hdmi_lcdc_device,
&meram_device, &meram_device,
}; };
......
...@@ -157,7 +157,7 @@ static struct platform_device nand_flash_device = { ...@@ -157,7 +157,7 @@ static struct platform_device nand_flash_device = {
#define PORT_DRVCRA 0xA405018A #define PORT_DRVCRA 0xA405018A
#define PORT_DRVCRB 0xA405018C #define PORT_DRVCRB 0xA405018C
static int ap320_wvga_set_brightness(void *board_data, int brightness) static int ap320_wvga_set_brightness(int brightness)
{ {
if (brightness) { if (brightness) {
gpio_set_value(GPIO_PTS3, 0); gpio_set_value(GPIO_PTS3, 0);
...@@ -170,12 +170,12 @@ static int ap320_wvga_set_brightness(void *board_data, int brightness) ...@@ -170,12 +170,12 @@ static int ap320_wvga_set_brightness(void *board_data, int brightness)
return 0; return 0;
} }
static int ap320_wvga_get_brightness(void *board_data) static int ap320_wvga_get_brightness(void)
{ {
return gpio_get_value(GPIO_PTS3); return gpio_get_value(GPIO_PTS3);
} }
static void ap320_wvga_power_on(void *board_data, struct fb_info *info) static void ap320_wvga_power_on(void)
{ {
msleep(100); msleep(100);
...@@ -183,7 +183,7 @@ static void ap320_wvga_power_on(void *board_data, struct fb_info *info) ...@@ -183,7 +183,7 @@ static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
__raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG); __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
} }
static void ap320_wvga_power_off(void *board_data) static void ap320_wvga_power_off(void)
{ {
/* ASD AP-320/325 LCD OFF */ /* ASD AP-320/325 LCD OFF */
__raw_writew(0, FPGA_LCDREG); __raw_writew(0, FPGA_LCDREG);
...@@ -211,21 +211,19 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -211,21 +211,19 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.interface_type = RGB18, .interface_type = RGB18,
.clock_divider = 1, .clock_divider = 1,
.lcd_cfg = ap325rxa_lcdc_modes, .lcd_modes = ap325rxa_lcdc_modes,
.num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes), .num_modes = ARRAY_SIZE(ap325rxa_lcdc_modes),
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = {
.width = 152, .width = 152, /* 7.0 inch */
.height = 91, .height = 91,
},
.board_cfg = {
.display_on = ap320_wvga_power_on, .display_on = ap320_wvga_power_on,
.display_off = ap320_wvga_power_off, .display_off = ap320_wvga_power_off,
.set_brightness = ap320_wvga_set_brightness,
.get_brightness = ap320_wvga_get_brightness,
}, },
.bl_info = { .bl_info = {
.name = "sh_mobile_lcdc_bl", .name = "sh_mobile_lcdc_bl",
.max_brightness = 1, .max_brightness = 1,
.set_brightness = ap320_wvga_set_brightness,
.get_brightness = ap320_wvga_get_brightness,
}, },
} }
}; };
......
...@@ -310,14 +310,14 @@ static const struct fb_videomode ecovec_dvi_modes[] = { ...@@ -310,14 +310,14 @@ static const struct fb_videomode ecovec_dvi_modes[] = {
}, },
}; };
static int ecovec24_set_brightness(void *board_data, int brightness) static int ecovec24_set_brightness(int brightness)
{ {
gpio_set_value(GPIO_PTR1, brightness); gpio_set_value(GPIO_PTR1, brightness);
return 0; return 0;
} }
static int ecovec24_get_brightness(void *board_data) static int ecovec24_get_brightness(void)
{ {
return gpio_get_value(GPIO_PTR1); return gpio_get_value(GPIO_PTR1);
} }
...@@ -327,17 +327,15 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -327,17 +327,15 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.interface_type = RGB18, .interface_type = RGB18,
.chan = LCDC_CHAN_MAINLCD, .chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = { /* 7.0 inch */
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
.board_cfg = {
.set_brightness = ecovec24_set_brightness,
.get_brightness = ecovec24_get_brightness,
},
.bl_info = { .bl_info = {
.name = "sh_mobile_lcdc_bl", .name = "sh_mobile_lcdc_bl",
.max_brightness = 1, .max_brightness = 1,
.set_brightness = ecovec24_set_brightness,
.get_brightness = ecovec24_get_brightness,
}, },
} }
}; };
...@@ -1116,8 +1114,8 @@ static int __init arch_setup(void) ...@@ -1116,8 +1114,8 @@ static int __init arch_setup(void)
/* DVI */ /* DVI */
lcdc_info.clock_source = LCDC_CLK_EXTERNAL; lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
lcdc_info.ch[0].clock_divider = 1; lcdc_info.ch[0].clock_divider = 1;
lcdc_info.ch[0].lcd_cfg = ecovec_dvi_modes; lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes;
lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_dvi_modes); lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes);
gpio_set_value(GPIO_PTA2, 1); gpio_set_value(GPIO_PTA2, 1);
gpio_set_value(GPIO_PTU1, 1); gpio_set_value(GPIO_PTU1, 1);
...@@ -1125,8 +1123,8 @@ static int __init arch_setup(void) ...@@ -1125,8 +1123,8 @@ static int __init arch_setup(void)
/* Panel */ /* Panel */
lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
lcdc_info.ch[0].clock_divider = 2; lcdc_info.ch[0].clock_divider = 2;
lcdc_info.ch[0].lcd_cfg = ecovec_lcd_modes; lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes;
lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_lcd_modes); lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes);
gpio_set_value(GPIO_PTR1, 1); gpio_set_value(GPIO_PTR1, 1);
......
...@@ -251,8 +251,7 @@ static void display_on(void *sohandle, ...@@ -251,8 +251,7 @@ static void display_on(void *sohandle,
write_memory_start(sohandle, so); write_memory_start(sohandle, so);
} }
int kfr2r09_lcd_setup(void *board_data, void *sohandle, int kfr2r09_lcd_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
struct sh_mobile_lcdc_sys_bus_ops *so)
{ {
/* power on */ /* power on */
gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */ gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
...@@ -273,8 +272,7 @@ int kfr2r09_lcd_setup(void *board_data, void *sohandle, ...@@ -273,8 +272,7 @@ int kfr2r09_lcd_setup(void *board_data, void *sohandle,
return 0; return 0;
} }
void kfr2r09_lcd_start(void *board_data, void *sohandle, void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
struct sh_mobile_lcdc_sys_bus_ops *so)
{ {
write_memory_start(sohandle, so); write_memory_start(sohandle, so);
} }
...@@ -327,12 +325,12 @@ static int kfr2r09_lcd_backlight(int on) ...@@ -327,12 +325,12 @@ static int kfr2r09_lcd_backlight(int on)
return 0; return 0;
} }
void kfr2r09_lcd_on(void *board_data, struct fb_info *info) void kfr2r09_lcd_on(void)
{ {
kfr2r09_lcd_backlight(1); kfr2r09_lcd_backlight(1);
} }
void kfr2r09_lcd_off(void *board_data) void kfr2r09_lcd_off(void)
{ {
kfr2r09_lcd_backlight(0); kfr2r09_lcd_backlight(0);
} }
...@@ -148,13 +148,11 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { ...@@ -148,13 +148,11 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
.interface_type = SYS18, .interface_type = SYS18,
.clock_divider = 6, .clock_divider = 6,
.flags = LCDC_FLAGS_DWPOL, .flags = LCDC_FLAGS_DWPOL,
.lcd_cfg = kfr2r09_lcdc_modes, .lcd_modes = kfr2r09_lcdc_modes,
.num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes), .num_modes = ARRAY_SIZE(kfr2r09_lcdc_modes),
.lcd_size_cfg = { .panel_cfg = {
.width = 35, .width = 35,
.height = 58, .height = 58,
},
.board_cfg = {
.setup_sys = kfr2r09_lcd_setup, .setup_sys = kfr2r09_lcd_setup,
.start_transfer = kfr2r09_lcd_start, .start_transfer = kfr2r09_lcd_start,
.display_on = kfr2r09_lcd_on, .display_on = kfr2r09_lcd_on,
......
...@@ -113,8 +113,7 @@ static const unsigned short magic3_data[] = { ...@@ -113,8 +113,7 @@ static const unsigned short magic3_data[] = {
0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061, 0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061,
}; };
int migor_lcd_qvga_setup(void *board_data, void *sohandle, int migor_lcd_qvga_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
struct sh_mobile_lcdc_sys_bus_ops *so)
{ {
unsigned long xres = 320; unsigned long xres = 320;
unsigned long yres = 240; unsigned long yres = 240;
......
...@@ -246,9 +246,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { ...@@ -246,9 +246,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.interface_type = RGB16, .interface_type = RGB16,
.clock_divider = 2, .clock_divider = 2,
.lcd_cfg = migor_lcd_modes, .lcd_modes = migor_lcd_modes,
.num_cfg = ARRAY_SIZE(migor_lcd_modes), .num_modes = ARRAY_SIZE(migor_lcd_modes),
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = { /* 7.0 inch */
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
...@@ -260,13 +260,11 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { ...@@ -260,13 +260,11 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.interface_type = SYS16A, .interface_type = SYS16A,
.clock_divider = 10, .clock_divider = 10,
.lcd_cfg = migor_lcd_modes, .lcd_modes = migor_lcd_modes,
.num_cfg = ARRAY_SIZE(migor_lcd_modes), .num_modes = ARRAY_SIZE(migor_lcd_modes),
.lcd_size_cfg = { /* 2.4 inch */ .panel_cfg = {
.width = 49, .width = 49, /* 2.4 inch */
.height = 37, .height = 37,
},
.board_cfg = {
.setup_sys = migor_lcd_qvga_setup, .setup_sys = migor_lcd_qvga_setup,
}, },
.sys_bus_cfg = { .sys_bus_cfg = {
......
...@@ -182,12 +182,10 @@ static struct sh_mobile_lcdc_info lcdc_info = { ...@@ -182,12 +182,10 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.chan = LCDC_CHAN_MAINLCD, .chan = LCDC_CHAN_MAINLCD,
.fourcc = V4L2_PIX_FMT_RGB565, .fourcc = V4L2_PIX_FMT_RGB565,
.clock_divider = 1, .clock_divider = 1,
.lcd_size_cfg = { /* 7.0 inch */ .panel_cfg = { /* 7.0 inch */
.width = 152, .width = 152,
.height = 91, .height = 91,
}, },
.board_cfg = {
},
} }
}; };
...@@ -888,12 +886,12 @@ static int __init devices_setup(void) ...@@ -888,12 +886,12 @@ static int __init devices_setup(void)
if (sw & SW41_B) { if (sw & SW41_B) {
/* 720p */ /* 720p */
lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes; lcdc_info.ch[0].lcd_modes = lcdc_720p_modes;
lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes); lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_720p_modes);
} else { } else {
/* VGA */ /* VGA */
lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes; lcdc_info.ch[0].lcd_modes = lcdc_vga_modes;
lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes); lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_vga_modes);
} }
if (sw & SW41_A) { if (sw & SW41_A) {
......
...@@ -4,21 +4,21 @@ ...@@ -4,21 +4,21 @@
#include <video/sh_mobile_lcdc.h> #include <video/sh_mobile_lcdc.h>
#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE) #if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
void kfr2r09_lcd_on(void *board_data, struct fb_info *info); void kfr2r09_lcd_on(void);
void kfr2r09_lcd_off(void *board_data); void kfr2r09_lcd_off(void);
int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle, int kfr2r09_lcd_setup(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops); struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
void kfr2r09_lcd_start(void *board_data, void *sys_ops_handle, void kfr2r09_lcd_start(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops); struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
#else #else
static void kfr2r09_lcd_on(void *board_data) {} static void kfr2r09_lcd_on(void) {}
static void kfr2r09_lcd_off(void *board_data) {} static void kfr2r09_lcd_off(void) {}
static int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle, static int kfr2r09_lcd_setup(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops) struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
{ {
return -ENODEV; return -ENODEV;
} }
static void kfr2r09_lcd_start(void *board_data, void *sys_ops_handle, static void kfr2r09_lcd_start(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops) struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
{ {
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <video/sh_mobile_lcdc.h> #include <video/sh_mobile_lcdc.h>
int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle, int migor_lcd_qvga_setup(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops); struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
#endif /* __ASM_SH_MIGOR_H */ #endif /* __ASM_SH_MIGOR_H */
...@@ -2016,6 +2016,7 @@ config FB_SH_MOBILE_HDMI ...@@ -2016,6 +2016,7 @@ config FB_SH_MOBILE_HDMI
config FB_SH_MOBILE_MERAM config FB_SH_MOBILE_MERAM
tristate "SuperH Mobile MERAM read ahead support for LCDC" tristate "SuperH Mobile MERAM read ahead support for LCDC"
depends on FB_SH_MOBILE_LCDC depends on FB_SH_MOBILE_LCDC
select GENERIC_ALLOCATOR
default y default y
---help--- ---help---
Enable MERAM support for the SH-Mobile LCD controller. Enable MERAM support for the SH-Mobile LCD controller.
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <video/sh_mipi_dsi.h> #include <video/sh_mipi_dsi.h>
#include <video/sh_mobile_lcdc.h> #include <video/sh_mobile_lcdc.h>
#include "sh_mobile_lcdcfb.h"
#define SYSCTRL 0x0000 #define SYSCTRL 0x0000
#define SYSCONF 0x0004 #define SYSCONF 0x0004
#define TIMSET 0x0008 #define TIMSET 0x0008
...@@ -50,16 +52,16 @@ ...@@ -50,16 +52,16 @@
#define MAX_SH_MIPI_DSI 2 #define MAX_SH_MIPI_DSI 2
struct sh_mipi { struct sh_mipi {
struct sh_mobile_lcdc_entity entity;
void __iomem *base; void __iomem *base;
void __iomem *linkbase; void __iomem *linkbase;
struct clk *dsit_clk; struct clk *dsit_clk;
struct platform_device *pdev; struct platform_device *pdev;
void *next_board_data;
void (*next_display_on)(void *board_data, struct fb_info *info);
void (*next_display_off)(void *board_data);
}; };
#define to_sh_mipi(e) container_of(e, struct sh_mipi, entity)
static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI]; static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI];
/* Protect the above array */ /* Protect the above array */
...@@ -120,7 +122,7 @@ static void sh_mipi_dsi_enable(struct sh_mipi *mipi, bool enable) ...@@ -120,7 +122,7 @@ static void sh_mipi_dsi_enable(struct sh_mipi *mipi, bool enable)
static void sh_mipi_shutdown(struct platform_device *pdev) static void sh_mipi_shutdown(struct platform_device *pdev)
{ {
struct sh_mipi *mipi = platform_get_drvdata(pdev); struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
sh_mipi_dsi_enable(mipi, false); sh_mipi_dsi_enable(mipi, false);
} }
...@@ -145,77 +147,77 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, ...@@ -145,77 +147,77 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
pctype = 0; pctype = 0;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
linelength = ch->lcd_cfg[0].xres * 3; linelength = ch->lcd_modes[0].xres * 3;
yuv = false; yuv = false;
break; break;
case MIPI_RGB565: case MIPI_RGB565:
pctype = 1; pctype = 1;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
linelength = ch->lcd_cfg[0].xres * 2; linelength = ch->lcd_modes[0].xres * 2;
yuv = false; yuv = false;
break; break;
case MIPI_RGB666_LP: case MIPI_RGB666_LP:
pctype = 2; pctype = 2;
datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
linelength = ch->lcd_cfg[0].xres * 3; linelength = ch->lcd_modes[0].xres * 3;
yuv = false; yuv = false;
break; break;
case MIPI_RGB666: case MIPI_RGB666:
pctype = 3; pctype = 3;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; 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; yuv = false;
break; break;
case MIPI_BGR888: case MIPI_BGR888:
pctype = 8; pctype = 8;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
linelength = ch->lcd_cfg[0].xres * 3; linelength = ch->lcd_modes[0].xres * 3;
yuv = false; yuv = false;
break; break;
case MIPI_BGR565: case MIPI_BGR565:
pctype = 9; pctype = 9;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
linelength = ch->lcd_cfg[0].xres * 2; linelength = ch->lcd_modes[0].xres * 2;
yuv = false; yuv = false;
break; break;
case MIPI_BGR666_LP: case MIPI_BGR666_LP:
pctype = 0xa; pctype = 0xa;
datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
linelength = ch->lcd_cfg[0].xres * 3; linelength = ch->lcd_modes[0].xres * 3;
yuv = false; yuv = false;
break; break;
case MIPI_BGR666: case MIPI_BGR666:
pctype = 0xb; pctype = 0xb;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; 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; yuv = false;
break; break;
case MIPI_YUYV: case MIPI_YUYV:
pctype = 4; pctype = 4;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
linelength = ch->lcd_cfg[0].xres * 2; linelength = ch->lcd_modes[0].xres * 2;
yuv = true; yuv = true;
break; break;
case MIPI_UYVY: case MIPI_UYVY:
pctype = 5; pctype = 5;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
linelength = ch->lcd_cfg[0].xres * 2; linelength = ch->lcd_modes[0].xres * 2;
yuv = true; yuv = true;
break; break;
case MIPI_YUV420_L: case MIPI_YUV420_L:
pctype = 6; pctype = 6;
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; 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; yuv = true;
break; break;
case MIPI_YUV420: case MIPI_YUV420:
...@@ -223,7 +225,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, ...@@ -223,7 +225,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
/* Length of U/V line */ /* Length of U/V line */
linelength = (ch->lcd_cfg[0].xres + 1) / 2; linelength = (ch->lcd_modes[0].xres + 1) / 2;
yuv = true; yuv = true;
break; break;
default: default:
...@@ -292,7 +294,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, ...@@ -292,7 +294,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
*/ */
iowrite32(0x00000006, mipi->linkbase + DTCTR); iowrite32(0x00000006, mipi->linkbase + DTCTR);
/* VSYNC width = 2 (<< 17) */ /* 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, (pdata->clksrc << 16) | (pctype << 12) | datatype,
mipi->linkbase + VMCTR1); mipi->linkbase + VMCTR1);
...@@ -326,7 +328,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, ...@@ -326,7 +328,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
top = linelength << 16; /* RGBLEN */ top = linelength << 16; /* RGBLEN */
bottom = 0x00000001; bottom = 0x00000001;
if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */ 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); iowrite32(top | bottom , mipi->linkbase + VMLEN1);
/* /*
...@@ -346,18 +348,18 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, ...@@ -346,18 +348,18 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
div = 2; div = 2;
if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */ 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; top = ((pdata->lane * top / div) - 10) << 16;
} }
if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */ 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; 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) { if ((pdata->lane / div) > bpp) {
tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */ tmp = ch->lcd_modes[0].xres / bpp; /* output cycle */
tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */ tmp = ch->lcd_modes[0].xres - tmp; /* (input - output) cycle */
delay = (pdata->lane * tmp); delay = (pdata->lane * tmp);
} }
...@@ -392,9 +394,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi, ...@@ -392,9 +394,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
return 0; return 0;
} }
static void mipi_display_on(void *arg, struct fb_info *info) static int mipi_display_on(struct sh_mobile_lcdc_entity *entity)
{ {
struct sh_mipi *mipi = arg; struct sh_mipi *mipi = to_sh_mipi(entity);
struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data; struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
int ret; int ret;
...@@ -410,25 +412,21 @@ static void mipi_display_on(void *arg, struct fb_info *info) ...@@ -410,25 +412,21 @@ static void mipi_display_on(void *arg, struct fb_info *info)
sh_mipi_dsi_enable(mipi, true); sh_mipi_dsi_enable(mipi, true);
if (mipi->next_display_on) return SH_MOBILE_LCDC_DISPLAY_CONNECTED;
mipi->next_display_on(mipi->next_board_data, info);
return;
mipi_display_on_fail1: mipi_display_on_fail1:
pm_runtime_put_sync(&mipi->pdev->dev); pm_runtime_put_sync(&mipi->pdev->dev);
mipi_display_on_fail2: mipi_display_on_fail2:
pdata->set_dot_clock(mipi->pdev, mipi->base, 0); pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
return ret;
} }
static void mipi_display_off(void *arg) static void mipi_display_off(struct sh_mobile_lcdc_entity *entity)
{ {
struct sh_mipi *mipi = arg; struct sh_mipi *mipi = to_sh_mipi(entity);
struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data; struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
if (mipi->next_display_off)
mipi->next_display_off(mipi->next_board_data);
sh_mipi_dsi_enable(mipi, false); sh_mipi_dsi_enable(mipi, false);
pdata->set_dot_clock(mipi->pdev, mipi->base, 0); pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
...@@ -436,6 +434,11 @@ static void mipi_display_off(void *arg) ...@@ -436,6 +434,11 @@ static void mipi_display_off(void *arg)
pm_runtime_put_sync(&mipi->pdev->dev); pm_runtime_put_sync(&mipi->pdev->dev);
} }
static const struct sh_mobile_lcdc_entity_ops mipi_ops = {
.display_on = mipi_display_on,
.display_off = mipi_display_off,
};
static int __init sh_mipi_probe(struct platform_device *pdev) static int __init sh_mipi_probe(struct platform_device *pdev)
{ {
struct sh_mipi *mipi; struct sh_mipi *mipi;
...@@ -467,6 +470,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev) ...@@ -467,6 +470,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
goto ealloc; goto ealloc;
} }
mipi->entity.owner = THIS_MODULE;
mipi->entity.ops = &mipi_ops;
if (!request_mem_region(res->start, resource_size(res), pdev->name)) { if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
dev_err(&pdev->dev, "MIPI register region already claimed\n"); dev_err(&pdev->dev, "MIPI register region already claimed\n");
ret = -EBUSY; ret = -EBUSY;
...@@ -521,18 +527,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev) ...@@ -521,18 +527,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
pm_runtime_resume(&pdev->dev); pm_runtime_resume(&pdev->dev);
mutex_unlock(&array_lock); mutex_unlock(&array_lock);
platform_set_drvdata(pdev, mipi); platform_set_drvdata(pdev, &mipi->entity);
/* Save original LCDC callbacks */
mipi->next_board_data = pdata->lcd_chan->board_cfg.board_data;
mipi->next_display_on = pdata->lcd_chan->board_cfg.display_on;
mipi->next_display_off = pdata->lcd_chan->board_cfg.display_off;
/* Set up LCDC callbacks */
pdata->lcd_chan->board_cfg.board_data = mipi;
pdata->lcd_chan->board_cfg.display_on = mipi_display_on;
pdata->lcd_chan->board_cfg.display_off = mipi_display_off;
pdata->lcd_chan->board_cfg.owner = THIS_MODULE;
return 0; return 0;
...@@ -558,10 +553,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev) ...@@ -558,10 +553,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
static int __exit sh_mipi_remove(struct platform_device *pdev) static int __exit sh_mipi_remove(struct platform_device *pdev)
{ {
struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
struct sh_mipi *mipi = platform_get_drvdata(pdev); struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
int i, ret; int i, ret;
mutex_lock(&array_lock); mutex_lock(&array_lock);
...@@ -581,11 +575,6 @@ static int __exit sh_mipi_remove(struct platform_device *pdev) ...@@ -581,11 +575,6 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
return ret; return ret;
pdata->lcd_chan->board_cfg.owner = NULL;
pdata->lcd_chan->board_cfg.display_on = NULL;
pdata->lcd_chan->board_cfg.display_off = NULL;
pdata->lcd_chan->board_cfg.board_data = NULL;
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_disable(mipi->dsit_clk); clk_disable(mipi->dsit_clk);
clk_put(mipi->dsit_clk); clk_put(mipi->dsit_clk);
......
...@@ -208,6 +208,8 @@ enum hotplug_state { ...@@ -208,6 +208,8 @@ enum hotplug_state {
}; };
struct sh_hdmi { struct sh_hdmi {
struct sh_mobile_lcdc_entity entity;
void __iomem *base; void __iomem *base;
enum hotplug_state hp_state; /* hot-plug status */ enum hotplug_state hp_state; /* hot-plug status */
u8 preprogrammed_vic; /* use a pre-programmed VIC or u8 preprogrammed_vic; /* use a pre-programmed VIC or
...@@ -217,14 +219,13 @@ struct sh_hdmi { ...@@ -217,14 +219,13 @@ struct sh_hdmi {
u8 edid_blocks; u8 edid_blocks;
struct clk *hdmi_clk; struct clk *hdmi_clk;
struct device *dev; struct device *dev;
struct fb_info *info;
struct mutex mutex; /* Protect the info pointer */
struct delayed_work edid_work; struct delayed_work edid_work;
struct fb_var_screeninfo var; struct fb_videomode mode;
struct fb_monspecs monspec; struct fb_monspecs monspec;
struct notifier_block notifier;
}; };
#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity)
static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg) static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
{ {
iowrite8(data, hdmi->base + reg); iowrite8(data, hdmi->base + reg);
...@@ -290,24 +291,24 @@ static struct snd_soc_codec_driver soc_codec_dev_sh_hdmi = { ...@@ -290,24 +291,24 @@ static struct snd_soc_codec_driver soc_codec_dev_sh_hdmi = {
/* External video parameter settings */ /* External video parameter settings */
static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi) static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
{ {
struct fb_var_screeninfo *var = &hdmi->var; struct fb_videomode *mode = &hdmi->mode;
u16 htotal, hblank, hdelay, vtotal, vblank, vdelay, voffset; u16 htotal, hblank, hdelay, vtotal, vblank, vdelay, voffset;
u8 sync = 0; u8 sync = 0;
htotal = var->xres + var->right_margin + var->left_margin + var->hsync_len; htotal = mode->xres + mode->right_margin + mode->left_margin
+ mode->hsync_len;
hdelay = var->hsync_len + var->left_margin; hdelay = mode->hsync_len + mode->left_margin;
hblank = var->right_margin + hdelay; hblank = mode->right_margin + hdelay;
/* /*
* Vertical timing looks a bit different in Figure 18, * Vertical timing looks a bit different in Figure 18,
* but let's try the same first by setting offset = 0 * but let's try the same first by setting offset = 0
*/ */
vtotal = var->yres + var->upper_margin + var->lower_margin + var->vsync_len; vtotal = mode->yres + mode->upper_margin + mode->lower_margin
+ mode->vsync_len;
vdelay = var->vsync_len + var->upper_margin; vdelay = mode->vsync_len + mode->upper_margin;
vblank = var->lower_margin + vdelay; vblank = mode->lower_margin + vdelay;
voffset = min(var->upper_margin / 2, 6U); voffset = min(mode->upper_margin / 2, 6U);
/* /*
* [3]: VSYNC polarity: Positive * [3]: VSYNC polarity: Positive
...@@ -315,14 +316,14 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi) ...@@ -315,14 +316,14 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
* [1]: Interlace/Progressive: Progressive * [1]: Interlace/Progressive: Progressive
* [0]: External video settings enable: used. * [0]: External video settings enable: used.
*/ */
if (var->sync & FB_SYNC_HOR_HIGH_ACT) if (mode->sync & FB_SYNC_HOR_HIGH_ACT)
sync |= 4; sync |= 4;
if (var->sync & FB_SYNC_VERT_HIGH_ACT) if (mode->sync & FB_SYNC_VERT_HIGH_ACT)
sync |= 8; sync |= 8;
dev_dbg(hdmi->dev, "H: %u, %u, %u, %u; V: %u, %u, %u, %u; sync 0x%x\n", dev_dbg(hdmi->dev, "H: %u, %u, %u, %u; V: %u, %u, %u, %u; sync 0x%x\n",
htotal, hblank, hdelay, var->hsync_len, htotal, hblank, hdelay, mode->hsync_len,
vtotal, vblank, vdelay, var->vsync_len, sync); vtotal, vblank, vdelay, mode->vsync_len, sync);
hdmi_write(hdmi, sync | (voffset << 4), HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS); hdmi_write(hdmi, sync | (voffset << 4), HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS);
...@@ -335,8 +336,8 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi) ...@@ -335,8 +336,8 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
hdmi_write(hdmi, hdelay, HDMI_EXTERNAL_H_DELAY_7_0); hdmi_write(hdmi, hdelay, HDMI_EXTERNAL_H_DELAY_7_0);
hdmi_write(hdmi, hdelay >> 8, HDMI_EXTERNAL_H_DELAY_9_8); hdmi_write(hdmi, hdelay >> 8, HDMI_EXTERNAL_H_DELAY_9_8);
hdmi_write(hdmi, var->hsync_len, HDMI_EXTERNAL_H_DURATION_7_0); hdmi_write(hdmi, mode->hsync_len, HDMI_EXTERNAL_H_DURATION_7_0);
hdmi_write(hdmi, var->hsync_len >> 8, HDMI_EXTERNAL_H_DURATION_9_8); hdmi_write(hdmi, mode->hsync_len >> 8, HDMI_EXTERNAL_H_DURATION_9_8);
hdmi_write(hdmi, vtotal, HDMI_EXTERNAL_V_TOTAL_7_0); hdmi_write(hdmi, vtotal, HDMI_EXTERNAL_V_TOTAL_7_0);
hdmi_write(hdmi, vtotal >> 8, HDMI_EXTERNAL_V_TOTAL_9_8); hdmi_write(hdmi, vtotal >> 8, HDMI_EXTERNAL_V_TOTAL_9_8);
...@@ -345,7 +346,7 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi) ...@@ -345,7 +346,7 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
hdmi_write(hdmi, vdelay, HDMI_EXTERNAL_V_DELAY); hdmi_write(hdmi, vdelay, HDMI_EXTERNAL_V_DELAY);
hdmi_write(hdmi, var->vsync_len, HDMI_EXTERNAL_V_DURATION); hdmi_write(hdmi, mode->vsync_len, HDMI_EXTERNAL_V_DURATION);
/* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */ /* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */
if (!hdmi->preprogrammed_vic) if (!hdmi->preprogrammed_vic)
...@@ -472,7 +473,7 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi) ...@@ -472,7 +473,7 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi)
*/ */
static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
{ {
if (hdmi->var.pixclock < 10000) { if (hdmi->mode.pixclock < 10000) {
/* for 1080p8bit 148MHz */ /* for 1080p8bit 148MHz */
hdmi_write(hdmi, 0x1d, HDMI_SLIPHDMIT_PARAM_SETTINGS_1); hdmi_write(hdmi, 0x1d, HDMI_SLIPHDMIT_PARAM_SETTINGS_1);
hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2); hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2);
...@@ -483,7 +484,7 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) ...@@ -483,7 +484,7 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
hdmi_write(hdmi, 0x0e, HDMI_SLIPHDMIT_PARAM_SETTINGS_8); hdmi_write(hdmi, 0x0e, HDMI_SLIPHDMIT_PARAM_SETTINGS_8);
hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9); hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9);
hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10); hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10);
} else if (hdmi->var.pixclock < 30000) { } else if (hdmi->mode.pixclock < 30000) {
/* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */ /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */
/* /*
* [1:0] Speed_A * [1:0] Speed_A
...@@ -732,14 +733,12 @@ static unsigned long sh_hdmi_rate_error(struct sh_hdmi *hdmi, ...@@ -732,14 +733,12 @@ static unsigned long sh_hdmi_rate_error(struct sh_hdmi *hdmi,
static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
unsigned long *parent_rate) unsigned long *parent_rate)
{ {
struct fb_var_screeninfo tmpvar; struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
struct fb_var_screeninfo *var = &tmpvar;
const struct fb_videomode *mode, *found = NULL; const struct fb_videomode *mode, *found = NULL;
struct fb_info *info = hdmi->info;
struct fb_modelist *modelist = NULL;
unsigned int f_width = 0, f_height = 0, f_refresh = 0; unsigned int f_width = 0, f_height = 0, f_refresh = 0;
unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */ unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */
bool scanning = false, preferred_bad = false; bool scanning = false, preferred_bad = false;
bool use_edid_mode = false;
u8 edid[128]; u8 edid[128];
char *forced; char *forced;
int i; int i;
...@@ -854,12 +853,9 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, ...@@ -854,12 +853,9 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
} }
/* Check if supported: sufficient fb memory, supported clock-rate */ /* Check if supported: sufficient fb memory, supported clock-rate */
fb_videomode_to_var(var, mode); if (ch && ch->notify &&
ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, mode,
var->bits_per_pixel = info->var.bits_per_pixel; NULL)) {
if (info && info->fbops->fb_check_var &&
info->fbops->fb_check_var(var, info)) {
scanning = true; scanning = true;
preferred_bad = true; preferred_bad = true;
continue; continue;
...@@ -867,28 +863,19 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, ...@@ -867,28 +863,19 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
found = mode; found = mode;
found_rate_error = rate_error; found_rate_error = rate_error;
use_edid_mode = true;
} }
hdmi->var.width = hdmi->monspec.max_x * 10;
hdmi->var.height = hdmi->monspec.max_y * 10;
/* /*
* TODO 1: if no ->info is present, postpone running the config until * TODO 1: if no default mode is present, postpone running the config
* after ->info first gets registered. * until after the LCDC channel is initialized.
* TODO 2: consider registering the HDMI platform device from the LCDC * TODO 2: consider registering the HDMI platform device from the LCDC
* driver, and passing ->info with HDMI platform data. * driver.
*/ */
if (info && !found) { if (!found && hdmi->entity.def_mode.xres != 0) {
modelist = info->modelist.next && found = &hdmi->entity.def_mode;
!list_empty(&info->modelist) ? found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate,
list_entry(info->modelist.next, parent_rate);
struct fb_modelist, list) :
NULL;
if (modelist) {
found = &modelist->mode;
found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate, parent_rate);
}
} }
/* No cookie today */ /* No cookie today */
...@@ -912,12 +899,13 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate, ...@@ -912,12 +899,13 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
else else
hdmi->preprogrammed_vic = 0; hdmi->preprogrammed_vic = 0;
dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n", dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), "
modelist ? "default" : "EDID", hdmi->preprogrammed_vic ? "VIC" : "external", "clock error %luHz\n", use_edid_mode ? "EDID" : "default",
found->xres, found->yres, found->refresh, hdmi->preprogrammed_vic ? "VIC" : "external", found->xres,
PICOS2KHZ(found->pixclock) * 1000, found_rate_error); found->yres, found->refresh, PICOS2KHZ(found->pixclock) * 1000,
found_rate_error);
fb_videomode_to_var(&hdmi->var, found); hdmi->mode = *found;
sh_hdmi_external_video_param(hdmi); sh_hdmi_external_video_param(hdmi);
return 0; return 0;
...@@ -998,22 +986,12 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id) ...@@ -998,22 +986,12 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/* locking: called with info->lock held, or before register_framebuffer() */ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
static void sh_hdmi_display_on(void *arg, struct fb_info *info)
{ {
/* struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
* info is guaranteed to be valid, when we are called, because our
* FB_EVENT_FB_UNBIND notify is also called with info->lock held
*/
struct sh_hdmi *hdmi = arg;
struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
struct sh_mobile_lcdc_chan *ch = info->par;
dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi,
pdata->lcd_dev, info->state); hdmi->hp_state);
/* No need to lock */
hdmi->info = info;
/* /*
* hp_state can be set to * hp_state can be set to
...@@ -1021,56 +999,30 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info) ...@@ -1021,56 +999,30 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
* HDMI_HOTPLUG_CONNECTED: on monitor plug-in * HDMI_HOTPLUG_CONNECTED: on monitor plug-in
* HDMI_HOTPLUG_EDID_DONE: on EDID read completion * HDMI_HOTPLUG_EDID_DONE: on EDID read completion
*/ */
switch (hdmi->hp_state) { if (hdmi->hp_state == HDMI_HOTPLUG_EDID_DONE) {
case HDMI_HOTPLUG_EDID_DONE:
/* PS mode d->e. All functions are active */ /* PS mode d->e. All functions are active */
hdmi_write(hdmi, 0x80, HDMI_SYSTEM_CTRL); hdmi_write(hdmi, 0x80, HDMI_SYSTEM_CTRL);
dev_dbg(hdmi->dev, "HDMI running\n"); dev_dbg(hdmi->dev, "HDMI running\n");
break;
case HDMI_HOTPLUG_DISCONNECTED:
info->state = FBINFO_STATE_SUSPENDED;
default:
hdmi->var = ch->display_var;
} }
return hdmi->hp_state == HDMI_HOTPLUG_DISCONNECTED
? SH_MOBILE_LCDC_DISPLAY_DISCONNECTED
: SH_MOBILE_LCDC_DISPLAY_CONNECTED;
} }
/* locking: called with info->lock held */ static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
static void sh_hdmi_display_off(void *arg)
{ {
struct sh_hdmi *hdmi = arg; struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
dev_dbg(hdmi->dev, "%s(%p)\n", __func__, pdata->lcd_dev); dev_dbg(hdmi->dev, "%s(%p)\n", __func__, hdmi);
/* PS mode e->a */ /* PS mode e->a */
hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL); hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
} }
static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi) static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
{ .display_on = sh_hdmi_display_on,
struct fb_info *info = hdmi->info; .display_off = sh_hdmi_display_off,
struct sh_mobile_lcdc_chan *ch = info->par; };
struct fb_var_screeninfo *new_var = &hdmi->var, *old_var = &ch->display_var;
struct fb_videomode mode1, mode2;
fb_var_to_videomode(&mode1, old_var);
fb_var_to_videomode(&mode2, new_var);
dev_dbg(info->dev, "Old %ux%u, new %ux%u\n",
mode1.xres, mode1.yres, mode2.xres, mode2.yres);
if (fb_mode_is_equal(&mode1, &mode2)) {
/* It can be a different monitor with an equal video-mode */
old_var->width = new_var->width;
old_var->height = new_var->height;
return false;
}
dev_dbg(info->dev, "Switching %u -> %u lines\n",
mode1.yres, mode2.yres);
*old_var = *new_var;
return true;
}
/** /**
* sh_hdmi_clk_configure() - set HDMI clock frequency and enable the clock * sh_hdmi_clk_configure() - set HDMI clock frequency and enable the clock
...@@ -1111,20 +1063,11 @@ static long sh_hdmi_clk_configure(struct sh_hdmi *hdmi, unsigned long hdmi_rate, ...@@ -1111,20 +1063,11 @@ static long sh_hdmi_clk_configure(struct sh_hdmi *hdmi, unsigned long hdmi_rate,
static void sh_hdmi_edid_work_fn(struct work_struct *work) static void sh_hdmi_edid_work_fn(struct work_struct *work)
{ {
struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work); struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
struct fb_info *info; struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
struct sh_mobile_lcdc_chan *ch;
int ret; int ret;
dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, hdmi,
pdata->lcd_dev, hdmi->hp_state); hdmi->hp_state);
if (!pdata->lcd_dev)
return;
mutex_lock(&hdmi->mutex);
info = hdmi->info;
if (hdmi->hp_state == HDMI_HOTPLUG_CONNECTED) { if (hdmi->hp_state == HDMI_HOTPLUG_CONNECTED) {
unsigned long parent_rate = 0, hdmi_rate; unsigned long parent_rate = 0, hdmi_rate;
...@@ -1145,103 +1088,32 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) ...@@ -1145,103 +1088,32 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
/* Switched to another (d) power-save mode */ /* Switched to another (d) power-save mode */
msleep(10); msleep(10);
if (!info) if (ch && ch->notify)
goto out; ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
&hdmi->mode, &hdmi->monspec);
ch = info->par;
if (lock_fb_info(info)) {
console_lock();
/* HDMI plug in */
if (!sh_hdmi_must_reconfigure(hdmi) &&
info->state == FBINFO_STATE_RUNNING) {
/*
* First activation with the default monitor - just turn
* on, if we run a resume here, the logo disappears
*/
info->var.width = hdmi->var.width;
info->var.height = hdmi->var.height;
sh_hdmi_display_on(hdmi, info);
} else {
/* New monitor or have to wake up */
fb_set_suspend(info, 0);
}
console_unlock();
unlock_fb_info(info);
}
} else { } else {
ret = 0;
if (!info)
goto out;
hdmi->monspec.modedb_len = 0; hdmi->monspec.modedb_len = 0;
fb_destroy_modedb(hdmi->monspec.modedb); fb_destroy_modedb(hdmi->monspec.modedb);
hdmi->monspec.modedb = NULL; hdmi->monspec.modedb = NULL;
if (lock_fb_info(info)) { if (ch && ch->notify)
console_lock(); ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
NULL, NULL);
/* HDMI disconnect */ ret = 0;
fb_set_suspend(info, 1);
console_unlock();
unlock_fb_info(info);
}
} }
out: out:
if (ret < 0 && ret != -EAGAIN) if (ret < 0 && ret != -EAGAIN)
hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED; hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED;
mutex_unlock(&hdmi->mutex);
dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, pdata->lcd_dev); dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, hdmi);
}
static int sh_hdmi_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
struct fb_event *event = data;
struct fb_info *info = event->info;
struct sh_mobile_lcdc_chan *ch = info->par;
struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
struct sh_hdmi *hdmi = board_cfg->board_data;
if (!hdmi || nb != &hdmi->notifier || hdmi->info != info)
return NOTIFY_DONE;
switch(action) {
case FB_EVENT_FB_REGISTERED:
/* Unneeded, activation taken care by sh_hdmi_display_on() */
break;
case FB_EVENT_FB_UNREGISTERED:
/*
* We are called from unregister_framebuffer() with the
* info->lock held. This is bad for us, because we can race with
* the scheduled work, which has to call fb_set_suspend(), which
* takes info->lock internally, so, sh_hdmi_edid_work_fn()
* cannot take and hold info->lock for the whole function
* duration. Using an additional lock creates a classical AB-BA
* lock up. Therefore, we have to release the info->lock
* temporarily, synchronise with the work queue and re-acquire
* the info->lock.
*/
unlock_fb_info(info);
mutex_lock(&hdmi->mutex);
hdmi->info = NULL;
mutex_unlock(&hdmi->mutex);
lock_fb_info(info);
return NOTIFY_OK;
}
return NOTIFY_DONE;
} }
static int __init sh_hdmi_probe(struct platform_device *pdev) static int __init sh_hdmi_probe(struct platform_device *pdev)
{ {
struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data; struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct sh_mobile_lcdc_board_cfg *board_cfg;
int irq = platform_get_irq(pdev, 0), ret; int irq = platform_get_irq(pdev, 0), ret;
struct sh_hdmi *hdmi; struct sh_hdmi *hdmi;
long rate; long rate;
...@@ -1255,9 +1127,9 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1255,9 +1127,9 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
mutex_init(&hdmi->mutex);
hdmi->dev = &pdev->dev; hdmi->dev = &pdev->dev;
hdmi->entity.owner = THIS_MODULE;
hdmi->entity.ops = &sh_hdmi_ops;
hdmi->hdmi_clk = clk_get(&pdev->dev, "ick"); hdmi->hdmi_clk = clk_get(&pdev->dev, "ick");
if (IS_ERR(hdmi->hdmi_clk)) { if (IS_ERR(hdmi->hdmi_clk)) {
...@@ -1297,14 +1169,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1297,14 +1169,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
goto emap; goto emap;
} }
platform_set_drvdata(pdev, hdmi); platform_set_drvdata(pdev, &hdmi->entity);
/* Set up LCDC callbacks */
board_cfg = &pdata->lcd_chan->board_cfg;
board_cfg->owner = THIS_MODULE;
board_cfg->board_data = hdmi;
board_cfg->display_on = sh_hdmi_display_on;
board_cfg->display_off = sh_hdmi_display_off;
INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn); INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn);
...@@ -1329,9 +1194,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1329,9 +1194,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
goto ecodec; goto ecodec;
} }
hdmi->notifier.notifier_call = sh_hdmi_notify;
fb_register_client(&hdmi->notifier);
return 0; return 0;
ecodec: ecodec:
...@@ -1347,7 +1209,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1347,7 +1209,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
erate: erate:
clk_put(hdmi->hdmi_clk); clk_put(hdmi->hdmi_clk);
egetclk: egetclk:
mutex_destroy(&hdmi->mutex);
kfree(hdmi); kfree(hdmi);
return ret; return ret;
...@@ -1355,21 +1216,12 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) ...@@ -1355,21 +1216,12 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
static int __exit sh_hdmi_remove(struct platform_device *pdev) static int __exit sh_hdmi_remove(struct platform_device *pdev)
{ {
struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data; struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
struct sh_hdmi *hdmi = platform_get_drvdata(pdev);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct sh_mobile_lcdc_board_cfg *board_cfg = &pdata->lcd_chan->board_cfg;
int irq = platform_get_irq(pdev, 0); int irq = platform_get_irq(pdev, 0);
snd_soc_unregister_codec(&pdev->dev); snd_soc_unregister_codec(&pdev->dev);
fb_unregister_client(&hdmi->notifier);
board_cfg->display_on = NULL;
board_cfg->display_off = NULL;
board_cfg->board_data = NULL;
board_cfg->owner = NULL;
/* No new work will be scheduled, wait for running ISR */ /* No new work will be scheduled, wait for running ISR */
free_irq(irq, hdmi); free_irq(irq, hdmi);
/* Wait for already scheduled work */ /* Wait for already scheduled work */
...@@ -1380,7 +1232,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) ...@@ -1380,7 +1232,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
clk_put(hdmi->hdmi_clk); clk_put(hdmi->hdmi_clk);
iounmap(hdmi->base); iounmap(hdmi->base);
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
mutex_destroy(&hdmi->mutex);
kfree(hdmi); kfree(hdmi);
return 0; return 0;
......
此差异已折叠。
...@@ -14,9 +14,35 @@ enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R, ...@@ -14,9 +14,35 @@ enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
#define PALETTE_NR 16 #define PALETTE_NR 16
struct sh_mobile_lcdc_priv;
struct fb_info;
struct backlight_device; struct backlight_device;
struct fb_info;
struct module;
struct sh_mobile_lcdc_chan;
struct sh_mobile_lcdc_entity;
struct sh_mobile_lcdc_format_info;
struct sh_mobile_lcdc_priv;
#define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
#define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
struct sh_mobile_lcdc_entity_ops {
/* Display */
int (*display_on)(struct sh_mobile_lcdc_entity *entity);
void (*display_off)(struct sh_mobile_lcdc_entity *entity);
};
enum sh_mobile_lcdc_entity_event {
SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
SH_MOBILE_LCDC_EVENT_DISPLAY_MODE,
};
struct sh_mobile_lcdc_entity {
struct module *owner;
const struct sh_mobile_lcdc_entity_ops *ops;
struct sh_mobile_lcdc_chan *lcdc;
struct fb_videomode def_mode;
};
/* /*
* struct sh_mobile_lcdc_chan - LCDC display channel * struct sh_mobile_lcdc_chan - LCDC display channel
...@@ -27,29 +53,57 @@ struct backlight_device; ...@@ -27,29 +53,57 @@ struct backlight_device;
*/ */
struct sh_mobile_lcdc_chan { struct sh_mobile_lcdc_chan {
struct sh_mobile_lcdc_priv *lcdc; struct sh_mobile_lcdc_priv *lcdc;
struct sh_mobile_lcdc_entity *tx_dev;
const struct sh_mobile_lcdc_chan_cfg *cfg;
unsigned long *reg_offs; unsigned long *reg_offs;
unsigned long ldmt1r_value; unsigned long ldmt1r_value;
unsigned long enabled; /* ME and SE in LDCNT2R */ unsigned long enabled; /* ME and SE in LDCNT2R */
struct sh_mobile_lcdc_chan_cfg cfg; void *meram;
u32 pseudo_palette[PALETTE_NR];
struct fb_info *info; struct mutex open_lock; /* protects the use counter */
struct backlight_device *bl; int use_count;
void *fb_mem;
unsigned long fb_size;
dma_addr_t dma_handle; dma_addr_t dma_handle;
struct fb_deferred_io defio;
struct scatterlist *sglist;
unsigned long frame_end;
unsigned long pan_offset; unsigned long pan_offset;
unsigned long frame_end;
wait_queue_head_t frame_end_wait; wait_queue_head_t frame_end_wait;
struct completion vsync_completion; struct completion vsync_completion;
struct fb_var_screeninfo display_var;
int use_count; const struct sh_mobile_lcdc_format_info *format;
int blank_status; u32 colorspace;
struct mutex open_lock; /* protects the use counter */ unsigned int xres;
int meram_enabled; unsigned int xres_virtual;
unsigned int yres;
unsigned int yres_virtual;
unsigned int pitch;
unsigned long base_addr_y; unsigned long base_addr_y;
unsigned long base_addr_c; unsigned long base_addr_c;
unsigned int pitch;
int (*notify)(struct sh_mobile_lcdc_chan *ch,
enum sh_mobile_lcdc_entity_event event,
const struct fb_videomode *mode,
const struct fb_monspecs *monspec);
/* Backlight */
struct backlight_device *bl;
/* FB */
struct fb_info *info;
u32 pseudo_palette[PALETTE_NR];
struct {
unsigned int width;
unsigned int height;
struct fb_videomode mode;
} display;
struct fb_deferred_io defio;
struct scatterlist *sglist;
int blank_status;
}; };
#endif #endif
此差异已折叠。
...@@ -31,8 +31,6 @@ struct clk; ...@@ -31,8 +31,6 @@ struct clk;
#define HDMI_SND_SRC_HBR (3 << 0) #define HDMI_SND_SRC_HBR (3 << 0)
struct sh_mobile_hdmi_info { struct sh_mobile_hdmi_info {
struct sh_mobile_lcdc_chan_cfg *lcd_chan;
struct device *lcd_dev;
unsigned int flags; unsigned int flags;
long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq, long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq,
unsigned long *parent_freq); unsigned long *parent_freq);
......
...@@ -147,29 +147,23 @@ struct sh_mobile_lcdc_sys_bus_ops { ...@@ -147,29 +147,23 @@ struct sh_mobile_lcdc_sys_bus_ops {
unsigned long (*read_data)(void *handle); unsigned long (*read_data)(void *handle);
}; };
struct module; struct sh_mobile_lcdc_panel_cfg {
struct sh_mobile_lcdc_board_cfg { unsigned long width; /* Panel width in mm */
struct module *owner; unsigned long height; /* Panel height in mm */
void *board_data; int (*setup_sys)(void *sys_ops_handle,
int (*setup_sys)(void *board_data, void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops); struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
void (*start_transfer)(void *board_data, void *sys_ops_handle, void (*start_transfer)(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops); struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
void (*display_on)(void *board_data, struct fb_info *info); void (*display_on)(void);
void (*display_off)(void *board_data); void (*display_off)(void);
int (*set_brightness)(void *board_data, int brightness);
int (*get_brightness)(void *board_data);
};
struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
unsigned long width;
unsigned long height;
}; };
/* backlight info */ /* backlight info */
struct sh_mobile_lcdc_bl_info { struct sh_mobile_lcdc_bl_info {
const char *name; const char *name;
int max_brightness; int max_brightness;
int (*set_brightness)(int brightness);
int (*get_brightness)(void);
}; };
struct sh_mobile_lcdc_chan_cfg { struct sh_mobile_lcdc_chan_cfg {
...@@ -179,13 +173,14 @@ struct sh_mobile_lcdc_chan_cfg { ...@@ -179,13 +173,14 @@ struct sh_mobile_lcdc_chan_cfg {
int interface_type; /* selects RGBn or SYSn I/F, see above */ int interface_type; /* selects RGBn or SYSn I/F, see above */
int clock_divider; int clock_divider;
unsigned long flags; /* LCDC_FLAGS_... */ unsigned long flags; /* LCDC_FLAGS_... */
const struct fb_videomode *lcd_cfg; const struct fb_videomode *lcd_modes;
int num_cfg; int num_modes;
struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; struct sh_mobile_lcdc_panel_cfg panel_cfg;
struct sh_mobile_lcdc_board_cfg board_cfg;
struct sh_mobile_lcdc_bl_info bl_info; 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_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
struct sh_mobile_meram_cfg *meram_cfg; const struct sh_mobile_meram_cfg *meram_cfg;
struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
}; };
struct sh_mobile_lcdc_info { struct sh_mobile_lcdc_info {
......
...@@ -17,52 +17,47 @@ enum { ...@@ -17,52 +17,47 @@ enum {
struct sh_mobile_meram_priv; struct sh_mobile_meram_priv;
struct sh_mobile_meram_ops; struct sh_mobile_meram_ops;
/*
* struct sh_mobile_meram_info - MERAM platform data
* @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
*/
struct sh_mobile_meram_info { struct sh_mobile_meram_info {
int addr_mode; int addr_mode;
u32 reserved_icbs;
struct sh_mobile_meram_ops *ops; struct sh_mobile_meram_ops *ops;
struct sh_mobile_meram_priv *priv; struct sh_mobile_meram_priv *priv;
struct platform_device *pdev; struct platform_device *pdev;
}; };
/* icb config */ /* icb config */
struct sh_mobile_meram_icb { struct sh_mobile_meram_icb_cfg {
int marker_icb; /* ICB # for Marker ICB */ unsigned int meram_size; /* MERAM Buffer Size to use */
int cache_icb; /* ICB # for Cache ICB */
int meram_offset; /* MERAM Buffer Offset to use */
int meram_size; /* MERAM Buffer Size to use */
int cache_unit; /* bytes to cache per ICB */
}; };
struct sh_mobile_meram_cfg { struct sh_mobile_meram_cfg {
struct sh_mobile_meram_icb icb[2]; struct sh_mobile_meram_icb_cfg icb[2];
int pixelformat;
int current_reg;
}; };
struct module; struct module;
struct sh_mobile_meram_ops { struct sh_mobile_meram_ops {
struct module *module; struct module *module;
/* register usage of meram */ /* register usage of meram */
int (*meram_register)(struct sh_mobile_meram_info *meram_dev, void *(*meram_register)(struct sh_mobile_meram_info *meram_dev,
struct sh_mobile_meram_cfg *cfg, const struct sh_mobile_meram_cfg *cfg,
int xres, int yres, int pixelformat, unsigned int xres, unsigned int yres,
unsigned long base_addr_y, unsigned int pixelformat,
unsigned long base_addr_c, unsigned int *pitch);
unsigned long *icb_addr_y,
unsigned long *icb_addr_c, int *pitch);
/* unregister usage of meram */ /* unregister usage of meram */
int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev, void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
struct sh_mobile_meram_cfg *cfg); void *data);
/* update meram settings */ /* update meram settings */
int (*meram_update)(struct sh_mobile_meram_info *meram_dev, void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data,
struct sh_mobile_meram_cfg *cfg, unsigned long base_addr_y,
unsigned long base_addr_y, unsigned long base_addr_c,
unsigned long base_addr_c, unsigned long *icb_addr_y,
unsigned long *icb_addr_y, unsigned long *icb_addr_c);
unsigned long *icb_addr_c);
}; };
#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */ #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册