From: flora.fu@mediatek.com (Flora Fu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] regulator: MT6397: Add support for MT6397 regulator
Date: Fri, 21 Nov 2014 15:09:31 +0800 [thread overview]
Message-ID: <1416553771.19764.51.camel@mtksdaap41> (raw)
In-Reply-To: <20141117234012.GE22111@sirena.org.uk>
Hi, Mark,
On Mon, 2014-11-17 at 23:40 +0000, Mark Brown wrote:
> On Mon, Nov 17, 2014 at 03:40:23PM +0800, Flora Fu wrote:
> > +static int mt6397_buck_set_voltage_sel(struct regulator_dev *rdev, unsigned sel)
> > +{
>
>
> > + vosel = info->buck_conf.vosel_reg;
> > + voselon = info->buck_conf.voselon_reg;
> > + vosel_mask = info->buck_conf.vosel_mask;
>
> Please use the standard way of specifying data even if you can't use the
> standard function.
>
Could you specify the standard way of specification data? Thanks.
> > +
> > + ret = regmap_update_bits(rdev->regmap, vosel, vosel_mask, sel);
> > + if (ret != 0) {
> > + dev_err(&rdev->dev, "Failed to update vosel: %d\n", ret);
> > + return ret;
> > + }
> > +
> > + ret = regmap_update_bits(rdev->regmap, voselon, vosel_mask, sel);
> > + if (ret != 0) {
> > + dev_err(&rdev->dev, "Failed to update vosel_on: %d\n", ret);
> > + return ret;
> > + }
> > + return 0;
>
> You should add comments here explaining what's going on - it's very
> strange to have to write the same value to two different registers and
> the names of the registers look suspiciously like this is something to do
> with a suspend mode...
>
Yes, its is for suspend mode control usage.
For registers "vosel", "voselon", they is called register mode or
hardware control mode voltage settings. Register mode is a default mode
on the buck control. For quickly normal/sleep mode switch, hardware
control can be enabled by controlling buck output by a CTRL_PIN. In the
following diagram, there is a static settings on vosel_sleep for suspend
mode output. According to CTRL_PIN's level, Vout can have different
output (voselon or vosel_sleep).
+------------------------------------------------------+
| MT6397 |
| -vosel - |
CTRL_PIN | +-----------------+ \ + nivosel-|-Vout
-----------|-----| hardware control|---+ -voselon - |
| +-----------------+ \ -vosel_sleep - |
| |
+------------------------------------------------------+
In the design, voltage change on bucks are set both on registers vosel
and voselon. I will add more comments on the function to clarify the
implementation.
Thanks,
Flora
WARNING: multiple messages have this Message-ID (diff)
From: Flora Fu <flora.fu@mediatek.com>
To: Mark Brown <broonie@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
Russell King <linux@arm.linux.org.uk>,
Samuel Ortiz <sameo@linux.intel.com>,
Grant Likely <grant.likely@linaro.org>,
"Joe.C" <yingjoe.chen@mediatek.com>,
devicetree@vger.kernel.org,
Vladimir Murzin <vladimir.murzin@arm.com>,
Pawel Moll <pawel.moll@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Eddie Huang <eddie.huang@mediatek.com>,
linux-arm-kernel@lists.infradead.org,
Dongdong Cheng <dongdong.cheng@mediatek.com>,
srv_heupstream@mediatek.com, Liam Girdwood <lgirdwood@gmail.com>,
Ashwin Chaugule <ashwin.chaugule@linaro.org>,
Sascha Hauer <kernel@pengutronix.de>,
Kumar Gala <galak@codeaurora.org>
Subject: Re: [PATCH 3/7] regulator: MT6397: Add support for MT6397 regulator
Date: Fri, 21 Nov 2014 15:09:31 +0800 [thread overview]
Message-ID: <1416553771.19764.51.camel@mtksdaap41> (raw)
In-Reply-To: <20141117234012.GE22111@sirena.org.uk>
Hi, Mark,
On Mon, 2014-11-17 at 23:40 +0000, Mark Brown wrote:
> On Mon, Nov 17, 2014 at 03:40:23PM +0800, Flora Fu wrote:
> > +static int mt6397_buck_set_voltage_sel(struct regulator_dev *rdev, unsigned sel)
> > +{
>
>
> > + vosel = info->buck_conf.vosel_reg;
> > + voselon = info->buck_conf.voselon_reg;
> > + vosel_mask = info->buck_conf.vosel_mask;
>
> Please use the standard way of specifying data even if you can't use the
> standard function.
>
Could you specify the standard way of specification data? Thanks.
> > +
> > + ret = regmap_update_bits(rdev->regmap, vosel, vosel_mask, sel);
> > + if (ret != 0) {
> > + dev_err(&rdev->dev, "Failed to update vosel: %d\n", ret);
> > + return ret;
> > + }
> > +
> > + ret = regmap_update_bits(rdev->regmap, voselon, vosel_mask, sel);
> > + if (ret != 0) {
> > + dev_err(&rdev->dev, "Failed to update vosel_on: %d\n", ret);
> > + return ret;
> > + }
> > + return 0;
>
> You should add comments here explaining what's going on - it's very
> strange to have to write the same value to two different registers and
> the names of the registers look suspiciously like this is something to do
> with a suspend mode...
>
Yes, its is for suspend mode control usage.
For registers "vosel", "voselon", they is called register mode or
hardware control mode voltage settings. Register mode is a default mode
on the buck control. For quickly normal/sleep mode switch, hardware
control can be enabled by controlling buck output by a CTRL_PIN. In the
following diagram, there is a static settings on vosel_sleep for suspend
mode output. According to CTRL_PIN's level, Vout can have different
output (voselon or vosel_sleep).
+------------------------------------------------------+
| MT6397 |
| -vosel - |
CTRL_PIN | +-----------------+ \ + nivosel-|-Vout
-----------|-----| hardware control|---+ -voselon - |
| +-----------------+ \ -vosel_sleep - |
| |
+------------------------------------------------------+
In the design, voltage change on bucks are set both on registers vosel
and voselon. I will add more comments on the function to clarify the
implementation.
Thanks,
Flora
next prev parent reply other threads:[~2014-11-21 7:09 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 7:40 Add Support for MediaTek PMIC MT6397 MFD Core and Regulator Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-17 7:40 ` [PATCH 1/7] mfd: MT6397: Add support for PMIC MT6397 MFD Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-18 11:59 ` Lee Jones
2014-11-18 11:59 ` Lee Jones
2014-11-17 7:40 ` [PATCH 2/7] mfd: MT6397: Add regmap for MT8135 and MT6397 SoC Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-18 11:46 ` Lee Jones
2014-11-18 11:46 ` Lee Jones
2014-11-18 13:46 ` Sascha Hauer
2014-11-18 13:46 ` Sascha Hauer
2014-11-19 17:04 ` Lee Jones
2014-11-19 17:04 ` Lee Jones
2014-11-19 17:04 ` Lee Jones
2014-11-20 9:19 ` Sascha Hauer
2014-11-20 9:19 ` Sascha Hauer
2014-11-20 9:19 ` Sascha Hauer
2014-11-20 10:38 ` Lee Jones
2014-11-20 10:38 ` Lee Jones
2014-11-20 10:38 ` Lee Jones
2014-11-17 7:40 ` [PATCH 3/7] regulator: MT6397: Add support for MT6397 regulator Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-17 23:40 ` Mark Brown
2014-11-17 23:40 ` Mark Brown
2014-11-17 23:40 ` Mark Brown
2014-11-21 7:09 ` Flora Fu [this message]
2014-11-21 7:09 ` Flora Fu
2014-11-21 10:16 ` Mark Brown
2014-11-21 10:16 ` Mark Brown
2014-11-17 7:40 ` [PATCH 4/7] dt-bindings: Add document for MT6397 MFD Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-17 23:31 ` Mark Brown
2014-11-17 23:31 ` Mark Brown
2014-11-17 23:31 ` Mark Brown
2014-11-17 7:40 ` [PATCH 5/7] dt-bindings: Add document for MT6397 regulator Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-17 7:40 ` [PATCH 6/7] ARM: dts: mt8135: Add support for PMIC MT6397 MFD Flora Fu
2014-11-17 7:40 ` Flora Fu
2014-11-17 7:40 ` [PATCH 7/7] ARM: dts: mt8135: Add support for MT6397 regulator Flora Fu
2014-11-17 7:40 ` Flora Fu
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=1416553771.19764.51.camel@mtksdaap41 \
--to=flora.fu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.