AnsweredAssumed Answered

CPU interface TFT connected to BF512 how to use framebuffer under uclinux

Question asked by astankvai on Jun 2, 2013
Latest reply on Jun 7, 2013 by astankvai

now i have a hardware platform with 480x320 TFT connected to AMI band 1. address range is 0x2010 0000 to 0x201F FFFF. the lower 512K used for TFT model command transfer and higher 512K used for data transfer.

 

now i want to use dma (MDMA, SDRAM(fb) to AMI) but it alwasy show dma configuration failed. because mdma use two channals, while old driver olny use PPI dma.

without a dma, it could work normal but every time need to refersh the display after the data changed.

not so convient.

 

Please help to solve the MDMA build for this platform.

 

 

hardware info:

BF512 customer board.

Uboot 2012, buildroot lastest one.

error part codes:

static int __devinit bfin_lq035q1_probe(struct platform_device *pdev)

{

    struct bfin_lq035q1fb_info *info;

    struct fb_info *fbinfo;

    u32 active_video_mem_offset;

    int ret;

printk("init 035 \r\n");

 

    ret = request_dma(CH_MEM_STREAM0_DEST, DRIVER_NAME"Blackfin dma_memcpy");

 

    if (ret < 0) {

        dev_err(&pdev->dev, "CH_MEM_STREAM0_DEST unavailable\n");

        goto out1;

    }

    ret = request_dma(CH_MEM_STREAM0_SRC, DRIVER_NAME"Blackfin dma_memcpy");

    if (ret < 0) {

        dev_err(&pdev->dev, "CH_MEM_STREAM0_SRC unavailable\n");

        goto out1;

    }

   

    fbinfo = framebuffer_alloc(sizeof(*info), &pdev->dev);

    if (!fbinfo) {

        printk("fb buffer error!\r\n");

        ret = -ENOMEM;

        goto out2;

    }

 

    info = fbinfo->par;

    info->fb = fbinfo;

    info->dev = &pdev->dev;

 

    info->disp_info = pdev->dev.platform_data;

 

    platform_set_drvdata(pdev, fbinfo);

 

    strcpy(fbinfo->fix.id, DRIVER_NAME);

 

 

    fbinfo->fix.type = FB_TYPE_PACKED_PIXELS;

    fbinfo->fix.type_aux = 0;

    fbinfo->fix.xpanstep = 0;

    fbinfo->fix.ypanstep = 0;

    fbinfo->fix.ywrapstep = 0;

    fbinfo->fix.accel = FB_ACCEL_NONE;

    fbinfo->fix.visual = FB_VISUAL_TRUECOLOR;

 

    fbinfo->var.nonstd = 0;

    fbinfo->var.activate = FB_ACTIVATE_NOW;

    fbinfo->var.height = -1;

    fbinfo->var.width = -1;

    fbinfo->var.accel_flags = 0;

    fbinfo->var.vmode = FB_VMODE_NONINTERLACED;

 

    info->lcd_bpp = 16;

    fbinfo->var.xres = LCD_X_RES;

    fbinfo->var.xres_virtual = LCD_X_RES;

    fbinfo->var.yres = LCD_Y_RES;

    fbinfo->var.yres_virtual = LCD_Y_RES;

    fbinfo->var.bits_per_pixel = info->lcd_bpp;

 

    if (info->disp_info->mode & LQ035_BGR) {

        if (info->lcd_bpp == 24) {

            fbinfo->var.red.offset = 0;

            fbinfo->var.green.offset = 8;

            fbinfo->var.blue.offset = 16;

        } else {

            fbinfo->var.red.offset = 0;

            fbinfo->var.green.offset = 5;

            fbinfo->var.blue.offset = 11;

        }

    } else {

        if (info->lcd_bpp == 24) {

            fbinfo->var.red.offset = 16;

            fbinfo->var.green.offset = 8;

            fbinfo->var.blue.offset = 0;

        } else {

            fbinfo->var.red.offset = 11;

            fbinfo->var.green.offset = 5;

            fbinfo->var.blue.offset = 0;

        }

    }

 

    fbinfo->var.transp.offset = 0;

 

    if (info->lcd_bpp == 24) {

        fbinfo->var.red.length = 8;

        fbinfo->var.green.length = 8;

        fbinfo->var.blue.length = 8;

    } else {

        fbinfo->var.red.length = 5;

        fbinfo->var.green.length = 6;

        fbinfo->var.blue.length = 5;

    }

 

    fbinfo->var.transp.length = 0;

 

    active_video_mem_offset = ((U_LINE / 2) * LCD_X_RES * (info->lcd_bpp / 8));

 

    fbinfo->fix.smem_len = LCD_X_RES * LCD_Y_RES * info->lcd_bpp / 8

                + active_video_mem_offset;

 

    fbinfo->fix.line_length = fbinfo->var.xres_virtual *

        fbinfo->var.bits_per_pixel / 8;

 

 

    fbinfo->fbops = &bfin_lq035q1_fb_ops;

    fbinfo->flags = FBINFO_FLAG_DEFAULT;

 

    info->fb_buffer =

        dma_alloc_coherent(NULL, fbinfo->fix.smem_len, &info->dma_handle,

                   GFP_KERNEL);

/*    info->fb_buffer = (unsigned char*)kmalloc(sizeof(char)*fbinfo->fix.smem_len,GFP_KERNEL); */

 

    if (NULL == info->fb_buffer) {

        dev_err(&pdev->dev, "couldn't allocate dma buffer\n");

        ret = -ENOMEM;

        goto out3;

    }

 

    fbinfo->screen_base = (void *)info->fb_buffer + active_video_mem_offset;

    fbinfo->fix.smem_start = (int)info->fb_buffer + active_video_mem_offset;

 

    fbinfo->fbops = &bfin_lq035q1_fb_ops;

 

    fbinfo->pseudo_palette = &info->pseudo_pal;

 

    ret = fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0);

    if (ret < 0) {

        dev_err(&pdev->dev, "failed to allocate colormap (%d entries)\n",

               BFIN_LCD_NBR_PALETTE_ENTRIES);

        goto out4;

    }

 

    /*

    info->spidrv.driver.name = DRIVER_NAME"-spi";

    info->spidrv.probe    = lq035q1_spidev_probe;

    info->spidrv.remove   = __devexit_p(lq035q1_spidev_remove);

    info->spidrv.shutdown = lq035q1_spidev_shutdown;

    info->spidrv.suspend  = lq035q1_spidev_suspend;

    info->spidrv.resume   = lq035q1_spidev_resume;

    */

    

 

    if (info->disp_info->use_bl) {

        ret = gpio_request_one(info->disp_info->gpio_bl,

                    GPIOF_OUT_INIT_LOW, "LQ035 Backlight");

 

        if (ret) {

            dev_err(&pdev->dev, "failed to request GPIO %d\n",

                info->disp_info->gpio_bl);

            goto out9;

        }

    }

 

    ret = register_framebuffer(fbinfo);

    if (ret < 0) {

        dev_err(&pdev->dev, "unable to register framebuffer\n");

        goto out10;

    }

 

    dev_info(&pdev->dev, "%dx%d %d-bit RGB FrameBuffer initialized\n",

        LCD_X_RES, LCD_Y_RES, info->lcd_bpp);

 

    return 0;

 

out10:

    

out9:

    

out8:

    

out7:

    

out6:

    fb_dealloc_cmap(&fbinfo->cmap);

out4:

    dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer,

              info->dma_handle);

out3:

    framebuffer_release(fbinfo);

out2:

    free_dma(CH_MEM_STREAM0_SRC);

    free_dma(CH_MEM_STREAM0_DEST);

out1:

    platform_set_drvdata(pdev, NULL);

 

    return ret;

}

other dma just like spi and uart could be requested but the lcd display dma reqest error!

Outcomes