From 46fd6a9478a4fba3fca41b5b72195186ea15e31a Mon Sep 17 00:00:00 2001 From: Padmanabhan Komanduru Date: Wed, 12 Sep 2012 11:10:26 +0530 Subject: [PATCH] msm_fb: Make Vsync IOCTL during disable sequence as NO WAIT Change to make the vsync IOCTL no wait during the disable sequence. This is to increase the performance. Handle the synchronization of vsync interrupt using state variables in drivers from now. Change-Id: Ia5ec14493f233a95f21d01ea627200a6c278239f Signed-off-by: Padmanabhan Komanduru Signed-off-by: Siddhartha Agrawal --- drivers/video/msm/mdp.c | 22 +++++++++++----------- drivers/video/msm/mdp.h | 2 +- drivers/video/msm/mdp_dma.c | 10 +++++----- drivers/video/msm/mdp_dma_dsi_video.c | 10 +++++----- drivers/video/msm/mdp_dma_lcdc.c | 10 +++++----- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index a7685b4006b9..d13b3b355d8f 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c @@ -1804,16 +1804,16 @@ irqreturn_t mdp_isr(int irq, void *ptr) if (!vsync_isr) { mdp_intr_mask &= ~MDP_PRIM_RDPTR; outp32(MDP_INTR_ENABLE, mdp_intr_mask); + mdp_disable_irq_nosync(MDP_VSYNC_TERM); + vsync_cntrl.disabled_clocks = 1; + } else { + vsync_isr_handler(); } spin_unlock_irqrestore(&mdp_spin_lock, flag); - if (vsync_isr) { - vsync_isr_handler(); - } else { + if (!vsync_isr) mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, TRUE); - complete(&vsync_cntrl.vsync_wait); - } } /* DMA3 TV-Out Start */ @@ -1872,16 +1872,16 @@ irqreturn_t mdp_isr(int irq, void *ptr) if (!vsync_isr) { mdp_intr_mask &= ~LCDC_FRAME_START; outp32(MDP_INTR_ENABLE, mdp_intr_mask); + mdp_disable_irq_nosync(MDP_VSYNC_TERM); + vsync_cntrl.disabled_clocks = 1; + } else { + vsync_isr_handler(); } spin_unlock_irqrestore(&mdp_spin_lock, flag); - if (vsync_isr) { - vsync_isr_handler(); - } else { + if (!vsync_isr) mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, TRUE); - complete(&vsync_cntrl.vsync_wait); - } } /* DMA2 LCD-Out Complete */ @@ -2012,7 +2012,7 @@ static void mdp_drv_init(void) atomic_set(&mdp_block_power_cnt[i], 0); } INIT_WORK(&(vsync_cntrl.vsync_work), send_vsync_work); - init_completion(&vsync_cntrl.vsync_wait); + vsync_cntrl.disabled_clocks = 1; #ifdef MSM_FB_ENABLE_DBGFS { struct dentry *root; diff --git a/drivers/video/msm/mdp.h b/drivers/video/msm/mdp.h index 965f819722d2..21195b132992 100644 --- a/drivers/video/msm/mdp.h +++ b/drivers/video/msm/mdp.h @@ -96,7 +96,7 @@ struct vsync { struct device *dev; struct work_struct vsync_work; int vsync_irq_enabled; - struct completion vsync_wait; + int disabled_clocks; }; extern struct vsync vsync_cntrl; diff --git a/drivers/video/msm/mdp_dma.c b/drivers/video/msm/mdp_dma.c index df57ee1e6ee7..68c45d46feed 100644 --- a/drivers/video/msm/mdp_dma.c +++ b/drivers/video/msm/mdp_dma.c @@ -515,14 +515,18 @@ void mdp_dma2_update(struct msm_fb_data_type *mfd) void mdp_dma_vsync_ctrl(int enable) { unsigned long flag; + int disabled_clocks; if (vsync_cntrl.vsync_irq_enabled == enable) return; spin_lock_irqsave(&mdp_spin_lock, flag); vsync_cntrl.vsync_irq_enabled = enable; + if (!enable) + vsync_cntrl.disabled_clocks = 0; + disabled_clocks = vsync_cntrl.disabled_clocks; spin_unlock_irqrestore(&mdp_spin_lock, flag); - if (enable) { + if (enable && disabled_clocks) { mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE); MDP_OUTP(MDP_BASE + 0x021c, 0x10); /* read pointer */ spin_lock_irqsave(&mdp_spin_lock, flag); @@ -531,10 +535,6 @@ void mdp_dma_vsync_ctrl(int enable) outp32(MDP_INTR_ENABLE, mdp_intr_mask); mdp_enable_irq(MDP_VSYNC_TERM); spin_unlock_irqrestore(&mdp_spin_lock, flag); - } else { - INIT_COMPLETION(vsync_cntrl.vsync_wait); - wait_for_completion(&vsync_cntrl.vsync_wait); - mdp_disable_irq(MDP_VSYNC_TERM); } } diff --git a/drivers/video/msm/mdp_dma_dsi_video.c b/drivers/video/msm/mdp_dma_dsi_video.c index 09ae82f8bdb5..ed224c28e7e8 100644 --- a/drivers/video/msm/mdp_dma_dsi_video.c +++ b/drivers/video/msm/mdp_dma_dsi_video.c @@ -250,14 +250,18 @@ int mdp_dsi_video_off(struct platform_device *pdev) void mdp_dma_video_vsync_ctrl(int enable) { unsigned long flag; + int disabled_clocks; if (vsync_cntrl.vsync_irq_enabled == enable) return; spin_lock_irqsave(&mdp_spin_lock, flag); vsync_cntrl.vsync_irq_enabled = enable; + if (!enable) + vsync_cntrl.disabled_clocks = 0; + disabled_clocks = vsync_cntrl.disabled_clocks; spin_unlock_irqrestore(&mdp_spin_lock, flag); - if (enable) { + if (enable && disabled_clocks) { mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE); spin_lock_irqsave(&mdp_spin_lock, flag); outp32(MDP_INTR_CLEAR, LCDC_FRAME_START); @@ -265,10 +269,6 @@ void mdp_dma_video_vsync_ctrl(int enable) outp32(MDP_INTR_ENABLE, mdp_intr_mask); mdp_enable_irq(MDP_VSYNC_TERM); spin_unlock_irqrestore(&mdp_spin_lock, flag); - } else { - INIT_COMPLETION(vsync_cntrl.vsync_wait); - wait_for_completion(&vsync_cntrl.vsync_wait); - mdp_disable_irq(MDP_VSYNC_TERM); } } diff --git a/drivers/video/msm/mdp_dma_lcdc.c b/drivers/video/msm/mdp_dma_lcdc.c index e1b78c2b2504..6146b45ebd70 100644 --- a/drivers/video/msm/mdp_dma_lcdc.c +++ b/drivers/video/msm/mdp_dma_lcdc.c @@ -331,14 +331,18 @@ int mdp_lcdc_off(struct platform_device *pdev) void mdp_dma_lcdc_vsync_ctrl(int enable) { unsigned long flag; + int disabled_clocks; if (vsync_cntrl.vsync_irq_enabled == enable) return; spin_lock_irqsave(&mdp_spin_lock, flag); vsync_cntrl.vsync_irq_enabled = enable; + if (!enable) + vsync_cntrl.disabled_clocks = 0; + disabled_clocks = vsync_cntrl.disabled_clocks; spin_unlock_irqrestore(&mdp_spin_lock, flag); - if (enable) { + if (enable && disabled_clocks) { mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE); spin_lock_irqsave(&mdp_spin_lock, flag); outp32(MDP_INTR_CLEAR, LCDC_FRAME_START); @@ -346,10 +350,6 @@ void mdp_dma_lcdc_vsync_ctrl(int enable) outp32(MDP_INTR_ENABLE, mdp_intr_mask); mdp_enable_irq(MDP_VSYNC_TERM); spin_unlock_irqrestore(&mdp_spin_lock, flag); - } else { - INIT_COMPLETION(vsync_cntrl.vsync_wait); - wait_for_completion(&vsync_cntrl.vsync_wait); - mdp_disable_irq(MDP_VSYNC_TERM); } }