public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] MFD/regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable.
@ 2012-05-08 19:43 NeilBrown
  2012-05-08 19:43 ` [PATCH 1/2] MFD: twl-regulator: define all feature flags in one place NeilBrown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: NeilBrown @ 2012-05-08 19:43 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Samuel Ortiz; +Cc: linux-kernel

This is a resend, rebased on linux-next (next-20120508) which
simplifies the second patch slightly.

Thanks,
NeilBrown


---

NeilBrown (2):
      regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable.
      MFD: twl-regulator: define all feature flags in one place.


 drivers/mfd/twl-core.c            |    7 -------
 drivers/regulator/twl-regulator.c |   10 ++++------
 include/linux/i2c/twl.h           |   13 +++++++++++--
 3 files changed, 15 insertions(+), 15 deletions(-)

-- 
Signature


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] MFD: twl-regulator: define all feature flags in one place.
  2012-05-08 19:43 [PATCH 0/2] MFD/regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable NeilBrown
@ 2012-05-08 19:43 ` NeilBrown
  2012-05-08 19:44 ` [PATCH 2/2] regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable NeilBrown
  2012-05-09  9:09 ` [PATCH 0/2] MFD/regulator: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-05-08 19:43 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Samuel Ortiz; +Cc: linux-kernel, NeilBrown

twl-regulator has a collection of feature flags, some defined
in twl-core.c and  one defined in i2c/twl.h.
This is confusing for anyone adding a new feature flag.

So collect them together and place them in twl.h immediately
after the structure in which they are initially set.

Signed-off-by: NeilBrown <neilb@suse.de>
---

 drivers/mfd/twl-core.c  |    7 -------
 include/linux/i2c/twl.h |    8 ++++++--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 7c2267e..6fc90be 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -224,13 +224,6 @@
 #define HIGH_PERF_SQ			(1 << 3)
 #define CK32K_LOWPWR_EN			(1 << 7)
 
-
-/* chip-specific feature flags, for i2c_device_id.driver_data */
-#define TWL4030_VAUX2		BIT(0)	/* pre-5030 voltage ranges */
-#define TPS_SUBSET		BIT(1)	/* tps659[23]0 have fewer LDOs */
-#define TWL5031			BIT(2)  /* twl5031 has different registers */
-#define TWL6030_CLASS		BIT(3)	/* TWL6030 class */
-
 /*----------------------------------------------------------------------*/
 
 /* is driver active, bound to a chip? */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1f90de0..d1afedc 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -171,8 +171,6 @@ static inline int twl_class_is_ ##class(void)	\
 TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
 TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
 
-#define TWL6025_SUBCLASS	BIT(4)  /* TWL6025 has changed registers */
-
 /*
  * Read and write single 8-bit registers
  */
@@ -746,6 +744,12 @@ struct twl_regulator_driver_data {
 	void		*data;
 	unsigned long	features;
 };
+/* chip-specific feature flags, for twl_regulator_driver_data.features */
+#define TWL4030_VAUX2		BIT(0)	/* pre-5030 voltage ranges */
+#define TPS_SUBSET		BIT(1)	/* tps659[23]0 have fewer LDOs */
+#define TWL5031			BIT(2)  /* twl5031 has different registers */
+#define TWL6030_CLASS		BIT(3)	/* TWL6030 class */
+#define TWL6025_SUBCLASS	BIT(4)  /* TWL6025 has changed registers */
 
 /*----------------------------------------------------------------------*/
 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable.
  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
  2012-05-09  9:09 ` [PATCH 0/2] MFD/regulator: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-05-08 19:44 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Samuel Ortiz; +Cc: linux-kernel, NeilBrown

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.
+					  */
 
 /*----------------------------------------------------------------------*/
 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] MFD/regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable.
  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 ` [PATCH 2/2] regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable NeilBrown
@ 2012-05-09  9:09 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-05-09  9:09 UTC (permalink / raw)
  To: NeilBrown; +Cc: Liam Girdwood, Samuel Ortiz, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

On Wed, May 09, 2012 at 05:43:59AM +1000, NeilBrown wrote:
> This is a resend, rebased on linux-next (next-20120508) which
> simplifies the second patch slightly.

Applied both after fixing up the changelog for the first patch slightly.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-09  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] regulator: twl-regulator: make TWL4030_ALLOW_UNSUPPORTED more configurable NeilBrown
2012-05-09  9:09 ` [PATCH 0/2] MFD/regulator: " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox