25 #include <linux/module.h>
32 #include <mach/hardware.h>
53 static struct lcd_dma_info {
75 lcd_dma.xres = fb_xres;
76 lcd_dma.yres = fb_yres;
88 lcd_dma.single_transfer = single;
99 lcd_dma.rotate = rotate;
109 lcd_dma.mirror = mirror;
116 pr_err(
"DMA virtual resolution is not supported in 1510 mode\n");
119 lcd_dma.vxres = vxres;
129 lcd_dma.xscale = xscale;
130 lcd_dma.yscale = yscale;
134 static void set_b1_regs(
void)
139 unsigned long en,
fn;
142 unsigned int xscale, yscale;
144 switch (lcd_dma.data_type) {
159 vxres = lcd_dma.vxres ? lcd_dma.vxres : lcd_dma.xres;
160 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
161 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
162 BUG_ON(vxres < lcd_dma.xres);
164 #define PIXADDR(x, y) (lcd_dma.addr + \
165 ((y) * vxres * yscale + (x) * xscale) * es)
166 #define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
168 switch (lcd_dma.rotate) {
170 if (!lcd_dma.mirror) {
172 bottom =
PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
179 fi =
PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
181 top =
PIXADDR(lcd_dma.xres - 1, 0);
182 bottom =
PIXADDR(0, lcd_dma.yres - 1);
184 fi =
PIXSTEP(0, 0, lcd_dma.xres - 1, 1);
190 if (!lcd_dma.mirror) {
191 top =
PIXADDR(0, lcd_dma.yres - 1);
192 bottom =
PIXADDR(lcd_dma.xres - 1, 0);
194 fi =
PIXSTEP(0, 0, 1, lcd_dma.yres - 1);
196 top =
PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
199 fi =
PIXSTEP(1, 0, 0, lcd_dma.yres - 1);
205 if (!lcd_dma.mirror) {
206 top =
PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
209 fi =
PIXSTEP(0, 1, lcd_dma.xres - 1, 0);
211 top =
PIXADDR(0, lcd_dma.yres - 1);
212 bottom =
PIXADDR(lcd_dma.xres - 1, 0);
214 fi =
PIXSTEP(lcd_dma.xres - 1, 1, 0, 0);
220 if (!lcd_dma.mirror) {
221 top =
PIXADDR(lcd_dma.xres - 1, 0);
222 bottom =
PIXADDR(0, lcd_dma.yres - 1);
224 fi =
PIXSTEP(1, lcd_dma.yres - 1, 0, 0);
227 bottom =
PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
229 fi =
PIXSTEP(0, lcd_dma.yres - 1, 1, 0);
259 w |= lcd_dma.data_type;
265 if (lcd_dma.callback !=
NULL)
271 if (!(lcd_dma.rotate || lcd_dma.mirror ||
272 lcd_dma.vxres || lcd_dma.xscale || lcd_dma.yscale))
298 if (lcd_dma.callback !=
NULL)
299 lcd_dma.callback(w, lcd_dma.cb_data);
307 spin_lock_irq(&lcd_dma.lock);
308 if (lcd_dma.reserved) {
309 spin_unlock_irq(&lcd_dma.lock);
314 lcd_dma.reserved = 1;
315 spin_unlock_irq(&lcd_dma.lock);
317 lcd_dma.cb_data =
data;
319 lcd_dma.single_transfer = 0;
325 lcd_dma.ext_ctrl = 0;
326 lcd_dma.src_port = 0;
334 spin_lock(&lcd_dma.lock);
335 if (!lcd_dma.reserved) {
336 spin_unlock(&lcd_dma.lock);
344 lcd_dma.reserved = 0;
345 spin_unlock(&lcd_dma.lock);
393 if (!lcd_dma.single_transfer)
418 static int __init omap_init_lcd_dma(
void)
439 pr_err(
"unable to request IRQ for LCD DMA (error %d)\n", r);