From ce66949d2ab3b4c03c11778b124e99089d0d4f59 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 26 Jan 2011 15:55:28 +0800 Subject: [PATCH] add Dma mem to mem --- arch/arm/mach-rk29/Makefile | 2 +- arch/arm/mach-rk29/board-rk29sdk.c | 8 ++++++++ arch/arm/mach-rk29/devices.h | 1 + arch/arm/mach-rk29/dma.c | 2 +- arch/arm/mach-rk29/include/mach/dma.h | 3 ++- .../mach-rk29/include/mach/rk29-dma-pl330.h | 1 + arch/arm/mach-rk29/rk29-pl330.c | 6 ++++++ drivers/video/rk29_fb.c | 19 ++++++++++++++----- include/linux/fb.h | 1 + 9 files changed, 35 insertions(+), 8 deletions(-) mode change 100644 => 100755 arch/arm/mach-rk29/dma.c mode change 100644 => 100755 arch/arm/mach-rk29/include/mach/dma.h mode change 100644 => 100755 arch/arm/mach-rk29/include/mach/rk29-dma-pl330.h mode change 100644 => 100755 arch/arm/mach-rk29/rk29-pl330.c mode change 100644 => 100755 drivers/video/rk29_fb.c mode change 100644 => 100755 include/linux/fb.h diff --git a/arch/arm/mach-rk29/Makefile b/arch/arm/mach-rk29/Makefile index 352e1c6fc1cc..13c2290d081f 100755 --- a/arch/arm/mach-rk29/Makefile +++ b/arch/arm/mach-rk29/Makefile @@ -1,4 +1,4 @@ -obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o gpio.o ddr.o sram.o +obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o gpio.o ddr.o sram.o Memcpy_Dma.o obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_RK29_VPU) += vpu.o vpu_mem.o diff --git a/arch/arm/mach-rk29/board-rk29sdk.c b/arch/arm/mach-rk29/board-rk29sdk.c index 5b5db3a5c502..9208746b8f9a 100755 --- a/arch/arm/mach-rk29/board-rk29sdk.c +++ b/arch/arm/mach-rk29/board-rk29sdk.c @@ -228,6 +228,13 @@ struct platform_device rk29_device_fb = { .platform_data = &rk29_fb_info, } }; + +struct platform_device rk29_device_Dma_cpy = { + .name = "dma_memcpy", + .id = 4, + +}; + #endif static struct android_pmem_platform_data android_pmem_pdata = { @@ -1436,6 +1443,7 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_FB_RK29 &rk29_device_fb, + &rk29_device_Dma_cpy, #endif #ifdef CONFIG_BACKLIGHT_RK29_BL &rk29_device_backlight, diff --git a/arch/arm/mach-rk29/devices.h b/arch/arm/mach-rk29/devices.h index b80198fa8325..b8637fb5c1f3 100755 --- a/arch/arm/mach-rk29/devices.h +++ b/arch/arm/mach-rk29/devices.h @@ -40,6 +40,7 @@ extern struct platform_device rk29xx_device_spi1m; extern struct rk29xx_spi_platform_data rk29xx_spi0_platdata; extern struct rk29xx_spi_platform_data rk29xx_spi1_platdata; extern struct platform_device rk29_device_fb; +extern struct platform_device rk29_device_Dma_cpy; extern struct platform_device rk29_device_nand; extern struct platform_device rk29xx_device_nand; extern struct rk29_sdmmc_platform_data default_sdmmc0_data; diff --git a/arch/arm/mach-rk29/dma.c b/arch/arm/mach-rk29/dma.c old mode 100644 new mode 100755 index ac5474034987..35c0e77467b0 --- a/arch/arm/mach-rk29/dma.c +++ b/arch/arm/mach-rk29/dma.c @@ -30,7 +30,7 @@ static struct rk29_pl330_platdata rk29_dmac0_pdata = { [4] = DMACH_I2S_2CH_TX, [5] = DMACH_I2S_2CH_RX, [6] = DMACH_SPDIF, - [7] = DMACH_MAX, + [7] = DMACH_DMAC0_MemToMem, [8] = DMACH_MAX, [9] = DMACH_MAX, [10] = DMACH_MAX, diff --git a/arch/arm/mach-rk29/include/mach/dma.h b/arch/arm/mach-rk29/include/mach/dma.h old mode 100644 new mode 100755 index bf2ba7e9e2ff..f55f040f9c22 --- a/arch/arm/mach-rk29/include/mach/dma.h +++ b/arch/arm/mach-rk29/include/mach/dma.h @@ -18,7 +18,8 @@ enum rk29_dma_buffresult { enum rk29_dmasrc { RK29_DMASRC_HW, /* source is memory */ - RK29_DMASRC_MEM /* source is hardware */ + RK29_DMASRC_MEM, /* source is hardware */ + RK29_DMASRC_MEMTOMEM }; /* enum rk29_chan_op diff --git a/arch/arm/mach-rk29/include/mach/rk29-dma-pl330.h b/arch/arm/mach-rk29/include/mach/rk29-dma-pl330.h old mode 100644 new mode 100755 index 84195588dfb5..8443d554335b --- a/arch/arm/mach-rk29/include/mach/rk29-dma-pl330.h +++ b/arch/arm/mach-rk29/include/mach/rk29-dma-pl330.h @@ -46,6 +46,7 @@ enum dma_ch { DMACH_SPI1_TX, DMACH_SPI1_RX, DMACH_PID_FILTER, + DMACH_DMAC0_MemToMem, /* END Marker, also used to denote a reserved channel */ DMACH_MAX, }; diff --git a/arch/arm/mach-rk29/rk29-pl330.c b/arch/arm/mach-rk29/rk29-pl330.c old mode 100644 new mode 100755 index 1c12f70f6516..ec290ddce682 --- a/arch/arm/mach-rk29/rk29-pl330.c +++ b/arch/arm/mach-rk29/rk29-pl330.c @@ -984,6 +984,12 @@ int rk29_dma_devconfig(enum dma_ch id, enum rk29_dmasrc source, ch->rqcfg.src_inc = 1; ch->rqcfg.dst_inc = 0; break; + case RK29_DMASRC_MEMTOMEM: + ch->req[0].rqtype = MEMTOMEM; + ch->req[1].rqtype = MEMTOMEM; + ch->rqcfg.src_inc = 1; + ch->rqcfg.dst_inc = 1; + break; default: ret = -EINVAL; goto devcfg_exit; diff --git a/drivers/video/rk29_fb.c b/drivers/video/rk29_fb.c old mode 100644 new mode 100755 index 507adf179dfd..238043cb71cd --- a/drivers/video/rk29_fb.c +++ b/drivers/video/rk29_fb.c @@ -166,7 +166,7 @@ struct rk29fb_inf { LCDC_REG regbak; int in_suspend; - + int fb0_color_deepth; /* variable used in mcu panel */ int mcu_needflush; int mcu_isrcnt; @@ -1140,6 +1140,7 @@ static int fb0_check_var(struct fb_var_screeninfo *var, struct fb_info *info) return -EINVAL; } + if(inf->fb0_color_deepth)var->bits_per_pixel=inf->fb0_color_deepth; switch(var->bits_per_pixel) { case 16: // rgb565 @@ -1184,6 +1185,7 @@ static int fb0_set_par(struct fb_info *info) CHK_SUSPEND(inf); + if(inf->fb0_color_deepth)var->bits_per_pixel=inf->fb0_color_deepth; if((inf->video_mode == 1)&&(screen->y_res < var->yres))ypos_virtual += (var->yres-screen->y_res); switch(var->bits_per_pixel) @@ -1191,7 +1193,7 @@ static int fb0_set_par(struct fb_info *info) case 16: // rgb565 par->format = 1; fix->line_length = 2 * xres_virtual; - offset = (ypos_virtual*xres_virtual + xpos_virtual)*2; + offset = (ypos_virtual*xres_virtual + xpos_virtual)*(inf->fb0_color_deepth ? 4:2); break; case 32: // rgb888 default: @@ -1251,13 +1253,14 @@ static int fb0_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) //fbprintk(">>>>>> %s : %s \n", __FILE__, __FUNCTION__); CHK_SUSPEND(inf); - + if(inf->fb0_color_deepth)var->bits_per_pixel=inf->fb0_color_deepth; + switch(var1->bits_per_pixel) { case 16: // rgb565 var->xoffset = (var->xoffset) & (~0x1); - offset = (var->yoffset*var1->xres_virtual + var->xoffset)*2; - break; + offset = (var->yoffset*var1->xres_virtual + var->xoffset)*(inf->fb0_color_deepth ? 4:2); + break; case 32: // rgb888 offset = (var->yoffset*var1->xres_virtual + var->xoffset)*4; break; @@ -1304,6 +1307,11 @@ static int fb0_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) inf->mcu_usetimer = 0; } break; + case FBIOPUT_16OR32: + + inf->fb0_color_deepth = arg; + + break; default: break; } @@ -2069,6 +2077,7 @@ static int __init rk29fb_probe (struct platform_device *pdev) inf->fb0->var.xres = screen->x_res; inf->fb0->var.yres = screen->y_res; inf->fb0->var.bits_per_pixel = 16; + inf->fb0_color_deepth = 0; inf->fb0->var.xres_virtual = screen->x_res; inf->fb0->var.yres_virtual = screen->y_res; inf->fb0->var.width = screen->width; diff --git a/include/linux/fb.h b/include/linux/fb.h old mode 100644 new mode 100755 index 862e7d4a7820..4a8b2fc84a45 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -18,6 +18,7 @@ struct dentry; #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x4606 +#define FBIOPUT_16OR32 0x4607 #ifdef __KERNEL__ #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor_user) #else -- 2.34.1