aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-05-08 17:16:37 -0400
committerLee Jones <lee.jones@linaro.org>2014-05-09 05:51:06 -0400
commitb69d2ad6748e2cd3a6b93fca074adc31f56e4436 (patch)
tree726e03c7c6cb7f51e23faee5010ed4ddf90551d9
parent89ca3b881987f5a4be4c5dbaa7f0df12bbdde2fd (diff)
mfd: stmpe: mask off unused blocks properly
The STMPE driver would just read/modify/write the system control register on the STMPE1601, meaning it would not properly mask off the PWM block, which remained active if it was on at boot time. This makes sure the blocks are always masked off if they were active on boot, saving some power. Also rename the inconsistenty named STMPE1601 define for the PWM block activation. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/mfd/stmpe.c9
-rw-r--r--drivers/mfd/stmpe.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index 4a91f6771fb8..9fa2dd6d38bd 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -605,9 +605,18 @@ static int stmpe1601_enable(struct stmpe *stmpe, unsigned int blocks,
605 605
606 if (blocks & STMPE_BLOCK_GPIO) 606 if (blocks & STMPE_BLOCK_GPIO)
607 mask |= STMPE1601_SYS_CTRL_ENABLE_GPIO; 607 mask |= STMPE1601_SYS_CTRL_ENABLE_GPIO;
608 else
609 mask &= ~STMPE1601_SYS_CTRL_ENABLE_GPIO;
608 610
609 if (blocks & STMPE_BLOCK_KEYPAD) 611 if (blocks & STMPE_BLOCK_KEYPAD)
610 mask |= STMPE1601_SYS_CTRL_ENABLE_KPC; 612 mask |= STMPE1601_SYS_CTRL_ENABLE_KPC;
613 else
614 mask &= ~STMPE1601_SYS_CTRL_ENABLE_KPC;
615
616 if (blocks & STMPE_BLOCK_PWM)
617 mask |= STMPE1601_SYS_CTRL_ENABLE_SPWM;
618 else
619 mask &= ~STMPE1601_SYS_CTRL_ENABLE_SPWM;
611 620
612 return __stmpe_set_bits(stmpe, STMPE1601_REG_SYS_CTRL, mask, 621 return __stmpe_set_bits(stmpe, STMPE1601_REG_SYS_CTRL, mask,
613 enable ? mask : 0); 622 enable ? mask : 0);
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
index 6639f1b0fef5..9e4d21d37a11 100644
--- a/drivers/mfd/stmpe.h
+++ b/drivers/mfd/stmpe.h
@@ -192,7 +192,7 @@ int stmpe_remove(struct stmpe *stmpe);
192 192
193#define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3) 193#define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3)
194#define STMPE1601_SYS_CTRL_ENABLE_KPC (1 << 1) 194#define STMPE1601_SYS_CTRL_ENABLE_KPC (1 << 1)
195#define STMPE1601_SYSCON_ENABLE_SPWM (1 << 0) 195#define STMPE1601_SYS_CTRL_ENABLE_SPWM (1 << 0)
196 196
197/* The 1601/2403 share the same masks */ 197/* The 1601/2403 share the same masks */
198#define STMPE1601_AUTOSLEEP_TIMEOUT_MASK (0x7) 198#define STMPE1601_AUTOSLEEP_TIMEOUT_MASK (0x7)