From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F70FC43458 for ; Fri, 3 Jul 2026 14:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H/pY379yEp2lOmdP4C0Z6JIWkDx1GiP2307SZe16gLA=; b=ZkKPZ4ZJOGzTDBBPpERi16+U6y flTOgh/+J0ZQloyI2/dYq7RvQUI6Mi7f/aG55sWw1H7ktOVE8ivvcQronzYMCymnUJVcK3NC3fc54 RYmYgMzNlX6oRuNjn9zIqoRLAydauhzODvoPAzHctgB1mSd1XTdFRd1C5XGl9sYnSchJnkoO0bpDn M1VigRNn20Kn6wvrOlBsIPoELeVmQxAsiLjUTIgsUPHngwBFkJqSL82rRCALAMAu4xlfPwobwnpJO ekhlg8h0fLsckRsi6gMaSZEUmmgPz0il0VQS350diAiLoGhvN7mvGOqIV0lIqFwHHjlZ4pkFSjK5F psBgnPeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wfejl-00000007F0Q-46PY; Fri, 03 Jul 2026 14:19:25 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wfejk-00000007F01-29QU for linux-arm-kernel@lists.infradead.org; Fri, 03 Jul 2026 14:19:24 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 926E660051; Fri, 3 Jul 2026 14:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BD461F000E9; Fri, 3 Jul 2026 14:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783088363; bh=H/pY379yEp2lOmdP4C0Z6JIWkDx1GiP2307SZe16gLA=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=ACuoiLw+PBVIzBrWKvIoNo05VcH7C/YELcrVEvtlUG/0yUjz4zdPeAChwsYJ+wAyW 3Ih4/iNLP2lsr4Bohpo8k8359ISyss15W5oiRjloFjJdYC+frHwNVL3jWntHPeOBzT 3OLnRjs7F2jsRN39p9EIMdAyBfUxv5Bs2sXC+RP7sE4eMLsOg0ws77uZSc51L1XyBe 2/2AqICf+c9XX+VsWMOdi9vRGu3luRtNuRBow2Y/PvSQogmWw3iDlw2L1bwt4VX5dv g/J5/ctC/DxsfdqcT6rosI/zvTtKZakhJjJGKhXVBgX8nnAvHB1r9xGsALjDbZnr0c PsYKnmvhysj9Q== Message-ID: <3e7a26e0-5ba5-4440-acd1-ac9547e1d403@kernel.org> Date: Fri, 3 Jul 2026 16:19:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] soc: apple: Add driver for Apple PMGR misc controls To: Sasha Finkelstein Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Janne Grunau , Hector Martin , Neal Gompa , Rob Herring , Krzysztof Kozlowski References: <20260703-pmgr-misc-v2-0-4b26ba10c5a4@chaosmail.tech> <20260703-pmgr-misc-v2-2-4b26ba10c5a4@chaosmail.tech> Content-Language: en-US From: Sven Peter In-Reply-To: <20260703-pmgr-misc-v2-2-4b26ba10c5a4@chaosmail.tech> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Just a few nits in case you need another version, this otherwise looks good to me On 7/3/26 14:44, Sasha Finkelstein wrote: > From: Hector Martin > > Apple SoCs have PMGR blocks that control a bunch of power-related > features. Besides the existing device power state controls (which are > very uniform and handled by apple-pmgr-pwrstate), we also need to manage > more random registers such as SoC-wide fabric and memory controller > power states, which have a different interface. > > Add a driver for these kitchen sink controls. Right now it implements > fabric and memory controller power state switching on system > standby/s2idle, which saves about 1W of power or so on t60xx platforms. > > Signed-off-by: Hector Martin > Co-developed-by: Sasha Finkelstein > Signed-off-by: Sasha Finkelstein > --- [...] > @@ -0,0 +1,179 @@ > +// SPDX-License-Identifier: GPL-2.0-only OR MIT > +/* > + * Apple SoC PMGR device power state driver > + * > + * Copyright The Asahi Linux Contributors > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include this should be a few lines up to keep the includes in alphabetical order > + > +#define APPLE_CLKGEN_PSTATE 0 > +#define APPLE_CLKGEN_PSTATE_DESIRED GENMASK(3, 0) > + [...] > + > +static void apple_pmgr_sys_dev_set_pstate(struct apple_pmgr_misc *misc, > + enum sys_device dev, bool active) > +{ > + u32 pstate; > + u32 val; > + > + if (!misc->devices[dev].base) > + return; > + > + if (active) > + pstate = misc->devices[dev].active_state; > + else > + pstate = misc->devices[dev].suspend_state; > + > + dev_dbg(misc->dev, "set %d ps to pstate %d\n", dev, pstate); > + > + val = readl_relaxed(misc->devices[dev].base + APPLE_CLKGEN_PSTATE); > + val &= ~APPLE_CLKGEN_PSTATE_DESIRED; > + val |= FIELD_PREP(APPLE_CLKGEN_PSTATE_DESIRED, pstate); > + writel_relaxed(val, misc->devices[dev].base + APPLE_CLKGEN_PSTATE); There's also FIELD_MODIFY now. > +} > + [...] > + > +static const struct apple_pmgr_misc_hw apple_pmgr_misc_hw_t600x = { > + .dev_min_ps = { > + [DEV_FABRIC] = SYS_DEV_PSTATE_SUSPEND, > + [DEV_DCS] = 7, Do we know what 7 means here? would be nice to also have that #defined Either way, Reviewed-by: Sven Peter Best, Sven