mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	Thierry Reding <treding@nvidia.com>,
	Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH 5/5] regulator: helpers: Ensure bypass register field matches ON value
Date: Thu, 21 Apr 2016 17:12:01 +0100	[thread overview]
Message-ID: <1461255121-5245-6-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1461255121-5245-1-git-send-email-jonathanh@nvidia.com>

When checking bypass state for a regulator, we check to see if any bits
in the bypass mask are set. For most cases this is fine because there is
typically, only a single bit used to determine if the regulator is in
bypass. However, for some regulators, such as LDO6 on AS3722, the bypass
state is indicate by a value rather than a single bit. Therefore, when
checking the bypass state, check that the bypass field matches the ON
value.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/regulator/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index b1e32e7482e9..bcf38fd5106a 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -460,7 +460,7 @@ int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable)
 	if (ret != 0)
 		return ret;
 
-	*enable = val & rdev->desc->bypass_mask;
+	*enable = (val & rdev->desc->bypass_mask) == rdev->desc->bypass_val_on;
 
 	return 0;
 }
-- 
2.1.4

      parent reply	other threads:[~2016-04-21 16:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 16:11 [PATCH 0/5] regulator: A few fixes for supply resolution Jon Hunter
2016-04-21 16:11 ` [PATCH 1/5] regulator: core: Don't terminate supply resolution early Jon Hunter
2016-04-22 10:49   ` Applied "regulator: core: Don't terminate supply resolution early" to the regulator tree Mark Brown
2016-04-21 16:11 ` [PATCH 2/5] regulator: core: Clear the supply pointer if enabling fails Jon Hunter
2016-04-22 10:49   ` Applied "regulator: core: Clear the supply pointer if enabling fails" to the regulator tree Mark Brown
2016-04-21 16:11 ` [PATCH 3/5] regulator: core: Move registration of regulator device Jon Hunter
2016-04-22 10:49   ` Applied "regulator: core: Move registration of regulator device" to the regulator tree Mark Brown
2016-04-21 16:12 ` [PATCH 4/5] regulator: core: Add early supply resolution for a bypassed regulator Jon Hunter
2016-04-22 10:48   ` Mark Brown
2016-04-22 11:26     ` Jon Hunter
2016-04-22 13:53       ` Mark Brown
2016-04-25 14:44         ` Jon Hunter
2016-04-25 16:54           ` Mark Brown
2016-04-21 16:12 ` Jon Hunter [this message]

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=1461255121-5245-6-git-send-email-jonathanh@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=treding@nvidia.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

Powered by JetHome