diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-09-03 03:20:12 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-09-14 04:22:52 -0400 |
commit | 71d3b0fcadf70d0de1ad334f48c9a4060209091a (patch) | |
tree | 8996e60ce3a517797db46c0c0456084b4a78008b | |
parent | baf163749952ca5e33dd2d6a74da023e385c3a00 (diff) |
fbdev: sh_mobile_lcdcfb: allocate memory, sufficient for the biggest mode
Now, that we add support for multiple modes to the sh_mobile_lcdcfb driver, it
has to allocate memory, sufficient for the biggest of them.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 2f6e37ea7906..ddd6c4669bd7 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -1103,8 +1103,10 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1103 | 1103 | ||
1104 | for (i = 0; i < j; i++) { | 1104 | for (i = 0; i < j; i++) { |
1105 | struct fb_var_screeninfo *var; | 1105 | struct fb_var_screeninfo *var; |
1106 | const struct fb_videomode *lcd_cfg; | 1106 | const struct fb_videomode *lcd_cfg, *max_cfg = NULL; |
1107 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; | 1107 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; |
1108 | unsigned long max_size = 0; | ||
1109 | int k; | ||
1108 | 1110 | ||
1109 | cfg = &ch->cfg; | 1111 | cfg = &ch->cfg; |
1110 | 1112 | ||
@@ -1117,9 +1119,8 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1117 | 1119 | ||
1118 | info = ch->info; | 1120 | info = ch->info; |
1119 | var = &info->var; | 1121 | var = &info->var; |
1120 | lcd_cfg = &cfg->lcd_cfg[0]; | ||
1121 | info->fbops = &sh_mobile_lcdc_ops; | 1122 | info->fbops = &sh_mobile_lcdc_ops; |
1122 | fb_videomode_to_var(var, lcd_cfg); | 1123 | fb_videomode_to_var(var, &cfg->lcd_cfg[0]); |
1123 | /* Default Y virtual resolution is 2x panel size */ | 1124 | /* Default Y virtual resolution is 2x panel size */ |
1124 | var->yres_virtual = var->yres * 2; | 1125 | var->yres_virtual = var->yres * 2; |
1125 | 1126 | ||
@@ -1127,10 +1128,23 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1127 | if (error) | 1128 | if (error) |
1128 | break; | 1129 | break; |
1129 | 1130 | ||
1131 | for (k = 0, lcd_cfg = cfg->lcd_cfg; | ||
1132 | k < cfg->num_cfg; | ||
1133 | k++, lcd_cfg++) { | ||
1134 | unsigned long size = lcd_cfg->yres * lcd_cfg->xres; | ||
1135 | |||
1136 | if (size > max_size) { | ||
1137 | max_cfg = lcd_cfg; | ||
1138 | max_size = size; | ||
1139 | } | ||
1140 | } | ||
1141 | |||
1142 | dev_dbg(&pdev->dev, "Found largest videomode %ux%u\n", | ||
1143 | max_cfg->xres, max_cfg->yres); | ||
1144 | |||
1130 | info->fix = sh_mobile_lcdc_fix; | 1145 | info->fix = sh_mobile_lcdc_fix; |
1131 | info->fix.line_length = lcd_cfg->xres * (cfg->bpp / 8); | 1146 | info->fix.line_length = cfg->lcd_cfg[0].xres * (cfg->bpp / 8); |
1132 | info->fix.smem_len = info->fix.line_length * | 1147 | info->fix.smem_len = max_size * (cfg->bpp / 8) * 2; |
1133 | var->yres_virtual; | ||
1134 | 1148 | ||
1135 | buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len, | 1149 | buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len, |
1136 | &ch->dma_handle, GFP_KERNEL); | 1150 | &ch->dma_handle, GFP_KERNEL); |