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: 13903376 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 C6547E7717D for ; Wed, 11 Dec 2024 11:25:26 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iUHH+eJbCiMl2j2oN03m6Q26pa8Tho3uZPMyt8IDCBg=; b=B1AKvhso3q5IQmiXnoTtcJuUZ3 2WaX9WuhYJJKl5ulQXi8BdYsoCAtuPOVRwt2118JvSd4JfUqPMEXBEW5vHDC6WBGKK3cE4RVxw1AS CO50tLp2usCoay7wsdPw+PPcpswGCUqZKLJJRRcS08GWrpvu4eZb5g9TvOROxoAgE0dPinENb7u6Z xRftZkhv0nMT5O6LjW/nit0VnZwhu4g6k+xYN0kwFiWop49Tm/kHjN7b9prMhWtn0p45lkj6+p5w2 5D22eHfoGnJbtGrQFTodui7sXciZwW7LrjZWZNB1jyQ9neDqTzMxXeGfl/oVDnaJx+uaKTW9rlTRf IhQAclfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKqB-0000000Egom-1iOL; Wed, 11 Dec 2024 11:25:15 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKo7-0000000EgEM-2p5Z for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:08 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-216426b0865so31073055ad.0 for ; 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=lists.infradead.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=k9rgUy6LNaraBosLysCQpMfZczQmhkrHmi+Ymi/JWDLfdkK+0Tk8poaav+cB9RZ+6O 90DL1qJaT0zxoFV7S9/5IoKEPa9TujSE2Zt0XAi5HwDJdPIFBd0RiYsiMTdrqVfv4l4k VSpwO7aDlsIQeaekq8A2RLjDduuVh1Fvys+BDyDqnjZ6aqb+UHqOjM3YUmJXJSRJ1EYJ DbD6iIZohHbvYxOvYtxMlTP8rB0y0VJoYnmPzV6NxwQ8vh+gKlZvMXDaZPJxppyPKheE Ksd6j2JJJv7id5dpp93GIDcED4nON0PyCTuWdG0B6qBsDfguYEJL762Tklgoh+ghD8QS Za7w== 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=DwrWQmjQvZ82POFAq3ijFtCBmCJvpuosb2vpEWVYnpG3GfQ7s/ndwDQHy0FSk+FIsn FW4VPRS2mp2XlvaOQ0syOVTqjyCrWtbPROv/sXW2y5U9NfE1yQOEDTDIFrU1hgLtln+n EM8s9xnSQxgQLGkebl5y/t1GnVdi7sF7hRibCrptpOop3kGb7aDp0xFjF7JeykIHtMP4 +Pb545MULz3SIP0bNi7qBdxnqXcEKzSk5PPc5cmeakymL9ZDAqUqJWGMYPRFibrueVdg xb6cMzWQwaLPdITjlakXqONo37CwISsfNL9TWU3OmOHaHiNOOy99DP1qfrRxb7Ucetwp RT1w== X-Forwarded-Encrypted: i=1; AJvYcCVCHpMje6LC5hTNjBYd1tqGuTOryf+LwSqU7lqdjWePi0l31PEkt3QW9EjNpEB3cB+iCFEcf136yhrbb5uql2CN@lists.infradead.org X-Gm-Message-State: AOJu0YxCBr2YjXnS5nSZBZM3rix8Q8opgoyylBa5AsHMOZ1vK7xb+Nm0 oJX4RYmWxg5V6y0jV8l5MegX4LpsWqTLbsl0zxnuG1jqQ/lT97BR X-Gm-Gg: ASbGncuodlDLxb/RiEk6iOlc0DfdtNI9DJ9M9DHd3RbVh9HzlMnBRPkEX0uAB38MHbz rP9vrGBXVJzbkISmw0DHp45SWuRNKrgNxdjgs9i6mi7x/aoUjbyEXN7Uq0NlrBewRUY3eSNqx93 xDa9SJEJ3FPVmJ8DLTCGl7oKzt4AHQcxxP/LVdNaABp6yOoQz9WMrsvobb7vFe8I+ezX/HylXHt WDis1u/5YnterHN/vzsKhQ9IVzNlZB8peA84iGc/U0SP6wZyYNdz3mKAUaEX0IMKxzjRQ== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032307_709586_4E73485E X-CRM114-Status: GOOD ( 10.44 ) 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 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:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13903377 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 98008E7717D for ; Wed, 11 Dec 2024 11:26:33 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M0xMWNhFbRFrvmQCRSO20OEZKspqHRsl+17s4y7Ifdg=; b=M7BY4NpaSfvKYX6js7q18zOQQJ urN9AiJsoYvkrkvbHskIEPWfw2UkOehBT/7JVtAARKB9FfT3t9HMhKdvSXjdHLzaopueXrCasjIBf U1CmiWq6UGDVNxElQ8wzPA8j3xFQgv2gTTjXzbwYE0GKbnePFfuPal1Dwz2NENfDTC1JubvoMVmDj 1yRNDMfFfT05Jh8QYueJ676D8dWZa5f14xGt7dA2XImi2lwF59cprqMZLP+Y/lZo+KAxzCupLrBXo l/hUGXHiEkQV0mdU2iL5AhJlSazM2n3hWClNJ1yY77rLZsZYz4njJPAr4pM1n7+tIA2i/KcMAWG3c TzSVHuJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKrD-0000000Eh2M-2eQe; Wed, 11 Dec 2024 11:26:19 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKoA-0000000EgFG-3Nvj for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:11 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2163b0c09afso35131165ad.0 for ; Wed, 11 Dec 2024 03:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916190; x=1734520990; darn=lists.infradead.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=jyWyc1eIjhrW5/0+AQk7cnoJxHee5hOg+vhjcKNBCsli6epH4B/vYyO5WrJUrqq50K +OPFFMQKg4dkXJFMoNCJoiJ25XI+0Xg/Vjj1wJ62Kp8VBTuYFQuFwV5VGL8CUoQGWRV4 1OkYJnacH+pqQQwdjiZkJRz7PeZvtr+vCbh031f2KGebnjw2tntMT5XXL0932FNvb5z2 AL9G8P+T6sjV4PzVdo29X9CixqacpUPvm5SnxSGv1WMUoY6sDNbemQOjfwOzEFBc1NxI TW5D17Xp4WQ/k3BlMRqux4hV0iaTNLdgI7lRDTxW6d3q6lbMKCYIH0iO140UCTRvri8N b1JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916190; x=1734520990; 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=JTfrrB5+krVQqW9OOTtr1ohkbrE1rs0zV31ajVfR2hh7yozmPWObuWwcq0nYtpJPdn 9pNfKoZCNEpZGvZnCYR+8XrhCFqFK4mrf2b6fjBUiRAG8+zFB/ElFcLxvUp5PSJ01HhO QO8+zH/JWWz+x/BwF6dbFcFmv4lxOtEycHg+Cc0goyBG6OMClpVesWl3VPDXVEHXom5w 49+DpD4BROtPNVEJ3DMYwrup8ZzCB9CbYSY6g9+OTFCUS2tHVbrz47rrgzfUg7vuIJfM XAv4SS5+dEK9yX6KrETBUG4LSqJkbCMOoTgOIcfrSShFqTEXg++BKJTbTSR1dp3pcG7F ueUw== X-Forwarded-Encrypted: i=1; AJvYcCUjUariHdI0WDob4WOmVYQ2tUvewqRei5cM0VGX9hPk7RvtEUa1ASV6gU1FF9hRfwvQQo3mv1XryGfv/niO1Mj0@lists.infradead.org X-Gm-Message-State: AOJu0YzRwk6UwP3NyEeXtk39Q+yKONKhOPyMsPqv0DHhQxnsHs4O+RwM ul+wJBcQ8S6jQhD2+BPgH2CFoFk2n2Pe5Y6sDvKnLU3pZfY1EcKD X-Gm-Gg: ASbGncvPQ/+dCp8bn51SyeXphn9v7OFpEQFGDrHtgdDwRJ0FxQiZRCd3pY+dbHNhhum WIES9T4orlKpVbZOrfItQ12Ya6y7pxbOO2S585YsmwqZVkesA1aNExpRBXQvK5fp1aEW3afIg8b CqdjV6v+0D61702rZa4m8ehP9WxRjqMSAOGspfbTkyVvzJCRIRA9nTK8PK1bWmEuz3PKOPN/awh OpZC1Jl85wxX2Z2rq7L8z0xmXZJLqx+WhBqLSgJI4cTxDw8opC7mtbnaHCaZmyYqQJ0Cw== X-Google-Smtp-Source: AGHT+IGg44vKKbajgZGuP1n8MacnuXqDCWExV+Yd5IMtS3xY4Kb7j1HNlaUyN1+xFgSOQQMzckgSjA== X-Received: by 2002:a17:902:ea07:b0:216:70b6:8723 with SMTP id d9443c01a7336-21778581e83mr41968685ad.44.1733916189869; Wed, 11 Dec 2024 03:23:09 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:09 -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 2/7] cpufreq: apple-soc: Drop setting the PS2 field on M2+ Date: Wed, 11 Dec 2024 19:19:29 +0800 Message-ID: <20241211112244.18393-3-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032310_842485_5147CE58 X-CRM114-Status: GOOD ( 14.93 ) 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 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 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: 13903378 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 8EE3FE7717D for ; Wed, 11 Dec 2024 11:27:33 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F1XYVqROmegnfGFhPLcLWSN8f1mP3yklImJht3PHB8s=; b=xu7NAx981YO6f/o8lj8Y5rn7QA rZj5/sI1kU1fr8QFi7SBnqYVUep2hIU0HQ5tkiItC3CADy1ZdHWK1ftCzGna8cAPpUE8cuveswMWK B251+FKjx1pVP8s4VP3DhyvxU/IyylxuNrdXTr/2PUYHLYghlvC+A6v9/5ahCxdsevpWFMo84m7f9 /4GsergxMdSJbccfYl11T+wWFI1xAY2AWO+tW0YQpdvr0cJDKJOO0EBKZu0X5ZD9yYHDr/s/8X5OU f0YHms0DjLLlqU+jp3ItPF8QvTGMi9Yr7afO9igfCoHB9lDSOLZv6MKZJl+FxcVJFF5SgcSWydIZC 8jaw9GWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKsF-0000000EhDW-0xwu; Wed, 11 Dec 2024 11:27:23 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKoE-0000000EgFz-0AgZ for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:15 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-215770613dbso44172795ad.2 for ; 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=lists.infradead.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=WnIl75JeXo9wTAu2Erl24+s+goeOBXxAF9Y6EqITS6fc/uXwp/cqp7ofCY8+H/2f52 4HoNLiKZqT52FBcsHLdZI7Z0+8/AxVaJaXBrlbFBGWLKdnGYp641TSbk5BwqNtpa70/C Itc+0LKyJXvheFKM9U/BAVbsONR3SVwSwRtEXLozt+RokPjUWY2fP1zHST64Mn/sV8tQ i5nUzcMp9FZTjAtkkjBFxH1Osr25zdyorWscZIBTLwkzC57KWTJEc8pubFTTLr18bEGn nT8Ctc7ByhY/ir/2U3Mcnu3KwxKdrr3AUSysTT8CalkAAjAwBv6In6EvdEM/O1sgiPYn 56uQ== 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=efubHn0IurWRHfcDC9E4NaVdZusVNUr4m6eKnSR4wYYidr3GuBiLVj0/4lz67Wwht1 Hspv/rAkCShZZ2DiOXW6WfGpEf9GyGLJHk8QEd11d8gghuyk0bDpWIRZa8mY8alnqs3a eKILowKJ9hB9wglTmkv4KxIngKulzCGIHSKMxV/lIC6TIcItKCkZuZgARD81bxe+l+lP Wt99iTZwr1A0iUpq4CJ1qzVSSOFW1+UwTEEj8K0rdet5SyGsV786VMWDR6DHUmg0Q7vL xeWEjb9FLMy0tRhmDuCXovpJJgSkrAhDgksanC8XZ8UASQHQTJ17gV03b6Dvyk2n/NwP iDCA== X-Forwarded-Encrypted: i=1; AJvYcCV48eqa+3sMj3yfV3bUdVuoagOPz/jMhFrtjciCu9luui3V22IxFPVrpnIbPF2rnw6yODEUo5cr+qnUHFv8efv5@lists.infradead.org X-Gm-Message-State: AOJu0YzIilT2GB240sDWu0ZukhgMsqPkq+E8BIOclp3AuSbwsPdkB+TS UilLv0jO+7EXB/b5dnbNAWiACBdAhm9pwMqX3mjwqkWLMPhCzHgN X-Gm-Gg: ASbGnctGWzK7MVLuVwjB540VRi+oOtwFAPuJ1SVlxYkY9C5eDC2COhaj//BC4g8mUYK 27m05lnTlMGxcV0COlWAcqVqfCTiynsvNDdV4ulSpgYZsrBbAziKZEdEbiFYE9Fi4FwU28p2DsM QL79daHmiCTSBIQ3P3uPlSvO8LzE+X8VSPfYSJH8b/6yS0cypSOpsHqjWBO2XWBl3yNht2zzQwV qC+Njm0Kjwa/P3NcWOebhRSSXgd/CfNXcabN+iXk57+tI2+w/Fec5HpKHx6RTLe48bxSg== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032314_075563_442E2F70 X-CRM114-Status: GOOD ( 15.37 ) 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 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:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13903379 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 9D7EEE77182 for ; Wed, 11 Dec 2024 11:28:38 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WbzFAeUuXXanJwe/RhcZGcox5IaVXp9hGHM//yffMwQ=; b=H3cEu2h9vVjgksbx9mlXHfhoZc DVCBANmiKp6FZg9Og9kplPqQ3KsF87nX4WyJ8IYQXLEPLFZiJSiXr2CZNBX8qv6s1yGDdLCgAUdvh NOpF10Z6RQs7qU60iOroMLGCXdMCWfXZqe1yxFQre2YjvYMejuHBQJsLdY55uGDCLAS/LjjnOTA6x rTTywjF6hXTbd1eIGD2dtOgQb295LtLRaVp2Ret4IjH6SUA3JFQ8udJBzuJJWh62mxpLz2j+xnvD7 +ORG+UV8qpyK5fcfzLxwEEBYx8gFe4IAZij/2Cy7h0/brgQF3yweUxyKIB+V6EvcRvjLhYFw6OVba vuzKoc3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKtG-0000000EhQi-3ZAk; Wed, 11 Dec 2024 11:28:26 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKoH-0000000EgHI-2AoW for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:18 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-2156e078563so49519885ad.2 for ; Wed, 11 Dec 2024 03:23:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916196; x=1734520996; darn=lists.infradead.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=Yu58ZCmC1o6LMEXUlEy+jwxzSVULPwdjNY7aC3bzE+k6WvTcSamkFfc7rN7rSkKS3w f6JkiFEZ9AqlrV/z/g2iq+IqslnQi/1NC//Wn87q4Wxgru1IK01Bh1D7CxOjDqhLTs4B Mta01CrFChm35S3rcyPYZcA0vaBc+gnM2eaK5AUbfwJmxUw5BZqsMuK2LoNPH+ZyjuDP dGD/txOWGo9yrvvgbw2vJ1OrOH8Q0nKMtx4VuEBnUSvXRYHo3Hn+GvHa1z117tA/LZUQ DxFQuWVaOZiBwSI4cgrz+EaIALvbkaFjmNBh9lu9BZ8jXjUfP8pdZuYx+UoJX870YBSB vu5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916196; x=1734520996; 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=s2g4x46rhEinRomt5OWOImZKLpugZloK1Lenp3k5vbKO2yD277ofeNqJmtNtYchyS/ zveHEx/Q9kxXotnN+nZ248hBxBStHyfRQR4Tpc5k88WXy/6iBSkfC1JDvuj8+Akqu09H h9bc3/BCfxube6fmHPGovsvg2mjS7POg2dq1/K+23V5hy9Syf0iTDnpHWlv3khmmZKPf xjGb4PfpYGe/penbq3Mz9eKJH7mbWQOSVD0GumX7WkNa0z2nk+Rq88J2ixF/70HMTJsb W74MMjU4VQizAZMStSdRMfU+ykHpHxRU79MNARTYHSa6ir75u3bNbZgNXW9no818t36/ C10Q== X-Forwarded-Encrypted: i=1; AJvYcCX0aiQF5VdC03gW/UuykiOvPLha6xdJCGCEsRmOG6fDmS5z8UT/1nmxndKamTWdMawP7tnro2oGJ0kZFiyfldfW@lists.infradead.org X-Gm-Message-State: AOJu0YwnLZsxw+A7HYQyVdDydJARuiX6gDddie9+dqDSP3md6IMnAqio b8UvKhaa/84DDtdTyntg8hJKgHPQplE7v9NhF1WEG5SJnVj6FgzwAZho2LzY X-Gm-Gg: ASbGncvSyOvQ++5ZB+cUW6dTJo2BWUyJB9KQah4yoLUmhXf/pSWtfJYwvm+4Ff84iu0 la4asJt1tGiMKsLd7Pj0d52lqFoj4tF+sjCfT1tC5OeBNlaxpxTywHDxqGIIpPIUNcbQbkoVhrx PEQ98WucdzymMRUb00ARsWiUBJZkFjeDU3p0RWgcXaLDajurGSsI0GyUSczXsDA3fBVVaa9gMji S942phtAzU0ZTEtrzhln9sZNWJW11r5cNUeqszsOxf5sUaobFhlQ4dr9yvCps1YihJZPQ== X-Google-Smtp-Source: AGHT+IH1hLAgeQvAxnVwe+D4VMDsSZTriCt++kQ7emPExGGKhpzABy5H4MFcc6Iy+zePAn8dZNzF/Q== X-Received: by 2002:a17:902:d503:b0:216:6c88:efd9 with SMTP id d9443c01a7336-2177851dec4mr41331435ad.15.1733916196279; Wed, 11 Dec 2024 03:23:16 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:15 -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 4/7] cpufreq: apple-soc: Use 32-bit read for status register Date: Wed, 11 Dec 2024 19:19:31 +0800 Message-ID: <20241211112244.18393-5-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032317_554695_0E99F6D2 X-CRM114-Status: GOOD ( 12.38 ) 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 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 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: 13903384 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 3702BE7717D for ; Wed, 11 Dec 2024 11:29:41 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=11W4ToO5h1HZTorB4p+IfX/arkj3h4R3MbzsYg+yGqg=; b=Ii50drj5gJLlfmVCdE91xwrRzh xwGFhxM/A+nG73MlPkN4QGLcbbsiNv+Y9Hzvj757MagsPklLQHkQ+dJFpx7Bo3VW+2BRUowJK5owR K4UJOAobvELjsqHp104PILOoOIuv49rStAU0GSDU8c1l6OmFUy1gukGFBDJxzuT27YL7b5KVFdl7p r52jvuRpDvbj3p7zS+NjhANjuj8SqfEX/gTjJ2o1wfo2mpngOKUjWL+vsAyyZjERIp6XY6kf0j0za OdGV/mbrvZlvz36fxOLRq+0D53p/PrpW5HYTeUfVTO7S56qlfVEWA5tXwvqLGM1UhG7Aod0U10wkz /pZWhg6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKuJ-0000000EhbX-29uB; Wed, 11 Dec 2024 11:29:31 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKoK-0000000EgIW-0HTX for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:21 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-216426b0865so31074615ad.0 for ; Wed, 11 Dec 2024 03:23:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916199; x=1734520999; darn=lists.infradead.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=fmvCD77lyxCr7hY7X00jSyZou615JdrqRYZ05YM3MWlQ3//Sm8U2AkWGKxIrrvb8nL rj82QdNc5O5HbynFp1w2pPkUkjbJBxGOgV3At/Gq29x4LQi5Y11Pfe+4HVupdhQj3KLv cuCrtAa7m3ZclfOBAjXn3SPFLSOIb1k363nzUjJX6fliC1XqcraQnTepgrjgThu5AhVW Bx0qHSJTHZi+2nDRF3Te+n6VhAcwGIt4OS2ccKCY8gnMxq9aQfg2LlXLknn4kVNNYw/m bTk5o4cRrTDA4M79/Inriq91S+e4QD18nPtb0qO0KlhFDXoRgRWWgTiYLP0ccqXnbVjD GqGw== 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=FUSRBxGrcqTV01fV8FGgAJbjIaxkaO+IcPDLaLM5U/IwBbq8c6GnQlEb4c9B4D4AgN hlegrdlycx/XeCbNWU9eEvHaTnRnN/+1/wmECTxv1I2eAh9ar/Gn7uBwqz9phAMH6mZI XxKfQhsPTlUPjxML5hanrgiKTOPya956iqcUt39QTNRqALee/VrDMpI1AmE3ZNIatOw9 vvTSXX8cR3HAuSisajq7UBQWOcm0EQ1KQszNg0P+Qxb1vb4tZUQBLRsOiNGQLVLMza2i voMZrudbcW1xch3FmN9jHeknCDIw0nlZfXZFdQOcu8mJTuZWZSSlAYhLPWNBAIWZmky/ AfdA== X-Forwarded-Encrypted: i=1; AJvYcCX3eA5RZn6jicePx+ZwkVqvEfm5Z7LR0lCHDEb5ALIKqYvabGF4nXd7e8Yl6mcOo4zWG82i6vAnPTk3Djvdfd5N@lists.infradead.org X-Gm-Message-State: AOJu0YyXi+MINHShsW4bv3LyKQoGNu9QkGb9JlKSQvL7HVgvvQaubuQc xJFZy1Qmn7G2nDMx4pfaYW9GYwDCOVUp3lPqdT4yoJE2Uws4ocDE X-Gm-Gg: ASbGncuz3wnxJNESvJq5fcX32pQ/4He7ZmkfN0me2SnGZh9MWB2r4gdjerBUMNiCe1X Sq2WZvJHFhHsl1ETYLxcDeXdNux+LGLUR5UN+inOnj500cHn+pMUtGllUOK78XnhEYZOw/rUVcU DmWbf9jacAObAxNNujRMNyKCyCvSiYMhrzPRM+cehL3eTHQQw38+xKtu8cmWkXFQt5h5dKYR5m/ 9EaFPS7i0Q0cK0ZL5rZXThFUZs9NUEgJh6hMK8213/rwv6+5YGyQbkSPFy6RpeCiqgyUw== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032320_100857_5734BC8C X-CRM114-Status: GOOD ( 11.53 ) 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 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:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13903385 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 8AF79E7717D for ; Wed, 11 Dec 2024 11:30:49 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6l1I2ck309o9qdqJYu3bhIkW88QmjXQLLkvder5A/zo=; b=gI2fxf7pPo/vOljPvC6pQBdeDa mgMb4ha/xiW+2c4guxqlI4gKeDl+Dcj57oFEjirICrScGGaTyRSAPUbXf++x5eTD7n+6tSM7bicG3 kKToHHXDL2kKIUFNAePkPir4+obizC/ABsgzGCIvAoqPG+vw1OUFxYxdljqOdn3/kSlPqvg8oVatE Wxwjzzcgf1cR5dJtUgt3OGgFPCJNoch5Lc/lo615ahtxuGV0iJhtXfyiQw87N73yONqa38qTxPXvY +mLuhOoLiHhXGJFieLuqja7wO19obbP0PVMOpkrS9B1HM7dRHRdGr8W0bGSiRWORxpX5osm220NZG q8RHX0Yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKvL-0000000Ehmr-0W5n; Wed, 11 Dec 2024 11:30:35 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKoN-0000000EgJX-1dAX for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:24 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-7e6d04f74faso414763a12.1 for ; Wed, 11 Dec 2024 03:23:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733916203; x=1734521003; darn=lists.infradead.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=6l1I2ck309o9qdqJYu3bhIkW88QmjXQLLkvder5A/zo=; b=e1bZAYHbzFB5RQf7M4HNg7vwMFTmNSleSXnJpla8XBuchbtZwM+78F6F3thc03aYAZ qjWkh/1qrAzlsSFQ9sj7U9hjwY59cPHyhlsPCdU7B/wyNFfjBWVyfSzqV+46sdu9CPU3 MZJL2lpL+keboap3r4sX68231/YyEmI6jTUUr92Iol87vzQEXTj/Q0CccVJZ7VYDIWyt dTgxrNK7C7bLw6G95MMGd2Qy/OXTrATKn4O5yVW1vfZr6BC+zITgZKUtRz18GHsTKfNy WlViiOB0i9l0dmZ4Zf0e4QjRQ7xEWlFCVuYRWbdG/+te26p5q28T9wvOI3s9r4USPi6i McvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733916203; x=1734521003; 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=6l1I2ck309o9qdqJYu3bhIkW88QmjXQLLkvder5A/zo=; b=JjeB+irnRcBJdgbn/6k+KntmtK6umziX3w6HEyzSJS3bIFNEQk7iIiLGBxmQ6bc8iR 63eDChINcMY33An8PBALsVBHGQOzO4uQ3k4TWT4t3HPzN2mHFf0dgJNUEhyhXs73dsBy cxlF4DDtLDJXOIjNe/uOCEURVhMwsbXDwsUqGI1f14rgD3csBFWqu/89ffV+Yi9eSM8v 4uLBd8+MkvrtmtLwi5jV8HPHF2DYKWucMLHFxF0fho8UXxM4QE3cZD6q/bGWCp9W8W2C EuuJ9Thd1h1vp+zYNz70iPkFZSehR64djg4v214C/oJGtNqd/7CakRcZ2EGd3qnuY+TC zPGw== X-Forwarded-Encrypted: i=1; AJvYcCUTlL6UA/Kn5B5XhPrYtqQCoTp07XzRgmgfsVaIVj06RXEoeIsLWWmUsZ6sAa+SjoAXd+O3zDrv/nJ40yw7LtUe@lists.infradead.org X-Gm-Message-State: AOJu0YzOATwlmJjEx+ruQLqnz52JQQaoa2YQVxeYFTQLcTpRf4y05DOR xOo1Ok/8zQjjC+ntYcOviL8svGF+nAoVqd1vPbjgLuLkILdWDxir X-Gm-Gg: ASbGncvvpm11qlKZzGlVut7b5bFdSp04zGtMwXXlE+lGez/7pVuOON53HfFT97NxV9T f8mlflSEngUhHfKRVDpnv3rLDPOkkrzD4YMsy43lVTI1L4JGYWOL3080XFaLjvNk05+bpJwrgy1 RluEKF6Cosk5pr7uIyaPDGhEUChWonyYcGNWfbfImUbeXpmchG3JgC+4pvzWEOBXq6OKiGkWhgo DwRQt3lrtXILop+o/OUHnTPt4igYGQx/OojyNQ8JWDF9Vq2LYNfQVIvORhJSCsEqUcw1Q== X-Google-Smtp-Source: AGHT+IFZ/i4RQlCJ3AH9/61VkIUfCaOigGZYmLs5RHyiP6u8Y2aWFd6COWq3vEZzepN3j6B/3uPbDQ== X-Received: by 2002:a17:902:e54a:b0:215:2d2c:dd0c with SMTP id d9443c01a7336-21779e47121mr34337095ad.14.1733916202695; Wed, 11 Dec 2024 03:23:22 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 03:23:22 -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 6/7] cpufreq: apple-soc: Set fallback transition latency to APPLE_DVFS_TRANSITION_TIMEOUT Date: Wed, 11 Dec 2024 19:19:33 +0800 Message-ID: <20241211112244.18393-7-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032323_424300_DDE1921A X-CRM114-Status: GOOD ( 13.17 ) 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 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 --- 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..0af36f911bea 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; policy->cpuinfo.transition_latency = transition_latency; policy->dvfs_possible_from_any_cpu = true; 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: 13903386 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 72CE2E7717D for ; Wed, 11 Dec 2024 11:31:48 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qlxPth3W7wbrCgZl9TutY0yGCH/wT/pCGymBpz4R5/s=; b=KjRzG2qS7jZnyxFrhDbbN2rlMX sox78Ex+oenTY4kFyOpDk9wl36nI26OKdIDDZYlfaqJSULUM2Qqt5diD80cSU2qSjXJeFsIo2ttaL y8Z0WNAwjxhTZcGCWsk1VfcCGYZHn8t2MhGnAbgiXQWMVwmGfhwYuKtZlkF4K8kHxaTjkGZkhTGXu Uu7Wla/RPMsldA0HRN+9l5Fxxej+lPNcaJNlSTsydRdWCQsQu6g1aGlp9k/PQ8sqhA1k+swA9lGn9 PQs3mg9A2IJNMAj9pIqEe8oBXYnQ31kaMwRS71Z2tzq02/EyXmjgXXoBAoe8mm7P3Hx7DelSTN0z3 6GRWff3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLKwM-0000000Ei2I-3Wc6; Wed, 11 Dec 2024 11:31:38 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLKoQ-0000000EgKN-3Odw for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 11:23:28 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2162c0f6a39so5295855ad.0 for ; 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=lists.infradead.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=JEjPXf0wfS70Y4t3fIPWgfeBYn8d8GimcGAAzDG6FZGc5ncpZQDVTAgl/p3z+3zcoh MQdq+6miRIO9yaOM7QvznBU9cXwVJbzCaIL9cufEVN/TnpFrrPxfLdeHtqyTMCFFQnSr mOH74hq+K5FMAU3zTuuFORJeQEZFTm7JYdUyB7kqRqEdCs3OIQfQkcIeLzSTg4ke+GH0 Y26OxFotZcDOM180ZifuCr4y+Q/Rz136z7vnLhfvWYbzEh2GCL9tngzTIbcIDOPRDE6Y 4JLOre3PokyZBaBevx58Z16kZ1cC4IZzN8aPQQToBfYf28YhEf+14cubtWJ7Oi+glDyG Z5OA== 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=Dkg6NSHwKtxM8b2Kn4IPzHFOC+YHmzOynm4QQQXoLHNrmYdtQFaLUWh325kZWEIDiR GG9aOctqn5e5uRXfhZc2uJSCKzdxVm0/qEsygSV4oCr8xJ4z4iHeVCgXUMP99/dA08QC a08nhZ1oXy75Ul63O+2VZxF1VNHvgD+CXz7bPXapUyckq/nFmQ7B0uefjgWFqKi+F18T 5Msw2D1DXrxeMx2OXnsZLvPdbg57F1fMyiuspAUfA7c60Yk3hlINEbltlZIWrNywAUFv WSmGCVZih3QGiHFbY9ucl4G1U1LJcZpnHT38dj98gwwQ4rRv9QTZJVGa2/osvcRYFN12 4aSA== X-Forwarded-Encrypted: i=1; AJvYcCUnC4FJR79zjjhldwclHZivNaiyeHdkFL3sf/64HByOslnSJv+J/bN6lBabukOH3sfejW6OxEip9efrPfw0Fq98@lists.infradead.org X-Gm-Message-State: AOJu0YwgYiqT+cZvady9Jpn+LYXQMQQVoR1+XclNVeN0cfyB2JdRomno dcCNbDggfw53+tvxfzfFpYs4ifEISF17dMNXrnS3ZJeSSsyH7gB2 X-Gm-Gg: ASbGncv+n7WugODTY6cMWzynEzrCogf3pAzNbec3pWr3YA6kOnKYIZlkXz9xN8vg5Ow gzQkHLEnEluOYFlY1DP+LdbmpxbOd9LLBxxB3+UGlHI2SNesP8Ruy3Tk0YrZ5igfNho3m1/IHBv QNOhFFM7ufSkkpKIbLZVRv4gA/uXkoocrJ6aaHxqk8mUZJBUlBqL/CJnMqdOHB0kmHchHYLXSAF XmvqxI286ckVQyNbIkWC+koEMX/la4ZrZ4HLm4t2qkwlkXJ6mmLZP4uzq0sdgLyrhvH/w== 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_032326_848441_8B109815 X-CRM114-Status: GOOD ( 14.12 ) 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 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,