public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Bengt Jonsson <bengt.g.jonsson@stericsson.com>,
	Lee Jones <lee.jones@linaro.org>,
	Yvan FILLION <yvan.fillion@stericsson.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: regulator: ab8500-ext: Strange set_mode behavior when info->cfg->hwreq is set
Date: Tue, 09 Apr 2013 23:01:21 +0800	[thread overview]
Message-ID: <1365519681.3946.4.camel@phoenix> (raw)

Hi,

I see below code && comments in enable() function:

        /*
         * To satisfy both HW high power request and SW request, the regulator
         * must be on in high power.
         */
        if (info->cfg && info->cfg->hwreq)
                *regval = info->update_val_hp;


I'm not very clear about the comment and the code.

1) Does that mean the device does not allow set REGULATOR_MODE_IDLE when
info->cfg->hwreq is set?

current code looks strange because when info->cfg->hwreq is set:
set_mode() allows set REGULATOR_MODE_IDLE and get_mode() returns the status
is REGULATOR_MODE_IDLE. However, current code actually write info->update_val_hp
to the register (which means it is in REGULATOR_MODE_NORMAL mode).

If the device does not allow set REGULATOR_MODE_IDLE when info->cfg->hwreq is 
set, we probably needs to return error in set REGULATOR_MODE_IDLE case.

Or 2) Does above comment mean the device needs set to REGULATOR_MODE_NORMAL
when the regulator is switching from off to on? Which means it allows setting
the regulator to REGULATOR_MODE_IDLE if the regulator is already on.

If this is the case, we cannot call enable() in set_mode() because current code
in set_mode() will write to register only when the regulator is already on.
Calling enable() always write info->update_val_hp to the register.
Thus it should just call abx500_mask_and_set_register_interruptible() directly
to update the register.

comments?

Regards,
Axel


             reply	other threads:[~2013-04-09 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 15:01 Axel Lin [this message]
2013-04-10  9:00 ` regulator: ab8500-ext: Strange set_mode behavior when info->cfg->hwreq is set Bengt Jönsson

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=1365519681.3946.4.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=bengt.g.jonsson@stericsson.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox