* [PATCH V1] regulator: da9211: Add gpio control for enable/disable of buck
@ 2015-01-16 8:59 James Ban
2015-01-16 9:31 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: James Ban @ 2015-01-16 8:59 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Support Opensource, LKML; +Cc: David Dajun Chen
This is a patch for adding gpio control about enable/disable of buck.
Signed-off-by: James Ban <james.ban.opensource@diasemi.com>
---
This patch is relative to linux-next repository tag next-20150115.
.../devicetree/bindings/regulator/da9211.txt | 7 ++++++-
drivers/regulator/da9211-regulator.c | 6 ++++++
include/linux/regulator/da9211.h | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt b/Documentation/devicetree/bindings/regulator/da9211.txt
index 240019a..ad777ac 100644
--- a/Documentation/devicetree/bindings/regulator/da9211.txt
+++ b/Documentation/devicetree/bindings/regulator/da9211.txt
@@ -11,6 +11,7 @@ Required properties:
BUCKA and BUCKB.
Optional properties:
+- buck-enable-platform-gpio: platform gpio for control of BUCKA/BUCKB.
- Any optional property defined in regulator.txt
Example 1) DA9211
@@ -27,6 +28,7 @@ Example 1) DA9211
regulator-max-microvolt = <1570000>;
regulator-min-microamp = <2000000>;
regulator-max-microamp = <5000000>;
+ buck-enable-platform-gpio = <&gpio 27 0>;
};
BUCKB {
regulator-name = "VBUCKB";
@@ -34,11 +36,12 @@ Example 1) DA9211
regulator-max-microvolt = <1570000>;
regulator-min-microamp = <2000000>;
regulator-max-microamp = <5000000>;
+ buck-enable-platform-gpio = <&gpio 17 0>;
};
};
};
-Example 2) DA92113
+Example 2) DA9213
pmic: da9213@68 {
compatible = "dlg,da9213";
reg = <0x68>;
@@ -51,6 +54,7 @@ Example 2) DA92113
regulator-max-microvolt = <1570000>;
regulator-min-microamp = <3000000>;
regulator-max-microamp = <6000000>;
+ buck-enable-platform-gpio = <&gpio 27 0>;
};
BUCKB {
regulator-name = "VBUCKB";
@@ -58,6 +62,7 @@ Example 2) DA92113
regulator-max-microvolt = <1570000>;
regulator-min-microamp = <3000000>;
regulator-max-microamp = <6000000>;
+ buck-enable-platform-gpio = <&gpio 17 0>;
};
};
};
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index c78d210..d299b0f 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -24,6 +24,7 @@
#include <linux/regmap.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
+#include <linux/of_gpio.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/da9211.h>
#include "da9211-regulator.h"
@@ -277,6 +278,10 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
pdata->init_data[n] = da9211_matches[i].init_data;
+ pdata->gpio_ren[n] =
+ of_get_named_gpio(da9211_matches[i].of_node,
+ "buck-enable-platform-gpio", 0);
+
n++;
}
@@ -365,6 +370,7 @@ static int da9211_regulator_init(struct da9211 *chip)
config.driver_data = chip;
config.regmap = chip->regmap;
config.of_node = chip->dev->of_node;
+ config.ena_gpio = chip->pdata->gpio_ren[i];
chip->rdev[i] = devm_regulator_register(chip->dev,
&da9211_regulators[i], &config);
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
index 5479394..530b5ea 100644
--- a/include/linux/regulator/da9211.h
+++ b/include/linux/regulator/da9211.h
@@ -32,6 +32,7 @@ struct da9211_pdata {
* 2 : 2 phase 2 buck
*/
int num_buck;
+ int gpio_ren[DA9211_MAX_REGULATORS];
struct regulator_init_data *init_data[DA9211_MAX_REGULATORS];
};
#endif
--
end-of-patch for regulator: da9211: Add gpio control for enable/disable of buck V1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V1] regulator: da9211: Add gpio control for enable/disable of buck
2015-01-16 8:59 [PATCH V1] regulator: da9211: Add gpio control for enable/disable of buck James Ban
@ 2015-01-16 9:31 ` Krzysztof Kozlowski
2015-01-19 0:32 ` Opensource [James Seong-Won Ban]
0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2015-01-16 9:31 UTC (permalink / raw)
To: James Ban
Cc: Liam Girdwood, Mark Brown, Support Opensource, LKML,
David Dajun Chen
On pią, 2015-01-16 at 17:59 +0900, James Ban wrote:
> This is a patch for adding gpio control about enable/disable of buck.
>
> Signed-off-by: James Ban <james.ban.opensource@diasemi.com>
> ---
>
> This patch is relative to linux-next repository tag next-20150115.
>
>
> .../devicetree/bindings/regulator/da9211.txt | 7 ++++++-
> drivers/regulator/da9211-regulator.c | 6 ++++++
> include/linux/regulator/da9211.h | 1 +
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt b/Documentation/devicetree/bindings/regulator/da9211.txt
> index 240019a..ad777ac 100644
> --- a/Documentation/devicetree/bindings/regulator/da9211.txt
> +++ b/Documentation/devicetree/bindings/regulator/da9211.txt
> @@ -11,6 +11,7 @@ Required properties:
> BUCKA and BUCKB.
>
> Optional properties:
> +- buck-enable-platform-gpio: platform gpio for control of BUCKA/BUCKB.
> - Any optional property defined in regulator.txt
>
> Example 1) DA9211
> @@ -27,6 +28,7 @@ Example 1) DA9211
> regulator-max-microvolt = <1570000>;
> regulator-min-microamp = <2000000>;
> regulator-max-microamp = <5000000>;
> + buck-enable-platform-gpio = <&gpio 27 0>;
> };
> BUCKB {
> regulator-name = "VBUCKB";
> @@ -34,11 +36,12 @@ Example 1) DA9211
> regulator-max-microvolt = <1570000>;
> regulator-min-microamp = <2000000>;
> regulator-max-microamp = <5000000>;
> + buck-enable-platform-gpio = <&gpio 17 0>;
The suffix was changed to "-gpios".
(Documentation/devicetree/bindings/gpio/gpio.txt)
> };
> };
> };
>
> -Example 2) DA92113
> +Example 2) DA9213
> pmic: da9213@68 {
> compatible = "dlg,da9213";
> reg = <0x68>;
> @@ -51,6 +54,7 @@ Example 2) DA92113
> regulator-max-microvolt = <1570000>;
> regulator-min-microamp = <3000000>;
> regulator-max-microamp = <6000000>;
> + buck-enable-platform-gpio = <&gpio 27 0>;
> };
> BUCKB {
> regulator-name = "VBUCKB";
> @@ -58,6 +62,7 @@ Example 2) DA92113
> regulator-max-microvolt = <1570000>;
> regulator-min-microamp = <3000000>;
> regulator-max-microamp = <6000000>;
> + buck-enable-platform-gpio = <&gpio 17 0>;
> };
> };
> };
> diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
> index c78d210..d299b0f 100644
> --- a/drivers/regulator/da9211-regulator.c
> +++ b/drivers/regulator/da9211-regulator.c
> @@ -24,6 +24,7 @@
> #include <linux/regmap.h>
> #include <linux/irq.h>
> #include <linux/interrupt.h>
> +#include <linux/of_gpio.h>
> #include <linux/regulator/of_regulator.h>
> #include <linux/regulator/da9211.h>
> #include "da9211-regulator.h"
> @@ -277,6 +278,10 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
>
> pdata->init_data[n] = da9211_matches[i].init_data;
>
> + pdata->gpio_ren[n] =
> + of_get_named_gpio(da9211_matches[i].of_node,
> + "buck-enable-platform-gpio", 0);
> +
> n++;
> }
>
> @@ -365,6 +370,7 @@ static int da9211_regulator_init(struct da9211 *chip)
> config.driver_data = chip;
> config.regmap = chip->regmap;
> config.of_node = chip->dev->of_node;
> + config.ena_gpio = chip->pdata->gpio_ren[i];
Probably you want to set also config.ena_gpio_initialized because '0'
could be a valid GPIO. However that could be inconsistent with
platform_data for your driver so it's up to you.
Don't you have to enable the GPIO usage in the device (switch from I2C
control to GPIO)?
Best regards,
Krzysztof
>
> chip->rdev[i] = devm_regulator_register(chip->dev,
> &da9211_regulators[i], &config);
> diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
> index 5479394..530b5ea 100644
> --- a/include/linux/regulator/da9211.h
> +++ b/include/linux/regulator/da9211.h
> @@ -32,6 +32,7 @@ struct da9211_pdata {
> * 2 : 2 phase 2 buck
> */
> int num_buck;
> + int gpio_ren[DA9211_MAX_REGULATORS];
> struct regulator_init_data *init_data[DA9211_MAX_REGULATORS];
> };
> #endif
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH V1] regulator: da9211: Add gpio control for enable/disable of buck
2015-01-16 9:31 ` Krzysztof Kozlowski
@ 2015-01-19 0:32 ` Opensource [James Seong-Won Ban]
0 siblings, 0 replies; 3+ messages in thread
From: Opensource [James Seong-Won Ban] @ 2015-01-19 0:32 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Liam Girdwood, Mark Brown, Support Opensource, LKML,
David Dajun Chen
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 4682 bytes --]
January 16, 2015 18:31, Krzysztof Kozlowski wrote:
> On piÄ
, 2015-01-16 at 17:59 +0900, James Ban wrote:
> > This is a patch for adding gpio control about enable/disable of buck.
> >
> > Signed-off-by: James Ban <james.ban.opensource@diasemi.com>
> > ---
> >
> > This patch is relative to linux-next repository tag next-20150115.
> >
> >
> > .../devicetree/bindings/regulator/da9211.txt | 7 ++++++-
> > drivers/regulator/da9211-regulator.c | 6 ++++++
> > include/linux/regulator/da9211.h | 1 +
> > 3 files changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt
> b/Documentation/devicetree/bindings/regulator/da9211.txt
> > index 240019a..ad777ac 100644
> > --- a/Documentation/devicetree/bindings/regulator/da9211.txt
> > +++ b/Documentation/devicetree/bindings/regulator/da9211.txt
> > @@ -11,6 +11,7 @@ Required properties:
> > BUCKA and BUCKB.
> >
> > Optional properties:
> > +- buck-enable-platform-gpio: platform gpio for control of BUCKA/BUCKB.
> > - Any optional property defined in regulator.txt
> >
> > Example 1) DA9211
> > @@ -27,6 +28,7 @@ Example 1) DA9211
> > regulator-max-microvolt = <1570000>;
> > regulator-min-microamp = <2000000>;
> > regulator-max-microamp = <5000000>;
> > + buck-enable-platform-gpio = <&gpio 27 0>;
> > };
> > BUCKB {
> > regulator-name = "VBUCKB";
> > @@ -34,11 +36,12 @@ Example 1) DA9211
> > regulator-max-microvolt = <1570000>;
> > regulator-min-microamp = <2000000>;
> > regulator-max-microamp = <5000000>;
> > + buck-enable-platform-gpio = <&gpio 17 0>;
>
> The suffix was changed to "-gpios".
> (Documentation/devicetree/bindings/gpio/gpio.txt)
>
I will change it.
> > };
> > };
> > };
> >
> > -Example 2) DA92113
> > +Example 2) DA9213
> > pmic: da9213@68 {
> > compatible = "dlg,da9213";
> > reg = <0x68>;
> > @@ -51,6 +54,7 @@ Example 2) DA92113
> > regulator-max-microvolt = <1570000>;
> > regulator-min-microamp = <3000000>;
> > regulator-max-microamp = <6000000>;
> > + buck-enable-platform-gpio = <&gpio 27 0>;
> > };
> > BUCKB {
> > regulator-name = "VBUCKB";
> > @@ -58,6 +62,7 @@ Example 2) DA92113
> > regulator-max-microvolt = <1570000>;
> > regulator-min-microamp = <3000000>;
> > regulator-max-microamp = <6000000>;
> > + buck-enable-platform-gpio = <&gpio 17 0>;
> > };
> > };
> > };
> > diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-
> regulator.c
> > index c78d210..d299b0f 100644
> > --- a/drivers/regulator/da9211-regulator.c
> > +++ b/drivers/regulator/da9211-regulator.c
> > @@ -24,6 +24,7 @@
> > #include <linux/regmap.h>
> > #include <linux/irq.h>
> > #include <linux/interrupt.h>
> > +#include <linux/of_gpio.h>
> > #include <linux/regulator/of_regulator.h>
> > #include <linux/regulator/da9211.h>
> > #include "da9211-regulator.h"
> > @@ -277,6 +278,10 @@ static struct da9211_pdata
> *da9211_parse_regulators_dt(
> >
> > pdata->init_data[n] = da9211_matches[i].init_data;
> >
> > + pdata->gpio_ren[n] =
> > + of_get_named_gpio(da9211_matches[i].of_node,
> > + "buck-enable-platform-gpio", 0);
> > +
> > n++;
> > }
> >
> > @@ -365,6 +370,7 @@ static int da9211_regulator_init(struct da9211 *chip)
> > config.driver_data = chip;
> > config.regmap = chip->regmap;
> > config.of_node = chip->dev->of_node;
> > + config.ena_gpio = chip->pdata->gpio_ren[i];
>
> Probably you want to set also config.ena_gpio_initialized because '0'
> could be a valid GPIO. However that could be inconsistent with
> platform_data for your driver so it's up to you.
>
I will set config.ena_gpio_initialized.
> Don't you have to enable the GPIO usage in the device (switch from I2C
> control to GPIO)?
>
We assume default setting for GPIO usage is programed in the device.
> Best regards,
> Krzysztof
>
> >
> > chip->rdev[i] = devm_regulator_register(chip->dev,
> > &da9211_regulators[i], &config);
> > diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
> > index 5479394..530b5ea 100644
> > --- a/include/linux/regulator/da9211.h
> > +++ b/include/linux/regulator/da9211.h
> > @@ -32,6 +32,7 @@ struct da9211_pdata {
> > * 2 : 2 phase 2 buck
> > */
> > int num_buck;
> > + int gpio_ren[DA9211_MAX_REGULATORS];
> > struct regulator_init_data *init_data[DA9211_MAX_REGULATORS];
> > };
> > #endif
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-19 0:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 8:59 [PATCH V1] regulator: da9211: Add gpio control for enable/disable of buck James Ban
2015-01-16 9:31 ` Krzysztof Kozlowski
2015-01-19 0:32 ` Opensource [James Seong-Won Ban]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox