summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Vatau <mikael.vatau@stericsson.com>2011-05-04 20:14:44 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:04:51 +0200
commitf0936be97346d20e04d18a09b433986a1ef2757d (patch)
tree1f40025d653c91bfcb19e24f5f626c81b3928152
parent036c288037f5248dbd685d1db3e2bf15775192b6 (diff)
msp i2s: Don't enable regulator for msp1 and msp3
Enabling the regulator for msp1/msp3 hinders sleep when in burst mode. Change-Id: Ic9484221e44e68b9e185d0a180f49d957e5aa9cd Signed-off-by: Mikael Vatau <mikael.vatau@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/22351 Reviewed-by: QATEST Reviewed-by: Peter AULIN <peter.aulin@stericsson.com> Tested-by: Peter AULIN <peter.aulin@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/include/mach/msp.h2
-rw-r--r--drivers/misc/i2s/msp_i2s.c15
2 files changed, 14 insertions, 3 deletions
diff --git a/arch/arm/mach-ux500/include/mach/msp.h b/arch/arm/mach-ux500/include/mach/msp.h
index ce6ec08e08d..b5b9761ea45 100644
--- a/arch/arm/mach-ux500/include/mach/msp.h
+++ b/arch/arm/mach-ux500/include/mach/msp.h
@@ -910,6 +910,7 @@ enum enum_i2s_controller {
* @polling_flag: Flag used in error handling while polling.
* @def_elem_len: Flag indicates whether default elem len to be used in
* protocol_desc or not.
+ * @reg_enabled: Flag indicates whether regulator has been enabled or not.
* @vape_opp_constraint: 1 if constraint is applied to have vape at 100OPP; 0 otherwise
* @infinite: true if an infinite transfer has been configured
*
@@ -942,6 +943,7 @@ struct msp {
struct clk *clk;
unsigned int direction;
int users;
+ int reg_enabled;
int loopback_enable;
u32 backup_regs[MAX_MSP_BACKUP_REGS];
int vape_opp_constraint;
diff --git a/drivers/misc/i2s/msp_i2s.c b/drivers/misc/i2s/msp_i2s.c
index 90629398202..5645e980c93 100644
--- a/drivers/misc/i2s/msp_i2s.c
+++ b/drivers/misc/i2s/msp_i2s.c
@@ -957,8 +957,10 @@ static int stm_msp_configure_enable(struct i2s_controller *i2s_cont,
/* Two simultanous configuring msp is avoidable */
down(&msp->lock);
- switch (msp->users) {
- case 0:
+
+ /* Don't enable regulator if its msp1 or msp3 */
+ if (!(msp->reg_enabled) && msp->id != MSP_1_I2S_CONTROLLER
+ && msp->id != MSP_3_I2S_CONTROLLER) {
res = regulator_enable(msp_vape_supply);
if (res != 0) {
dev_err(&msp->i2s_cont->dev,
@@ -966,7 +968,11 @@ static int stm_msp_configure_enable(struct i2s_controller *i2s_cont,
up(&msp->lock);
return res;
}
+ msp->reg_enabled = 1;
+ }
+ switch (msp->users) {
+ case 0:
clk_enable(msp->clk);
msp->direction = config->direction;
break;
@@ -1768,7 +1774,10 @@ static int stm_msp_close(struct i2s_controller *i2s_cont, i2s_flag flag)
else {
status = stm_msp_disable(msp, MSP_BOTH_T_R_MODE, DISABLE_ALL);
clk_disable(msp->clk);
- status = regulator_disable(msp_vape_supply);
+ if (msp->reg_enabled) {
+ status = regulator_disable(msp_vape_supply);
+ msp->reg_enabled = 0;
+ }
if (status != 0) {
dev_err(&msp->i2s_cont->dev,
"Failed to disable regulator\n");