aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-07-06 22:24:32 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-07-06 22:24:32 -0400
commite33afddca174171a68d57476ead8947476ab9240 (patch)
tree96ef173369d9c5ec442215ee0e5c9c8c809011a3 /drivers/video
parent9731f4a202f29ff402ea2ddad7ff6f3a559c0c82 (diff)
video: sh_mobile_lcdcfb: Convert to framebuffer_alloc().
All fb_info structures need to be allocated with framebuffer_alloc() due to special initialization. Switch over to it. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index da983b720f08..8f24564f77b0 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -31,7 +31,7 @@ struct sh_mobile_lcdc_chan {
31 unsigned long enabled; /* ME and SE in LDCNT2R */ 31 unsigned long enabled; /* ME and SE in LDCNT2R */
32 struct sh_mobile_lcdc_chan_cfg cfg; 32 struct sh_mobile_lcdc_chan_cfg cfg;
33 u32 pseudo_palette[PALETTE_NR]; 33 u32 pseudo_palette[PALETTE_NR];
34 struct fb_info info; 34 struct fb_info *info;
35 dma_addr_t dma_handle; 35 dma_addr_t dma_handle;
36 struct fb_deferred_io defio; 36 struct fb_deferred_io defio;
37 struct scatterlist *sglist; 37 struct scatterlist *sglist;
@@ -442,22 +442,22 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
442 /* set bpp format in PKF[4:0] */ 442 /* set bpp format in PKF[4:0] */
443 tmp = lcdc_read_chan(ch, LDDFR); 443 tmp = lcdc_read_chan(ch, LDDFR);
444 tmp &= ~(0x0001001f); 444 tmp &= ~(0x0001001f);
445 tmp |= (priv->ch[k].info.var.bits_per_pixel == 16) ? 3 : 0; 445 tmp |= (ch->info->var.bits_per_pixel == 16) ? 3 : 0;
446 lcdc_write_chan(ch, LDDFR, tmp); 446 lcdc_write_chan(ch, LDDFR, tmp);
447 447
448 /* point out our frame buffer */ 448 /* point out our frame buffer */
449 lcdc_write_chan(ch, LDSA1R, ch->info.fix.smem_start); 449 lcdc_write_chan(ch, LDSA1R, ch->info->fix.smem_start);
450 450
451 /* set line size */ 451 /* set line size */
452 lcdc_write_chan(ch, LDMLSR, ch->info.fix.line_length); 452 lcdc_write_chan(ch, LDMLSR, ch->info->fix.line_length);
453 453
454 /* setup deferred io if SYS bus */ 454 /* setup deferred io if SYS bus */
455 tmp = ch->cfg.sys_bus_cfg.deferred_io_msec; 455 tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
456 if (ch->ldmt1r_value & (1 << 12) && tmp) { 456 if (ch->ldmt1r_value & (1 << 12) && tmp) {
457 ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; 457 ch->defio.deferred_io = sh_mobile_lcdc_deferred_io;
458 ch->defio.delay = msecs_to_jiffies(tmp); 458 ch->defio.delay = msecs_to_jiffies(tmp);
459 ch->info.fbdefio = &ch->defio; 459 ch->info->fbdefio = &ch->defio;
460 fb_deferred_io_init(&ch->info); 460 fb_deferred_io_init(ch->info);
461 461
462 /* one-shot mode */ 462 /* one-shot mode */
463 lcdc_write_chan(ch, LDSM1R, 1); 463 lcdc_write_chan(ch, LDSM1R, 1);
@@ -503,12 +503,12 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
503 * flush frame, and wait for frame end interrupt 503 * flush frame, and wait for frame end interrupt
504 * clean up deferred io and enable clock 504 * clean up deferred io and enable clock
505 */ 505 */
506 if (ch->info.fbdefio) { 506 if (ch->info->fbdefio) {
507 ch->frame_end = 0; 507 ch->frame_end = 0;
508 schedule_delayed_work(&ch->info.deferred_work, 0); 508 schedule_delayed_work(&ch->info->deferred_work, 0);
509 wait_event(ch->frame_end_wait, ch->frame_end); 509 wait_event(ch->frame_end_wait, ch->frame_end);
510 fb_deferred_io_cleanup(&ch->info); 510 fb_deferred_io_cleanup(ch->info);
511 ch->info.fbdefio = NULL; 511 ch->info->fbdefio = NULL;
512 sh_mobile_lcdc_clk_on(priv); 512 sh_mobile_lcdc_clk_on(priv);
513 } 513 }
514 514
@@ -817,9 +817,16 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev)
817 priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1); 817 priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1);
818 818
819 for (i = 0; i < j; i++) { 819 for (i = 0; i < j; i++) {
820 info = &priv->ch[i].info;
821 cfg = &priv->ch[i].cfg; 820 cfg = &priv->ch[i].cfg;
822 821
822 priv->ch[i].info = framebuffer_alloc(0, &pdev->dev);
823 if (!priv->ch[i].info) {
824 dev_err(&pdev->dev, "unable to allocate fb_info\n");
825 error = -ENOMEM;
826 break;
827 }
828
829 info = priv->ch[i].info;
823 info->fbops = &sh_mobile_lcdc_ops; 830 info->fbops = &sh_mobile_lcdc_ops;
824 info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; 831 info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres;
825 info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; 832 info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres;
@@ -872,7 +879,7 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev)
872 for (i = 0; i < j; i++) { 879 for (i = 0; i < j; i++) {
873 struct sh_mobile_lcdc_chan *ch = priv->ch + i; 880 struct sh_mobile_lcdc_chan *ch = priv->ch + i;
874 881
875 info = &ch->info; 882 info = ch->info;
876 883
877 if (info->fbdefio) { 884 if (info->fbdefio) {
878 priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * 885 priv->ch->sglist = vmalloc(sizeof(struct scatterlist) *
@@ -915,15 +922,15 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
915 int i; 922 int i;
916 923
917 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) 924 for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
918 if (priv->ch[i].info.dev) 925 if (priv->ch[i].info->dev)
919 unregister_framebuffer(&priv->ch[i].info); 926 unregister_framebuffer(priv->ch[i].info);
920 927
921 sh_mobile_lcdc_stop(priv); 928 sh_mobile_lcdc_stop(priv);
922 929
923 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { 930 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
924 info = &priv->ch[i].info; 931 info = priv->ch[i].info;
925 932
926 if (!info->device) 933 if (!info || !info->device)
927 continue; 934 continue;
928 935
929 if (priv->ch[i].sglist) 936 if (priv->ch[i].sglist)
@@ -932,6 +939,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
932 dma_free_coherent(&pdev->dev, info->fix.smem_len, 939 dma_free_coherent(&pdev->dev, info->fix.smem_len,
933 info->screen_base, priv->ch[i].dma_handle); 940 info->screen_base, priv->ch[i].dma_handle);
934 fb_dealloc_cmap(&info->cmap); 941 fb_dealloc_cmap(&info->cmap);
942 framebuffer_release(info);
935 } 943 }
936 944
937#ifdef CONFIG_HAVE_CLK 945#ifdef CONFIG_HAVE_CLK