Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683412

[PATCH 1/2] regulator: cpcap: Fix standby mode

From Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Newsgroups linux.kernel
Subject [PATCH 1/2] regulator: cpcap: Fix standby mode
Date 2017-07-07 22:10 +0200
Message-ID <u0HJE-uJ-5@gated-at.bofh.it> (permalink)
References <u0HJE-uJ-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


While working on the audio-codec I noticed, that the
low power mode of the regulators are not properly
supported. This fixes the issue for vaudio.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
 drivers/regulator/cpcap-regulator.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c
index cc98aceed1c1..65da6dba0b82 100644
--- a/drivers/regulator/cpcap-regulator.c
+++ b/drivers/regulator/cpcap-regulator.c
@@ -121,6 +121,7 @@ struct cpcap_regulator {
 		.enable_val = (mode_val),				\
 		.disable_val = (off_val),				\
 		.ramp_delay = (volt_trans_time),			\
+		.of_map_mode = cpcap_map_mode,				\
 	},								\
 	.assign_reg = (assignment_reg),					\
 	.assign_mask = (assignment_mask),				\
@@ -211,13 +212,23 @@ static int cpcap_regulator_disable(struct regulator_dev *rdev)
 	return error;
 }
 
+static unsigned int cpcap_map_mode(unsigned int mode)
+{
+	switch (mode) {
+	case CPCAP_BIT_AUDIO_LOW_PWR:
+		return REGULATOR_MODE_STANDBY;
+	default:
+		return REGULATOR_MODE_NORMAL;
+	}
+}
+
 static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev)
 {
 	int value;
 
 	regmap_read(rdev->regmap, rdev->desc->enable_reg, &value);
 
-	if (!(value & CPCAP_BIT_AUDIO_LOW_PWR))
+	if (value & CPCAP_BIT_AUDIO_LOW_PWR)
 		return REGULATOR_MODE_STANDBY;
 
 	return REGULATOR_MODE_NORMAL;
@@ -230,10 +241,10 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev,
 
 	switch (mode) {
 	case REGULATOR_MODE_NORMAL:
-		value = CPCAP_BIT_AUDIO_LOW_PWR;
+		value = 0;
 		break;
 	case REGULATOR_MODE_STANDBY:
-		value = 0;
+		value = CPCAP_BIT_AUDIO_LOW_PWR;
 		break;
 	default:
 		return -EINVAL;
-- 
2.13.2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] regulator: cpcap: Fix standby mode Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-07-07 22:10 +0200
  Re: [PATCH 1/2] regulator: cpcap: Fix standby mode Tony Lindgren <tony@atomide.com> - 2017-07-08 07:40 +0200
  Re: [PATCH 1/2] regulator: cpcap: Fix standby mode Mark Brown <broonie@kernel.org> - 2017-07-10 14:30 +0200
    Re: [PATCH 1/2] regulator: cpcap: Fix standby mode Tony Lindgren <tony@atomide.com> - 2017-07-10 15:50 +0200
    Re: [PATCH 1/2] regulator: cpcap: Fix standby mode Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-07-10 15:50 +0200

csiph-web