Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4486886imw; Tue, 19 Jul 2022 07:31:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t2/aPyXuaRwAzj6O+28+6ivZ6hwxqmWvicXtNs1UIxqHM66BkB+T3zkh4LKExd8ipd6Fvi X-Received: by 2002:a17:907:da4:b0:72f:755:ce3f with SMTP id go36-20020a1709070da400b0072f0755ce3fmr18669786ejc.111.1658241085954; Tue, 19 Jul 2022 07:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658241085; cv=none; d=google.com; s=arc-20160816; b=okV7JMbGrupK9o9tGPRR17MeAwJatweENms9b+OQWc4K8UQljlVLc4rLMAE+MEJR+Z EUHkA/aFZZbRbTWyKKAGC5KwalDj+xNUiN5MWizvZGNQLswmrA6NBFRkk7mjMbzWFexy SS/yXKjULH9mKRjZyztHiBd+W7KSvA/5YDLkI8b8ZBCT/e9wInYI8zPSByamyq311OpM ZcYlZJEv0pis7qpS7pRq0lggBpThTjuB/vDKgTSk1+3dqluJeN667HLpjDEARxG2aUd+ ztBYYmJdRI/WK3bL09Crht9X0efxhpBkmUh33WtUq8KoPUd/ck7oQbbZ8ouT5CZr4JZF NqnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=CmdStA6vypQg2oavVstr5dnAYNGqZ+2TKvct0NXz+Ow=; b=XLAsCBp0IQ/wRf4roy+Jl//OvqpVYTuOgF1bRTEG4yzkqummQb+hmlg0NhP7F9Jk/W SU5WtCbDAm54G0zgyGpa20Wsqsr1UlrGoySX6uBf6Ic8F++YXKdFU9rkOULHxZAC7BH7 k5fXV3Dh4eKwHxfDMyxayUOT3VdhubltrxhWK1pZLQ1ipx3YuPkEZDOyoywTYWxilugS jcX8EZMVmmKmj6ZGbK28zCBtABqSgGcHC8d0CiqbkK6Kt5k+SCDOsDy4/JkeaizPnDAW IsGNjW3SCQeGiyRBaCayAKDgJEbaNYrQKUSAbOl8MxnAX7oToy5WKmTVUIHqxrcBH7J4 Dtlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kohlschutter-com.20210112.gappssmtp.com header.s=20210112 header.b="fFNwbc/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jo25-20020a170906f6d900b0072ed0d06c0csi17786081ejb.411.2022.07.19.07.31.00; Tue, 19 Jul 2022 07:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kohlschutter-com.20210112.gappssmtp.com header.s=20210112 header.b="fFNwbc/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236561AbiGSOUv (ORCPT + 99 others); Tue, 19 Jul 2022 10:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234465AbiGSOU0 (ORCPT ); Tue, 19 Jul 2022 10:20:26 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 422AF62485 for ; Tue, 19 Jul 2022 07:02:03 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id os14so27394661ejb.4 for ; Tue, 19 Jul 2022 07:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kohlschutter-com.20210112.gappssmtp.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=CmdStA6vypQg2oavVstr5dnAYNGqZ+2TKvct0NXz+Ow=; b=fFNwbc/QPVDNUcVntB412v41OF7k/V1xKqaEQxrdm7eVV0MA5iFjkDBYwa7f2Mw5ip HnBQSZJ7a78ZUZaambrut3/CR5pHiulCv93zJm0qLTF2wUPBwwjwEwvFaQeVyHYy7is/ dQtAMcxJ4qPhspOSp4rYcfVd0LdCdL/uA6Xs9uDBaQkvSpyWD1m9DPQbX4KjsPgFkLy9 iIpbWo1qeOE+pxfN2NRiU839DWVX33TkkwCKlDJAq1WrYemKFlHITI37/Ov8iv0j9ID9 c7+T9bBQh7oLJ3xq0f1FS7pJOUbjC1sbLAVVdiiBL+VR4NOUwS4U5dGbrNRCD5d6Wabn BM9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=CmdStA6vypQg2oavVstr5dnAYNGqZ+2TKvct0NXz+Ow=; b=O7ajdGlBcZuEZwIx83XeJwqEXkRSzc2t6tTJRrUzJ02i4AIdvsjS5oxWAHBX94R0Hz LkUBgNHzz/3/HQEIinza2JS5dYiEEVJXn1cJqEaFDC/VMLuugjQZjKNMDpdENinW76lj wYUU4enf5vFjw9E+jAzqOvzqJqWFS1StJvHqpiz4vJaBGo46pgD/Gi8bt4jrayfgh9o3 Zk5DDacjaKqo5dGdXEWia4sKddrIeVpgN84DE11CLx1Yx7rKVoXPFQMAwSRR0ZJd9QoO uH+w0LpyI8cTMSBg9AQTpqaMLnDRuMQbmKB9jKJT+nyAobP+ykNI5HllEZqu+Q2QtoOJ VfIA== X-Gm-Message-State: AJIora+oEnxpuzm6qaOpMpNobECP1t8SQ0L2LGhcE420q0p72Na1PAT2 Yo9rdyLtWAHhTxVU0pzeMoguz3rOEO0scgm0 X-Received: by 2002:a17:906:c7c1:b0:711:d2e9:99d0 with SMTP id dc1-20020a170906c7c100b00711d2e999d0mr30752629ejb.639.1658239321794; Tue, 19 Jul 2022 07:02:01 -0700 (PDT) Received: from smtpclient.apple (ip5b434222.dynamic.kabel-deutschland.de. [91.67.66.34]) by smtp.gmail.com with ESMTPSA id t18-20020a1709067c1200b006febce7081bsm6715986ejo.163.2022.07.19.07.02.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2022 07:02:01 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: [PATCH REBASE] regulator: core: Fix off-on-delay-us for always-on/boot-on regulators From: =?utf-8?Q?Christian_Kohlsch=C3=BCtter?= In-Reply-To: <3270C618-E361-4BC1-B63A-917AE09DA60E@kohlschuetter.com> Date: Tue, 19 Jul 2022 16:02:00 +0200 Cc: Liam Girdwood , linux-kernel Content-Transfer-Encoding: quoted-printable Message-Id: References: <3270C618-E361-4BC1-B63A-917AE09DA60E@kohlschuetter.com> To: Mark Brown X-Mailer: Apple Mail (2.3696.100.31) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=C3=BCtter --- 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 1e54a833f..398c8d6af 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1565,6 +1565,9 @@ static int set_machine_constraints(struct = regulator_dev *rdev) rdev->constraints->always_on =3D true; } + if (rdev->desc->off_on_delay) + rdev->last_off =3D ktime_get(); + /* If the constraints say the regulator should be on at this = point * and we have control then make sure it is enabled. */ @@ -1592,8 +1595,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 =3D ktime_get(); } print_constraints(rdev); --=20 2.36.1