aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/glamo/glamo-fb.c
diff options
context:
space:
mode:
authormokopatches <mokopatches@openmoko.org>2008-11-19 17:03:23 +0000
committerwarmcat <andy@warmcat.com>2008-11-19 17:03:23 +0000
commitf6b10d9df789f837123305297030f95f9677f58d (patch)
treef53c80af291fc10901f8747527720be4f57da959 /drivers/mfd/glamo/glamo-fb.c
parentdc4f3dc3fb8b06195873aa55a4b7b6b41d19eddd (diff)
glamo-cmdqueue-bandaid.patch
[ Stop kernel from hanging every once in a while during Glamo initialization. ] debug-glamo-fb-cmdqueue-wait-timeout.patch From: warmcat <andy@warmcat.com>
Diffstat (limited to 'drivers/mfd/glamo/glamo-fb.c')
-rw-r--r--drivers/mfd/glamo/glamo-fb.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
index 394a0add5cb..f0d7600f9d8 100644
--- a/drivers/mfd/glamo/glamo-fb.c
+++ b/drivers/mfd/glamo/glamo-fb.c
@@ -553,12 +553,20 @@ static inline int glamofb_cmdq_empty(struct glamofb_handle *gfb)
void glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
{
+ int timeout = 2000;
+
dev_dbg(gfb->dev, "glamofb_cmd_mode(gfb=%p, on=%d)\n", gfb, on);
if (on) {
dev_dbg(gfb->dev, "%s: waiting for cmdq empty: ",
__FUNCTION__);
- while (!glamofb_cmdq_empty(gfb))
+ while ((!glamofb_cmdq_empty(gfb)) && (timeout--))
yield();
+ if (timeout < 0) {
+ printk(KERN_ERR"*************"
+ "glamofb cmd_queue never got empty"
+ "*************\n");
+ return;
+ }
dev_dbg(gfb->dev, "empty!\n");
/* display the entire frame then switch to command */
@@ -568,8 +576,16 @@ void glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
/* wait until LCD is idle */
dev_dbg(gfb->dev, "waiting for LCD idle: ");
- while (!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12))
+ timeout = 2000;
+ while ((!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12)) &&
+ (timeout--))
yield();
+ if (timeout < 0) {
+ printk(KERN_ERR"*************"
+ "glamofb lcd never idle"
+ "*************\n");
+ return;
+ }
dev_dbg(gfb->dev, "idle!\n");
msleep(90);
@@ -589,10 +605,18 @@ EXPORT_SYMBOL_GPL(glamofb_cmd_mode);
int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val)
{
+ int timeout = 2000;
+
dev_dbg(gfb->dev, "%s: waiting for cmdq empty\n",
__FUNCTION__);
- while (!glamofb_cmdq_empty(gfb))
+ while ((!glamofb_cmdq_empty(gfb)) && (timeout--))
yield();
+ if (timeout < 0) {
+ printk(KERN_ERR"*************"
+ "glamofb cmd_queue never got empty"
+ "*************\n");
+ return 1;
+ }
dev_dbg(gfb->dev, "idle, writing 0x%04x\n", val);
reg_write(gfb, GLAMO_REG_LCD_COMMAND1, val);