summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/powerdetect.c
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2011-12-13 19:13:49 +0900
committerVarun Wadekar <vwadekar@nvidia.com>2011-12-21 12:06:26 +0530
commitada2a1b016611ac9bbeee8c8281a339d448e2149 (patch)
tree988edf939062113478d9c194759b6c144fda6e15 /arch/arm/mach-tegra/powerdetect.c
parentdb128e88fee3435c10ba0b9a2c1479b85a14ede7 (diff)
tegra: fix processing of regulator notifier event
Regulator notifier event chain may be called with several events OR'd together, e.g. in drivers/regulator/core.c: _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | REGULATOR_EVENT_DISABLE, Bug 913417 Change-Id: Ifba9860c1ee59c2fe2a4ee3c901e983912e07139 Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-on: http://git-master/r/69725 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Aleksandr Frid <afrid@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/powerdetect.c')
-rw-r--r--arch/arm/mach-tegra/powerdetect.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm/mach-tegra/powerdetect.c b/arch/arm/mach-tegra/powerdetect.c
index b759083330ba..6a2a57794589 100644
--- a/arch/arm/mach-tegra/powerdetect.c
+++ b/arch/arm/mach-tegra/powerdetect.c
@@ -237,31 +237,28 @@ static int pwrdet_notify_cb(
spin_lock_irqsave(&pwr_lock, flags);
- switch (event) {
- case REGULATOR_EVENT_PRE_ENABLE:
+ if (event & REGULATOR_EVENT_PRE_ENABLE) {
pwrio_disabled_mask &= ~cell->pwrio_mask;
if (!pwrio_always_on)
pwr_io_enable(cell->pwrio_mask);
- /* fall thru */
- case REGULATOR_EVENT_OUT_PRECHANGE:
+ }
+ if (event & (REGULATOR_EVENT_PRE_ENABLE |
+ REGULATOR_EVENT_OUT_PRECHANGE)) {
if (!pwrdet_always_on && cell->pwrdet_mask)
pwr_detect_reset(cell->pwrdet_mask);
- break;
-
- case REGULATOR_EVENT_POST_ENABLE:
- case REGULATOR_EVENT_OUT_POSTCHANGE:
+ }
+ if (event & (REGULATOR_EVENT_POST_ENABLE |
+ REGULATOR_EVENT_OUT_POSTCHANGE)) {
if (!pwrdet_always_on && cell->pwrdet_mask) {
pwr_detect_start(cell->pwrdet_mask);
pwr_detect_latch();
}
- break;
-
- case REGULATOR_EVENT_DISABLE:
- case REGULATOR_EVENT_FORCE_DISABLE:
+ }
+ if (event & (REGULATOR_EVENT_DISABLE |
+ REGULATOR_EVENT_FORCE_DISABLE)) {
pwrio_disabled_mask |= cell->pwrio_mask;
if (!pwrio_always_on)
pwr_io_disable(cell->pwrio_mask);
- break;
}
pr_debug("tegra: %s: event %lu, pwrdet 0x%x, pwrio 0x%x\n",