Add support for TPS6235x support
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 patchdev_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
@@ -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
@@ -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
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
movingMakefilechanges to this patchdev_errused
removed the extra configuration option fromKconfigSigned-off-by Manikandan Pillai <[email protected]>
This looks fine from a regulator API point of view.
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
movingMakefilechanges to this patchdev_errused
removed the extra configuration option fromKconfigSigned-off-by Manikandan Pillai <[email protected]>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
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 theplatform_data. (Thatinit_data->driver_datawas
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.
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 theplatform_data. (Thatinit_data->driver_datawasI'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
Quoted 5 lines · David Brownell
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
Yes, that's right - branch for-next.
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