From patchwork Wed Dec 11 11:19:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 849627 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 71A7E2210CB; Wed, 11 Dec 2024 11:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916188; cv=none; b=fq8cK1krcSCVbPxVnFIT3L4WWB2+VZfVHTXl8WuEJxKf+FjvoXB0vOoCmbKR5Vw1wKQZd9foXJQVVjOlXmdxM0z8m8V8ZXY7Zjx0KwI1SQKB5ib70ff4dyR9wFJW08dIF5WPa5QQ8eQTz8n1M8iNt0yKlPa21k06K7WUFhkN6uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916188; c=relaxed/simple; bh=Z0UJoK+JMHqXLXGpFMKhOQr6LnXF7afe9z5eb1Hv2yo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QJadUz0BT6bDk43mvT8VwPsq+VHBxHb9LzIUBfU5VSBKDzO3cyBw7VptoVo+rQXrx2ZoDAd9Y8rQFEB+uir1RlKNPV3BUxVIOMXRUJum82bflBRszqkTOjf3pKJDhrZB+UbIisqPoyC2E2opIMOBKAe/zJ98LmM9A//+iFIbEjI= 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=GTE1EGvM; arc=none smtp.client-ip=209.85.214.172 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="GTE1EGvM" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-216634dd574so19626195ad.2; Wed, 11 Dec 2024 03:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916187; x=1734520987; 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=GTE1EGvMW1tt5O+TZG46Ymrxh+gcuM4WzlF0er4y4y0ktZLA9jT3DMhY5rHvN757gZ VKU2IZH59GOHV3VaV9LXxYgW2dlQpr0bzdft26mdfc18VjRmt+DZkhu4LIc6tMOAHfBh Qt3d1wPU9kvOI6BGdgWS90F8s6Hm9bwRiCoAM1tPHj6oMz+mr9yNwkIWqHosWkfPWx6u ArlKMmkxzOIEBXJhJEWESM1dY2nSdho+1mjzCVYgzzlA/DPFWqOS02VkakRRv7yydbba faBs3qoM9za7DVwIin4+NYTzChTp9UDnkm+NGtK7ST5/8Dx2baV02JQRcPKjCKm0dh/M iM6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916187; x=1734520987; 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=GpJchaD8AjHMCdbk1Y9pppMHiwgYHO1WiCv0M8UVu+K1XPKuQDc/b0Y+9clQuew3CM gaVe0o+U82SVp73t58KpNz2DDO8OCuCOpJwp4tW/Z8sgk9XwEOZ9d7OQRCdEveBJFG64 9308FSuwOchavT2X79dJObv5RFzDpZNGLVv4WImnMsMQlMFDG/ubB6rs/oz+TauBhypU 5ALVjtapJ4bMIq/bTcBTkWOoe7mXdRlvrk3remml3fLUcvafetfs9URhxdq3sz66ewv9 hRI7kIGXj2el0pIrWkT67lMwz+MfXD1KGafl/nU1/uePomUg0HCkPYxsygKnqj18+ljW h3tg== X-Forwarded-Encrypted: i=1; AJvYcCUV098bawyWLie+FwkE+FPEfH8SZ0gj2nSfSfH0LhZRWmlfD89qSsW6g2yVTdvQGIkJjTo3BrTiG5I=@vger.kernel.org, AJvYcCV+i1aNDWWLUdxmzpZHu+cd1QwNFcXZcm/gIMWsukDexU+dUfDnYV2p6GNH5J/e8weFTWqF4Bd+eEI1@vger.kernel.org, AJvYcCV1rqqsRt0V7Pydfr/yMbGH2/6K+xzIh4r33QeBN9sP8rm67xTPEauAhY15HnzzkstOJizuiwvAv3b4ULw1@vger.kernel.org X-Gm-Message-State: AOJu0YxCa4md8jLq7VV2Vj9DTqrwXH10mVH3Z+JdWcG1M3Jf6g0hgPC3 qke0yl9rjer+uwHc0tYLaUpilZguTtAiKffV4WUr0ysdY/vdn+gX X-Gm-Gg: ASbGncv/utHuPwo3Tn7AjmN0bzCS/elWpY7+Z+jpeDcAxJU6+pqK58opoI5ZKAVWjNe yu+v449bV5rYZ/B/x/G8QmiPI3+MPUtjquHUI4iIj/JUOzW5zdUBD1KB118SSnsV2ZxEU4haWsG m8a5KRb1ulfwM4j9dSCMoEzJwJJe9J0AbJjs0G6DsFuZ/o35uxEfKEs3ZeAgGueuspmAGF0Ypk3 pvOxrIEnteHAL7ikmXHfUbYv3SqFWoNG7z1QuG5D2Zv0GSE44HuLxAICUjhGVIECnIdUw== X-Google-Smtp-Source: AGHT+IFM5a7MpO8fzMF1Ciyph8SCkj9YYHpvyC3PVX6ufLbwk3i7/23nnaT70/hHri50A8+ULdGjzQ== X-Received: by 2002:a17:902:db08:b0:216:2f7f:ff69 with SMTP id d9443c01a7336-21778393b9dmr38658675ad.5.1733916186646; Wed, 11 Dec 2024 03:23:06 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-21650ccdc7esm48956615ad.133.2024.12.11.03.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:06 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nick Chan Subject: [PATCH 1/7] dt-bindings: cpufreq: apple, cluster-cpufreq: Add A7-A11, T2 compatibles Date: Wed, 11 Dec 2024 19:19:28 +0800 Message-ID: <20241211112244.18393-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241211112244.18393-1-towinchenmi@gmail.com> References: <20241211112244.18393-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 --- .../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 Wed Dec 11 11:19:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 849626 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 CCB662336AC; Wed, 11 Dec 2024 11:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916195; cv=none; b=lhqNUH8ej7vPFaMDRYi2/Y8hEFecMRKABlsBrnsIZmethNBpVYUk20HHK55VUH7SdSqxQ0mn6FWa34abFbgMcpJHWcdPTFrEOVQgzmX+SwotrTsvtLNTOUfGLBe86cgvylEzbXVZkZZiS7zcZT04yPi6Mskqi+2ilspxKkPW95E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916195; c=relaxed/simple; bh=RgXy7GQICkh4yaDvFbIaxUPIIfKur6XP15eVhbM+Yts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l21fyjAFuMLItfw75QDl4DWGmAF1cJdwrVRVLlXx6HkH0vudCOAJAKz5t76KwqkrTq5N631kPVKXHHnKJpX9ILGtY6IKPAT1rowZ3YZ7zvNHYv0IXj+3rE3lmj4OEm8p3robGxSv/l0qGRXTVp0V6woBepIi8HQMPRNHbzbHTLk= 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=XGvG3Qyo; arc=none smtp.client-ip=209.85.214.177 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="XGvG3Qyo" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-21661be2c2dso22785245ad.1; Wed, 11 Dec 2024 03:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916193; x=1734520993; 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=XGvG3QyoTPhciV4mdgufU3QaNqM0G1bYhnAnmbURv+ya/+c8nMES17R4k3ySd6YQDk RTQ8Tmkip9UdUcFWdk1TxknliadN+sMPEetPNgUjkJ7AEZ1p/O4NdczDTI+Td2GCcOdq yfqrOA3hDy0BqRLjvmLl0Xd19EX+DoPhhJHaoi45CgGv77JvWKcUZQLe1pxHiN/EpoIk kKEKb5yMJYzeajhpgcGLqz5QByE+VqBPn4CoTDy4K7GeIulnBcX58hZySwnUft8+pAQw F1fCIz0ttnLe/5Dt7FieW4h0O2B6nyjRIFnU4GPmFiMnlI3BzyjxjFM0Hw2vvpJwmLEc OmgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916193; x=1734520993; 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=AjRjZQgSFeI5MGCgVHOuAiXvwq9Y9eHXAQkz9j8WFuKDWA/G2NxHUXLY7DOVzf0rmJ VALw4ujJqd9APzKSi1L+zPwQWd8Q1P17od5eeg2fqdHmea/qGd2CEINNOLK8uKBHjOzI 9aRBjkxhSZx4M3CDm9D1pxytL/jHX0H3LfaC/fZSlXH7KHVbtGhSX5YmV0as9YBUV8Ng cyoZu4Ae+QLVGzYoxrihrwA1V5DbWOO7mAk4YGpjlghLIWyn/bjOj3WQHSusDpM4HK1K WhZy9eo2p86rcB8OobwQWRa8OigCzIK+LZmHr6rDpspEp/dSd4WzdLMfbBWEinLLD7WV z/2w== X-Forwarded-Encrypted: i=1; AJvYcCU8z+9ApWFT7fTpcKgln148rleM+k6Nck5qqgFgdotu+TQ/WeUuqivoGe3vH9KEhbD2gKkFfqpJcFc=@vger.kernel.org, AJvYcCULqdNFuzlAtmr5sUM7hRXbOaGvnrSYmMDxxb3jLcaibrUFo7teFPh27Ztm+bLIwkovNm4OybVaRSacIx74@vger.kernel.org, AJvYcCVgcP2SKfxDxW9yi6PiSj0pek8BSomy6xkrBMYsI8lO3x+W5Gh/VeRv2HUvtSk5IDfSUBqKJrQBBod6@vger.kernel.org X-Gm-Message-State: AOJu0YwyiryOyS0p3QcINj/M6dAI6afni9ha0L08EByOJmsySZAnEzXW 4WOlJM5SXy2mSwQLGExalb/gwEmktGEDqIjSLxLy7/TiI1wcWZQz X-Gm-Gg: ASbGncvv3lC3tG4h2bxRjjRRWw2SSMiBlKtSKWZKR9SCZbPTLDj2BbO6vh0n/Z4J1Kl skr8ph0ZaNwXQIZYSQqRttF6KM/LtFl8+0NLfIBdlJAjjCxQcBMHX3DVnRSfP5VarDTPXam6kAl zs4I8o5P7kvfc/zSl4pg9zSIUwjucVLPVJTYFVJyzZ7dkR1UjgcqjyTaT/1PE62fEPs0Oy6XQwd q+r1zcydxWcOQcF0pcDr53KUpNE0wQBh2clO+4LeNbnSovcL88TKRVyIZg5/bN9iPDDLA== X-Google-Smtp-Source: AGHT+IH3ONBmas7xlrBFZwEBLUlf/D/cSYjNZZPpeQFWgFHm/3eyRH4IxETbO7fyTNvbq/gjEuALFg== X-Received: by 2002:a17:902:ebc4:b0:216:2a36:5b2e with SMTP id d9443c01a7336-21778536b37mr48738815ad.32.1733916193070; Wed, 11 Dec 2024 03:23:13 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-21650ccdc7esm48956615ad.133.2024.12.11.03.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:12 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nick Chan Subject: [PATCH 3/7] cpufreq: apple-soc: Allow per-SoC configuration of APPLE_DVFS_CMD_PS1 Date: Wed, 11 Dec 2024 19:19:30 +0800 Message-ID: <20241211112244.18393-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241211112244.18393-1-towinchenmi@gmail.com> References: <20241211112244.18393-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 Wed Dec 11 11:19:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 849625 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 02EEF236907; Wed, 11 Dec 2024 11:23:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916201; cv=none; b=fRO2DuVhIWSuImIfWgUDHJrHpAd78jvs/U4eQnZjGqhRquK4Yh4F2CdHKVDbw2aJ1huokL0Py2bFlEapQ4+OJJ8SKmNl7TAlqU4G56iIi03sxGzj1At2oZod6DhOFMw4JzCDnupwFmWMyp7K7MaUwnO3n+t5iPL3YBSocgX5CQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916201; c=relaxed/simple; bh=lSmc5lpStkRdh6T2UaHkJlaMrEahYyD8GNIRGOk35wk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SBtWG0n6AJwm2cCgXeB0eYdojg4QNg3TU0LlsqUo3Po05jQK/fUVQUwvBWXs3athHp0etnq2mhqrOKZ56DDrqs+BLugk2b4j3YaHD5kyCYGB3+g5zaaSGB3KyTQL4MnMaHHGd+G8j1LOYmuth/HVMgjAi8hL8LxwwIKbfMMPjP4= 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=LMT9rPcP; arc=none smtp.client-ip=209.85.214.179 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="LMT9rPcP" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-216634dd574so19627275ad.2; Wed, 11 Dec 2024 03:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916199; x=1734520999; 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=LMT9rPcPKygud+KsMONRhw2mdB86YHjFPQH2g6snq7z6OY7hbMKEvXkH9NiODkXk0E fL0pX2bdWSshbsxiLL0H3lNBYFxPNo4jFDCC6MswgxGJWiNIhIEhxSE+cnKM/Z76bIKg VgECuyoNJ0DLy4XuNjCWWdQeDM5eK/1WOiAVuRvldxRmJT+QJvmo/As6RhNZn8WqJ1dG 5hX6eO+tDbndM4ImpsvPGJ3aluLg2kSe4dKsJY9LLQSc1A+S2iUdRAuy9HX7093TaJt0 os9w9twpOhPEL+zJ1s7WVGehOQTUqey0Kk4ghTF+rsYvK7cM6Xjaax1XLwqY+b8jmEEO M+rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916199; x=1734520999; 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=AN7B7s0Q8HDNWwDEhXmF5JbxInnenruEh7BOHhb2DSDboVB3sLYlmFOd+4EXkApnsf 8Y/GmguARtZchnQ0AUmn7C5EdaSyRCMwso+a7ENg0Xzob7Qjoo9OO0OvdR0kmS7pSaI3 TSw5THYanMwL6lpucxEcAYMhQgIE6MJL+lVF/CIjxxBHaHFypt57qxizKSgkilFJyYSH Zk//45OY5hsmPt700Ucn+xGbECaRTr8OLgqqJ7xC2bAfQzmfTWFkn7NYUjqSQJRXsQTa 5693jP/5M/rx6D1juFsK4bSTpN8ynt2QskZLzZPvCa7q3e8jq38ISp+CQ5oFTxg06oim xzWw== X-Forwarded-Encrypted: i=1; AJvYcCUALgPPyUxOAav/a+KdZifFXNRlXntXqcCMWypk+kbj1z3SsWC9rHYZseWVC7XLVj6aD1U17mby94U46ixI@vger.kernel.org, AJvYcCWAIlWeup484uWzV7D7MjVCzOXVzNPeOrjf1VUOAtlKsyzPX74+vl9p4lYf93PWh/GnPgvNx534wjB3@vger.kernel.org, AJvYcCWa0HUGozOiyQA/n4T/GDYTH335iZrRYMkZsj4Fdr1PtatMhRFwwvvVmuR6sQAXUkK6z9zRWpg0aCw=@vger.kernel.org X-Gm-Message-State: AOJu0YwPsdrFN6QczSsW5V5dMqE7Yuu+MsbTKh10JD4k0MnN4rSakfyN LiC/4OTOaN6NLqVJZHU1ZkCKjnFcCcBLRGvc1n1t/YiEdXy7jYkC X-Gm-Gg: ASbGncvW05hpd7t744LA3YFTH4hx3q7iTO/uANFakYEK4EXlIaEXS3YVOXfdXiuRNb8 BV3hLc7IKpHMW04PVnCApzkSLsPCgouW6/wH/kwgu9D8ctzFuvjt9xkv4uPWcbxNST7VLpYFJ2Z AO73YOe4wgE3vcDuRTrbOlQCf1ZMqr0P2IvMWjYBOKeAi4FDs3ljHcHTJn8IStIm3n+HfLB4V44 weO3W+HMOTMhLzbdtjoLPa2e2obnMDRRrIE0tmgTO/xgucxvDnqHL47f32Gx7gjsMdD1g== X-Google-Smtp-Source: AGHT+IHo+Kzzu1G9jRKGQEFBse9aRUgQJuEW2pdF7vw9TKlIsPyr1dSWpP9Ey4Q+GR2YFuS1mJUrIg== X-Received: by 2002:a17:902:c946:b0:215:3849:9275 with SMTP id d9443c01a7336-21778562d49mr36068865ad.49.1733916199490; Wed, 11 Dec 2024 03:23:19 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-21650ccdc7esm48956615ad.133.2024.12.11.03.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:19 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nick Chan Subject: [PATCH 5/7] cpufreq: apple-soc: Increase cluster switch timeout to 400us Date: Wed, 11 Dec 2024 19:19:32 +0800 Message-ID: <20241211112244.18393-6-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241211112244.18393-1-towinchenmi@gmail.com> References: <20241211112244.18393-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 Wed Dec 11 11:19:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 849624 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 94C0623027F; Wed, 11 Dec 2024 11:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916208; cv=none; b=omuzDUgS0yovpYTv3Zemaksd2HgvVCHBIpYTNQH82OnIFh3Nz5xBxK+n9Vrvu8xzIdGb2IPcGNfTKDsbQIxI7ysY161OIqepLzOtKth44VjDA7XQKmioKddC4qOHHNAPy8Ym+hvPyBdSxSvkoXGE6v3j8vAw1TJjCdZKqcWKwFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733916208; c=relaxed/simple; bh=7lcoJt3fEYxFRq8rAOGd84uCM/lkZcSDWF3TclaNims=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oVlC3NolRWRK4UNjtkj3BwoEiwKUTGLen8o4BsoU2niH3XEBx/UAwoAAasgD/ujmz3hGl8/HWCYaeE07LuguP+LV1oK7KitDk7ihUWzlDMTN89FneMFFD9/pRDVGJz8v4+8oqw78CHmSWoJYSUih4W95dDHNcbOUK9IE2foxb5o= 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=BEw6J3FE; arc=none smtp.client-ip=209.85.215.180 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="BEw6J3FE" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-7fc93152edcso467447a12.0; Wed, 11 Dec 2024 03:23:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916206; x=1734521006; 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=qlxPth3W7wbrCgZl9TutY0yGCH/wT/pCGymBpz4R5/s=; b=BEw6J3FELZSeuRZzrAnEIaxmXxGCzhZHeYLKlLDhfI1/HJXLkm42PjGqA1/NnAkdhd XMSt7G4MnYUKTcTpxYrQh44gMEmesHeGjMDCd9it8VAU9AxzG2vrHgyuoGv9YmBdoCID zaM+lee2PhupBtvBDVsiRgwmi4EFtHd3sQJvlWR3uIA68Da4fGYRbHqOPNzIBAtTx7B7 Ld2aqbujhFOG57HSTodlhFCk8AikOTQdtlaNTSBos2JR7n5D+yFqlDWaeTldcTZh7dGl 6PkfPoM1GRrO1pZSBhHQKCygySyPyEBMslrjmUuLI3hRDbTYE5wX/pJ+w5xyfItkf27U hheg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916206; x=1734521006; 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=qlxPth3W7wbrCgZl9TutY0yGCH/wT/pCGymBpz4R5/s=; b=oQPRsxPRo67FZ6IZKJ1fL/WQA/2pV7XdleOIfdnbRUzqLBcoB/Sy3tKn09N0FBH1JZ SIilY9f2cWOv1OxVxTbEiTQr/6pyEs7ru6FxJBI0A4f1jijs8Uf13pZViE4aQUPdSAVN 2qmizV6Vj/UzvDN39YT8Is1JBa2IX019LkMltTx/4fWxIDAXZ/z82UFbS73ZfAVaFkiP 9fGXbhdnTSpcIeSWjBQKUF+AD5x6boK9FAjzzNOznqYaBWfC02p3aUugtNqlDZXzeA8x P+z6GPYq/Ud3GehrXX9QUwE6JvP+Pv5jXzogPjhFRRhx6/Lf5D46CTUfWqkbyTK2msZj a6CA== X-Forwarded-Encrypted: i=1; AJvYcCUAETTgDmt+YteL7p78vHyKs5WH/94WAc+lxsYQZkU0g3jObKCDNgyKI9lmZs+3vl5Ou0F15J5cZDw=@vger.kernel.org, AJvYcCW38Phe5oF8IzzyFN5MpDIkqCjtbqjktEJX160ucv0Whl5UH6r/8l0jfqNJcjpn8tsVjCrfkqHgAYH0@vger.kernel.org, AJvYcCXK17XtiP/2izXXRaHfvOl4cUKLVMEV9Wfy8Pj5AB7HxhycIqaisA2MNWaNEDjcSJUNtZa4z8Ms8UZkpOnU@vger.kernel.org X-Gm-Message-State: AOJu0YynQDz/LEhlQDji9IdxahZC9aRpqExLuwGO+ebgz71yhICwt9ql CE422eK9Cplwru7mNTcZ2+NoDWPlIFtUuMsxvrFy7n/2ZoGRQLq9 X-Gm-Gg: ASbGncs4M1Y8FkDd1OLR0ba68bKxSP/SZ3f0DquAu+oc0gH94Q+Tqc9EYHfugP+LXO+ 9hUXhsWehW2mOOwY+mh2IChgEwzkpOSAWb98NgNaFS+lQkeiKEWV3ZhZfpY3zlNFnlucbV+quuF fBOMAoXq/dJ5BxU/GpzeF5pU0oSIcF8+9QIvrbYtENHh5Mr67BnFf1QA76JFcfT719v9UaHLgif FI7ELkXGjkNBylzv2QmO/btR0Azz7cr/IvwfgWHaNhBH3RutLG9Q8SlQ1mA5uQSiHgJCA== X-Google-Smtp-Source: AGHT+IFMuiaI6I3IF80U3p4jkCdMcH2pHwrnp13N4Jra+xHLG9sBJnqMa1fKJOB7LKNxTMS5auBS3g== X-Received: by 2002:a17:903:186:b0:215:742e:5cff with SMTP id d9443c01a7336-21779e6245amr31917835ad.16.1733916205923; Wed, 11 Dec 2024 03:23:25 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-21650ccdc7esm48956615ad.133.2024.12.11.03.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:25 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nick Chan Subject: [PATCH 7/7] cpufreq: apple-soc: Add Apple A7-A8X SoC cpufreq support Date: Wed, 11 Dec 2024 19:19:34 +0800 Message-ID: <20241211112244.18393-8-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241211112244.18393-1-towinchenmi@gmail.com> References: <20241211112244.18393-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 0af36f911bea..12ee9123a1c2 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,