Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp14829035rwb; Mon, 28 Nov 2022 05:29:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+oq8h9dhZVhvcjYKMzYlEDlyAqxTjnTxCMfXxyVn2sI106hUErnnVwcbdVlvVsjwWnH8E X-Received: by 2002:a17:902:ec04:b0:189:8c37:6f17 with SMTP id l4-20020a170902ec0400b001898c376f17mr4688306pld.67.1669642144485; Mon, 28 Nov 2022 05:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669642144; cv=none; d=google.com; s=arc-20160816; b=x764t3fOvyDd8fc3S54jopotzwCguY3tFlo4zhvTWYRUp5RNbI9wfEWUaNxUkEdQgQ +b73NFQR3YSL7tzGOPUikJlNgLUFWDntMm/2RRwJoegyjD42W+UoNxZ1NuYZVg2jqHut 4AoUn+K4DB/1koMjcYYGRjx5g0xuoH1hJhUipO9e8q7pHObZb4kgsgTwitMAGyonDHfP j6xHBplhJmdCHw5jgZwGtdHrep/Xr2OAj4F34LYdWldsMCEZbF/pPYok7f2YuuhqSE5j nA45Thb1vp+RjgsE7fjDVahyT6ysO7UiBnLhhnlxCn5/mZHihLpVeNnfMDyV9n84i92A hiOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EaYc9l1eTsAr3aQUHMri3l5fBK3QFcN6nsbnDD1bLlM=; b=T1RBX26mY1g3LEdzRyGsR4AqJSzZTquhRQLlmlLE9INBkK+I60kualcCAd4TGZUoyA yu9hRFkj+s4PAUUCB+8MroLM4SeYluX461yze8dL17mN7kA567T2VZm1syyxsLEfiD+H QtYJ96LTvbzoTebyVQ+gqhWdH1u8vIqWquLZVrK6HDDVbUMqGXGgie3LYp7AeoPC93lk TDvIECqAkCr7QKrvMHaHSnnV3Uh9ov9v7lKyn3qOuFyE3bTJCnbSriYv7xP5Oy4tYVjk sMzcd3sYfmD/biGZDI/Lye/Z250dXpHZUiYQ+NkAkVBpx2odfgGySCYwnS9kAWMWwrp0 yqyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=P4XVKazW; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a17090a521200b0021871478f6esi10699188pjh.85.2022.11.28.05.28.51; Mon, 28 Nov 2022 05:29:04 -0800 (PST) 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=@marcan.st header.s=default header.b=P4XVKazW; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231171AbiK1Mmy (ORCPT + 84 others); Mon, 28 Nov 2022 07:42:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbiK1Mmw (ORCPT ); Mon, 28 Nov 2022 07:42:52 -0500 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA70640E; Mon, 28 Nov 2022 04:42:50 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sendonly@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 6AEFE41E2F; Mon, 28 Nov 2022 12:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1669639368; bh=1dxnUSDEvKYeE43lav3OHIW+vuIWNs74+BJaO5X2HgQ=; h=From:To:Cc:Subject:Date; b=P4XVKazWMVlXvD9Tnwcyve+7orDds3+LiOth/HZyYvEjUwhHG4HruZbvpTjOddcZv kT8+YDbhlibU6tOsK9rKanIrqhSsi6yhUDYtiJ6m9su7Vdd5Mte1VSehKFXNeuXf9x gDVMrO9Nnky1jGWX0L8Ltjmcuol2EHIzTHqnFW6rXSUD04kaaDPeUGjmQJq5BYp5K/ nA79B1Tjsy9oVpPQm+9uGeK0daUbwkGtBZq5208n6R+zXKi/ROYdb7pZi2auQ7GHn/ DFsypPJW3yA7XXBFsrP6bjaiI9hv0CgDkYotzXyO5bfXYqbIxXhro7aY0ItPb/y2q2 OznqIDvV6IMPg== From: Hector Martin To: "Rafael J. Wysocki" , Viresh Kumar , Matthias Brugger Cc: Hector Martin , Sven Peter , Alyssa Rosenzweig , Rob Herring , Krzysztof Kozlowski , Stephen Boyd , Ulf Hansson , Marc Zyngier , Mark Kettenis , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 0/4] Apple SoC cpufreq driver Date: Mon, 28 Nov 2022 21:42:12 +0900 Message-Id: <20221128124216.13477-1-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hi folks, Here's v4 of the cpufreq driver for Apple SoCs. v4 just incorporates minor review feedback changes from v3, and no functional changes. Once reviewed, please merge #3 via the cpufreq tree, and we'll take care of #1,#2,#4 via the asahi-soc tree. This lets us merge the DT changes in the same cycle without blocking on the binding coming in via the cpufreq tree first. This version takes a page from both v1 and v2, keeping the dedicated cpufreq style (instead of pretending to be a clock controller) but using dedicated DT nodes for each cluster, which accurately represents the hardware. In particular, this makes supporting t6002 (M1 Ultra) a lot more reasonable on the DT side. This version also switches to the standard performance-domains binding, so we don't need any more vendor-specific properties. In order to support this, I had to make the performance-domains parsing code more generic. This required a minor change to the only consumer (mediatek-cpufreq-hw). The Linux driver probes based on platform compatible, and then attempts to locate the cluster nodes by following the performance-domains links from CPU nodes (this will then fail for any incompatible nodes, e.g. if a future SoC needs a new compatible and can't fall back). This approach was suggested by robh as the right way to handle the impedance mismatch between the hardware, which has separate controllers per cluster, and the Linux model where there can only be one CPUFreq driver instance. Functionality-wise, there are no significant changes from v2. The only notable difference is support for t8112 (M2). This works largely the same as the other SoCs, but they ran out of bits in the current PState register, so that needs a SoC-specific quirk. Since that register is not used by macOS (it was discovered experimentally) and is not critical for functionality (it just allows accurately reporting the current frequency to userspace, given boost clock limitations), I've decided to only use it when a SoC-specific compatible is present. The default fallback code will simply report the requested frequency as actual. I expect this will work for future SoCs. Hector Martin (4): MAINTAINERS: Add entries for Apple SoC cpufreq driver dt-bindings: cpufreq: apple,soc-cpufreq: Add binding for Apple SoC cpufreq cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states arm64: dts: apple: Add CPU topology & cpufreq nodes for t8103 .../cpufreq/apple,cluster-cpufreq.yaml | 117 ++++++ MAINTAINERS | 2 + arch/arm64/boot/dts/apple/t8103.dtsi | 204 +++++++++- drivers/cpufreq/Kconfig.arm | 9 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/apple-soc-cpufreq.c | 352 ++++++++++++++++++ drivers/cpufreq/cpufreq-dt-platdev.c | 2 + 7 files changed, 677 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml create mode 100644 drivers/cpufreq/apple-soc-cpufreq.c -- 2.35.1