lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 9 Jan 2018 14:08:45 +0800
From:   Chunyan Zhang <zhang.chunyan@...aro.org>
To:     Mark Brown <broonie@...nel.org>
Cc:     Rob Herring <robh@...nel.org>, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, Ulf Hansson <ulf.hansson@...aro.org>,
        Chunyan Zhang <zhang.lyra@...il.com>
Subject: Re: [PATCH V2 1/5] bindings: regulator: added support for suspend states

On 8 January 2018 at 20:35, Mark Brown <broonie@...nel.org> wrote:
> On Mon, Jan 08, 2018 at 02:36:36PM +0800, Chunyan Zhang wrote:
>> On 6 January 2018 at 03:18, Mark Brown <broonie@...nel.org> 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);
+}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ