aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/pcf50633-core.c
diff options
context:
space:
mode:
authormerge <null@invalid>2008-12-05 09:59:34 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-12-05 09:59:34 +0000
commit361fff778b7c4d2c78f28833415335148d86a1aa (patch)
treee616c940a691b9ff548b1aaeb747eae8a1342509 /drivers/mfd/pcf50633-core.c
parent5adc83c203167f77dd9b975ee275e3014287d6c7 (diff)
MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-build-fix-path-to-toolchain-on-1228470136
pending-tracking-hist top was MERGE-via-stable-tracking-build-fix-path-to-toolchain-on-1228470136 / 21b67ab8e79998b0a534263282dab1dda0f11b00 ... parent commitmessage: From: merge <null@invalid> MERGE-via-stable-tracking-hist-build-fix-path-to-toolchain-on stable-tracking-hist top was build-fix-path-to-toolchain-on / ca14ba894df9b28822066c578dde48d7dbe931de ... parent commitmessage: From: Andy Green <andy@openmoko.com> build-fix-path-to-toolchain-one-at-last.patch Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/mfd/pcf50633-core.c')
-rw-r--r--drivers/mfd/pcf50633-core.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 891f7623377..6634558ea91 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -28,12 +28,8 @@
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
+
#include <linux/mfd/pcf50633/core.h>
-#include <linux/mfd/pcf50633/adc.h>
-#include <linux/mfd/pcf50633/rtc.h>
-#include <linux/mfd/pcf50633/mbc.h>
-#include <linux/mfd/pcf50633/input.h>
-#include <linux/mfd/pcf50633/pmic.h>
/* Read a block of upto 32 regs */
int pcf50633_read_block(struct pcf50633 *pcf , u8 reg,
@@ -303,7 +299,7 @@ static void pcf50633_irq_worker(struct work_struct *work)
/* Some revisions of the chip don't have a 8s standby mode on
* ONKEY1S press. We try to manually do it in such cases. */
- if (pcf_int[0] & PCF50633_INT1_SECOND && pcf->onkey1s_held) {
+ if ((pcf_int[0] & PCF50633_INT1_SECOND) && pcf->onkey1s_held) {
dev_info(pcf->dev, "ONKEY1S held for %d secs\n",
pcf->onkey1s_held);
if (pcf->onkey1s_held++ == PCF50633_ONKEY1S_TIMEOUT)
@@ -320,11 +316,11 @@ static void pcf50633_irq_worker(struct work_struct *work)
PCF50633_INT1_SECOND);
/* Unmask IRQ_ONKEYR */
- pcf50633_reg_clear_bits(pcf, PCF50633_REG_INT1M,
- PCF50633_INT1_SECOND);
+ pcf50633_reg_clear_bits(pcf, PCF50633_REG_INT2M,
+ PCF50633_INT2_ONKEYR);
}
- if (pcf_int[1] & PCF50633_INT2_ONKEYR & pcf->onkey1s_held) {
+ if ((pcf_int[1] & PCF50633_INT2_ONKEYR) && pcf->onkey1s_held) {
pcf->onkey1s_held = 0;
/* Mask SECOND and ONKEYR interrupts */
@@ -351,19 +347,18 @@ static void pcf50633_irq_worker(struct work_struct *work)
pcf->resume_reason[i] = pcf_int[i] &
pcf->pdata->resumers[i];
- /* Make sure we don't pass on any input events to
+ /* Make sure we don't pass on any ONKEY events to
* userspace now */
- pcf_int[1] = 0;
+ pcf_int[1] &= ~ (PCF50633_INT2_ONKEYR | PCF50633_INT2_ONKEYF);
}
/* Unset masked interrupts */
- for (i = 0; i < 5; i++)
+ for (i = 0; i < ARRAY_SIZE(pcf_int); i++) {
pcf_int[i] &= ~pcf->mask_regs[i];
-
- for (i = 0; i < ARRAY_SIZE(pcf_int); i++)
for (j = 0; j < 8 ; j++)
if (pcf_int[i] & (1 << j))
pcf50633_irq_call_handler(pcf, (i * 8) + j);
+ }
put_device(pcf->dev);
@@ -434,7 +429,8 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state)
cancel_work_sync(&pcf->irq_work);
/* Save the masks */
- ret = pcf50633_read_block(pcf, PCF50633_REG_INT1M, 5,
+ ret = pcf50633_read_block(pcf, PCF50633_REG_INT1M,
+ ARRAY_SIZE(pcf->suspend_irq_masks),
pcf->suspend_irq_masks);
if (ret < 0)
dev_err(pcf->dev, "error saving irq masks\n");
@@ -442,10 +438,10 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state)
/* Set interrupt masks. So that only those sources we want to wake
* us up can
*/
- for (i = 0; i < 5; i++)
+ for (i = 0; i < ARRAY_SIZE(res); i++)
res[i] = ~pcf->pdata->resumers[i];
- pcf50633_write_block(pcf, PCF50633_REG_INT1M, 5, &res[0]);
+ pcf50633_write_block(pcf, PCF50633_REG_INT1M, ARRAY_SIZE(res), &res[0]);
pcf->is_suspended = 1;
@@ -459,13 +455,16 @@ static int pcf50633_resume(struct device *dev)
pcf = dev_get_drvdata(dev);
/* Write the saved mask registers */
- pcf50633_write_block(pcf, PCF50633_REG_INT1M, 5,
+ pcf50633_write_block(pcf, PCF50633_REG_INT1M,
+ ARRAY_SIZE(pcf->suspend_irq_masks),
pcf->suspend_irq_masks);
get_device(pcf->dev);
- /* Clear any pending interrupts and set resume reason if any */
- /* this will leave with enable_irq() */
+ /*
+ * Clear any pending interrupts and set resume reason if any.
+ * This will leave with enable_irq()
+ */
pcf50633_irq_worker(&pcf->irq_work);
return 0;