* [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration
@ 2016-03-02 7:02 ` Laxman Dewangan
0 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2016-03-02 7:02 UTC (permalink / raw)
To: broonie, robh+dt, pawel.moll, mark.rutland, lgirdwood
Cc: devicetree, linux-kernel, Laxman Dewangan
Add support to enable/disable active discharge of regulator via
machine constraints. This configuration is done when setting
machine constraint during regulator register and if regulator
driver implemented the callback ops.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Changes from V1:
Make the interface like 0 (non-init member) will be treated as default,
1 for disable and 2 for enable. Created enum for active discharge
default/enable/disable
drivers/regulator/core.c | 11 +++++++++++
drivers/regulator/of_regulator.c | 6 ++++++
include/linux/regulator/driver.h | 3 +++
include/linux/regulator/machine.h | 12 ++++++++++++
4 files changed, 32 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 055f8c1..095de51 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1139,6 +1139,17 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
+ if (rdev->constraints->active_discharge && ops->set_active_discharge) {
+ bool ad_state = (rdev->constraints->active_discharge ==
+ REGULATOR_ACTIVE_DISCHARGE_ENABLE) ? true : false;
+
+ ret = ops->set_active_discharge(rdev, ad_state);
+ if (ret < 0) {
+ rdev_err(rdev, "failed to set active discharge\n");
+ return ret;
+ }
+ }
+
print_constraints(rdev);
return 0;
}
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 499e437..fe2e3344 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -93,6 +93,12 @@ static void of_get_regulation_constraints(struct device_node *np,
constraints->soft_start = of_property_read_bool(np,
"regulator-soft-start");
+ ret = of_property_read_u32(np, "regulator-active-discharge", &pval);
+ if (!ret) {
+ constraints->active_discharge =
+ (pval) ? REGULATOR_ACTIVE_DISCHARGE_ENABLE :
+ REGULATOR_ACTIVE_DISCHARGE_DISABLE;
+ }
if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
if (desc && desc->of_map_mode) {
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 16ac9e1..59dbaf7 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -93,6 +93,8 @@ struct regulator_linear_range {
* @get_current_limit: Get the configured limit for a current-limited regulator.
* @set_input_current_limit: Configure an input limit.
*
+ * @set_active_discharge: Set active discharge enable/disable of regulators.
+ *
* @set_mode: Set the configured operating mode for the regulator.
* @get_mode: Get the configured operating mode for the regulator.
* @get_status: Return actual (not as-configured) status of regulator, as a
@@ -149,6 +151,7 @@ struct regulator_ops {
int (*set_input_current_limit) (struct regulator_dev *, int lim_uA);
int (*set_over_current_protection) (struct regulator_dev *);
+ int (*set_active_discharge) (struct regulator_dev *, bool enable);
/* enable/disable regulator */
int (*enable) (struct regulator_dev *);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index a1067d0..5d627c8 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -42,6 +42,13 @@ struct regulator;
#define REGULATOR_CHANGE_DRMS 0x10
#define REGULATOR_CHANGE_BYPASS 0x20
+/* Regulator active discharge flags */
+enum regulator_active_discharge {
+ REGULATOR_ACTIVE_DISCHARGE_DEFAULT,
+ REGULATOR_ACTIVE_DISCHARGE_DISABLE,
+ REGULATOR_ACTIVE_DISCHARGE_ENABLE,
+};
+
/**
* struct regulator_state - regulator state during low power system states
*
@@ -100,6 +107,9 @@ struct regulator_state {
* @initial_state: Suspend state to set by default.
* @initial_mode: Mode to set at startup.
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
+ * @active_discharge: Enable/disable active discharge. The enum
+ * regulator_active_discharge values are used for
+ * initialisation.
* @enable_time: Turn-on time of the rails (unit: microseconds)
*/
struct regulation_constraints {
@@ -140,6 +150,8 @@ struct regulation_constraints {
unsigned int ramp_delay;
unsigned int enable_time;
+ unsigned int active_discharge;
+
/* constraint flags */
unsigned always_on:1; /* regulator never off when system is on */
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration
@ 2016-03-02 7:02 ` Laxman Dewangan
0 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2016-03-02 7:02 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
lgirdwood-Re5JQEeQqe8AvxtiuMwx3w
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan
Add support to enable/disable active discharge of regulator via
machine constraints. This configuration is done when setting
machine constraint during regulator register and if regulator
driver implemented the callback ops.
Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Changes from V1:
Make the interface like 0 (non-init member) will be treated as default,
1 for disable and 2 for enable. Created enum for active discharge
default/enable/disable
drivers/regulator/core.c | 11 +++++++++++
drivers/regulator/of_regulator.c | 6 ++++++
include/linux/regulator/driver.h | 3 +++
include/linux/regulator/machine.h | 12 ++++++++++++
4 files changed, 32 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 055f8c1..095de51 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1139,6 +1139,17 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
+ if (rdev->constraints->active_discharge && ops->set_active_discharge) {
+ bool ad_state = (rdev->constraints->active_discharge ==
+ REGULATOR_ACTIVE_DISCHARGE_ENABLE) ? true : false;
+
+ ret = ops->set_active_discharge(rdev, ad_state);
+ if (ret < 0) {
+ rdev_err(rdev, "failed to set active discharge\n");
+ return ret;
+ }
+ }
+
print_constraints(rdev);
return 0;
}
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 499e437..fe2e3344 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -93,6 +93,12 @@ static void of_get_regulation_constraints(struct device_node *np,
constraints->soft_start = of_property_read_bool(np,
"regulator-soft-start");
+ ret = of_property_read_u32(np, "regulator-active-discharge", &pval);
+ if (!ret) {
+ constraints->active_discharge =
+ (pval) ? REGULATOR_ACTIVE_DISCHARGE_ENABLE :
+ REGULATOR_ACTIVE_DISCHARGE_DISABLE;
+ }
if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
if (desc && desc->of_map_mode) {
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 16ac9e1..59dbaf7 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -93,6 +93,8 @@ struct regulator_linear_range {
* @get_current_limit: Get the configured limit for a current-limited regulator.
* @set_input_current_limit: Configure an input limit.
*
+ * @set_active_discharge: Set active discharge enable/disable of regulators.
+ *
* @set_mode: Set the configured operating mode for the regulator.
* @get_mode: Get the configured operating mode for the regulator.
* @get_status: Return actual (not as-configured) status of regulator, as a
@@ -149,6 +151,7 @@ struct regulator_ops {
int (*set_input_current_limit) (struct regulator_dev *, int lim_uA);
int (*set_over_current_protection) (struct regulator_dev *);
+ int (*set_active_discharge) (struct regulator_dev *, bool enable);
/* enable/disable regulator */
int (*enable) (struct regulator_dev *);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index a1067d0..5d627c8 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -42,6 +42,13 @@ struct regulator;
#define REGULATOR_CHANGE_DRMS 0x10
#define REGULATOR_CHANGE_BYPASS 0x20
+/* Regulator active discharge flags */
+enum regulator_active_discharge {
+ REGULATOR_ACTIVE_DISCHARGE_DEFAULT,
+ REGULATOR_ACTIVE_DISCHARGE_DISABLE,
+ REGULATOR_ACTIVE_DISCHARGE_ENABLE,
+};
+
/**
* struct regulator_state - regulator state during low power system states
*
@@ -100,6 +107,9 @@ struct regulator_state {
* @initial_state: Suspend state to set by default.
* @initial_mode: Mode to set at startup.
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
+ * @active_discharge: Enable/disable active discharge. The enum
+ * regulator_active_discharge values are used for
+ * initialisation.
* @enable_time: Turn-on time of the rails (unit: microseconds)
*/
struct regulation_constraints {
@@ -140,6 +150,8 @@ struct regulation_constraints {
unsigned int ramp_delay;
unsigned int enable_time;
+ unsigned int active_discharge;
+
/* constraint flags */
unsigned always_on:1; /* regulator never off when system is on */
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration
@ 2016-03-02 10:25 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2016-03-02 10:25 UTC (permalink / raw)
To: Laxman Dewangan
Cc: robh+dt, pawel.moll, mark.rutland, lgirdwood, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On Wed, Mar 02, 2016 at 12:32:10PM +0530, Laxman Dewangan wrote:
> Add support to enable/disable active discharge of regulator via
> machine constraints. This configuration is done when setting
> machine constraint during regulator register and if regulator
> driver implemented the callback ops.
I'm missing patches 1, 3 and 4 here. Please don't send patches numbered
as part of a series outside of the series, it makes things confusing.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration
@ 2016-03-02 10:25 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2016-03-02 10:25 UTC (permalink / raw)
To: Laxman Dewangan
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
mark.rutland-5wv7dgnIgG8, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On Wed, Mar 02, 2016 at 12:32:10PM +0530, Laxman Dewangan wrote:
> Add support to enable/disable active discharge of regulator via
> machine constraints. This configuration is done when setting
> machine constraint during regulator register and if regulator
> driver implemented the callback ops.
I'm missing patches 1, 3 and 4 here. Please don't send patches numbered
as part of a series outside of the series, it makes things confusing.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration
2016-03-02 10:25 ` Mark Brown
@ 2016-03-02 10:51 ` Laxman Dewangan
-1 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2016-03-02 10:51 UTC (permalink / raw)
To: Mark Brown
Cc: robh+dt, pawel.moll, mark.rutland, lgirdwood, devicetree, linux-kernel
On Wednesday 02 March 2016 03:55 PM, Mark Brown wrote:
> * PGP Signed by an unknown key
>
> On Wed, Mar 02, 2016 at 12:32:10PM +0530, Laxman Dewangan wrote:
>> Add support to enable/disable active discharge of regulator via
>> machine constraints. This configuration is done when setting
>> machine constraint during regulator register and if regulator
>> driver implemented the callback ops.
> I'm missing patches 1, 3 and 4 here. Please don't send patches numbered
> as part of a series outside of the series, it makes things confusing.
>
> * Unknown Key
> * 0x5D5487D0
I sent full series of V2 but unfortunately (which I missed), 2/4 did not
have V2 in its subject and resend again on 2/4 with V2 in its subject.
Let me resend all patches again.
Sorry for inconvenience created.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration
@ 2016-03-02 10:51 ` Laxman Dewangan
0 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2016-03-02 10:51 UTC (permalink / raw)
To: Mark Brown
Cc: robh+dt, pawel.moll, mark.rutland, lgirdwood, devicetree, linux-kernel
On Wednesday 02 March 2016 03:55 PM, Mark Brown wrote:
> * PGP Signed by an unknown key
>
> On Wed, Mar 02, 2016 at 12:32:10PM +0530, Laxman Dewangan wrote:
>> Add support to enable/disable active discharge of regulator via
>> machine constraints. This configuration is done when setting
>> machine constraint during regulator register and if regulator
>> driver implemented the callback ops.
> I'm missing patches 1, 3 and 4 here. Please don't send patches numbered
> as part of a series outside of the series, it makes things confusing.
>
> * Unknown Key
> * 0x5D5487D0
I sent full series of V2 but unfortunately (which I missed), 2/4 did not
have V2 in its subject and resend again on 2/4 with V2 in its subject.
Let me resend all patches again.
Sorry for inconvenience created.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-02 11:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02 7:02 [PATCH V2 2/4] regulator: core: Add support for active-discharge configuration Laxman Dewangan
2016-03-02 7:02 ` Laxman Dewangan
2016-03-02 10:25 ` Mark Brown
2016-03-02 10:25 ` Mark Brown
2016-03-02 10:51 ` Laxman Dewangan
2016-03-02 10:51 ` Laxman Dewangan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.