1 From ce8eaeee7875e668be4c2888fa05a61a5af0dd98 Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Sun, 13 Apr 2008 07:23:59 +0100
4 Subject: [PATCH] glamo-cmdqueue-bandaid.patch
5 [ Stop kernel from hanging every once in a while during Glamo
8 debug-glamo-fb-cmdqueue-wait-timeout.patch
10 From: warmcat <andy@warmcat.com>
12 drivers/mfd/glamo/glamo-fb.c | 30 +++++++++++++++++++++++++++---
13 1 files changed, 27 insertions(+), 3 deletions(-)
15 diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
16 index 394a0ad..f0d7600 100644
17 --- a/drivers/mfd/glamo/glamo-fb.c
18 +++ b/drivers/mfd/glamo/glamo-fb.c
19 @@ -553,12 +553,20 @@ static inline int glamofb_cmdq_empty(struct glamofb_handle *gfb)
21 void glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
25 dev_dbg(gfb->dev, "glamofb_cmd_mode(gfb=%p, on=%d)\n", gfb, on);
27 dev_dbg(gfb->dev, "%s: waiting for cmdq empty: ",
29 - while (!glamofb_cmdq_empty(gfb))
30 + while ((!glamofb_cmdq_empty(gfb)) && (timeout--))
33 + printk(KERN_ERR"*************"
34 + "glamofb cmd_queue never got empty"
38 dev_dbg(gfb->dev, "empty!\n");
40 /* display the entire frame then switch to command */
41 @@ -568,8 +576,16 @@ void glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
43 /* wait until LCD is idle */
44 dev_dbg(gfb->dev, "waiting for LCD idle: ");
45 - while (!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12))
47 + while ((!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12)) &&
51 + printk(KERN_ERR"*************"
52 + "glamofb lcd never idle"
56 dev_dbg(gfb->dev, "idle!\n");
59 @@ -589,10 +605,18 @@ EXPORT_SYMBOL_GPL(glamofb_cmd_mode);
61 int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val)
65 dev_dbg(gfb->dev, "%s: waiting for cmdq empty\n",
67 - while (!glamofb_cmdq_empty(gfb))
68 + while ((!glamofb_cmdq_empty(gfb)) && (timeout--))
71 + printk(KERN_ERR"*************"
72 + "glamofb cmd_queue never got empty"
76 dev_dbg(gfb->dev, "idle, writing 0x%04x\n", val);
78 reg_write(gfb, GLAMO_REG_LCD_COMMAND1, val);