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: 38846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5069298wrt; Wed, 4 Jan 2023 02:26:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoLaDAdo2KxxL6i3ex4/f2CwCxxpv4ouMPRAuwnn/Dm0xCRAStxeSrOcZkZePbaJ7ltQWo X-Received: by 2002:a17:90a:2a42:b0:225:d697:40d7 with SMTP id d2-20020a17090a2a4200b00225d69740d7mr39136266pjg.36.1672827970139; Wed, 04 Jan 2023 02:26:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672827970; cv=none; d=google.com; s=arc-20160816; b=oxM9OKjZlKiaMGTAQiN0vO8rGDs5tS9NO3/kdQqAMY0RIEPHkkO+SQsmDZyMLvefF/ T6OZBbQpuMOYERGBSprtUq0xMOe2Wg+kmdF7lGgSkkjwLDr2hWKSUp+FWwekfgfnXOFl gS8GN0U92oJApoAEg7hNYmcSUSLPuIRnhSwgdAjE+B66oVgk4gTNhMj5HS9CksgmYPuW dOzE4wcjNfCxg8zRQwm6f30/xtyve5xhqzMTizcnSqriWuPOJkO2jwVM6ivdqwkGNMPu EAlncgEPtpHbp+WGdatXYGY+wAW+oRcsqTMbL7lUXsYeBvlrzjl6hjpshIrsVeTO5kgf OwIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=qKZW5DJ/oBWtpP4aNXla2DpSzmAYsit8EHGWYcVfWV8=; b=R1XormE9cs9EmCWTEu+aCjZx5dYYZdOPA8MqVwR7Pg9bwQ2iZZT5ndoEdWK4BKYVdV VnvSoJlWE+Q5oPtAtpJp1DrDvOUYmuJVd9DJjaWdoBPOkgVRN7nC8A2lC8O2G+jPb6MZ UwQRoq1Nk4+HCFJl0rlO3z8N8R+WKiQK5uAPfCg+rpHJsO9SfNk0vJtq54ICwdULjUO/ tbdmZtBsYneCEXjaPUkhPM4N/XKJ/2n8fG9F0vaHiefQfN6b2w5LcJEWmI+01+vGD/xU ABOhFaxBQJg+ufjczUzkPMECMPiVpl1epYt1h32N1RAHlbhcHPs74cfoefS6VPkxQrrk FaWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=dHYMK6WA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j64-20020a638043000000b004780e6f20a3si35518344pgd.414.2023.01.04.02.25.56; Wed, 04 Jan 2023 02:26:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=dHYMK6WA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbjADKWP (ORCPT + 99 others); Wed, 4 Jan 2023 05:22:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231128AbjADKWN (ORCPT ); Wed, 4 Jan 2023 05:22:13 -0500 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F77DED5; Wed, 4 Jan 2023 02:22:12 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sendonly@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754087262027601006?= X-GMAIL-MSGID: =?utf-8?q?1754087262027601006?= 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)