linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
@ 2012-08-15 15:05 Anthony Olech
  2012-08-27 16:50 ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Anthony Olech @ 2012-08-15 15:05 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Guenter Roeck
  Cc: Jean Delvare, Randy Dunlap, LKML, David Dajun Chen

This is the REGULATOR component driver of the Dialog DA9058 PMIC.
This driver is just one component of the whole DA9058 PMIC driver.
It depends on the CORE component driver of the DA9058 MFD.

Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
Signed-off-by: David Dajun Chen <david.chen@diasemi.com>
---
 drivers/regulator/Kconfig            |   11 ++
 drivers/regulator/Makefile           |    1 +
 drivers/regulator/da9058-regulator.c |  251 ++++++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/da9058-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index c86b886..1fc04f9 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -64,6 +64,17 @@ config REGULATOR_USERSPACE_CONSUMER
 
           If unsure, say no.
 
+config REGULATOR_DA9058
+	tristate "Support regulators on Dialog Semiconductor DA9058 PMIC"
+	depends on MFD_DA9058
+	help
+	  Say y here to support the BUCKs and LDOs regulators found on
+	  Dialog Semiconductor DA9058 PMIC.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called da9058-regulator.
+
+
 config REGULATOR_GPIO
 	tristate "GPIO regulator support"
 	depends on GENERIC_GPIO
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 977fd46..f4d0bff 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
+obj-$(CONFIG_REGULATOR_DA9058) += da9058-regulator.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
 obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
diff --git a/drivers/regulator/da9058-regulator.c b/drivers/regulator/da9058-regulator.c
new file mode 100644
index 0000000..2e8ae43
--- /dev/null
+++ b/drivers/regulator/da9058-regulator.c
@@ -0,0 +1,251 @@
+/*
+ *  Copyright (C) 2012 Dialog Semiconductor Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/driver.h>
+#include <linux/regmap.h>
+#include <linux/mfd/core.h>
+
+#include <linux/mfd/da9058/version.h>
+#include <linux/mfd/da9058/registers.h>
+#include <linux/mfd/da9058/core.h>
+#include <linux/mfd/da9058/regulator.h>
+
+struct da9058_regulator {
+	struct da9058 *da9058;
+	int ramp_register;
+	int ramp_enable_mask;
+	int fixed_voltage;
+	struct platform_device *pdev;
+	struct regulator_dev *reg_dev;
+	struct regulator_desc desc;
+	struct regulator_init_data init;
+};
+
+static int da9058_buck_ramp_voltage(struct regulator_dev *rdev,
+					unsigned int old_selector,
+					unsigned int new_selector)
+{
+	struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
+	struct da9058 *da9058 = regulator->da9058;
+	int ret;
+
+	if (regulator->ramp_register == 0)
+		return -EINVAL;
+
+	if (regulator->ramp_enable_mask == 0)
+		return -EINVAL;
+
+	ret = da9058_set_bits(da9058, regulator->ramp_register,
+					regulator->ramp_enable_mask);
+
+	if (ret)
+		return ret;
+
+	return 2200; /* micro Seconds needed to ramp to new voltage*/
+}
+
+static int da9058_get_fixed_regulator_voltage(struct regulator_dev *rdev)
+{
+	struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
+
+	if (regulator_is_enabled_regmap(rdev))
+		return regulator->fixed_voltage;
+	else
+		return 0;
+}
+
+static struct regulator_ops da9058_buck_regulator_ops = {
+	.map_voltage = regulator_map_voltage_linear,
+	.list_voltage = regulator_list_voltage_linear,
+	.set_voltage_time_sel = da9058_buck_ramp_voltage,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
+static struct regulator_ops da9058_ldo_regulator_ops = {
+	.map_voltage = regulator_map_voltage_linear,
+	.list_voltage = regulator_list_voltage_linear,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
+static struct regulator_ops da9058_fixed_regulator_ops = {
+	.get_voltage = da9058_get_fixed_regulator_voltage,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
+static int da9058_regulator_probe(struct platform_device *pdev)
+{
+	struct da9058 *da9058 = dev_get_drvdata(pdev->dev.parent);
+	const struct mfd_cell *cell = mfd_get_cell(pdev);
+	struct da9058_regulator_pdata *rpdata;
+	struct da9058_regulator *reg;
+	struct regulator_dev *rdev;
+	struct regulator_config config = { };
+	int ret;
+	unsigned int val;
+
+	if (cell == NULL) {
+		ret = -ENODEV;
+		goto exit;
+	}
+
+	rpdata = cell->platform_data;
+
+	if (rpdata == NULL) {
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	if (rpdata->control_register == 0) {
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	if (rpdata->control_enable_mask == 0) {
+		ret = -EINVAL;
+		goto exit;
+	}
+
+	reg = devm_kzalloc(&pdev->dev, sizeof(struct da9058_regulator),
+				GFP_KERNEL);
+	if (!reg) {
+		ret = -ENOMEM;
+		goto exit;
+	}
+
+	platform_set_drvdata(pdev, reg);
+
+	reg->da9058 = da9058;
+	reg->pdev = pdev;
+	reg->ramp_register = rpdata->ramp_register;
+	reg->ramp_enable_mask = rpdata->ramp_enable_mask;
+	reg->fixed_voltage = rpdata->fixed_voltage;
+
+	reg->desc.name = rpdata->regulator_name;
+	reg->desc.id = rpdata->regulator_id;
+	reg->desc.type = REGULATOR_VOLTAGE;
+	reg->desc.n_voltages = 1;
+
+	if (rpdata->control_voltage_step > 0)
+		reg->desc.n_voltages += (rpdata->max_uV - rpdata->min_uV) /
+					rpdata->control_voltage_step;
+
+	reg->desc.owner = THIS_MODULE;
+	reg->desc.enable_reg = rpdata->control_register;
+	reg->desc.enable_mask = rpdata->control_enable_mask;
+	reg->desc.vsel_reg = rpdata->control_register;
+	reg->desc.vsel_mask = DA9058_MAX_VSEL;
+
+	if (rpdata->control_voltage_step == 0) {
+		reg->desc.ops = &da9058_fixed_regulator_ops;
+	} else {
+		reg->desc.min_uV = rpdata->min_uV;
+		reg->desc.uV_step = rpdata->control_voltage_step;
+
+		if (reg->ramp_register)
+			reg->desc.ops = &da9058_buck_regulator_ops;
+		else
+			reg->desc.ops = &da9058_ldo_regulator_ops;
+	}
+
+	reg->init.constraints.name = rpdata->regulator_name;
+	reg->init.constraints.min_uV = rpdata->min_uV;
+	reg->init.constraints.max_uV = rpdata->max_uV;
+	reg->init.constraints.valid_ops_mask = rpdata->valid_ops_mask;
+	reg->init.constraints.valid_modes_mask = rpdata->valid_modes_mask;
+	reg->init.constraints.boot_on = rpdata->boot_on;
+	reg->init.constraints.always_on = rpdata->always_on;
+	reg->init.num_consumer_supplies = rpdata->num_consumer_supplies;
+	reg->init.consumer_supplies = rpdata->consumer_supplies;
+
+	config.dev = pdev->dev.parent;
+	config.init_data = &reg->init;
+	config.driver_data = reg;
+	config.regmap = da9058->regmap;
+
+	rdev = regulator_register(&reg->desc, &config);
+
+	if (IS_ERR(rdev)) {
+		dev_err(&pdev->dev, "failed to register %s\n",
+			rpdata->regulator_name);
+		ret = PTR_ERR(rdev);
+		goto failed_to_register;
+	}
+	reg->reg_dev = rdev;
+
+	/* before we do anything check the lock bit */
+	ret = da9058_reg_read(da9058, DA9058_SUPPLY_REG, &val);
+	if (ret)
+		goto unlock_failed;
+
+	if (val & DA9058_SUPPLY_VLOCK)
+		ret = da9058_clear_bits(da9058, DA9058_SUPPLY_REG,
+					DA9058_SUPPLY_VLOCK);
+	if (ret)
+		goto unlock_failed;
+
+	goto exit;
+
+unlock_failed:
+	regulator_unregister(rdev);
+failed_to_register:
+	platform_set_drvdata(pdev, NULL);
+exit:
+	return ret;
+}
+
+static int da9058_regulator_remove(struct platform_device *pdev)
+{
+	struct regulator_dev *rdev = platform_get_drvdata(pdev);
+
+	regulator_unregister(rdev);
+
+	return 0;
+}
+
+static struct platform_driver da9058_regulator_driver = {
+	.probe = da9058_regulator_probe,
+	.remove = da9058_regulator_remove,
+	.driver = {
+		.name = "da9058-regulator",
+		.owner = THIS_MODULE,
+	},
+};
+
+static int __init da9058_regulator_init(void)
+{
+	return platform_driver_register(&da9058_regulator_driver);
+}
+
+subsys_initcall(da9058_regulator_init);
+
+static void __exit da9058_regulator_exit(void)
+{
+	platform_driver_unregister(&da9058_regulator_driver);
+}
+
+module_exit(da9058_regulator_exit);
+
+MODULE_DESCRIPTION("Dialog DA9058 PMIC voltage and current regulator");
+MODULE_AUTHOR("Anthony Olech <Anthony.Olech@diasemi.com>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:da9058-regulator");
-- 
end-of-patch for NEW DRIVER V3


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

* Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-08-15 15:05 [NEW DRIVER V3 8/8] DA9058 REGULATOR driver Anthony Olech
@ 2012-08-27 16:50 ` Mark Brown
  2012-09-17 10:29   ` Opensource [Anthony Olech]
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-08-27 16:50 UTC (permalink / raw)
  To: Anthony Olech
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

On Wed, Aug 15, 2012 at 04:05:25PM +0100, Anthony Olech wrote:

> +static int da9058_buck_ramp_voltage(struct regulator_dev *rdev,
> +					unsigned int old_selector,
> +					unsigned int new_selector)
> +{

> +	ret = da9058_set_bits(da9058, regulator->ramp_register,
> +					regulator->ramp_enable_mask);
> +
> +	if (ret)
> +		return ret;

> +	return 2200; /* micro Seconds needed to ramp to new voltage*/

Why is this function writing to the hardware, especially writing the
same value every time?

> +static int da9058_get_fixed_regulator_voltage(struct regulator_dev *rdev)
> +{
> +	struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
> +
> +	if (regulator_is_enabled_regmap(rdev))
> +		return regulator->fixed_voltage;
> +	else
> +		return 0;
> +}

list_voltage_linear()

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

* RE: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-08-27 16:50 ` Mark Brown
@ 2012-09-17 10:29   ` Opensource [Anthony Olech]
  2012-09-17 10:40     ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Opensource [Anthony Olech] @ 2012-09-17 10:29 UTC (permalink / raw)
  To: Mark Brown, Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: 27 August 2012 17:51
> To: Opensource [Anthony Olech]
> Cc: Liam Girdwood; Guenter Roeck; Jean Delvare; Randy Dunlap; LKML; David
> Dajun Chen
> Subject: Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
> On Wed, Aug 15, 2012 at 04:05:25PM +0100, Anthony Olech wrote:
> > +static int da9058_buck_ramp_voltage(struct regulator_dev *rdev,
> > +					unsigned int old_selector,
> > +					unsigned int new_selector)
> > +{
> > +	ret = da9058_set_bits(da9058, regulator->ramp_register,
> > +					regulator->ramp_enable_mask);
> > +	if (ret)
> > +		return ret;
> > +	return 2200; /* micro Seconds needed to ramp to new voltage*/
> Why is this function writing to the hardware, especially writing the same value
> every time?


the ramp_register is DA9058_SUPPLY_REG and it is marked as volitile.
Writing to the ramp enable bit starts the voltage change. When the PMIC has
finished making the change it resets the bit. Thus to make another voltage
change the bit needs to be set again.

 
> > +static int da9058_get_fixed_regulator_voltage(struct regulator_dev
> > +*rdev) {
> > +	struct da9058_regulator *regulator = rdev_get_drvdata(rdev);
> > +
> > +	if (regulator_is_enabled_regmap(rdev))
> > +		return regulator->fixed_voltage;
> > +	else
> > +		return 0;
> > +}
> list_voltage_linear()

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

* Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 10:29   ` Opensource [Anthony Olech]
@ 2012-09-17 10:40     ` Mark Brown
  2012-09-17 10:49       ` Opensource [Anthony Olech]
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-09-17 10:40 UTC (permalink / raw)
  To: Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

On Mon, Sep 17, 2012 at 10:29:43AM +0000, Opensource [Anthony Olech] wrote:

> > Why is this function writing to the hardware, especially writing the same value
> > every time?

> the ramp_register is DA9058_SUPPLY_REG and it is marked as volitile.
> Writing to the ramp enable bit starts the voltage change. When the PMIC has
> finished making the change it resets the bit. Thus to make another voltage
> change the bit needs to be set again.

This function is retrieving the amount of time it would take to set the
voltage.  Why would it be starting a voltage ramp?  The fact that it's
not setting the new voltage in the hardware ought to be a warning sign
here...

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

* RE: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 10:40     ` Mark Brown
@ 2012-09-17 10:49       ` Opensource [Anthony Olech]
  2012-09-17 11:15         ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Opensource [Anthony Olech] @ 2012-09-17 10:49 UTC (permalink / raw)
  To: Mark Brown, Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: 17 September 2012 11:40
> To: Opensource [Anthony Olech]
> Cc: Liam Girdwood; Guenter Roeck; Jean Delvare; Randy Dunlap; LKML; David
> Dajun Chen
> Subject: Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
> On Mon, Sep 17, 2012 at 10:29:43AM +0000, Opensource [Anthony Olech]
> wrote:
> > > Why is this function writing to the hardware, especially writing the
> > > same value every time?
> > the ramp_register is DA9058_SUPPLY_REG and it is marked as volitile.
> > Writing to the ramp enable bit starts the voltage change. When the
> > PMIC has finished making the change it resets the bit. Thus to make
> > another voltage change the bit needs to be set again.
> This function is retrieving the amount of time it would take to set the voltage.
> Why would it be starting a voltage ramp?  The fact that it's not setting the new
> voltage in the hardware ought to be a warning sign here...

Thanks for the quick response Mark,

I thought that the set_voltage_sel = regulator_set_voltage_sel_regmap callback first
set the target voltage, and that the set_voltage_time_sel = da9058_buck_ramp_voltage
callback was called afterwards?

was I wrong?


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

* Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 10:49       ` Opensource [Anthony Olech]
@ 2012-09-17 11:15         ` Mark Brown
  2012-09-17 11:23           ` Opensource [Anthony Olech]
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-09-17 11:15 UTC (permalink / raw)
  To: Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

On Mon, Sep 17, 2012 at 10:49:22AM +0000, Opensource [Anthony Olech] wrote:

> I thought that the set_voltage_sel = regulator_set_voltage_sel_regmap callback first
> set the target voltage, and that the set_voltage_time_sel = da9058_buck_ramp_voltage
> callback was called afterwards?

> was I wrong?

That will currently happen but we might also decide to query the ramp
time first, or we might decide to query the ramp time totally separately
to actually changing the voltage (to decide when we will want to change
the voltage in DVFS situations for example).

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

* RE: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 11:15         ` Mark Brown
@ 2012-09-17 11:23           ` Opensource [Anthony Olech]
  2012-09-17 11:32             ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Opensource [Anthony Olech] @ 2012-09-17 11:23 UTC (permalink / raw)
  To: Mark Brown, Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: 17 September 2012 12:16
> To: Opensource [Anthony Olech]
> Cc: Liam Girdwood; Guenter Roeck; Jean Delvare; Randy Dunlap; LKML; David
> Dajun Chen
> Subject: Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
> On Mon, Sep 17, 2012 at 10:49:22AM +0000, Opensource [Anthony Olech]
> wrote:
> > I thought that the set_voltage_sel = regulator_set_voltage_sel_regmap
> > callback first set the target voltage, and that the
> > set_voltage_time_sel = da9058_buck_ramp_voltage callback was called
> afterwards?
> > was I wrong?
> That will currently happen but we might also decide to query the ramp time
> first, or we might decide to query the ramp time totally separately to actually
> changing the voltage (to decide when we will want to change the voltage in
> DVFS situations for example).

Can you suggest a future proofed way of using the new regulator API that
would solve my problem?


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

* Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 11:23           ` Opensource [Anthony Olech]
@ 2012-09-17 11:32             ` Mark Brown
  2012-09-17 12:07               ` Opensource [Anthony Olech]
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-09-17 11:32 UTC (permalink / raw)
  To: Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

On Mon, Sep 17, 2012 at 11:23:54AM +0000, Opensource [Anthony Olech] wrote:

> Can you suggest a future proofed way of using the new regulator API that
> would solve my problem?

As I said you should set the voltage as part of the set voltage
operation.

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

* RE: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 11:32             ` Mark Brown
@ 2012-09-17 12:07               ` Opensource [Anthony Olech]
  2012-09-19  2:37                 ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Opensource [Anthony Olech] @ 2012-09-17 12:07 UTC (permalink / raw)
  To: Mark Brown, Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: 17 September 2012 12:33
> To: Opensource [Anthony Olech]
> Cc: Liam Girdwood; Guenter Roeck; Jean Delvare; Randy Dunlap; LKML; David
> Dajun Chen
> Subject: Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
> On Mon, Sep 17, 2012 at 11:23:54AM +0000, Opensource [Anthony Olech]
> wrote:
> > Can you suggest a future proofed way of using the new regulator API
> > that would solve my problem?
> As I said you should set the voltage as part of the set voltage operation.

So I will have to write my own set_voltage_sel() callback instead of using
the default regulator_set_voltage_sel_regmap() ??

Well, I did try hard to use your defaults, but I suppose there is nothing to
stop me calling regulator_set_voltage_sel_regmap() explicitly as the first
part of my set_voltage_sel() callback before setting the ramp_enable bit.
Then my implemenation of the set_voltage_time_sel() callback needs to
just simply return the ramp time.

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

* Re: [NEW DRIVER V3 8/8] DA9058 REGULATOR driver
  2012-09-17 12:07               ` Opensource [Anthony Olech]
@ 2012-09-19  2:37                 ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2012-09-19  2:37 UTC (permalink / raw)
  To: Opensource [Anthony Olech]
  Cc: Liam Girdwood, Guenter Roeck, Jean Delvare, Randy Dunlap, LKML,
	David Dajun Chen

On Mon, Sep 17, 2012 at 12:07:11PM +0000, Opensource [Anthony Olech] wrote:

> > > Can you suggest a future proofed way of using the new regulator API
> > > that would solve my problem?

> > As I said you should set the voltage as part of the set voltage operation.

> So I will have to write my own set_voltage_sel() callback instead of using
> the default regulator_set_voltage_sel_regmap() ??

Yes.

> Well, I did try hard to use your defaults, but I suppose there is nothing to
> stop me calling regulator_set_voltage_sel_regmap() explicitly as the first
> part of my set_voltage_sel() callback before setting the ramp_enable bit.
> Then my implemenation of the set_voltage_time_sel() callback needs to
> just simply return the ramp time.

The point with using the framework stuff is that you should factor out
common code, if what you have is not common code then don't do crazy
things in other ops to try to paper over that.

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

end of thread, other threads:[~2012-09-19  2:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-15 15:05 [NEW DRIVER V3 8/8] DA9058 REGULATOR driver Anthony Olech
2012-08-27 16:50 ` Mark Brown
2012-09-17 10:29   ` Opensource [Anthony Olech]
2012-09-17 10:40     ` Mark Brown
2012-09-17 10:49       ` Opensource [Anthony Olech]
2012-09-17 11:15         ` Mark Brown
2012-09-17 11:23           ` Opensource [Anthony Olech]
2012-09-17 11:32             ` Mark Brown
2012-09-17 12:07               ` Opensource [Anthony Olech]
2012-09-19  2:37                 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).