From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org, Ben Dooks <ben-linux@fluff.org>,
Kukjin Kim <kgene.kim@samsung.com>,
Russell King <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>
Subject: Re: [PATCH v5 2/4] regulator: max77686: Store opmode non-shifted
Date: Mon, 27 Oct 2014 14:45:37 +0100 [thread overview]
Message-ID: <1414417537.1674.5.camel@AMDC1943> (raw)
In-Reply-To: <544E4A8E.3060803@collabora.co.uk>
On pon, 2014-10-27 at 14:37 +0100, Javier Martinez Canillas wrote:
> Hello Krzysztof,
>
> On 10/27/2014 01:11 PM, Krzysztof Kozlowski wrote:
> > Introduce simple helper for calculating the shift for OPMODE field in
> > registers. This allows storing the current value of opmode in
> > non-shifted form and simplifies a little set_suspend_disable and enable
> > functions. Additionally this will allow adding support LDOs to the
> > existing set_suspend_disable function.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Suggested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> > ---
> > drivers/regulator/max77686.c | 49 ++++++++++++++++++++++++++++++--------------
> > 1 file changed, 34 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
>
> The patch looks good to me.
>
> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>
> >
> > static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
> > @@ -495,7 +513,8 @@ static int max77686_pmic_probe(struct platform_device *pdev)
> > config.init_data = pdata->regulators[i].initdata;
> > config.of_node = pdata->regulators[i].of_node;
> >
> > - max77686->opmode[i] = regulators[i].enable_mask;
> > + max77686->opmode[i] = regulators[i].enable_mask >>
> > + max77686_get_opmode_shift(i);
>
> I don't think it has to be done in your patch but as a follow-up it would be
> good to change this to:
>
> max77686->opmode[i] = MAX77686_NORMAL;
>
> since that is really what this code is trying to do AFAIU. This just happens
> to work because the value of MAX77686_OPMODE_MASK (0x3) is also "Output ON in
> Normal Mode" but the code is not correct IMHO.
It is technically correct (and regulator core use it this way if
enable_val is not specified) but I agree that MAX77686_NORMAL would be
more readable. I have some next patches almost ready, so I'll change it
there.
> Or even better, the regulator mode should be read from the hw registers instead
> of setting always to normal. That is what the max77802 driver does for example.
This would put trust on the bootloader... I don't know if I could trust
him :)
next prev parent reply other threads:[~2014-10-27 13:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 12:11 [PATCH v5 0/4] regulator: max77686/trats2: Disable some regulators in suspend Krzysztof Kozlowski
[not found] ` <1414411911-5539-1-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-27 12:11 ` [PATCH v5 1/4] regulator: max77686: Replace hard-coded opmode values with defines Krzysztof Kozlowski
2014-10-28 22:32 ` Mark Brown
2014-10-27 12:11 ` [PATCH v5 2/4] regulator: max77686: Store opmode non-shifted Krzysztof Kozlowski
2014-10-27 13:37 ` Javier Martinez Canillas
2014-10-27 13:45 ` Krzysztof Kozlowski [this message]
2014-10-28 22:32 ` Mark Brown
2014-10-27 12:11 ` [PATCH v5 4/4] ARM: dts: exynos4412-trats: Add suspend configuration for max77686 regulators Krzysztof Kozlowski
2014-10-27 12:11 ` [PATCH v5 3/4] regulator: max77686: Add suspend disable for some LDOs Krzysztof Kozlowski
2014-10-27 13:39 ` Javier Martinez Canillas
2014-10-28 22:31 ` Mark Brown
2014-10-29 9:20 ` Krzysztof Kozlowski
2014-10-29 10:01 ` Mark Brown
2014-10-29 10:18 ` Krzysztof Kozlowski
2014-10-29 10:31 ` Mark Brown
2014-10-29 10:44 ` Krzysztof Kozlowski
2014-10-29 10:51 ` Javier Martinez Canillas
[not found] ` <5450C6C2.2050506-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
2014-10-29 10:53 ` Krzysztof Kozlowski
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=1414417537.1674.5.camel@AMDC1943 \
--to=k.kozlowski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=ben-linux@fluff.org \
--cc=broonie@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=javier.martinez@collabora.co.uk \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.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;
as well as URLs for NNTP newsgroup(s).