From: Thomas Abraham <thomas.abraham@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org,
broonie@opensource.wolfsonmicro.com, myungjoo.ham@samsung.com,
linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com,
t.figa@samsung.com
Subject: [PATCH 2/3] regulator: max8997: limit the number of dvs registers programmed in non-dvs mode
Date: Fri, 23 Nov 2012 13:33:14 +0530 [thread overview]
Message-ID: <1353657795-1725-3-git-send-email-thomas.abraham@linaro.org> (raw)
In-Reply-To: <1353657795-1725-1-git-send-email-thomas.abraham@linaro.org>
In case the gpio based volatage selection mode is not used for either of
buck 1/2/5, then only the BUCKxDVS1 register need to be programmed. So
determine whether dvs mode is used and limit the loop count appropriately.
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
drivers/regulator/max8997.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 8901371..231fcdb 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -941,7 +941,7 @@ static int max8997_pmic_probe(struct platform_device *pdev)
struct regulator_dev **rdev;
struct max8997_data *max8997;
struct i2c_client *i2c;
- int i, ret, size;
+ int i, ret, size, nr_dvs;
u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0;
if (!pdata) {
@@ -973,7 +973,10 @@ static int max8997_pmic_probe(struct platform_device *pdev)
memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3);
max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect;
- for (i = 0; i < 8; i++) {
+ nr_dvs = (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs ||
+ pdata->buck5_gpiodvs) ? 8 : 1;
+
+ for (i = 0; i < nr_dvs; i++) {
max8997->buck1_vol[i] = ret =
max8997_get_voltage_proper_val(
&buck1245_voltage_map_desc,
@@ -1020,7 +1023,7 @@ static int max8997_pmic_probe(struct platform_device *pdev)
}
/* Initialize all the DVS related BUCK registers */
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < nr_dvs; i++) {
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
max8997->buck1_vol[i],
0x3f);
--
1.6.6.rc2
next prev parent reply other threads:[~2012-11-23 7:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 8:03 [PATCH 0/3] regulator: max8997: minor updates and device tree support Thomas Abraham
2012-11-23 8:03 ` [PATCH 1/3] regulator: max8997: reorder buck1/2/5 dvs setup code Thomas Abraham
2012-11-24 17:56 ` Mark Brown
2012-11-23 8:03 ` Thomas Abraham [this message]
2012-11-24 17:56 ` [PATCH 2/3] regulator: max8997: limit the number of dvs registers programmed in non-dvs mode Mark Brown
2012-11-23 8:03 ` [PATCH 3/3] regulator: add device tree support for max8997 Thomas Abraham
2012-11-24 17:59 ` Mark Brown
2012-11-24 18:16 ` Thomas Abraham
2012-11-26 9:51 ` Mark Brown
2012-11-26 13:46 ` Thomas Abraham
2012-11-26 14:11 ` Mark Brown
2012-11-26 14:43 ` Thomas Abraham
2012-11-26 14:46 ` Mark Brown
2012-11-27 8:34 ` [PATCH] " Thomas Abraham
2012-11-27 20:05 ` Mark Brown
2012-11-23 15:35 ` [PATCH 0/3] regulator: max8997: minor updates and device tree support Tomasz Figa
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=1353657795-1725-3-git-send-email-thomas.abraham@linaro.org \
--to=thomas.abraham@linaro.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=kgene.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=t.figa@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
all inboxes | Powered by JetHome®