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:   Sun, 17 Jul 2022 13:49:23 +0200
From:   Christian Kohlschütter 
        <christian@...lschutter.com>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Cc:     Robin Murphy <robin.murphy@....com>, wens@...nel.org,
        Heiko Stübner <heiko@...ech.de>,
        Markus Reichl <m.reichl@...etechno.de>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        "open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>,
        Linux MMC List <linux-mmc@...r.kernel.org>
Subject: Re: [PATCH] regulator: core: Fix off-on-delay-us for
 always-on/boot-on regulators

+CC mmc/rockchip folks

> Am 17.07.2022 um 13:39 schrieb Christian Kohlschütter <christian@...lschutter.com>:
> 
> This is _somewhat_ related to "[PATCH] regulator: core: Fix off-on-delay-us for always-on/boot-on regulators"
> That other patch is the right solution for my specific problem, and no further fixes are necessary.
> 
> This change fixes an attempted "bandage" solution (adding an "off-on-delay-us") that we had initially tried to no avail.
> While the cleanup not only reduces complexity, it may also prevent future code changes reintroducing the non-delayed cycling after registration.
> 
> from arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi:
> vcc3v0_sd: vcc3v0-sd {
>        compatible = "regulator-fixed";
>        enable-active-high;
>        gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
>        pinctrl-names = "default";
>        pinctrl-0 = <&sdmmc0_pwr_h>;
>        regulator-always-on; // prevents setting last_off upon registration
>        off-on-delay-us = <500000>; // would not be honored upon regulator_register
>        regulator-min-microvolt = <3000000>;
>        regulator-max-microvolt = <3000000>;
>        regulator-name = "vcc3v0_sd";
>        vin-supply = <&vcc3v3_sys>;
> };
> 
>> Am 17.07.2022 um 13:30 schrieb Christian Kohlschuetter <christian@...lschuetter.com>:
>> 
>> Regulators marked with "regulator-always-on" or "regulator-boot-on"
>> as well as an "off-on-delay-us", may run into cycling issues that are
>> hard to detect.
>> 
>> This is caused by the "last_off" state not being initialized in this
>> case.
>> 
>> Fix the "last_off" initialization by setting it to the current kernel
>> time upon initialization, regardless of always_on/boot_on state.
>> 
>> Signed-off-by: Christian Kohlschütter <christian@...lschutter.com>
>> ---
>> drivers/regulator/core.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
>> index c4d844ffad7a..48ed33ad48c8 100644
>> --- a/drivers/regulator/core.c
>> +++ b/drivers/regulator/core.c
>> @@ -1522,6 +1522,9 @@ static int set_machine_constraints(struct regulator_dev *rdev)
>> 		}
>> 	}
>> 
>> +	if (rdev->desc->off_on_delay)
>> +		rdev->last_off = ktime_get();
>> +
>> 	/* If the constraints say the regulator should be on at this point
>> 	 * and we have control then make sure it is enabled.
>> 	 */
>> @@ -1549,8 +1552,6 @@ static int set_machine_constraints(struct regulator_dev *rdev)
>> 
>> 		if (rdev->constraints->always_on)
>> 			rdev->use_count++;
>> -	} else if (rdev->desc->off_on_delay) {
>> -		rdev->last_off = ktime_get();
>> 	}
>> 
>> 	print_constraints(rdev);
>> -- 
>> 2.36.1
>> 
>> 
> 
> 
> 
> -- 
> Dr. Christian Kohlschütter
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ