Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states
On Tue, Jan 09, 2018 at 02:08:45PM +0800, Chunyan Zhang wrote: > Then, do we need a flag as well to give permission to change > 'suspend_state->enabled'? Yes, that's a separate thing which people might want to control even if the voltage can't be changed. signature.asc Description: PGP signature
Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states
On 8 January 2018 at 20:35, Mark Brown wrote: > On Mon, Jan 08, 2018 at 02:36:36PM +0800, Chunyan Zhang wrote: >> On 6 January 2018 at 03:18, Mark Brown wrote: > >> > No, it means that the software has permission to use those changes to >> > those registers - we only want to be changing things if the user has >> > permission to change them since some systems will have specific >> > constraints, we don't know if it's safe without being explicitly told. >> > You're right that we could infer this from a range being provided >> > though, let's do that. > >> Ok, so we don't need this property IIUC, and instead we just need to check >> if the regulator-suspend-min-microvolt and regulator-suspend-max-microvolt >> are set to the same value, right? > > Yes. Then, do we need a flag as well to give permission to change 'suspend_state->enabled'? Or we just do keeping the regulator device enabled if any consumer of it has set voltage for suspend mode with non-zero value, and do switching it off if all consumers of it have set voltage for suspend with zero. +static int _regulator_set_suspend_voltage(struct regulator *regulator, + int min_uV, int max_uV, + suspend_state_t state) +{ + int ret; + struct regulator_dev *rdev = regulator->rdev; + + /* +* We assume users want to switch off the regulator device for +* suspend state when setting min_uV and max_uV all with zero. +*/ + if (min_uV == 0 && max_uV == 0) { + regulator->voltage[state].min_uV = 0; + regulator->voltage[state].max_uV = 0; + return regulator_suspend_disable(rdev, state); + } + + ret = regulator_suspend_enable(rdev, state); + if (ret < 0) + return ret; + + return regulator_set_voltage_unlocked(regulator, min_uV, max_uV, state); +}
Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states
On Mon, Jan 08, 2018 at 02:36:36PM +0800, Chunyan Zhang wrote: > On 6 January 2018 at 03:18, Mark Brown wrote: > > No, it means that the software has permission to use those changes to > > those registers - we only want to be changing things if the user has > > permission to change them since some systems will have specific > > constraints, we don't know if it's safe without being explicitly told. > > You're right that we could infer this from a range being provided > > though, let's do that. > Ok, so we don't need this property IIUC, and instead we just need to check > if the regulator-suspend-min-microvolt and regulator-suspend-max-microvolt > are set to the same value, right? Yes. signature.asc Description: PGP signature
Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states
On 6 January 2018 at 03:18, Mark Brown wrote: > On Fri, Jan 05, 2018 at 12:53:28PM -0600, Rob Herring wrote: >> On Thu, Jan 04, 2018 at 03:22:44PM +0800, Chunyan Zhang wrote: > >> > + - regulator-suspend-microvolt: the default voltage which regulator >> > + would be set in suspend. The voltage for suspend also can be >> > + adjusted among {regulator-suspend-min-microvolt, >> > + regulator-suspend-max-microvolt} by calling >> > + regulator_set_suspend_voltage(). This property is not deprecated, > >> You mean "is deprecated", right? Ah, right, will correct this. > > I suspect "is now" but yeah. > >> > + - regulator-changeable-in-suspend: whether the default voltage and >> > + the regulator on/off in suspend can be changed in runtime. > >> Is this not implied by having the constraints? Or the driver should know >> this. The simply means you have some 2nd bank of registers for settings >> while in suspend mode, right? > > No, it means that the software has permission to use those changes to > those registers - we only want to be changing things if the user has > permission to change them since some systems will have specific > constraints, we don't know if it's safe without being explicitly told. > You're right that we could infer this from a range being provided > though, let's do that. Ok, so we don't need this property IIUC, and instead we just need to check if the regulator-suspend-min-microvolt and regulator-suspend-max-microvolt are set to the same value, right? Thanks, Chunyan
Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states
On Fri, Jan 05, 2018 at 12:53:28PM -0600, Rob Herring wrote: > On Thu, Jan 04, 2018 at 03:22:44PM +0800, Chunyan Zhang wrote: > > + - regulator-suspend-microvolt: the default voltage which regulator > > + would be set in suspend. The voltage for suspend also can be > > + adjusted among {regulator-suspend-min-microvolt, > > + regulator-suspend-max-microvolt} by calling > > + regulator_set_suspend_voltage(). This property is not deprecated, > You mean "is deprecated", right? I suspect "is now" but yeah. > > + - regulator-changeable-in-suspend: whether the default voltage and > > + the regulator on/off in suspend can be changed in runtime. > Is this not implied by having the constraints? Or the driver should know > this. The simply means you have some 2nd bank of registers for settings > while in suspend mode, right? No, it means that the software has permission to use those changes to those registers - we only want to be changing things if the user has permission to change them since some systems will have specific constraints, we don't know if it's safe without being explicitly told. You're right that we could infer this from a range being provided though, let's do that. signature.asc Description: PGP signature
Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states
On Thu, Jan 04, 2018 at 03:22:44PM +0800, Chunyan Zhang wrote: > Some systems need to set regulators to specific states when they enter > low power modes, especially around CPUs. There are many of these modes > depending on the particular runtime state. > > Currently the regulator consumers are not granted permission to change > suspend state of regulator devices, the constraints are configured at > startup. In order to allow changes in a vlotage range, we need to add > new properties for voltage range and a flag to give permission to > change the suspend voltage and suspend on/off in suspend mode. > > Signed-off-by: Chunyan Zhang > --- > Documentation/devicetree/bindings/regulator/regulator.txt | 15 > +-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt > b/Documentation/devicetree/bindings/regulator/regulator.txt > index 378f6dc..532e286 100644 > --- a/Documentation/devicetree/bindings/regulator/regulator.txt > +++ b/Documentation/devicetree/bindings/regulator/regulator.txt > @@ -42,8 +42,19 @@ Optional properties: > - regulator-state-[mem/disk] node has following common properties: > - regulator-on-in-suspend: regulator should be on in suspend state. > - regulator-off-in-suspend: regulator should be off in suspend state. > - - regulator-suspend-microvolt: regulator should be set to this voltage > - in suspend. > + - regulator-suspend-min-microvolt: minimum voltage may be set in > + suspend state. > + - regulator-suspend-max-microvolt: maximum voltage may be set in > + suspend state. > + - regulator-suspend-microvolt: the default voltage which regulator > + would be set in suspend. The voltage for suspend also can be > + adjusted among {regulator-suspend-min-microvolt, > + regulator-suspend-max-microvolt} by calling > + regulator_set_suspend_voltage(). This property is not deprecated, You mean "is deprecated", right? > + setting voltage for suspend mode via API the regulator driver > + provides is recommended. > + - regulator-changeable-in-suspend: whether the default voltage and > + the regulator on/off in suspend can be changed in runtime. Is this not implied by having the constraints? Or the driver should know this. The simply means you have some 2nd bank of registers for settings while in suspend mode, right? > - regulator-mode: operating mode in the given suspend state. > The set of possible operating modes depends on the capabilities of > every hardware so the valid modes are documented on each regulator > -- > 2.7.4 >
[PATCH V2 1/5] bindings: regulator: added support for suspend states
Some systems need to set regulators to specific states when they enter low power modes, especially around CPUs. There are many of these modes depending on the particular runtime state. Currently the regulator consumers are not granted permission to change suspend state of regulator devices, the constraints are configured at startup. In order to allow changes in a vlotage range, we need to add new properties for voltage range and a flag to give permission to change the suspend voltage and suspend on/off in suspend mode. Signed-off-by: Chunyan Zhang --- Documentation/devicetree/bindings/regulator/regulator.txt | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt index 378f6dc..532e286 100644 --- a/Documentation/devicetree/bindings/regulator/regulator.txt +++ b/Documentation/devicetree/bindings/regulator/regulator.txt @@ -42,8 +42,19 @@ Optional properties: - regulator-state-[mem/disk] node has following common properties: - regulator-on-in-suspend: regulator should be on in suspend state. - regulator-off-in-suspend: regulator should be off in suspend state. - - regulator-suspend-microvolt: regulator should be set to this voltage - in suspend. + - regulator-suspend-min-microvolt: minimum voltage may be set in + suspend state. + - regulator-suspend-max-microvolt: maximum voltage may be set in + suspend state. + - regulator-suspend-microvolt: the default voltage which regulator + would be set in suspend. The voltage for suspend also can be + adjusted among {regulator-suspend-min-microvolt, + regulator-suspend-max-microvolt} by calling + regulator_set_suspend_voltage(). This property is not deprecated, + setting voltage for suspend mode via API the regulator driver + provides is recommended. + - regulator-changeable-in-suspend: whether the default voltage and + the regulator on/off in suspend can be changed in runtime. - regulator-mode: operating mode in the given suspend state. The set of possible operating modes depends on the capabilities of every hardware so the valid modes are documented on each regulator -- 2.7.4