The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Jon Hunter <jonathanh@nvidia.com>
Cc: Thierry Reding <treding@nvidia.com>,
	Mark Brown <broonie@kernel.org>, Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Applied "regulator: as3722: Add bypass support for LDO6" to the regulator tree
Date: Mon, 11 Apr 2016 17:15:04 +0100	[thread overview]
Message-ID: <E1apeUS-0005h5-PB@debutante> (raw)
In-Reply-To: <1460038959-21592-4-git-send-email-thierry.reding@gmail.com>

The patch

   regulator: as3722: Add bypass support for LDO6

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 40a865500c4d408b552cf5899bf091ac72e32bf8 Mon Sep 17 00:00:00 2001
From: Jon Hunter <jonathanh@nvidia.com>
Date: Thu, 7 Apr 2016 16:22:38 +0200
Subject: [PATCH] regulator: as3722: Add bypass support for LDO6

LD06 on the AS3722 power management IC supports a bypass mode. Bypass
is enabled for the LDO by writing the value 0x3F to the voltage select
field in the control register for the LDO. Note that this is the same
register and field that is used to select the voltage as well for the
LDO.

Add support for bypass on LDO6 by specifying the various bypass
parameters for regulator and adding new function pointer tables for the
LDO. Note that the bypass OFF value is the same as the ON value simply
because there is no actual OFF value and bypass will be disabled when
a new voltage is written to the VSEL field.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/as3722-regulator.c | 43 ++++++++++++++++++++++++++++++++++++
 include/linux/mfd/as3722.h           |  1 +
 2 files changed, 44 insertions(+)

diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
index 8b046eec6ae0..35a7c647f6a9 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -432,6 +432,31 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = {
 	.get_current_limit = as3722_ldo3_get_current_limit,
 };
 
+static struct regulator_ops as3722_ldo6_ops = {
+	.is_enabled = regulator_is_enabled_regmap,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.map_voltage = regulator_map_voltage_linear_range,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.list_voltage = regulator_list_voltage_linear_range,
+	.get_current_limit = as3722_ldo_get_current_limit,
+	.set_current_limit = as3722_ldo_set_current_limit,
+	.get_bypass = regulator_get_bypass_regmap,
+	.set_bypass = regulator_set_bypass_regmap,
+};
+
+static struct regulator_ops as3722_ldo6_extcntrl_ops = {
+	.map_voltage = regulator_map_voltage_linear_range,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.list_voltage = regulator_list_voltage_linear_range,
+	.get_current_limit = as3722_ldo_get_current_limit,
+	.set_current_limit = as3722_ldo_set_current_limit,
+	.get_bypass = regulator_get_bypass_regmap,
+	.set_bypass = regulator_set_bypass_regmap,
+};
+
 static const struct regulator_linear_range as3722_ldo_ranges[] = {
 	REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0),
 	REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000),
@@ -829,6 +854,24 @@ static int as3722_regulator_probe(struct platform_device *pdev)
 				}
 			}
 			break;
+		case AS3722_REGULATOR_ID_LDO6:
+			if (reg_config->ext_control)
+				ops = &as3722_ldo6_extcntrl_ops;
+			else
+				ops = &as3722_ldo6_ops;
+			as3722_regs->desc[id].enable_time = 500;
+			as3722_regs->desc[id].bypass_reg =
+						AS3722_LDO6_VOLTAGE_REG;
+			as3722_regs->desc[id].bypass_mask =
+						AS3722_LDO_VSEL_MASK;
+			as3722_regs->desc[id].bypass_val_on =
+						AS3722_LDO6_VSEL_BYPASS;
+			as3722_regs->desc[id].bypass_val_off =
+						AS3722_LDO6_VSEL_BYPASS;
+			as3722_regs->desc[id].linear_ranges = as3722_ldo_ranges;
+			as3722_regs->desc[id].n_linear_ranges =
+						ARRAY_SIZE(as3722_ldo_ranges);
+			break;
 		case AS3722_REGULATOR_ID_SD0:
 		case AS3722_REGULATOR_ID_SD1:
 		case AS3722_REGULATOR_ID_SD6:
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
index 8d43e9f2a842..51e6f9414575 100644
--- a/include/linux/mfd/as3722.h
+++ b/include/linux/mfd/as3722.h
@@ -196,6 +196,7 @@
 #define AS3722_LDO3_VSEL_MIN				0x01
 #define AS3722_LDO3_VSEL_MAX				0x2D
 #define AS3722_LDO3_NUM_VOLT				0x2D
+#define AS3722_LDO6_VSEL_BYPASS 			0x3F
 #define AS3722_LDO_VSEL_MASK				0x7F
 #define AS3722_LDO_VSEL_MIN				0x01
 #define AS3722_LDO_VSEL_MAX				0x7F
-- 
2.8.0.rc3

  reply	other threads:[~2016-04-11 16:15 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 14:22 [PATCH 1/5] regulator: core: Resolve supply earlier Thierry Reding
2016-04-07 14:22 ` [PATCH 2/5] regulator: core: Use parent voltage from the supply when bypassed Thierry Reding
2016-04-12  6:31   ` Applied "regulator: core: Use parent voltage from the supply when bypassed" to the regulator tree Mark Brown
2016-04-07 14:22 ` [PATCH 3/5] regulator: helpers: Ensure bypass register field matches ON value Thierry Reding
2016-04-22 10:49   ` Applied "regulator: helpers: Ensure bypass register field matches ON value" to the regulator tree Mark Brown
2016-04-07 14:22 ` [PATCH 4/5] regulator: as3722: Add bypass support for LDO6 Thierry Reding
2016-04-11 16:15   ` Mark Brown [this message]
2016-04-07 14:22 ` [PATCH 5/5] regulator: as3722: Constify regulator ops Thierry Reding
2016-04-11 16:15   ` Applied "regulator: as3722: Constify regulator ops" to the regulator tree Mark Brown
2016-04-11 10:59 ` [PATCH 1/5] regulator: core: Resolve supply earlier Jon Hunter
2016-04-11 11:46   ` Thierry Reding
2016-04-11 12:19     ` Jon Hunter
2016-04-11 12:49       ` Mark Brown
2016-04-11 14:03       ` Javier Martinez Canillas
2016-04-11 12:58     ` Mark Brown
2016-04-11 13:09       ` Thierry Reding
2016-04-11 13:45         ` Javier Martinez Canillas
2016-04-11 13:57           ` Mark Brown
2016-04-11 14:07             ` Thierry Reding
2016-04-11 14:32               ` Mark Brown
2016-04-11 14:49                 ` Thierry Reding
2016-04-11 15:50                   ` Mark Brown
2016-04-11 13:56         ` Mark Brown
2016-04-11 14:03 ` Mark Brown
2016-04-11 14:11   ` Thierry Reding
2016-04-11 14:16     ` Mark Brown
2016-04-19 10:16       ` Jon Hunter
2016-04-19 11:03         ` Thierry Reding
2016-04-19 15:40         ` Mark Brown
2016-04-19 16:09           ` Jon Hunter
2016-04-20 15:21             ` Mark Brown
2016-04-21 15:34               ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1apeUS-0005h5-PB@debutante \
    --to=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=treding@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox