From: "Bengt Jönsson" <bengt.g.jonsson@stericsson.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Lee Jones <lee.jones@linaro.org>,
Yvan FILLION <yvan.fillion@stericsson.com>,
Liam Girdwood <lgirdwood@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] regulator: ab8500: Fix get_mode for shared mode regulators
Date: Mon, 15 Apr 2013 13:34:06 +0200 [thread overview]
Message-ID: <516BE5AE.3020703@stericsson.com> (raw)
In-Reply-To: <CAFRkauDhqwcHtJU_uBf8wMmKr8DohHZnU6DNPBnzZhTp9-eBfg@mail.gmail.com>
On 04/15/2013 10:50 AM, Axel Lin wrote:
>> My understanding is for shared mode regulators:
>> It can be in LP mode only when *BOTH* are in LP mode.
>> If only one of the regulator in HP mode, then *BOTH* should be in HP mode.
>> Did I misunderstand something?
Your understanding is correct.
> Let me put this issue this way:
>
> Current code behavior:
> get_mode() returns IDLE if only one lp_mode_req flag is true, but mode
> register value is HP.
>
> AB8540_LDO_ANAMIC1 AB8540_LDO_ANAMIC2 mode register
> get_mode() returns
> lp_mode_req=true lp_mode_req=true HP
> REGULATOR_MODE_NORMAL
> lp_mode_req=true lp_mode_req=false HP
> REGULATOR_MODE_IDLE
> lp_mode_req=false lp_mode_req=true HP
> REGULATOR_MODE_IDLE
> lp_mode_req=false lp_mode_req=false LP
> REGULATOR_MODE_IDLE
I think it looks like this:
AB8540_LDO_ANAMIC1 AB8540_LDO_ANAMIC2 mode register
get_mode() returns
lp_mode_req=true lp_mode_req=true LP
REGULATOR_MODE_IDLE REGULATOR_MODE_IDLE
lp_mode_req=true lp_mode_req=false HP
REGULATOR_MODE_IDLE REGULATOR_MODE_NORMAL
lp_mode_req=false lp_mode_req=true HP
REGULATOR_MODE_NORMAL REGULATOR_MODE_IDLE
lp_mode_req=false lp_mode_req=false HP
REGULATOR_MODE_NORMAL REGULATOR_MODE_NORMAL
> with this path:
> mode register value is consistent with get_mode().
>
> AB8540_LDO_ANAMIC1 AB8540_LDO_ANAMIC2 mode register
> get_mode() returns
> lp_mode_req=true lp_mode_req=true HP
> REGULATOR_MODE_NORMAL
> lp_mode_req=true lp_mode_req=false HP
> REGULATOR_MODE_NORMAL
> lp_mode_req=false lp_mode_req=true HP
> REGULATOR_MODE_NORMAL
> lp_mode_req=false lp_mode_req=false LP
> REGULATOR_MODE_IDLE
And like this:
AB8540_LDO_ANAMIC1 AB8540_LDO_ANAMIC2 mode register
get_mode() returns
lp_mode_req=true lp_mode_req=true LP
REGULATOR_MODE_IDLE REGULATOR_MODE_IDLE
lp_mode_req=true lp_mode_req=false HP
REGULATOR_MODE_NORMAL REGULATOR_MODE_NORMAL
lp_mode_req=false lp_mode_req=true HP
REGULATOR_MODE_NORMAL REGULATOR_MODE_NORMAL
lp_mode_req=false lp_mode_req=false HP
REGULATOR_MODE_NORMAL REGULATOR_MODE_NORMAL
I guess what you don't like with the current approach is that the driver returns REGULATOR_MODE_IDLE in some cases where the mode register is set to LP. But I think, with patch applied, the control may be wrong in some cases because the regulator framework will call get_mode and see that the mode is already correct and not call set_mode so lp_mode_req will not get updated. I realised my previous example was incorrect so here I describe another example:
0. Start condition:
ANAMIC1 is requested in LP mode (lp_mode_req=true) and ANAMIC2 is requested in HP mode (lp_mode_req=false).
So the mode register is set to HP.
1. Now ANAMIC1 is requested to HP mode from consumer side. The regulator framework checks the current mode with get_mode which returns HP. So the regulator framework returns without calling set_mode because the mode is already correct.
For ANAMIC1 lp_mode_req=true and for ANAMIC2 lp_mode_req=false (still).
The mode register will be correct at HP.
2. If ANAMIC2 is now requested to LP mode from consumer side, the regulator framework calls get_mode which returns HP, so the framework calls set_mode.
In set_mode, the function checks the other regulator's status which is lp_mode_req=true. So the function will continue and set the regulator in LP mode even if it should not be.
Bengt
next prev parent reply other threads:[~2013-04-15 11:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 12:31 [PATCH] regulator: ab8500: Fix get_mode for shared mode regulators Axel Lin
2013-04-13 14:10 ` Axel Lin
2013-04-15 8:09 ` Lee Jones
2013-04-15 8:03 ` Bengt Jönsson
2013-04-15 8:34 ` Axel Lin
2013-04-15 8:50 ` Axel Lin
2013-04-15 11:34 ` Bengt Jönsson [this message]
2013-04-15 12:13 ` Axel Lin
2013-04-15 12:41 ` Bengt Jönsson
2013-04-15 14:11 ` Axel Lin
2013-04-15 14:48 ` Bengt Jönsson
2013-04-15 16:07 ` Mark Brown
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=516BE5AE.3020703@stericsson.com \
--to=bengt.g.jonsson@stericsson.com \
--cc=axel.lin@ingics.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yvan.fillion@stericsson.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 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.