From patchwork Wed Jan 4 10:21:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 13088449 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 70CD7C46467 for ; Wed, 4 Jan 2023 10:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OzMFLub4Af0dxVF+zN3fH/6jy0D9W3szCkR0/ooL7Xk=; b=JMl+3A3hFy7Nsf OpVLPZ74ScxsLDcb/BXcf5go7/V7lrxwp7qDHx22/Qg2Dek/uUq6HWlHNTSt/an+4wrz2WTAajFsi yvUX1MXo3pKH2xAf6xO3daUCAsaWfhyvpxunHzD6O7pn+tXcUnzeM8zVm5J6ajO/v9UUMDDpht/j/ BiHQxEM1CvPPf4WjIVHcDfmZ+xkznuaGXvkLlqN0chGWKJvZa2aBTMgL6hnDoG3gccWsaPwNwnp4F rzAmIRlOVKqPBFXv7gX0GW63bHdvbRFZNqP52JFpgOjbH9tr1osAbo1zdbaxlH2pHOYtDFDUeH5C7 7LWqPJnCFgo8j00d2tjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pD10J-008Ng1-Oe; Wed, 04 Jan 2023 10:28:15 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pD0uT-008MZz-LC for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2023 10:22:17 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sendonly@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 8896A41DF4; Wed, 4 Jan 2023 10:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1672827731; bh=C65Y880SV1Tdts/rGaPJHJDfQ8ugZxGMUgNTK5mzFGs=; h=From:To:Cc:Subject:Date; b=dHYMK6WAEPqelJLF5YEYu1B0EEsAKD+W5xwP4bMwOSs8erzoVRN8IC1dKJllMa+vF ude2NFLUUFa3jLATefD+0kxumhCMEhXtt8PRJKVpw6Q/EZoeTxlKSiYx6RuOBkLXEf jAw5f9VXpRQR2gf/TUJnC0PeOcsf9UIMs2/MaERTdIZiFcORo+8kueO1EwoufihK+X ELMG7mUMCiss0uHxxIk6EaLzgB6QCmNnVtV3QGeGZtqiYYf5+udtRpyBpqW6O/0G87 kZ+QuU10TV15lyCStlDtn7OkT0vajJCWUVSM8aiLoqm0/oyaeYwrhWhaA1PR3wct// 4v5EyVadU1jsA== From: Hector Martin To: "Rafael J. Wysocki" , Viresh Kumar Cc: Hector Martin , Sven Peter , Alyssa Rosenzweig , Marc Zyngier , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: apple-soc: Switch to the lowest frequency on suspend Date: Wed, 4 Jan 2023 19:21:49 +0900 Message-Id: <20230104102149.16263-1-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230104_022215_862427_B5C3D7D3 X-CRM114-Status: GOOD ( 10.43 ) 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 Without this, the CPUs are left in a random pstate. Since we don't support deep idle yet (which powers down the CPUs), this results in significantly increased idle power consumption in suspend. Fixes: 6286bbb40576 ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states") Signed-off-by: Hector Martin --- drivers/cpufreq/apple-soc-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index d1801281cdd9..1b4e6c701860 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -280,6 +280,7 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy) policy->cpuinfo.transition_latency = transition_latency; policy->dvfs_possible_from_any_cpu = true; policy->fast_switch_possible = true; + policy->suspend_freq = freq_table[0].frequency; if (policy_has_boost_freq(policy)) { ret = cpufreq_enable_boost_support(); @@ -329,6 +330,7 @@ static struct cpufreq_driver apple_soc_cpufreq_driver = { .fast_switch = apple_soc_cpufreq_fast_switch, .register_em = cpufreq_register_em_with_opp, .attr = apple_soc_cpufreq_hw_attr, + .suspend = cpufreq_generic_suspend, }; static int __init apple_soc_cpufreq_module_init(void)