From: NeilBrown <neilb@suse.de>
To: Liam Girdwood <lrg@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, NeilBrown <neilb@suse.de>
Subject: [PATCH 2/2] regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable.
Date: Wed, 09 May 2012 05:44:00 +1000 [thread overview]
Message-ID: <20120508194359.31629.80664.stgit@notabene.brown> (raw)
In-Reply-To: <20120508193938.31629.64303.stgit@notabene.brown>
The regulators in the twl4030 can provide some voltage settings
that are not offically supported.
These settings are disabled by default, but can be enabled with
CONFIG_TWL4030_ALLOW_UNSUPPORTED=y
However
- that config variable is not mentioned in any Kconfig so cannot
be used, and
- a global setting is clumsy - a per regulator setting would be
better.
So define a new 'feature' flag that a board file can set to enable
these unsupported volatages for boards which need them.
This flag cannot (yet) be set using device-tree.
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/regulator/twl-regulator.c | 10 ++++------
include/linux/i2c/twl.h | 5 +++++
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index fffacb4..c739071 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -395,14 +395,12 @@ static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
* VAUX3 at 3V is incorrectly listed in some TI manuals as unsupported.
* TI are revising the twl5030/tps659x0 specs to support that 3.0V setting.
*/
-#ifdef CONFIG_TWL4030_ALLOW_UNSUPPORTED
-#define UNSUP_MASK 0x0000
-#else
#define UNSUP_MASK 0x8000
-#endif
#define UNSUP(x) (UNSUP_MASK | (x))
-#define IS_UNSUP(x) (UNSUP_MASK & (x))
+#define IS_UNSUP(info, x) \
+ ((UNSUP_MASK & (x)) && \
+ !((info)->features & TWL4030_ALLOW_UNSUPPORTED))
#define LDO_MV(x) (~UNSUP_MASK & (x))
@@ -476,7 +474,7 @@ static int twl4030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
struct twlreg_info *info = rdev_get_drvdata(rdev);
int mV = info->table[index];
- return IS_UNSUP(mV) ? 0 : (LDO_MV(mV) * 1000);
+ return IS_UNSUP(info, mV) ? 0 : (LDO_MV(mV) * 1000);
}
static int
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index d1afedc..3993477 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -750,6 +750,11 @@ struct twl_regulator_driver_data {
#define TWL5031 BIT(2) /* twl5031 has different registers */
#define TWL6030_CLASS BIT(3) /* TWL6030 class */
#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
+#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
+ * but not officially supported.
+ * This flag is necessary to
+ * enable them.
+ */
/*----------------------------------------------------------------------*/
next prev parent reply other threads:[~2012-05-08 19:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-08 19:43 [PATCH 0/2] MFD/regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable NeilBrown
2012-05-08 19:43 ` [PATCH 1/2] MFD: twl-regulator: define all feature flags in one place NeilBrown
2012-05-08 19:44 ` NeilBrown [this message]
2012-05-09 9:09 ` [PATCH 0/2] MFD/regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable 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=20120508194359.31629.80664.stgit@notabene.brown \
--to=neilb@suse.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sameo@linux.intel.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