18 #include <linux/kernel.h>
22 #include <linux/wait.h>
26 #include <linux/slab.h>
30 #include <linux/export.h>
36 #define MDP_CMD_DEBUG_ACCESS_BASE (0x10000)
38 static uint16_t mdp_default_ccs[] = {
39 0x254, 0x000, 0x331, 0x254, 0xF38, 0xE61, 0x254, 0x409, 0x000,
47 static unsigned int mdp_irq_mask;
53 unsigned long irq_flags;
61 if (mdp_irq_mask & mask) {
76 spin_unlock_irqrestore(&mdp_lock, irq_flags);
83 if (!(mdp_irq_mask & mask)) {
90 mdp_irq_mask &= ~(
mask);
102 unsigned long irq_flags;
106 ret = locked_disable_mdp_irq(mdp, mask);
107 spin_unlock_irqrestore(&mdp_lock, irq_flags);
114 unsigned long irq_flags;
122 status &= mdp_irq_mask;
125 dma_callback->
func(dma_callback);
135 locked_disable_mdp_irq(mdp, status);
137 spin_unlock_irqrestore(&mdp_lock, irq_flags);
144 unsigned long irq_flags;
147 ret = mdp_irq_mask &
mask;
148 spin_unlock_irqrestore(&mdp_lock, irq_flags);
155 unsigned long irq_flags;
160 if (mdp_irq_mask & mask) {
161 locked_disable_mdp_irq(mdp, mask);
166 spin_unlock_irqrestore(&mdp_lock, irq_flags);
173 #define MDP_MAX_TIMEOUTS 20
174 static int timeout_count;
177 if (mdp_wait(mdp, DL0_DMA2_TERM_DONE, &mdp_dma2_waitqueue) == -
ETIMEDOUT)
189 static int mdp_ppp_wait(
struct mdp_info *mdp)
191 return mdp_wait(mdp, DL0_ROI_DONE, &mdp_ppp_waitqueue);
201 if (enable_mdp_irq(mdp, DL0_DMA2_TERM_DONE)) {
256 unsigned long *
start,
unsigned long *len,
265 *start = info->
fix.smem_start;
266 *len = info->
fix.smem_len;
282 unsigned long src_start = 0, src_len = 0, dst_start = 0, dst_len = 0;
284 struct file *src_file = 0, *dst_file = 0;
319 unsigned int tiles = req->
dst_rect.h / 16;
320 unsigned int remainder = req->
dst_rect.h % 16;
323 for (i = 0; i < tiles; i++) {
324 enable_mdp_irq(mdp, DL0_ROI_DONE);
326 src_len, dst_file, dst_start,
330 ret = mdp_ppp_wait(mdp);
332 goto err_wait_failed;
341 enable_mdp_irq(mdp, DL0_ROI_DONE);
342 ret =
mdp_ppp_blit(mdp, req, src_file, src_start, src_len, dst_file,
347 ret = mdp_ppp_wait(mdp);
349 goto err_wait_failed;
355 disable_mdp_irq(mdp, DL0_ROI_DONE);
373 pr_err(
"mdp: no mdp_class when registering mdp client\n");
392 pr_err(
"mdp: can not get mdp mem resource!\n");
402 pr_err(
"mdp: can not get mdp irq\n");
408 if (mdp->
base == 0) {
428 goto error_request_irq;
474 for (n = 0; n < 9; n++)
475 mdp_writel(mdp, mdp_default_ccs[n], 0x40440 + 4 * n);
476 mdp_writel(mdp, mdp_default_ccs[9], 0x40500 + 4 * 0);
477 mdp_writel(mdp, mdp_default_ccs[10], 0x40500 + 4 * 0);
478 mdp_writel(mdp, mdp_default_ccs[11], 0x40500 + 4 * 0);
491 goto error_device_register;
494 error_device_register:
507 .driver = {.name =
"msm_mdp"},
510 static int __init mdp_init(
void)
513 if (IS_ERR(mdp_class)) {
515 return PTR_ERR(mdp_class);