Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp112556pxt; Thu, 5 Aug 2021 19:55:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzC6ORQ9OGkSRL/Mb2gWnWuS66HyvWgRpnCbdGLjwbEZwfoneU+IZJ6pCUZErJeQZgmVYm X-Received: by 2002:a05:6402:747:: with SMTP id p7mr10535106edy.114.1628218553693; Thu, 05 Aug 2021 19:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628218553; cv=none; d=google.com; s=arc-20160816; b=cL2flu9ipHKsYhPyMCU+/Z/affprIxsrj9FS0Y4vuQKV2upx++uD9n5RhI+ye1jtU/ wgBLF/PHFx/CjtEb6hLjr6JQ9szUFdNdTe/4mVMx9splJgQaTueZ8DIh4WUIVqpAzyCz YMcGaRj0W9DJQwZOKhT4RWkW3YBDePnsEnhq4VjOCAP2O8T8TNNAN5eeSicQ/WgyAght HTRyrYG94RR/MPGtc+dWsDEp/fL62pKLHC4xHEKYf6XBSlni2hI1aQQLThoaroNn7CqP 47+GVkHdt7rwfur3Qgs7BGeYFgnrVmRmSwZ/mj0xVafGimJaRCBFIMdVJhp/DRS8nxkk oWBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=N4h4dBuDJ4KHxr54fi8jhhcQmz/UXhAg6jZwfPXQ9ec=; b=yDeoMa7g08nxF+nlkjTyhIgWaBfjy+YFhm7k+zF9ZizXRYqqL4nfcWDS8UYKDVUQKX xBf86OVzTFet9C+o5z/uLQPg7Wb5pLdowbn6SxxBTVdbYAE9uh+5qqAosVV+XHU8gP7o WmKkyS3cMsamCrG40/FzIDTUtbox1R2XRjFEpCKgVxuYDaIeOglgWxFScA8rOfUnSEhz 7GJOdlQ/vkVNSpXx+4ndLpy+SIM+F2Fot10fWLwTMiWnRncQIazf+uYRX/tPS5tLErVA O0yEaQGFWWMAw53FuZ3vrvosLUk8cZ8iwZHB6HxRFEMRU7UfppLqelMQYh13kBr55GRU kDWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VO+dEf6B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si7386574edr.98.2021.08.05.19.55.29; Thu, 05 Aug 2021 19:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VO+dEf6B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242087AbhHFBVw (ORCPT + 99 others); Thu, 5 Aug 2021 21:21:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:59122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241839AbhHFBVw (ORCPT ); Thu, 5 Aug 2021 21:21:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0318A61184; Fri, 6 Aug 2021 01:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628212897; bh=N4h4dBuDJ4KHxr54fi8jhhcQmz/UXhAg6jZwfPXQ9ec=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=VO+dEf6Bju4jYaQDGVfD2VqWT3T814WQ4FVXr/tAAc9AOPmM5AF9nv1+bWhMrpsAG ir0QNuvYR49EzzG0yBXKsDT3oAQ8mtjkbXhYa13lsEGTJ3sqEGhKPa+cmFOQm7Uxy0 PTYIarVunY+JfF0qWT+GVAvhaQIaSZvC2d6YaLXtM4Ficjh47T4gJ8Jh5r7QDnDlq4 xImwWvnUt/NejBpa9r2LPzKVZT7nKGkxhubxVshaG+SQrfR+4raXiz0NMSUSbEebsA aUV+x/H0eCzA12y6zKkqN3tpm3Hhpix/DDmmoMQbhAnnBkee06D/Utr+z9XibgnjZV ChfBct1MFfQfQ== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210721224056.3035016-1-bjorn.andersson@linaro.org> References: <20210721224056.3035016-1-bjorn.andersson@linaro.org> Subject: Re: [PATCH v2] clk: qcom: gdsc: Ensure regulator init state matches GDSC state From: Stephen Boyd Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org To: Andy Gross , Bjorn Andersson , Michael Turquette , Mike Tipton , Taniya Das , Vinod Koul Date: Thu, 05 Aug 2021 18:21:35 -0700 Message-ID: <162821289569.19113.17542153894487967394@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Bjorn Andersson (2021-07-21 15:40:56) > As GDSCs are registered and found to be already enabled gdsc_init() > ensures that 1) the kernel state matches the hardware state, and 2) > votable GDSCs are properly enabled from this master as well. >=20 > But as the (optional) supply regulator is enabled deep into > gdsc_toggle_logic(), which is only executed for votable GDSCs the > kernel's state of the regulator might not match the hardware. The > regulator might be automatically turned off if no other users are > present or the next call to gdsc_disable() would cause an unbalanced > regulator_disable(). >=20 > But as the votable case deals with an already enabled GDSC, most of > gdsc_enable() and gdsc_toggle_logic() can be skipped. Reducing it to > just clearing the SW_COLLAPSE_MASK and enabling hardware control allow > us to simply call regulator_enable() in both cases. >=20 > The enablement of hardware control seems to be an independent property > from the GDSC being enabled, so this is moved outside that conditional > segment. >=20 > Lastly, as the propagation of ALWAY_ON to GENPD_FLAG_ALWAYS_ON needs to > happen regardless of the initial state this is grouped together with the > other sc->pd updates at the end of the function. >=20 > Cc: stable@vger.kernel.org > Fixes: 37416e554961 ("clk: qcom: gdsc: Handle GDSC regulator supplies") > Signed-off-by: Bjorn Andersson > --- Applied to clk-fixes