Skip to contentSkip to conversation

Add support for TPS6235x support

PATCH In review Manikandan Pillai 3 participants 7 messages Feb 4, 2009 – Feb 14, 2009 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add support for TPS6235x support

The patch has been fixed for comments given by David Brownell and Mark Brown for adding TPS6235x support on OMAP3 EVM. Comments fixed include
moving Makefile changes to this patch
dev_err used
removed the extra configuration option from Kconfig

---
 drivers/regulator/Kconfig              |    8 +
 drivers/regulator/Makefile             |    1 +
 drivers/regulator/tps6235x-regulator.c |  350 ++++++++++++++++++++++++++++++++
 3 files changed, 359 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/tps6235x-regulator.c
drivers/regulator/Kconfig +8 -0
index 0765389..c61024f 100644
@@ -80,4 +80,12 @@ config REGULATOR_DA903X
 	  Say y here to support the BUCKs and LDOs regulators found on
 	  Dialog Semiconductor DA9030/DA9034 PMIC.
 
+config REGULATOR_TPS6235X
+        tristate "TI TPS6235x Power regulators"
+	depends on I2C
+	help
+          This driver supports TPS6235x voltage regulator chips, for values
+	  of "x" from 0 to 6.  These are buck converters which support TI's
+	  hardware based "SmartReflex" dynamic voltage scaling.
+
 endif
drivers/regulator/Makefile +1 -0
index 0dacb18..fdc5f5b 100644
@@ -12,5 +12,6 @@ obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o
 obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
 obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
 obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
+obj-$(CONFIG_REGULATOR_TPS6235X)+= tps6235x-regulator.o
 
 ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
drivers/regulator/tps6235x-regulator.c new file +350 -0

350 lines not on this page · raw message

Signature · 1 line
1.5.6
#1 lore raw
Quoted 8 lines · Manikandan Pillai

The patch has been fixed for comments given by David Brownell and Mark Brown for adding TPS6235x support on OMAP3 EVM. Comments fixed include
moving Makefile changes to this patch
dev_err used
removed the extra configuration option from Kconfig

This looks fine from a regulator API point of view.

#2 lore raw
Quoted 11 lines · Mark Brown
Quoted 8 lines · Manikandan Pillai

The patch has been fixed for comments given by David Brownell and Mark Brown for adding TPS6235x support on OMAP3 EVM. Comments fixed include
moving Makefile changes to this patch
dev_err used
removed the extra configuration option from Kconfig

This looks fine from a regulator API point of view.

So what's the plan for merging it then? I suspect it relates to board-specific init ... regulator_register() having changed signature for the 2.6.30 merge window, and this FIXME remaining un-addressed:

Quoted 5 lines

/* FIXME board init code should provide init_data->driver_data
* saying how to configure this regulator: how big is the
* inductor (affects light PFM mode optimization), slew rate,
* PLL multiplier, and so forth.
*/

Maybe there should be a <linux/regulator/tps6235x.h> header with that board-specific data, and the framework data that's now thankfully not required to be held in the platform_data. (That init_data->driver_data was sort of a workaround for inability to use platform_data in the normal way...)

The tps6235x_dcdc_is_enabled() function won't handle I2C errors well ... I suggest at least one retry, and some fixed return value if that fails (instead of some bit from the error status). The big issue of course is that the regulator framework doesn't believe there can be errors in such calls.

Part of an answer to that framework issue would be implementing the new regulator.get_status() operation. That can return not just enabled/disabled, but also report the "out of regulation" status ... or errno, in case of I2C troubles. (That patch is also in the merge queue for 2.6.30, plus the current OMAP tree.)

Minor style point: TPS6235X_VSM_MSK shouldn't be parenthesizing that constant value.

- Dave

#3 lore raw
Quoted 4 lines · David Brownell

So what's the plan for merging it then? I suspect it relates to board-specific init ... regulator_register() having changed signature for the 2.6.30 merge window, and this FIXME remaining un-addressed:

Yes, it'll need to be updated for mainline. I'd expect the updated version to be submitted via linux-kernel to myself and Liam (it's Liam who'd be doing the actual merge with Linus).

Quoted 10 lines
Quoted 5 lines

/* FIXME board init code should provide init_data->driver_data
* saying how to configure this regulator: how big is the
* inductor (affects light PFM mode optimization), slew rate,
* PLL multiplier, and so forth.
*/

Maybe there should be a <linux/regulator/tps6235x.h> header with that board-specific data, and the framework data that's now thankfully not required to be held in the platform_data. (That init_data->driver_data was

I'd expect that would be done for whatever data is required - it's the standard thing and it's not new for regulator drivers either. I've no specific knowledge of this chip so I can't really assess what's vital to get implemented prior to merge and what can be added in further patches later.

#4 lore raw
Quoted 10 lines · Mark Brown
Quoted 4 lines · David Brownell

So what's the plan for merging it then? I suspect it relates to board-specific init ... regulator_register() having changed signature for the 2.6.30 merge window, and this FIXME remaining un-addressed:

Yes, it'll need to be updated for mainline. I'd expect the updated version to be submitted via linux-kernel to myself and Liam (it's Liam who'd be doing the actual merge with Linus).

Me too. I just wanted to be clear on those steps. As you noted, this has been around a few times ... IMO it would be good to stick a useful milestone, like "mainline merge", in the process. ;)

Especially with 2.6.29-rc5 out now ... get it in the regulator merge queue, so it can cook for a bit in the MM tree. I think the URL is

http://git.kernel.org/?p=linux/kernel/git/lrg/voltage-2.6.git;a=shortlog;h=for-next

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

/* FIXME board init code should provide init_data->driver_data
* saying how to configure this regulator: how big is the
* inductor (affects light PFM mode optimization), slew rate,
* PLL multiplier, and so forth.
*/

Quoted 6 lines
Quoted 4 lines

Maybe there should be a <linux/regulator/tps6235x.h> header with that board-specific data, and the framework data that's now thankfully not required to be held in the platform_data. (That init_data->driver_data was

I'd expect that would be done

I assume "that" is a struct defining the platform_data contents.

Quoted 5 lines

for whatever data is required - it's the
standard thing and it's not new for regulator drivers either. I've no specific knowledge of this chip so I can't really assess what's vital to get implemented prior to merge and what can be added in further patches later.

Minimally

	struct tps6235x_board_info {
		struct regulator_init_data *init_data;
	};

but presumably at least a few of the CTRL1 and CTRL2 fields. Heck ... doing *all* of them is trivial, just add two bytes to that struct (and move the bitfield decls to that header).

- Dave

#6 lore raw
In reply to Manikandan Pillai

drivers/regulator/tps6235x-regulator.c line 91

Quoted 9 lines · Manikandan Pillai
drivers/regulator/tps6235x-regulator.c new file +9 -0
+static int tps6235x_dcdc_is_enabled(struct regulator_dev *dev)
+{
+       unsigned char vsel1;
+       struct tps *tps = rdev_get_drvdata(dev);
+
+       tps_6235x_read_reg(tps, TPS6235X_REG_VSEL1, &vsel1);
+
+       return !(vsel1 & TPS6235X_EN_DCDC);
+}

Let me correct my earlier comment about bugs in this routine. Today's is_enabled() predicate *DOES* support error reporting. So that code should be

	ret = tps_6235x_read_reg(...);
	if (ret < 0)
		return ret;

But another bug here is the "!(vsel & ...)", returning zero when the regulator is *ENABLED* not disabled.

Either return "!!(vsel & ...)" to return zero/one, or else remove the "!( )" entirely

- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html