From patchwork Mon Dec 18 20:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liming Sun X-Patchwork-Id: 1877636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sv9vx0qxBz1ydc for ; Tue, 19 Dec 2023 07:11:57 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rFJxo-0001Mt-Q6; Mon, 18 Dec 2023 20:11:45 +0000 Received: from mail-mw2nam10on2072.outbound.protection.outlook.com ([40.107.94.72] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rFJxR-0001GB-Hf for kernel-team@lists.ubuntu.com; Mon, 18 Dec 2023 20:11:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGNyeQKmbpZV1mbDfELG3PMQQSjf7nQcHQzzARdw36UR9ZS1uBzWsYZ+fIy/1hHytqK6fZRrC/N/2/JR9pn/5pca3EOJUw+k81Y+/7o/Ffu3UHoZkGijiMEHs7LAeZ8oOXm4hOIHUeyxyB06Pa5ubdAWAP58+wKsYAwQpYTOkQ9I+YnVO4cDA0SeXwfQH2lmupjT1g+rlK8a1j7eYFXlTJ5D66prTtk2ljTUiKF7k4prap4/BpwF76e9wIEF8AZUgjDhCsZtqW5WCOOCtFU6zmF90h3oGIbO2UU57DhnuQcIXSLpq+0ZeuQTB/LLDKklYghVr3AZQ+J/pQdXJ7S8Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3zcRB2amBMgw9IZ+j8zbQBWgFh8eWRwQD3zd75AM3h4=; b=NcjCfvlGrqmJNgoFssU5ag1jLdHUkh9M4kcKcetEtkajgDC00qv2wkgp+aIZwsHsw5SIFaFQwqmjsW4F50SsgPmlfA1CQQDhWnkK74/gNzf3CxEYGR7EDR5UxqduQhAHooddNMM+YS3N6+3VfI/0t2BKp8a3eI/4TyOm7No5+z1H4mr8CVcPABYFc2q7CJNfr0vH3hk5k8cgHfRR+zPuGd9Zev1CKM944gQHmHYX2eVF2rswzA0k0P82fptCfWH/3aMIznHxSPW/hGiU7sYJSqHCLg0ILAwZ6rUS0yuUdW3MSAYnO4ImZsHCV9agsPGVrJFagB2mD4XcdmaZcjV4yw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) Received: from MN2PR17CA0009.namprd17.prod.outlook.com (2603:10b6:208:15e::22) by MW4PR12MB7437.namprd12.prod.outlook.com (2603:10b6:303:21a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.35; Mon, 18 Dec 2023 20:11:17 +0000 Received: from BL6PEPF0001AB4C.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::95) by MN2PR17CA0009.outlook.office365.com (2603:10b6:208:15e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.38 via Frontend Transport; Mon, 18 Dec 2023 20:11:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BL6PEPF0001AB4C.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.14 via Frontend Transport; Mon, 18 Dec 2023 20:11:16 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 18 Dec 2023 12:11:03 -0800 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 18 Dec 2023 12:11:02 -0800 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 18 Dec 2023 12:11:02 -0800 From: Liming Sun To: Subject: [PATCH v1 1/7] Revert UBUNTU: SAUCE: mmc: sdhci-of-dwcmshc: Add runtime PM operations for BlueField-3 Date: Mon, 18 Dec 2023 15:10:49 -0500 Message-ID: <7315e47661ea7ae98ccffaee3c4d921c8de7ef07.1702924774.git.limings@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4C:EE_|MW4PR12MB7437:EE_ X-MS-Office365-Filtering-Correlation-Id: b64c008e-f8fb-4e68-8a16-08dc00057dd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JtbZoxy0e06R2hWpIC4F6c+Yx2KuIUSJfxZyVX85rH02CefR+CtBhuh7nIE98aZiqs4DeSReleZXzBoIBJE3ZG8Qf3vatf43sejXhAmRnaJeB/2sKmu/E8yPvQ+cI07/VUSBQajF2o6ZJEF2slqkJNNTiTVirwvNO/f7XBiyjuc9cbTYl6WvbSlol+QtrTL+BmW504tEXU+ZpYEzgmH8YnJ8Wutzc8WV5MnEbzcWK/8znCwaDdnD0WFoeOS22TPwjyinHy+gyv0D0rNyB6T84g4k2+jUwJlLnVYkZIx7j5X6s0OoGzx0NO1xSazBQAv+xjAttgns4mFf+C9gVpXboVxDmMlp5lTIZpPeC4BXft4PfuhAgTNrndBO+22CdXZ9o7HRvbs0Fz++0LVPRnQNmItTDGO/4RKsgsCvhEmAs6j9d9YPfoc18HQeze1fLYd8TSPTBEpd5HpFp4BMbZNe0Z4t8vTjx0lGl++nGB5hZcMTG/FYR8G5RaPbglfBWO2Ca7hK7DPfc2pUB/z2jfrcDcZFUU6ENEyl7wEdk0UBL3NdV03qYFj2RaQ+GU2AzrWHyfBcE76zuWKaEH5kokMfxzb4dlx/F4/aP/zQyy4yxvxEX6Zoy9YC+byQie1Rk0LpLeg2fP6iOIWf/sXUYtgxuF4A6gaukujXKgatjygDcnGHhSw54mibKrYLCqz6y8kDFZOZjqeuDtD7lPfoVr9f/hlxcRmWHB0qNNy3rOgYqlDQsuL+dIAMOvf3zAZsebhE5Nxas/o4EB3jwkSgawWxzm5JN4gp8NylnEW1qp1dwdCkDtndYzG3vb3Kt+a+p40N X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(396003)(376002)(136003)(39860400002)(230922051799003)(186009)(1800799012)(82310400011)(451199024)(64100799003)(40470700004)(36840700001)(46966006)(40460700003)(40480700001)(316002)(426003)(7696005)(336012)(107886003)(2616005)(26005)(6666004)(70206006)(4326008)(54906003)(6916009)(5660300002)(966005)(47076005)(83380400001)(36860700001)(478600001)(86362001)(8936002)(8676002)(41300700001)(7636003)(82740400003)(70586007)(36756003)(356005)(2906002)(133343001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2023 20:11:16.3916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b64c008e-f8fb-4e68-8a16-08dc00057dd8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB4C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7437 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Sun , David Thompson Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2046657 This reverts commit 3ec050f4050f804ad65d051796c95c49feb15efa. --- drivers/mmc/host/sdhci-of-dwcmshc.c | 103 +--------------------------- 1 file changed, 1 insertion(+), 102 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index 188c5ae7efc5..87a831a752fd 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -75,22 +74,6 @@ struct dwcmshc_priv { void *priv; /* pointer to SoC private stuff */ }; -/* Last jiffies when entering idle state */ -static uint64_t idle_last_jiffies; - -/* Total jiffies in idle state */ -static uint64_t idle_total_jiffies; - -/* Total idle time */ -static int idle_time; -module_param(idle_time, int, 0444); -MODULE_PARM_DESC(idle_time, "idle time (seconds)"); - -/* The current idle state */ -static int idle_state; -module_param(idle_state, int, 0444); -MODULE_PARM_DESC(idle_state, "idle state (0: not idle, 1: idle)"); - /* * If DMA addr spans 128MB boundary, we split the DMA transfer into two * so that each DMA transfer doesn't exceed the boundary. @@ -474,7 +457,6 @@ static int dwcmshc_probe(struct platform_device *pdev) #ifdef CONFIG_ACPI if (pltfm_data == &sdhci_dwcmshc_bf3_pdata) { sdhci_enable_v4_mode(host); - pm_runtime_enable(dev); } #endif @@ -569,90 +551,7 @@ static int dwcmshc_resume(struct device *dev) } #endif -#ifdef CONFIG_PM - -#ifdef CONFIG_ACPI -static void dwcmshc_enable_card_clk(struct sdhci_host *host) -{ - u16 ctrl; - - ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); - ctrl |= SDHCI_CLOCK_CARD_EN; - sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); -} - -static void dwcmshc_disable_card_clk(struct sdhci_host *host) -{ - u16 ctrl; - - ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); - ctrl &= ~SDHCI_CLOCK_CARD_EN; - sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); -} -#endif - -static int dwcmshc_runtime_suspend(struct device *dev) -{ - struct sdhci_host *host = dev_get_drvdata(dev); - const struct sdhci_pltfm_data *pltfm_data; - int ret = 0; - - pltfm_data = device_get_match_data(dev); - if (!pltfm_data) - return -ENODEV; - -#ifdef CONFIG_ACPI - if (pltfm_data == &sdhci_dwcmshc_bf3_pdata) { - ret = sdhci_runtime_suspend_host(host); - if (!ret) { - dwcmshc_disable_card_clk(host); - - if (!idle_state) { - idle_state = 1; - idle_last_jiffies = jiffies; - } - } - } -#endif - - return ret; -} - -static int dwcmshc_runtime_resume(struct device *dev) -{ - struct sdhci_host *host = dev_get_drvdata(dev); - const struct sdhci_pltfm_data *pltfm_data; - int ret = 0; - - pltfm_data = device_get_match_data(dev); - if (!pltfm_data) - return -ENODEV; - -#ifdef CONFIG_ACPI - if (pltfm_data == &sdhci_dwcmshc_bf3_pdata) { - dwcmshc_enable_card_clk(host); - - if (idle_state) { - idle_state = 0; - idle_total_jiffies = jiffies - idle_last_jiffies; - idle_time += jiffies_to_msecs( - idle_total_jiffies) / 1000; - } - - ret = sdhci_runtime_resume_host(host, 0); - } -#endif - - return ret; -} - -#endif - -static const struct dev_pm_ops dwcmshc_pmops = { - SET_SYSTEM_SLEEP_PM_OPS(dwcmshc_suspend, dwcmshc_resume) - SET_RUNTIME_PM_OPS(dwcmshc_runtime_suspend, - dwcmshc_runtime_resume, NULL) -}; +static SIMPLE_DEV_PM_OPS(dwcmshc_pmops, dwcmshc_suspend, dwcmshc_resume); static struct platform_driver sdhci_dwcmshc_driver = { .driver = {