From patchwork Sun Jan 10 23:27:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 360303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36510C433E6 for ; Sun, 10 Jan 2021 23:29:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F3F2E2231F for ; Sun, 10 Jan 2021 23:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726151AbhAJX3T (ORCPT ); Sun, 10 Jan 2021 18:29:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbhAJX3T (ORCPT ); Sun, 10 Jan 2021 18:29:19 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75E66C061786; Sun, 10 Jan 2021 15:28:38 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id u25so14506979lfc.2; Sun, 10 Jan 2021 15:28:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1cjTKh3zk70/fWnN1TGeSc/TTueUPP8l3i6siZ1XPIQ=; b=b/yc/gmqhtcjC0idadVE4eFOHYHprCh9Lwg1g4cBYkO/zgieIMQ3wmrUz9FQEVEhBe SzyQ307c00ByIwogHqFMWRP2uAIY2H+DYOROvNKJn6lYnQnKYIrXBpLqnUNavr/Jwh5W v6aB8M9x1UYF9OxuW9rFG5AQpVM2/Uc1S3mGEiRMRM8VYBAz4Z5w2glmA85UdrNhiA7H pBhJlxiGjir7kc9LgJKHbxVEqW++cIHPKpN5jLNbfBcfoqlbUvM+WyOY7SJQ8JLFdBbj LfYhptZfH+vpA9rVF9l3XrwBh5916rab3AdZe06ymkute4tVLEuquCeO3kJChu86iktI rLXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1cjTKh3zk70/fWnN1TGeSc/TTueUPP8l3i6siZ1XPIQ=; b=TLOhe3/1qvIGjjolKMgUy5x8thuDM5yn1Nu0NWZHaw93CWdNF1MGMFFqWAOzb1OWjL YWjAKj4tMdVNuS1NWOj3eGLzpBx2kwRNV2B1nF7AOFj7vGuVYLeUhWirRU8ikiLziJVM tU1P7CqoPcIE2+/lVtA/AENmzQ/A4DCQKjIYqyyn09/vlh+7a5EBnHvC7tODrC0puoUe bNAnBP6Q4fA92Kqm6zJQl8EIJH6Oj0rKDRGVPq0PAX6cT2V7b5W5dV39dIe0wXHO6hIH Uu8q7oiAptoTlCEXWpCr4FYo2E/6ExOPRFyX29LOYVbZJZOF5usYvwSmGVl9BHuXAvle yuJw== X-Gm-Message-State: AOAM532NUOqNRJ8r/4Qnsr1L3Q3wJ3hOHhhRcGiHdDqmAi5m4CE9Byji uTat+81XlhqfElP5FAwuRznTpyUpA1Q= X-Google-Smtp-Source: ABdhPJyNVKR9Vz9QDSB2ZF6a2CbaOBBfIk1HCiv3Uy/csWtTD5/iWnpTytFs3731rXd+c1BNhFhqJw== X-Received: by 2002:ac2:58f7:: with SMTP id v23mr5862782lfo.26.1610321317031; Sun, 10 Jan 2021 15:28:37 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id s27sm3220563ljd.25.2021.01.10.15.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 15:28:36 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , "Rafael J. Wysocki" , Daniel Lezcano , Anton Bambura , Matt Merhar , Peter Geis Cc: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v1 1/2] cpuidle: tegra: Fix C7 idling state on Tegra114 Date: Mon, 11 Jan 2021 02:27:04 +0300 Message-Id: <20210110232705.20658-1-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Trusted Foundation firmware doesn't implement the do_idle call and in this case suspending should fall back to the common suspend path. In order to fix this issue we will unconditionally set the NOFLUSH_L2 mode via firmware call, which is a NO-OP on Tegra30/124, and then proceed to the C7 idling, like it was done by the older Tegra114 cpuidle driver. Fixes: 14e086baca50 ("cpuidle: tegra: Squash Tegra114 driver into the common driver") Cc: stable@vger.kernel.org # 5.7+ Reported-by: Anton Bambura Tested-by: Anton Bambura Tested-by: Matt Merhar Tested-by: Peter Geis Signed-off-by: Dmitry Osipenko --- drivers/cpuidle/cpuidle-tegra.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c index ecc5d9b31553..49531939f24b 100644 --- a/drivers/cpuidle/cpuidle-tegra.c +++ b/drivers/cpuidle/cpuidle-tegra.c @@ -135,13 +135,13 @@ static int tegra_cpuidle_c7_enter(void) { int err; - if (tegra_cpuidle_using_firmware()) { - err = call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2); - if (err) - return err; + err = call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2); + if (err && err != -ENOSYS) + return err; - return call_firmware_op(do_idle, 0); - } + err = call_firmware_op(do_idle, 0); + if (err != -ENOSYS) + return err; return cpu_suspend(0, tegra30_pm_secondary_cpu_suspend); } From patchwork Sun Jan 10 23:27:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 360758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66173C433E9 for ; Sun, 10 Jan 2021 23:29:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3100A22AB9 for ; Sun, 10 Jan 2021 23:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726229AbhAJX3U (ORCPT ); Sun, 10 Jan 2021 18:29:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbhAJX3U (ORCPT ); Sun, 10 Jan 2021 18:29:20 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61EF3C061794; Sun, 10 Jan 2021 15:28:39 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id w26so1453355ljo.4; Sun, 10 Jan 2021 15:28:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gmTSjSeyUWQmPkotNjgjdIHP/fEVm6ggDFHMD/YD1ts=; b=hFfhMSm6L+RIZcO73W69XnCqWlYC5WZap3JcD+9ZD1RKoDnFraA1me0FPYbxCNAPRf GZIJ70uhQvQyJT5/Q7Qou+P3f2k+DUoq923iqDc0waWolvjDi1uwWx7HTzRo8ciIYv5h rOypS1xiFFhqCji6tYAVKgk1cfpXdfE56xUFC+mgK0gAi7NKAKbQfHy5T5veosfz8RJc IdNxG9G08YTrTDV6m1YQAxklln1qkophXvkP8O8XQ/56LgWXfcqlbEvskig46NHKNdoR An9NbQMSyYOLcsw/YZb1JWtLSnKydLsDpH12mUN5CP5flbNFF1srww0BRb6svtlyg59F KNew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gmTSjSeyUWQmPkotNjgjdIHP/fEVm6ggDFHMD/YD1ts=; b=ggDCL8cfEa0EZNK5SkFgtfEkTcS27m3KfH/4nuA/qfOb7lsYtL1r4wCpmxDDYGBUd3 8FfIQjvdh8EPGyJxsQ00Bbowc8NQV9TJXlwo6VrMrtsbHd/PFlHRM02jeObtUegygAlW kEPiCfxR8HMw+kvMF6r+QOJAa04ZLvg5vSGE5hEzOfB3IEtU/d19plIG0/D7hzFn0kon Hwab8foaWYKgHlJlSRWLCtHCa+nF8eTgWOz/su24WZmC6rNtlPwe5fOYp06LxHLPaNqN k8ZtZu3bXVErBrUyanHnKfRvNwzdLVG3eh2+gLHwq3Ud8Yog4Xr2nk4aId5LOJ1FwDFY q4Rg== X-Gm-Message-State: AOAM530ch5BH4+z+VXhSPp2byKgkOIH7m7VyUGCPMOmEcWTOPYCmR/t3 fzVyYvWFxweSvyJL6FhdWGQ= X-Google-Smtp-Source: ABdhPJz//Mv/RJyC9CZ93smyAEujTwC2Q0Oxx0c4wuPDDbR3gBg8sKl77o8tNFj3po49jgIGpaFA5Q== X-Received: by 2002:a2e:9988:: with SMTP id w8mr5852507lji.107.1610321317867; Sun, 10 Jan 2021 15:28:37 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id s27sm3220563ljd.25.2021.01.10.15.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 15:28:37 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , "Rafael J. Wysocki" , Daniel Lezcano , Anton Bambura , Matt Merhar , Peter Geis Cc: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v1 2/2] cpuidle: tegra: Remove do_idle firmware call Date: Mon, 11 Jan 2021 02:27:05 +0300 Message-Id: <20210110232705.20658-2-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210110232705.20658-1-digetx@gmail.com> References: <20210110232705.20658-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The do_idle firmware call is unused by all Tegra SoCs, hence remove it in order to keep driver's code clean. Tested-by: Anton Bambura Tested-by: Matt Merhar Tested-by: Peter Geis Signed-off-by: Dmitry Osipenko --- drivers/cpuidle/cpuidle-tegra.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c index 49531939f24b..e8f92e4d5739 100644 --- a/drivers/cpuidle/cpuidle-tegra.c +++ b/drivers/cpuidle/cpuidle-tegra.c @@ -48,11 +48,6 @@ enum tegra_state { static atomic_t tegra_idle_barrier; static atomic_t tegra_abort_flag; -static inline bool tegra_cpuidle_using_firmware(void) -{ - return firmware_ops->prepare_idle && firmware_ops->do_idle; -} - static void tegra_cpuidle_report_cpus_state(void) { unsigned long cpu, lcpu, csr; @@ -139,10 +134,6 @@ static int tegra_cpuidle_c7_enter(void) if (err && err != -ENOSYS) return err; - err = call_firmware_op(do_idle, 0); - if (err != -ENOSYS) - return err; - return cpu_suspend(0, tegra30_pm_secondary_cpu_suspend); } @@ -356,9 +347,7 @@ static int tegra_cpuidle_probe(struct platform_device *pdev) * is disabled. */ if (!IS_ENABLED(CONFIG_PM_SLEEP)) { - if (!tegra_cpuidle_using_firmware()) - tegra_cpuidle_disable_state(TEGRA_C7); - + tegra_cpuidle_disable_state(TEGRA_C7); tegra_cpuidle_disable_state(TEGRA_CC6); }