From patchwork Thu Dec 12 07:03:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904754 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8C8D2054E6; Thu, 12 Dec 2024 07:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987085; cv=none; b=ASOEA4cp7Mwkvt9yLKW3bYOm08aJXVAAtM6tV5+3PwIKFFB2YgTMB/nUOlkZ0nw/9QiKseCH5AKW/6dPNDxtoEqiH6hL3y1RVIGD+6qglPv6CsXNBHUNJ5oVLJlp+27fnz8ch4pcdZNHr+rvujQU4XFlNJpt4/pLdoD9gaUGb08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987085; c=relaxed/simple; bh=Z0UJoK+JMHqXLXGpFMKhOQr6LnXF7afe9z5eb1Hv2yo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sYdso/PDrF0pG10JndZL8+A5plkUPgZrVGE1vjE8qsT2RJtpW8VRu6b4KuAbSqpQJ69YMsYNtwrGdgrY5A3RZ5cxUuN4+scx4+yq3bHa3O2U+hij63z5bFmjynq+WimW7mMW6WES0znFjtm6Qsr0vBbG5htgcRFp7TCEO5VTxfI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k8ogm8QC; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k8ogm8QC" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-725abf74334so219081b3a.3; Wed, 11 Dec 2024 23:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987083; x=1734591883; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iUHH+eJbCiMl2j2oN03m6Q26pa8Tho3uZPMyt8IDCBg=; b=k8ogm8QCj0Cua5i6CkZ2FYDRRu4VUk6LA2MI7I/5wROHr1fa8wosjR4VyaXR/WR7FK NU1vgaaAzmxHmk8RrzSxFnYawWIhLwcanCvXnOw0srReu8TzihhJru14JMsbnUpxiTYH JRPHCWHHIGhwvp3+fjQe121GY472Ns8jLztpARCteooGB+JcyHMs0fSy4BOSLhMKHFvY +jkdUbXJBTuunqfO4ED6Vnh+U2FtZ/y9k6004cNONjGMB73iftCZU5YhIcQf+vqMmgVz QAShPBEW5UUsQlFO4lZWV0YfKgXi3WaFmzyrZlndEArEyf0OwUdrzWyWnZs1yxBiQX4w KpQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987083; x=1734591883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iUHH+eJbCiMl2j2oN03m6Q26pa8Tho3uZPMyt8IDCBg=; b=v66KLmLtNumqDIdszYUZQHLqN5ZIX4fgNatsPWHA9ggvOU5drqTXTiRsGPih37PT3b 0KrihfiS0S5B5s2Ap5LM716SH+Sps3NosPAKxY4xy6ABgRqMD7VKQs6FOpuizNSVUmuv oVR52Sdjn5Za1iSVYlTYJOLPf74i2qJABMKajDqmkR4jGMKIfcf9kTzB7fwCuta4psah lULU2extzWOzgPxtONrTG1iEQuGb6eAIxNSon1np9aevDCPtHM2Zeaeru5+myKQ/DK1c SKj+qnbXRMkguyFNp3cAI1rzrR1wRvZ+qzuFA5zVAx5Na5wcTCvhOJrgBfWN8iUUTLT2 z/0A== X-Forwarded-Encrypted: i=1; AJvYcCUCVVdALxO4IQUCpByaE+0RcJy25T89+JD23+OW3Gy7F6xxJKnVRZjdYnCL2nxNzNUPZNi8h8rYabFV@vger.kernel.org, AJvYcCWrKV2sPhtnWf5CuKLsofSLFi3iMM1iSB+tIloolH7mdzjvHg/aGeJEX98/refZwyZug4+5xX4nCCC1K35Z@vger.kernel.org, AJvYcCX2uxpt5SP4OnDe276aAzg7J+K4EpXicACr2k26dd5a8nX/gPzX5FualC61AkTx6FpA600wDnMoT78=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1gCZlNy1Jnnqo9tGRjjkJ8PtWFmmDNALOxGOXzmtoLWc5f8uQ IlI4tRGWoTH+TEW7FquYxSlNujYKKQcaBRjY+eJG7C6Bxqle8VqQ X-Gm-Gg: ASbGncseq7C4GCmAdUeoVl0xmpTLdRgVc9KSajzZBeXVOw4O2tjrkU69OWI8ni6Y//d zG3f/2Qhlx62e5oB/3ezCrHFBBnIA6PVz4SJW4BwcfNGKWWKesXjdtrEF7qhR6tkw2TVSDBkuSg ucEpSEb8dP3v9Rjx4c4QO34hHfVs7blMOZRNkod2U7naLIqdNJ68R+WdUhCmvjLCNJ10+1KbAST Cv4ak+U3nflipqUehK28/c2FqiW+5nEyEKGTpFM6aJ/27/bbFBKSYXZP+MsZB2RmIg99lxJ X-Google-Smtp-Source: AGHT+IGtN/4wOi7l9DheFzbvnmhfw8j2aOU+HkhGN2Yp/3Yo0IKmhXbzVUwwdn6N9+FFWNTL8LZBlw== X-Received: by 2002:a05:6a00:464f:b0:728:e196:b5b5 with SMTP id d2e1a72fcca58-728faad31f3mr3605642b3a.20.1733987082812; Wed, 11 Dec 2024 23:04:42 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:42 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 1/7] dt-bindings: cpufreq: apple,cluster-cpufreq: Add A7-A11, T2 compatibles Date: Thu, 12 Dec 2024 15:03:00 +0800 Message-ID: <20241212070344.3858-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add compatibles for Apple A7-A11, T2 SoCs. Apple A7, A8, A8X gets the per-SoC compatible and the A7 "apple,s5l8960x-cluster-cpufreq" compatible. Apple A9, A9X, A10, A10X, T2, A11 gets the per-SoC compatible, M1 "apple,t8103-cluster-cpufreq" compatible, then the "apple,cluster-cpufreq" fallback compatible. Signed-off-by: Nick Chan Acked-by: Krzysztof Kozlowski --- .../bindings/cpufreq/apple,cluster-cpufreq.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml b/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml index 76cb9726660e..896276b8c6bb 100644 --- a/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml +++ b/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml @@ -24,9 +24,17 @@ properties: - apple,t8112-cluster-cpufreq - const: apple,cluster-cpufreq - items: - - const: apple,t6000-cluster-cpufreq + - enum: + - apple,s8000-cluster-cpufreq + - apple,t8010-cluster-cpufreq + - apple,t8015-cluster-cpufreq + - apple,t6000-cluster-cpufreq - const: apple,t8103-cluster-cpufreq - const: apple,cluster-cpufreq + - items: + - const: apple,t7000-cluster-cpufreq + - const: apple,s5l8960x-cluster-cpufreq + - const: apple,s5l8960x-cluster-cpufreq reg: maxItems: 1 From patchwork Thu Dec 12 07:03:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904755 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F232E205510; Thu, 12 Dec 2024 07:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987089; cv=none; b=G9l0SBjKg/seFgX+wPgUWmm7Wq9CpFpH1M5stL81z2wFFSl8K48jU8U0W8jNsMk1TpqrDtQ6xzSy7eSHF6+ttDXQjeoLfuXtuxOob6UkDl1iiA+ArBLAkyBgxd5ionqlnyRJ2puhfSX6r+qsYgaufJvpASUZHfTL1AWLVbRPGws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987089; c=relaxed/simple; bh=BuOxgI2CbOrK9Hxnatsu8Mn/4pRiwpGqt9d6S48h8hA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iFsoKh959l86ElTBlnGrNDOTLEqvmJF2qw0/bpYfqh8xLPwkaYkq+7Q4rOxO3RGVeykWidSl/3Lfl8sti+w6wCQMkMA21V78yxiDYlwohA+tkTZlWLXFxwcZIhBAEVT7SL/rNHgPeuLbokX3XvkNgAQLfB+LMmVbyF/mkEd1dMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cQs9Thfp; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cQs9Thfp" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-728e1799d95so327185b3a.2; Wed, 11 Dec 2024 23:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987087; x=1734591887; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M0xMWNhFbRFrvmQCRSO20OEZKspqHRsl+17s4y7Ifdg=; b=cQs9ThfpdPkEn4kolxgp+dIRgFztCbOBUR+hcyWOYdiczJNvPhQbQQG1lp2gCpt+uy 1+MMTgfhDH/NtJxxJql4Z+bjbsKu+qV096fAcnU/HaYvGNqIuN1aIE2Dx2AKcdbmHHU7 WmQWUExHwRtJkNcjzZFuiOZ4+b0bnZ5UJEZZfycn9BlX8/Nh0h2kuWcOsu4UhsakjEx1 SdFystBIaJx0D/WBn8NVesPBfGuII2tTVmbobC/JL81rljlTFF2QEX063FzR5YHyQhdF SFIZSt3uA9Q75HQhVPRb8ZYufeoFLuPjfvqeVc8PnoBdTkmstvufNJx0KWsAgL0JNdt9 5wBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987087; x=1734591887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M0xMWNhFbRFrvmQCRSO20OEZKspqHRsl+17s4y7Ifdg=; b=i/Ho7bS3wjoFZGuZ7OS+uAgtfr1CQH+nzpc7+IBomn2K1w58g+NV1hpDh07yseuc7e nwQEGkdKB3qVZYdp2lO7X2mswogy/8dsiECCfb0t7pBAXZ9kvDQ2BA0s/kBj1YvN5jlc wHeeSunLrcHFfvLEsT5zG1BJChfBfect0cCX5W5fSjyU3aVz8fQDajOlTv+76STB3WH/ 3/CrTu5eJQJGXayleB+tV4d8Ao0LlwFp+u1UIXWfzFiimnMgSeBuenaB5f6SoVxPgHSv hXDlgumXpSJHFf6HmbrgpIW3W3sB/CrLvDtn5+j6A/jD5WKWobKJfhkwnxt6K5mxUyx7 SNyA== X-Forwarded-Encrypted: i=1; AJvYcCWXGW4ytWAmue40C22B50iNZWour/EsM1Kfv/fsqvv7ApiE8eG0/jdPUQJ5K0vxqecZXszEZhm0baeMpZDO@vger.kernel.org, AJvYcCX0oV5sprUKdM3Dfbz2Fdfx+BGwmOg3dBrz7azTqqKysKFG5F7qucBuUMCL0LHd4mRR+coU5tFuhKI=@vger.kernel.org, AJvYcCXW3QytMlJeTCJ2xEUDuZnwm74EAvlV4w0qlLjz4+Cz+OsWlWL1devELKS5/NeHRzqnjdeBgaPTC07/@vger.kernel.org X-Gm-Message-State: AOJu0YzOO9DQFKdSGC/oZoBxXoBLVD8GrPxAYoOfgO9COaOwpGRRDuEw jORW2NVVtI1Tz/FVEM66RT/if8FKh+sJT87tYKnbqKWSuviUjiiR X-Gm-Gg: ASbGncs+PHKXXEOXZvuK9mVhDspmHKy84dl+u+OkLee3swJib+oVbZOzGVXtqtPCnIi tS96G/YXDIfIZ45/07WrDQRiSfotSeoaDIJpqb1inUbB3CI82YPJUBJSRn/pfP8dohmoNRVSm9P trHf2El1c9sKovPc/JbOM3oB8yKn/A9O+kd4DCjM1kKEzk0tKXUDtaQJvCMIkXGUDbp4SyAuMXq t/vNi2VBVjnWPYz6ff7CXy0tviZA9ksnSy2uXCkV07csp8cJpRm3tAiNx+awnfyA6f8r+Ab X-Google-Smtp-Source: AGHT+IGvBAQXtMRTleyDW6x3HzSYF2eqnBC5Rmkc6964KlaHxGxL1kuAEnMzaZToFmlebupGFAzwyQ== X-Received: by 2002:a05:6a00:999:b0:727:3cd0:112b with SMTP id d2e1a72fcca58-728fa9e5e39mr3210909b3a.9.1733987087085; Wed, 11 Dec 2024 23:04:47 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:46 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 2/7] cpufreq: apple-soc: Drop setting the PS2 field on M2+ Date: Thu, 12 Dec 2024 15:03:01 +0800 Message-ID: <20241212070344.3858-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Hector Martin Newer device do not use this. It is not known what this field does, but change the behavior to be same as macOS to be safe. Signed-off-by: Hector Martin Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 4dcacab9b4bf..ad6c7b8f290c 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -25,7 +25,7 @@ #define APPLE_DVFS_CMD 0x20 #define APPLE_DVFS_CMD_BUSY BIT(31) #define APPLE_DVFS_CMD_SET BIT(25) -#define APPLE_DVFS_CMD_PS2 GENMASK(16, 12) +#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) #define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) /* Same timebase as CPU counter (24MHz) */ @@ -55,6 +55,7 @@ #define APPLE_DVFS_TRANSITION_TIMEOUT 100 struct apple_soc_cpufreq_info { + bool has_ps2; u64 max_pstate; u64 cur_pstate_mask; u64 cur_pstate_shift; @@ -69,18 +70,21 @@ struct apple_cpu_priv { static struct cpufreq_driver apple_soc_cpufreq_driver; static const struct apple_soc_cpufreq_info soc_t8103_info = { + .has_ps2 = true, .max_pstate = 15, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8103, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103, }; static const struct apple_soc_cpufreq_info soc_t8112_info = { + .has_ps2 = false, .max_pstate = 31, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8112, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8112, }; static const struct apple_soc_cpufreq_info soc_default_info = { + .has_ps2 = false, .max_pstate = 15, .cur_pstate_mask = 0, /* fallback */ }; @@ -148,9 +152,12 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy, return -EIO; } - reg &= ~(APPLE_DVFS_CMD_PS1 | APPLE_DVFS_CMD_PS2); + reg &= ~APPLE_DVFS_CMD_PS1; reg |= FIELD_PREP(APPLE_DVFS_CMD_PS1, pstate); - reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate); + if (priv->info->has_ps2) { + reg &= ~APPLE_DVFS_CMD_PS2; + reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate); + } reg |= APPLE_DVFS_CMD_SET; writeq_relaxed(reg, priv->reg_base + APPLE_DVFS_CMD); From patchwork Thu Dec 12 07:03:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904756 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2264205AA5; Thu, 12 Dec 2024 07:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987092; cv=none; b=RfpnNljJmNyoA9d2ehrMTh8Ffre9k2laSW1VwraDB4koeSQPGrY0jOnm00SDJmdminPtq2V+4MAEzhKdzWi7uKWZXS4LI9QCh+JPt8YUmyzH3xiDqRSxB+E86+nl3HMmVOw9Q7CvBYfc5Z5cwSv8wycpuAxFL5ienW35O0+4ob0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987092; c=relaxed/simple; bh=RgXy7GQICkh4yaDvFbIaxUPIIfKur6XP15eVhbM+Yts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WmASvf0mHUlPevKa2exVM/jsuX04m4Rj8kvlVbiFwJOdk8yIVCqMs1X0LWR0pgkyUvejxY7uuUrrouVV/y50iR90Zbz5j29WMYNI72Gq6iPg05TUWcwOpXRrYQ9ll1WqsSqaTVybyebBSC3zfyVlbZ8Vlb1mJQa2SWYV7Hf04Fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cb5i0gH6; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cb5i0gH6" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-7e6d04f74faso195019a12.1; Wed, 11 Dec 2024 23:04:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987090; x=1734591890; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F1XYVqROmegnfGFhPLcLWSN8f1mP3yklImJht3PHB8s=; b=cb5i0gH687AjCsfRtf9MbTPGwbzcfyYt5zJl3SgkqHlViWOyLdizKoZdTbshNNCT3R V/saMAObIc+or2/lXRRvFsVyufNV9X5Zj+P+F/sT5sgP6OxBGYBqY4TNmXgfBaPjVPhf bFPcMR43ubkaFpxGBNxm0+dTAqcUkiZt+YSmxIu8wp+f7Ml+9M/gl3yhqh1aNu34C82G iH3y3+wibia0oOr+wKa0FtJtG3yfX3ChmYpfGRF7DtV7mqcxYExs6bzd5JmpJWbGR1fd O3CkzadWjALDq3s6xRbQdumq+fbPwMTdi2Zc7vsWvSvSd83s2IrWLXXyzKfhSOdRNSnK BMFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987090; x=1734591890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F1XYVqROmegnfGFhPLcLWSN8f1mP3yklImJht3PHB8s=; b=leMuvPllExTxcFblvT/hNglTEvrH2f24Kj8NbE2F8D5KQ7qxl/g+UzBLsIZLKl3wqv j7CDFmzPloTN0D0EOVw7zHAOyE0Uch1D153zhPg/aFzP8ox+0yv3j8s2OUxrffrhvvrr epYl2OQ9XSweAc8tehTPMLM9YhlEzg+8LGcGuHwx/E9XNSSIZ3E6frVQwEWCRLOq6NKJ Uq58iy2hPkJOSBtaOjSyeactoN1ypqcNMJZO2jB5rdJJiWFWmrrwiwWbMeV+5jwMMorw MpoZaUYo0QbHAF4QyWflnUZayW97eJnEfJiKOoed+HFWd+dEmwp22/KBjsiPeXsZGug+ QgiQ== X-Forwarded-Encrypted: i=1; AJvYcCUDoIs7W3VQ2DBzLA4flby+Nj4vpdnCwOZeig5wLoVrMT6QnTKlfcoOJ8nFARnXwnRndgdJsyBOR52wktsM@vger.kernel.org, AJvYcCXAHOUw3XR65JxMTpiw1zxNY8l83l1991g5OkzN7CsF1cHIUXI3Gyv3rNrroIsti9hG7X+s75jlB4Y=@vger.kernel.org, AJvYcCXvDM6MCNgmuAQvXdXv4yG7F5fMFnb6Uyt+lVJqavxdFOPE7kYMhkfy1B56TsNYAl3nNqbEIyLqjrsP@vger.kernel.org X-Gm-Message-State: AOJu0Yyo/69gz3RNXK0NCjQZ9gkwztSB6PWgidyvxNgCpIfriOQl6fXu PCOG4ulTnthi5txFYu5TF+YeegDCFgKl9jPNguCb4DvFw9Qfa5b9ubflMToS X-Gm-Gg: ASbGncvtJoPqHEio5A/khJCVAHwTwl4Nl7tq0d+xNzGlQpruB69OE0KiIwnjc/uQs5z cCHuFDfiqeUQzAhth0IpKaPn352tnQ8EsuWL3JvpjJ1B4luwmPYm6Dqh4UTllizvTgWZew8yItI 7iTQEZyntk5+Jocbx9NkXpujtYCyQo0lPA1mtLv19OuQD7XdNbrtNDmw73b934rVzFC5l4oAZjJ lVrfEpJsbJFV6NLBNu4Q22wM79FWwr5McwML++FQMRyXlAYsGFn67JCZ6RJ+HoL9LnP7OjT X-Google-Smtp-Source: AGHT+IGD5L0XY10ir8ZWn31kZESh8+9pkRmRaTucZ22hPfqRxTf/NOnmFpSI0fmwVeu1XXmMvpKLow== X-Received: by 2002:a05:6a20:d98:b0:1e1:b0e8:11dc with SMTP id adf61e73a8af0-1e1cefbb8b9mr3506448637.21.1733987090125; Wed, 11 Dec 2024 23:04:50 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:49 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 3/7] cpufreq: apple-soc: Allow per-SoC configuration of APPLE_DVFS_CMD_PS1 Date: Thu, 12 Dec 2024 15:03:02 +0800 Message-ID: <20241212070344.3858-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Support for SoC that has a different APPLE_DVFS_CMD_PS1 will be added soon, so modify the driver first to allow it to be configured per-SoC. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index ad6c7b8f290c..90e34105b50b 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -27,6 +27,7 @@ #define APPLE_DVFS_CMD_SET BIT(25) #define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) #define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) +#define APPLE_DVFS_CMD_PS1_SHIFT 0 /* Same timebase as CPU counter (24MHz) */ #define APPLE_DVFS_LAST_CHG_TIME 0x38 @@ -59,6 +60,8 @@ struct apple_soc_cpufreq_info { u64 max_pstate; u64 cur_pstate_mask; u64 cur_pstate_shift; + u64 ps1_mask; + u64 ps1_shift; }; struct apple_cpu_priv { @@ -74,6 +77,8 @@ static const struct apple_soc_cpufreq_info soc_t8103_info = { .max_pstate = 15, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8103, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103, + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; static const struct apple_soc_cpufreq_info soc_t8112_info = { @@ -81,12 +86,16 @@ static const struct apple_soc_cpufreq_info soc_t8112_info = { .max_pstate = 31, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8112, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8112, + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; static const struct apple_soc_cpufreq_info soc_default_info = { .has_ps2 = false, .max_pstate = 15, .cur_pstate_mask = 0, /* fallback */ + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; static const struct of_device_id apple_soc_cpufreq_of_match[] __maybe_unused = { @@ -152,8 +161,8 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy, return -EIO; } - reg &= ~APPLE_DVFS_CMD_PS1; - reg |= FIELD_PREP(APPLE_DVFS_CMD_PS1, pstate); + reg &= ~priv->info->ps1_mask; + reg |= pstate << priv->info->ps1_shift; if (priv->info->has_ps2) { reg &= ~APPLE_DVFS_CMD_PS2; reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate); From patchwork Thu Dec 12 07:03:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904757 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9207205ACF; Thu, 12 Dec 2024 07:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987095; cv=none; b=Uty/TryGCwEXCUA6uS+M/zOGn3zI5xQcOhORHONpuX+eyOtAIYaWjHzBI/8FCpMYwPwoHa0IhqQCi5L5ej1kGj5e7XuR7QKhy6y5g3vm3A2kzTE4R8IkPEN9g6kAKno5+6ZsOW0wMTThoTmamb2PoPyKyLcPolEfB1i/4kxNd9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987095; c=relaxed/simple; bh=xZAYewJHUZWNR4AiiFT7ZCFsiAmElXgtdpZlXkHdURc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OZ/GnWvnQlds38IAxBgfbUG49Seq6kLHCXYlCqfySDyn1ZR+Ua1nK+7JXVPzwCG35IqRQ3xBmWOOgrwISYAQfrZfPXDoauR7gVGEku8rFcGyorTMG6rF9I6yYMcFczCLEq3LJL3bBmRdgxzX1KPK6fRWmQpngeMTZjaLHBiEDT0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bqmtqtpd; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bqmtqtpd" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-725f2f79ed9so202701b3a.2; Wed, 11 Dec 2024 23:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987093; x=1734591893; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WbzFAeUuXXanJwe/RhcZGcox5IaVXp9hGHM//yffMwQ=; b=BqmtqtpdBm2wiLsk0hCyF6emLX+xT254gVJDSSzRB3g0BzhjDB4MdKvypvSO/4AMpQ ODiJ6gukVifGKxQyPIYnFfMg09d/jjYu05b3NhQgU5uc6INbJ16AKC/aB6RD8QmsvxOj uimapykIYm05rpXKBZ+i0xgA8/uGNOVdmDfpbOueA3VceEZEU721HftvbH/yrRJFRWKv Cdvt8gwZ70QPNeAfIJ+uWxpqrk622gWpWewZQQBTxqHZRX1mhSIQhuyeeu5UQU6Y2cVA CIM1LIpGeu/m/n+DoITvcvUKkUJCFKo0XBg6g9BJq6ANlXFYr7O/FJILoT9fBFRuBE9E WA7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987093; x=1734591893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WbzFAeUuXXanJwe/RhcZGcox5IaVXp9hGHM//yffMwQ=; b=JfFsFj8W3u5+4KBMrEuk0gcOL1NeRcmUfUVDxBOYB4YbytXwTp7tkvsSEIxTweoPor 6sShOd20IZk35543V0/VQ48TXNpgbS3KDgmgQ5KxgxqQ7uzf1/eH/m5nd3+UTAfGhWDQ SDhRbyWqw0O4K8AY55+ZqhpZPeH7qov9Dx+mqj2D2s51E2nOJ1MaKGWoRJcJo4lSsd1t mt4v2J40xkgeTKieZ3z5YsvHZCh2IUhcyEThEMS2fRFo17ySu/cEKSXBCIRzwuG9JzzT ifwrDG5rJsHGfnJr/ZboDVL1XrxZA57idy44/YvqCFWPDg9axPFmxImm4lCSgc57pfUi T6lQ== X-Forwarded-Encrypted: i=1; AJvYcCU4Y9b08ub0U3oDTAPa+vkCFsCf3c8GWRh7ZAZWslh1VeXwYpcWXCCglEckBFM1Yhx1wBLD9QZgRnOP2akC@vger.kernel.org, AJvYcCUu/UfTGyriShFheY2SvvVYlautLZvo7HW7+V3eF6yAbl736io5B4ELE4E4/7s2engTn9FHCJHKJNg=@vger.kernel.org, AJvYcCXoAV8KK+XyITjwi1RRLoNaCdLEqgHJVVykVjYW9n7OfiEBkTvsuEKAicH5KDuLo4gKzeKd5YQ8LQ5i@vger.kernel.org X-Gm-Message-State: AOJu0YxmmyzDN/0WM9r0rKLQhwuS6RAE7z7HygEEtFW1m2gNQFlHSUww UbP+pOyFF+5Sg5jjtgVUQ0D8TRrxJzaNIkS1SD4+f5niVOlHGN3j X-Gm-Gg: ASbGnctlqvpRw2+/Dl7aUEcoAmhzWbkh18rvfj+91wXyMiDk4owZigCW/W5GQ5AgcoT 7a9JfqGwLYvbDpCD2KCkKiLfLFCtxjbFy1zJ/e7YKaDnD8cuUQOybr9MdEGPIboVBUe9W0hqDpN OwIr0InzsBy/jOjJ8G0htJtORYwfljz8h6/xYKNmJwpptSbxm/vPeehRYya6hHchclYM2A458ou bxCSSi6C97zXNXmkOuGdzqg0WBKYIa+0zW+W+4e8Mtoh/fLNKlcWVuS8jqv7Ghf2y2ciB9L X-Google-Smtp-Source: AGHT+IEmXq444oBwmD5u2gt6hQ4Y1b6qVPA6zh/gRHg0XG/Uu/LCdJJ6Nmc53XVFX072F+jsIRC8gw== X-Received: by 2002:a05:6a00:3e09:b0:725:30f3:67d8 with SMTP id d2e1a72fcca58-728fa87787bmr2990369b3a.0.1733987093085; Wed, 11 Dec 2024 23:04:53 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:52 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 4/7] cpufreq: apple-soc: Use 32-bit read for status register Date: Thu, 12 Dec 2024 15:03:03 +0800 Message-ID: <20241212070344.3858-5-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Apple A7-A9(X) SoCs requires 32-bit reads on the status register. Newer SoCs accepts 32-bit reads on the status register as well. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 90e34105b50b..b27d261fe5a6 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -122,7 +122,7 @@ static unsigned int apple_soc_cpufreq_get_rate(unsigned int cpu) unsigned int pstate; if (priv->info->cur_pstate_mask) { - u64 reg = readq_relaxed(priv->reg_base + APPLE_DVFS_STATUS); + u32 reg = readl_relaxed(priv->reg_base + APPLE_DVFS_STATUS); pstate = (reg & priv->info->cur_pstate_mask) >> priv->info->cur_pstate_shift; } else { From patchwork Thu Dec 12 07:03:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904758 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5411205E1A; Thu, 12 Dec 2024 07:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987098; cv=none; b=an8qbN6u26a+oZRIWVX2rAO49LR2/WfR4YvcNsHzcSuOOE7uP0pPplVgIQCac92wqRmGkol3TATTwmuT76ifV8QH6s3DEsmqAkl3bYz7DQ82amNwTgrBXU8DlAsiiRAswiCcLXK9WFO49wclux4km8Msmf10q/amyc/pnfDO1Hc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987098; c=relaxed/simple; bh=lSmc5lpStkRdh6T2UaHkJlaMrEahYyD8GNIRGOk35wk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Johk3d1fYYmuZ5blQS+wLdmS7lfIyenzIGKeF8alUpYZlnpwWfdyVAJuPOqlnpV/gOpT58314gxgAoFFtmtSJrkprR1uzGhwxw01VQfybYDbcyA33qMJBiFqTvNb5ER2mZhfSoO5EcWKg8eQW1Yuscdpc5KweV4nX2qOXaQ0iBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=K7clhfgZ; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K7clhfgZ" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-7273967f2f0so294215b3a.1; Wed, 11 Dec 2024 23:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987096; x=1734591896; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=11W4ToO5h1HZTorB4p+IfX/arkj3h4R3MbzsYg+yGqg=; b=K7clhfgZbp6azmVflVUJF4GP9TlgdnmHoEg65VE9QzDP8l2yRq6wTm+ivUGKAYNR3R 33Ty0PW6fYoLMoLW6LgkMhepjRUMo0eLdj9XAeMDKpY9+xJzDHMHMZId8kkXHPz9w0tV QbtD4y4emupRm1A8he8GX053UV/+d16cJJYGoK2r7vDD/RoIi7wUMBDIHWveCXpicj5r 9/lH2AdPI6ryQmRW5sJNXTY4N1OH2ptmNIByGvgNoB40m5zNQjrTSBKnsRF62rJekvY3 VhgdebbyOtdkE7bukCSyit/EN3+vTBoGXD/BU+BtduDlPSIc145USUl6tT+s8beabGUA KbHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987096; x=1734591896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=11W4ToO5h1HZTorB4p+IfX/arkj3h4R3MbzsYg+yGqg=; b=Y7iFuMdXqVG5tfHwqmVmoz6T205YBWXo1RssyocjptzcvRTwG2+cutBsmbATAfuGkV 0odncHElmbQUj1S3TIP7Ipr6kH5jaE5ZGEY/olGsboziJjmvjtpRQZqeCAQLJ+mm/iU4 8Eav6cUtX+OzDl2QlWcCC+m79eVPVq00s8FOemoy+njoLjL9n01NXAKgbAZZIINd9Y7n w49UjKz6vQTqUBOuO0uv4aRFadJJceC5K0HawWxMSyOn3ysnZsYZaoj7yGvigZP809BK rU0lCzJEB2W3CJPvMoHZN+D1m4G9nhYUhvi9Qq+UksHDE9F2qttyY9W1NG5y34E0II8v idfQ== X-Forwarded-Encrypted: i=1; AJvYcCUDAyw5LdDt/GMUN2Swb/kIcAqWHp0lKLitNL/yoHb/NnTpOaxfuuJVN39PdNsH/XG6Vml6UDxnStXq@vger.kernel.org, AJvYcCUtwKxZuW36DeBuqThOFgT+kmN0nQKVYicDzGc5Gbi9mGRzmvUU5ct8PJHsJu0BeGN6vu2D0o0bKrw=@vger.kernel.org, AJvYcCVYU68U9gDM2umcwIAv6qNfrp12WHe+6kqyMnpfZ1dOxLPAtUsCbCcgaMFnRuLiK3X7dy0bvymd9xrp92l1@vger.kernel.org X-Gm-Message-State: AOJu0YwSOSsSpTModXwflxSHa4+VCqIWNzCClgBsfi+OXBQ9/4UnEToi /HbCDaOV2UKF9GZKYUPIebh0gzpvwkU/yO9nKz9rX/cuntZJamjYCq05QBAo X-Gm-Gg: ASbGncvxDJgFg85tjrV0CUu19KjhkfXP4zkL9biOD1IZ5szFhGfgSfyF7q6s7laJfFr I86MuJkdDiVArW21VBJDjdJo4koALCtXjzGaDxDQUu1jjwoWKbeq0v2qmUxkKFk3kwQL42yogds VuSbXO3Yc+9FNgXGpFMMFUbjPtNNOyhHUEWRLyFBLAYzSAXmot79e7C7NhGf+TlbhdskFiKvhdE 1w6tmK/XCf0XcUTjC97DZmoaf7pfXEeXBlpQw1wrC+Uhza4ZQJA9GPHm6k1H4MgxSXnFS7b X-Google-Smtp-Source: AGHT+IHKPAp1Y9VHLYOP5k5Lmr6P41gM42/smjErSsBmXsfXGl8fcB/4q3SDqlWrJH5E2MTneTUBEw== X-Received: by 2002:a05:6a00:230a:b0:725:eacf:cfdb with SMTP id d2e1a72fcca58-728faad3a55mr3591696b3a.24.1733987096031; Wed, 11 Dec 2024 23:04:56 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:55 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 5/7] cpufreq: apple-soc: Increase cluster switch timeout to 400us Date: Thu, 12 Dec 2024 15:03:04 +0800 Message-ID: <20241212070344.3858-6-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Apple A11 SoC takes a long time to switch. Maximum switch time observed is 345us, so increase the cluster switch timeout to 400us to be safe. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index b27d261fe5a6..94e57f055a5f 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -53,7 +53,7 @@ #define APPLE_DVFS_PLL_FACTOR_MULT GENMASK(31, 16) #define APPLE_DVFS_PLL_FACTOR_DIV GENMASK(15, 0) -#define APPLE_DVFS_TRANSITION_TIMEOUT 100 +#define APPLE_DVFS_TRANSITION_TIMEOUT 400 struct apple_soc_cpufreq_info { bool has_ps2; From patchwork Thu Dec 12 07:03:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904759 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D83F6206273; Thu, 12 Dec 2024 07:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987101; cv=none; b=MEIw9YKov+/VJBzWzVHF7irj1/2AnKckuIePnLAACzky7LxKhj5YXQI1vOEYq7ZRrdmq0IYN9julOc0chGlMSmDRGpjVEv/9FzyCma3PdZWQBQE8LeZdYWr7OsSQ4GPI836DExg+hVv8K77NfpFqQx6iz1UArKgEZzY2jei+qpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987101; c=relaxed/simple; bh=yE0aQpLH/1FOUdWsRUbN03Tzw84skMe8N0rw7qw0z1U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nk2zs+9qxf0PAC5klaBZEXPkOoJ6ew8AOo75rDVUaiBAjWd7a+FeLCkS0tk970Prmy4xKBeOwGP5zghdIw7PITOI35HjUL1NXFymCEayfMnMBKsIpH9HcKXgGdBD5yodlGV4ADfzpdykF2XETOLhbNtnsN5MbbpCjRItuF/37dU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PsvGrCWO; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PsvGrCWO" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-728e81257bfso220358b3a.2; Wed, 11 Dec 2024 23:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987099; x=1734591899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f+xNT9o8scJSCGD7/hX9myZPXhoesiiISnOX8ftRSxw=; b=PsvGrCWOM+koJ5jtRXUbwVD60HIWVOjTexVje1MaHTCBa/H/rBs+Y2h6b66CkovtA9 8V8PHMYtVLQhinydEhWJahXGIx6EvdwrIZCWxiCh0zXWUN+yOyWmw+zSKDIOVhfVh8O3 26rAxC+ydWgFZzd88bnLjMaPO5e0a6dlIAKE8tHmoDQ0ui3azNzMsuqSoYYI6fD4NsyS nll+/Zl2M1j9XRmcFb4vLt6DXDlF8wYaN8rk10/qUyJGANmp+pUZ1uNnCatjgB5AhtbU b8jwnU8ma5SlJH5GpsCzFELK1XIxvLFgYB2Vv4rAGkIx9yBXcu0TBOcjnNGyOx9wSPD6 BBZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987099; x=1734591899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f+xNT9o8scJSCGD7/hX9myZPXhoesiiISnOX8ftRSxw=; b=N0Jaoy+JiElikkoJ9SOHF6gaYkyu/kHUHQDQgKwcyT2jiiXq0Yv0e8NRa3fuAteVrJ zxFdlD1oAgf6pMpAUXht521c7JpnWLHOsts0uwn7mVpwLeQvzVWDnxvmwGzVyLE6C9Cf tZoNIbtV+hpcdc2k8zyy2SFKsEwGtNQImZaVYk5PubIIGjQxjwqDe/0UyusdkH6Rx2QB RhpQIYaxBa4cTQSvc7TDTkBSs1wEgicmiNGVvP65WetlvaD/m0zsV3AUrWFfUukst9B7 hbdbU36d12NgZkb+IpL5QQjxfciHK9dj0PSd1wMV9+t12IRV3kIQ0TJhUm5m/HPsCQ/7 6yBA== X-Forwarded-Encrypted: i=1; AJvYcCUNegh3j3N/3jvgYautehiaK5txkBiHrmxORu7XahKei7cwpEd+w1k3gX1yH9FAO67kgdem6IyMSD+D@vger.kernel.org, AJvYcCUj2yyhz/3shSi1Wo8AU1NcQucHkYkhkyK22Uzu+/PptBW6QWLBz87uko0g8WerjdWYZymFgvKUAcI=@vger.kernel.org, AJvYcCWjwtSZl5XbbGCQMo7Jbumxxhw5MCaMO15b8G9Wl4qhu7vrdREptCdTLjai3sX1DZ9QeWj/zL1IiKHqK9Kt@vger.kernel.org X-Gm-Message-State: AOJu0YwVcGtriwEfW4g0fRGy6cZZdqJlWHO9H3nJY9fWnL2JWCWxi/xL SfnWEaAs5psJNIGSy2vETiz9gTGULcUqqgt6sAtCh4C+ro+3tDbUyIi2A1qu X-Gm-Gg: ASbGncvVNG2X3RmfCX/GhnI8xAuBw1TyHZWwIwdo3B6q3x4r35Lo1WO/jyU6Sm+I4Eb 649F9Y8HUqIQOCuODiHng6EAnILqiRJr9NBIH4Fc5FUc8x6k+A0eiL4ok4H3JPZHuCQDkVFrGPb uTtwYUE4fRfeR0oLHr1Y9EG875vZhPsQsDg/5LXKz5n58zYABQFbg3rOYz4NOVz61B7Poyi9yws Cpvo1LrkYhrxuDo2Y/Iiy4S8orxzcx8kgVLsDTOKrJWDqs65yONXCEmNAxlJTXLUaXA/U5z X-Google-Smtp-Source: AGHT+IEWZFABNU2cmsx9g4Vfkxtd5tDRV33KNAhW9o7B+oCf+G6xKL0qxxHdO05yjrF+abxzB9dUcw== X-Received: by 2002:a05:6a21:398f:b0:1e1:b12e:edb8 with SMTP id adf61e73a8af0-1e1cebb7f15mr3582956637.30.1733987099042; Wed, 11 Dec 2024 23:04:59 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:58 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 6/7] cpufreq: apple-soc: Set fallback transition latency to APPLE_DVFS_TRANSITION_TIMEOUT Date: Thu, 12 Dec 2024 15:03:05 +0800 Message-ID: <20241212070344.3858-7-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The driver already assumes transitions will not take longer than APPLE_DVFS_TRANSITION_TIMEOUT in apple_soc_cpufreq_set_target(), so it makes little sense to set CPUFREQ_ETERNAL as the transition latency when the transistion latency is not given by the opp-table. Signed-off-by: Nick Chan Reviewed-by: Christian Loehle --- drivers/cpufreq/apple-soc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 94e57f055a5f..c9f31a3653e2 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -291,7 +291,7 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy) transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev); if (!transition_latency) - transition_latency = CPUFREQ_ETERNAL; + transition_latency = APPLE_DVFS_TRANSITION_TIMEOUT * 1000; policy->cpuinfo.transition_latency = transition_latency; policy->dvfs_possible_from_any_cpu = true; From patchwork Thu Dec 12 07:03:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904760 X-Patchwork-Delegate: viresh.linux@gmail.com Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69D6820626E; Thu, 12 Dec 2024 07:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987106; cv=none; b=sYUlVMX7aCZUqSv8hO2yyeQg3y6ixou4Nm8/s2sCfLtccoJ2MmYLm0V6sXGw32W93KynSU8VR7geQvIKX++Cz+bn5MGnqPTWPO2x5feTOaVyRt9+cYNamlHq/Zz3z8GJ/vhuiE1GidbjAAV7icXLjjV2NZoM7yQxbI5WF0UgfJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733987106; c=relaxed/simple; bh=HOAKg6b0eEPy/zF2EuAgJ4CV33fx/jUkVtp0FziM0gI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JlSum3fW+H6L5zY9mtMpRC38AeBcpurgHXj+YckUB+5EBiKpXQz5hj7h8jJnRkvZOhLsG5GwuRPT6dORkZrDAFlVaDL98ZuOte8nRPInLT9UUyoJUS28LKwK12MYLrY0lv9Vl4PqR4+v/pY24bY9z2mZDkPtGncL4Vbjin8lN68= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=amtl6X+q; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="amtl6X+q" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7242f559a9fso325581b3a.1; Wed, 11 Dec 2024 23:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987103; x=1734591903; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R6P537stxvMQqeF6f3roncNxbUVv366ZADaeaxeRSNY=; b=amtl6X+ql2p4T7/GpY+OodH2R0Bz4/VzQnJTiy8rQY3r7wv9aqA0etxs62CgllPQlg VQvxuYtF1DkLOOjhX3ZsvyB6X/vlLCFJb3rgyVazIGruY3WLAWdIe1VRs6EAgqiyQYRs AXFuRhWnkSKfmZj5YiPWQ9glKj3huvo40aPn5DL/WpMOTIBllgZ/5wvKciWXaS+hIUdQ n8I35XsybY2153Gw0XPW/reLM/fCv896dBbRQMrvOi3jYSNeeSL1eNoI+72c2C/nZRmn 7fU/m4BtZR/e1Xb7sN5PB4WDBlEvuxW8RDAZDplLjxM3XnsYwcWL/XL/d6tggfnemfTW LF7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987103; x=1734591903; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R6P537stxvMQqeF6f3roncNxbUVv366ZADaeaxeRSNY=; b=hZ7RpED9QJOrytKjNjfQlnfDJR2lWXpFfqd/jEUQ0aMol48sNNuEXgyai7euNSl0iz mBSIjz/c2lM6XdewmlaHn+5753kIuUU1vudRVJJfm7y5yAOBWkB7F3g/xynEGc8anyNS QOvq84AFMc110oEJ0Th0kjEDW3O+vtqUoC1MHB7/bzjunC7c16J9yVcGNKakOEspV6JT ADdzy0rkd/OBSQH0wbwl6K/pP805/Ft3cYLZGmkCnRA05BuxHinm1VeFbEvdRjrc15ty c/RpZ2yh3mlyQG/pbGo4GPZNm3B4KykBbi+FHfMH79IgiqbZL2jW5Q3E2SAU5dFLljTW r1Ug== X-Forwarded-Encrypted: i=1; AJvYcCU/+/IkAYjE5dZu8aqS8WNw3UOUlpvPV3ljnS5SAWunMFq3I/897G8FXW7RsZgHU3h84sYRSOW1ai8G@vger.kernel.org, AJvYcCUweeHxo+2jsR0lgUjR1guNHj3LUcTQBoIeL/sn9UF+A2Zi1YL7za7rEEN6FjF7H/cBwU+AakA65Hs=@vger.kernel.org, AJvYcCWwKq+1Kaw4Au7vaM7oyVa5Vdj19AfuqEvPpSjU95+39Bw9BdcowTHbU19PqhgCGBt1qhNyoECoL1y6jr45@vger.kernel.org X-Gm-Message-State: AOJu0YyWMgTKRKs0ddufnpgK/+uMVP7BYawoFiT6es9S1b7c7Ko5uJCA JIXaul1Ok7FRMC/JwXDxJt7bSJloKfIXdHUQMw1L3SeSdg9hOtJc X-Gm-Gg: ASbGnctS8LmCGahpqL3l5WiazNThiA4LdNGoWoqo6xp+/CByfY+Mp0Zf2RCvZyKeNpJ W77rchJWNUOvSC0IfuSScc05qHUb+tlo/JpPr+HCvn3P1LQLaH4bRV/V1Sz8C1FIljOvFSZlBzu 3/weHxgrBEEzFokUmvWXg4bQ6G3v+fljcTuLp9mvVqy1x0qLsZhoug1+9Zt4p62glYKrZRAanjT wy8IQYx87wEaIIJ4hvGH7phH87IRx3Us1vrKibn9dhdMRjPYB/iX8aG3soiBFkn5ODpcpLB X-Google-Smtp-Source: AGHT+IGrdOYxBGn8CzjzAjnMQjSdYYWqQKbTysuxC6esT4QB5BXv4xEumBLxne4E9WmA5a4aAN8WoA== X-Received: by 2002:a05:6a00:1803:b0:725:eb85:f7ef with SMTP id d2e1a72fcca58-728faa62ae1mr3631124b3a.14.1733987102674; Wed, 11 Dec 2024 23:05:02 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:05:02 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 7/7] cpufreq: apple-soc: Add Apple A7-A8X SoC cpufreq support Date: Thu, 12 Dec 2024 15:03:06 +0800 Message-ID: <20241212070344.3858-8-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 These SoCs only use 3 bits for p-states, and have a different APPLE_DVFS_CMD_PS1 mask value. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 30 +++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index c9f31a3653e2..c3a6dd8ae22a 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -22,12 +22,14 @@ #include #include -#define APPLE_DVFS_CMD 0x20 -#define APPLE_DVFS_CMD_BUSY BIT(31) -#define APPLE_DVFS_CMD_SET BIT(25) -#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) -#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) -#define APPLE_DVFS_CMD_PS1_SHIFT 0 +#define APPLE_DVFS_CMD 0x20 +#define APPLE_DVFS_CMD_BUSY BIT(31) +#define APPLE_DVFS_CMD_SET BIT(25) +#define APPLE_DVFS_CMD_PS1_S5L8960X GENMASK(24, 22) +#define APPLE_DVFS_CMD_PS1_S5L8960X_SHIFT 22 +#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) +#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) +#define APPLE_DVFS_CMD_PS1_SHIFT 0 /* Same timebase as CPU counter (24MHz) */ #define APPLE_DVFS_LAST_CHG_TIME 0x38 @@ -36,6 +38,9 @@ * Apple ran out of bits and had to shift this in T8112... */ #define APPLE_DVFS_STATUS 0x50 +#define APPLE_DVFS_STATUS_CUR_PS_S5L8960X GENMASK(5, 3) +#define APPLE_DVFS_STATUS_CUR_PS_SHIFT_S5L8960X 3 +#define APPLE_DVFS_STATUS_TGT_PS_S5L8960X GENMASK(2, 0) #define APPLE_DVFS_STATUS_CUR_PS_T8103 GENMASK(7, 4) #define APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103 4 #define APPLE_DVFS_STATUS_TGT_PS_T8103 GENMASK(3, 0) @@ -72,6 +77,15 @@ struct apple_cpu_priv { static struct cpufreq_driver apple_soc_cpufreq_driver; +static const struct apple_soc_cpufreq_info soc_s5l8960x_info = { + .has_ps2 = false, + .max_pstate = 7, + .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_S5L8960X, + .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_S5L8960X, + .ps1_mask = APPLE_DVFS_CMD_PS1_S5L8960X, + .ps1_shift = APPLE_DVFS_CMD_PS1_S5L8960X_SHIFT, +}; + static const struct apple_soc_cpufreq_info soc_t8103_info = { .has_ps2 = true, .max_pstate = 15, @@ -99,6 +113,10 @@ static const struct apple_soc_cpufreq_info soc_default_info = { }; static const struct of_device_id apple_soc_cpufreq_of_match[] __maybe_unused = { + { + .compatible = "apple,s5l8960x-cluster-cpufreq", + .data = &soc_s5l8960x_info, + }, { .compatible = "apple,t8103-cluster-cpufreq", .data = &soc_t8103_info,