Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Peter <sven@kernel.org>
To: Sasha Finkelstein <k@chaosmail.tech>
Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Conor Dooley <conor+dt@kernel.org>, Janne Grunau <j@jannau.net>,
	Hector Martin <marcan@marcan.st>, Neal Gompa <neal@gompa.dev>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>
Subject: Re: [PATCH v2 2/3] soc: apple: Add driver for Apple PMGR misc controls
Date: Fri, 3 Jul 2026 16:19:19 +0200	[thread overview]
Message-ID: <3e7a26e0-5ba5-4440-acd1-ac9547e1d403@kernel.org> (raw)
In-Reply-To: <20260703-pmgr-misc-v2-2-4b26ba10c5a4@chaosmail.tech>

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 <marcan@marcan.st>
>
> 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 <marcan@marcan.st>
> Co-developed-by: Sasha Finkelstein <k@chaosmail.tech>
> Signed-off-by: Sasha Finkelstein <k@chaosmail.tech>
> ---

[...]

> @@ -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 <linux/bitops.h>
> +#include <linux/bitfield.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/module.h>
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 <sven@kernel.org>


Best,


Sven





  reply	other threads:[~2026-07-03 14:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 12:44 [PATCH v2 0/3] soc: apple: Add "PMGR misc" power controls driver Sasha Finkelstein
2026-07-03 12:44 ` [PATCH v2 1/3] dt-bindings: soc: apple: Add Apple PMGR misc controls Sasha Finkelstein
2026-07-03 16:19   ` Conor Dooley
2026-07-03 12:44 ` [PATCH v2 2/3] soc: apple: Add driver for " Sasha Finkelstein
2026-07-03 14:19   ` Sven Peter [this message]
2026-07-03 14:26     ` Sasha Finkelstein
2026-07-03 12:44 ` [PATCH v2 3/3] arm64: dts: apple: Add pmgr-misc nodes to t60xx Sasha Finkelstein
2026-07-03 14:20   ` Sven Peter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e7a26e0-5ba5-4440-acd1-ac9547e1d403@kernel.org \
    --to=sven@kernel.org \
    --cc=asahi@lists.linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=j@jannau.net \
    --cc=k@chaosmail.tech \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=neal@gompa.dev \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox