diff options
author | Werner Almesberger <werner@openmoko.org> | 2009-03-11 12:23:40 -0300 |
---|---|---|
committer | Werner Almesberger <werner@openmoko.org> | 2009-03-25 23:37:15 -0300 |
commit | 29bad58ada635337342eca46bf71f3b4f6dac62c (patch) | |
tree | 36bf91674eff1b2a14c73b194e509e7aa1412e53 | |
parent | 1e257a0e99817a338e3706708ebb5036518e46d8 (diff) |
Fewer HDQ errors on 3D7K
If no battery is connected, we periodically get a burst of HDQ error
messages (at least on 3D7K), interrupting whatever we're doing on
the console.
This patch reduces this to only one message per sequence of errors,
and one more message if communication with HDQ is successful later.
Signed-off-by: Werner Almesberger <werner@openmoko.org>
-rw-r--r-- | drivers/power/hdq.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/power/hdq.c b/drivers/power/hdq.c index 755a5efe5ec..d64f8f69e0c 100644 --- a/drivers/power/hdq.c +++ b/drivers/power/hdq.c @@ -33,7 +33,7 @@ enum hdq_bitbang_states { HDQB_WAIT_TX, }; -struct hdq_priv { +static struct hdq_priv { u8 hdq_probed; /* nonzero after HDQ driver probed */ struct mutex hdq_lock; /* if you want to use hdq, you have to take lock */ unsigned long hdq_gpio_pin; /* GTA02 = GPD14 which pin to meddle with */ @@ -49,11 +49,26 @@ struct hdq_priv { u8 hdq_shifter; u8 hdq_tx_data_done; enum hdq_bitbang_states hdq_state; + int reported_error; struct hdq_platform_data *pdata; } hdq_priv; +static void hdq_bad(void) +{ + if (!hdq_priv.reported_error) + printk(KERN_ERR "HDQ error: %d\n", hdq_priv.hdq_error); + hdq_priv.reported_error = 1; +} + +static void hdq_good(void) +{ + if (hdq_priv.reported_error) + printk(KERN_INFO "HDQ responds again\n"); + hdq_priv.reported_error = 0; +} + int hdq_fiq_handler(void) { if (!hdq_priv.hdq_probed) @@ -267,9 +282,10 @@ int hdq_read(int address) continue; if (hdq_priv.hdq_error) { - printk(KERN_ERR "HDQ error: %d\n", hdq_priv.hdq_error); + hdq_bad(); goto done; /* didn't see a response in good time */ } + hdq_good(); ret = hdq_priv.hdq_rx_data; goto done; @@ -308,9 +324,10 @@ int hdq_write(int address, u8 data) continue; /* something bad with FIQ */ if (hdq_priv.hdq_error) { - printk(KERN_ERR "HDQ error: %d\n", hdq_priv.hdq_error); + hdq_bad(); goto done; /* didn't see a response in good time */ } + hdq_good(); ret = 0; goto done; |