From: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
To: Christoph Fritz <chf.fritz@googlemail.com>,
Adam Thomson <Adam.Thomson.Opensource@diasemi.com>,
Mark Brown <broonie@kernel.org>,
Fabio Estevam <festevam@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Shawn Guo <shawnguo@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Support Opensource <Support.Opensource@diasemi.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Christian Hemp <c.hemp@phytec.de>,
Stefan Riedmueller <s.riedmueller@phytec.de>
Subject: RE: [PATCH v2 2/4] regulator: da9062: add of_map_mode support for bucks
Date: Wed, 13 Nov 2019 16:24:47 +0000 [thread overview]
Message-ID: <AM5PR1001MB09947464276D08EEF3C0338880760@AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <1573652416-9848-3-git-send-email-chf.fritz@googlemail.com>
On 13 November 2019 13:40, Christoph Fritz wrote:
> This patch adds of_map_mode support for bucks to set regulator modes
> from within regulator framework.
>
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> ---
> drivers/regulator/da9062-regulator.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-
> regulator.c
> index 601002e..29f4a60 100644
> --- a/drivers/regulator/da9062-regulator.c
> +++ b/drivers/regulator/da9062-regulator.c
> @@ -98,6 +98,20 @@ static const unsigned int da9062_buck_b_limits[] = {
> 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000
> };
>
> +static unsigned int da9062_map_buck_mode(unsigned int mode)
> +{
> + switch (mode) {
> + case DA9063_BUCK_MODE_SLEEP:
> + return REGULATOR_MODE_STANDBY;
> + case DA9063_BUCK_MODE_SYNC:
> + return REGULATOR_MODE_FAST;
> + case DA9063_BUCK_MODE_AUTO:
> + return REGULATOR_MODE_NORMAL;
> + default:
> + return -EINVAL;
> + }
> +}
> +
> static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode)
> {
> struct da9062_regulator *regl = rdev_get_drvdata(rdev);
> @@ -360,6 +374,7 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK1_A,
> .desc.vsel_mask = DA9062AA_VBUCK1_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK1_A,
> __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> @@ -396,6 +411,7 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK3_A,
> .desc.vsel_mask = DA9062AA_VBUCK3_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK3_A,
> __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> @@ -432,6 +448,7 @@ static const struct da9062_regulator_info
> local_da9061_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK4_A,
> .desc.vsel_mask = DA9062AA_VBUCK4_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK4_A,
> __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> @@ -604,6 +621,7 @@ static const struct da9062_regulator_info
> local_da9062_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK1_A,
> .desc.vsel_mask = DA9062AA_VBUCK1_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK1_A,
> __builtin_ffs((int)DA9062AA_BUCK1_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> @@ -640,6 +658,7 @@ static const struct da9062_regulator_info
> local_da9062_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK2_A,
> .desc.vsel_mask = DA9062AA_VBUCK2_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK2_A,
> __builtin_ffs((int)DA9062AA_BUCK2_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> @@ -676,6 +695,7 @@ static const struct da9062_regulator_info
> local_da9062_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK3_A,
> .desc.vsel_mask = DA9062AA_VBUCK3_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK3_A,
> __builtin_ffs((int)DA9062AA_BUCK3_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> @@ -712,6 +732,7 @@ static const struct da9062_regulator_info
> local_da9062_regulator_info[] = {
> .desc.vsel_reg = DA9062AA_VBUCK4_A,
> .desc.vsel_mask = DA9062AA_VBUCK4_A_MASK,
> .desc.linear_min_sel = 0,
> + .desc.of_map_mode = da9062_map_buck_mode,
> .sleep = REG_FIELD(DA9062AA_VBUCK4_A,
> __builtin_ffs((int)DA9062AA_BUCK4_SL_A_MASK) - 1,
> sizeof(unsigned int) * 8 -
> --
> 2.1.4
next prev parent reply other threads:[~2019-11-13 16:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-13 13:40 [PATCH v2 0/4] regulator da9062: support setting buck modes Christoph Fritz
2019-11-13 13:40 ` [PATCH v2 1/4] regulator: da9062: refactor buck modes into header Christoph Fritz
2019-11-13 16:19 ` Adam Thomson
2019-11-15 12:25 ` Applied "regulator: da9062: refactor buck modes into header" to the regulator tree Mark Brown
2019-11-13 13:40 ` [PATCH v2 2/4] regulator: da9062: add of_map_mode support for bucks Christoph Fritz
2019-11-13 16:24 ` Adam Thomson [this message]
2019-11-15 12:25 ` Applied "regulator: da9062: add of_map_mode support for bucks" to the regulator tree Mark Brown
2019-11-13 13:40 ` [PATCH v2 3/4] dt-bindings: mfd: da9062: describe buck modes Christoph Fritz
2019-11-13 16:26 ` Adam Thomson
2019-11-15 12:25 ` Applied "dt-bindings: mfd: da9062: describe buck modes" to the regulator tree Mark Brown
2019-11-13 13:40 ` [PATCH v2 4/4] ARM: dts: phycore-imx6: set buck regulator modes explicitly Christoph Fritz
2019-11-13 16:26 ` Adam Thomson
2019-11-28 20:30 ` Christoph Fritz
2019-12-04 12:53 ` Shawn Guo
2019-12-11 18:56 ` Christoph Fritz
2019-12-12 1:41 ` Shawn Guo
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=AM5PR1001MB09947464276D08EEF3C0338880760@AM5PR1001MB0994.EURPRD10.PROD.OUTLOOK.COM \
--to=adam.thomson.opensource@diasemi.com \
--cc=Support.Opensource@diasemi.com \
--cc=broonie@kernel.org \
--cc=c.hemp@phytec.de \
--cc=chf.fritz@googlemail.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=s.riedmueller@phytec.de \
--cc=shawnguo@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).