Commit 2ba162b9 authored by Eric Miao's avatar Eric Miao Committed by Linus Torvalds

pxafb: use completion for LCD disable wait code

Signed-off-by: default avatareric miao <eric.miao@marvell.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a7535ba7
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/completion.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -810,11 +811,6 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) ...@@ -810,11 +811,6 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
{ {
uint32_t lccr0; uint32_t lccr0;
DECLARE_WAITQUEUE(wait, current);
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&fbi->ctrlr_wait, &wait);
/* Clear LCD Status Register */ /* Clear LCD Status Register */
lcd_writel(fbi, LCSR, 0xffffffff); lcd_writel(fbi, LCSR, 0xffffffff);
...@@ -822,8 +818,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) ...@@ -822,8 +818,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
lcd_writel(fbi, LCCR0, lccr0); lcd_writel(fbi, LCCR0, lccr0);
lcd_writel(fbi, LCCR0, lccr0 | LCCR0_DIS); lcd_writel(fbi, LCCR0, lccr0 | LCCR0_DIS);
schedule_timeout(200 * HZ / 1000); wait_for_completion_timeout(&fbi->disable_done, 200 * HZ / 1000);
remove_wait_queue(&fbi->ctrlr_wait, &wait);
/* disable LCD controller clock */ /* disable LCD controller clock */
clk_disable(fbi->clk); clk_disable(fbi->clk);
...@@ -840,7 +835,7 @@ static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) ...@@ -840,7 +835,7 @@ static irqreturn_t pxafb_handle_irq(int irq, void *dev_id)
if (lcsr & LCSR_LDD) { if (lcsr & LCSR_LDD) {
lccr0 = lcd_readl(fbi, LCCR0); lccr0 = lcd_readl(fbi, LCCR0);
lcd_writel(fbi, LCCR0, lccr0 | LCCR0_LDM); lcd_writel(fbi, LCCR0, lccr0 | LCCR0_LDM);
wake_up(&fbi->ctrlr_wait); complete(&fbi->disable_done);
} }
lcd_writel(fbi, LCSR, lcsr); lcd_writel(fbi, LCSR, lcsr);
...@@ -1190,6 +1185,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) ...@@ -1190,6 +1185,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
init_waitqueue_head(&fbi->ctrlr_wait); init_waitqueue_head(&fbi->ctrlr_wait);
INIT_WORK(&fbi->task, pxafb_task); INIT_WORK(&fbi->task, pxafb_task);
init_MUTEX(&fbi->ctrlr_sem); init_MUTEX(&fbi->ctrlr_sem);
init_completion(&fbi->disable_done);
return fbi; return fbi;
} }
......
...@@ -114,6 +114,8 @@ struct pxafb_info { ...@@ -114,6 +114,8 @@ struct pxafb_info {
wait_queue_head_t ctrlr_wait; wait_queue_head_t ctrlr_wait;
struct work_struct task; struct work_struct task;
struct completion disable_done;
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
struct notifier_block freq_transition; struct notifier_block freq_transition;
struct notifier_block freq_policy; struct notifier_block freq_policy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment