Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4696676pxv; Tue, 20 Jul 2021 09:32:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEFWb7bjR5K0UcrE5gcoXABDGGfJ5vvXZuLumbL2Lige0ynjmHhIQKt+WLOPddwD17CWRT X-Received: by 2002:a05:6402:1d96:: with SMTP id dk22mr41457456edb.7.1626798753228; Tue, 20 Jul 2021 09:32:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626798753; cv=pass; d=google.com; s=arc-20160816; b=S32LQRWTynTPOloP0VH2EtPAPpWkT0lZYRO443KMqtyeDhhG5I4pvf5jYA1WL4VEaU B+7wkihtlwp3UxIayF2CqfWX9vPNHyMZRAfwNi8p8ryjkq6vFGvnOcRlwC2iimvLqFcU sFuGFuxhsUJ5mMPaL9/1NYr1zLRxhenoBy6foNT5SlS5puseYi/hvjcp+Et7a9Rugtll u9KXLnajXopbQG4lN7aq3RLsT0DpswWXxVa6ziNXXuhmOI57LUg106hEK2cIrHVwMyiL wCWkhTZoi4Rxi8cN0XcO7VZ9pX3TxvIRAh1VDon1eCzi5ZTlt+P1LxzyN2XJsgROzC6G UZeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XobA1l++vrxesg4ZMRqffclUjEnXwpXU4R6ua2fJh5k=; b=hSwttAbHgxIfU1eO15FAf69zvEeB4XThbzS0Y7SX8VplUWSRJ64BCOPcmfd+/nfnkF 8FURAepaJjbIJ1ECebxr5oA3JNhGMAqDDogw2uXH+IkHz2eyypAFL7K63g+/yBJJV3pu QF2XguGTVgcPgvs3Ek82xr8CJmE7fv9HGXULriiz7pthm7CzAdww7r5cUIJv7BYbxdNc EyHNzUKabzeyFz6iKE+I65lQiG29Ksmqpi7d+2wKQXOZ4KWzX+zMnWK3os9X8Brh9fBk SbxQTqECpXjY6vnhuyiLQZyWQ25bLfko4S8xrNzYGlJBdMyJaokPilGyg+TdLHIHd+iV QHSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZufyGcAG; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si24571093ejt.443.2021.07.20.09.32.08; Tue, 20 Jul 2021 09:32:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZufyGcAG; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235056AbhGTPth (ORCPT + 99 others); Tue, 20 Jul 2021 11:49:37 -0400 Received: from mail-sn1anam02on2065.outbound.protection.outlook.com ([40.107.96.65]:2643 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237659AbhGTPlQ (ORCPT ); Tue, 20 Jul 2021 11:41:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQiNO4lyntc7hbp3YRKv+3sCVCSI02n0GhODIwalMCXjy7KHVe307RyCq/zVR6sJQmeoQooX3/S5PYhHCIPdrle0c2zL9+kVuFokMOzs/S33cqHzT5uoT7ooQp5Putz0MJD+vjl1n5MDFecEpIylYDUUKxb6HKVS293FEUFc0uIPwvdxnUfzfiHqavHUyIa/02I6y679W5Dyjsd52K5zztxWY2q9rOpoaiS0/vFlaQVH8kV10/KOACuDuG64zBUH1lDMpw4WgwipvpSOrPfjIy21YZ1UBEUKpMbSykVWEqANAnILgh/jXZTmTP6s0puxrq1QPf9Wp7GjZ+i6183fgw== 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-SenderADCheck; bh=XobA1l++vrxesg4ZMRqffclUjEnXwpXU4R6ua2fJh5k=; b=fjHD9jw8lREUuqtwbOpDdJD0/2KW1iT2vaaXGTMWdzObyTEcjtInH7RalJD/3s2d5ZGEE7KLe9Jd47mLhUYZrVFq3zDN0xjdtOPt4ubm9VLZbg9ByUSa3qyUlRjJNDBkvIGRWWpc+7BiAwGUt0yMesvJfeIk49+ECRLSOEp1LW+nJMxd+aEjYcFM1AOkiQKiZ7MptCRLJBYrbF4LJABp2C4jIGj4pdzcpGlRmuhbZqZzDNAGxfDYG9CbMop6WUsuQlz7p+dAQBCTYpY7EzdL/hNjg4U+MqFi5UV5ZXZ8fqTnf81uDSZLZWNExhROM1TLVYuFmHqXmKycctakZXv6jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XobA1l++vrxesg4ZMRqffclUjEnXwpXU4R6ua2fJh5k=; b=ZufyGcAGhok9ffM2tygpbNUU4mdrS0mAJoWTPwDTJqRaEOTEF7aJ/zWe5OoyGmS38pfIQgzd83cwYIRYVGyimyyOXQq1z72LR1NGlVxrRCrMWROd7k0xza1xRdka3NamWNoaumNhr2jUzr8nh0OUC2dWx+GoGDu6kghc1BGun1k= Received: from MW4PR04CA0193.namprd04.prod.outlook.com (2603:10b6:303:86::18) by MWHPR12MB1488.namprd12.prod.outlook.com (2603:10b6:301:f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Tue, 20 Jul 2021 16:21:46 +0000 Received: from CO1NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::14) by MW4PR04CA0193.outlook.office365.com (2603:10b6:303:86::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24 via Frontend Transport; Tue, 20 Jul 2021 16:21:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT029.mail.protection.outlook.com (10.13.174.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 16:21:46 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 11:21:45 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 20 Jul 2021 09:21:45 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Tue, 20 Jul 2021 11:21:41 -0500 From: Vijendar Mukunda To: , CC: , , , Vijendar Mukunda , "Liam Girdwood" , Jaroslav Kysela , "Takashi Iwai" , open list Subject: [PATCH v4 10/12] ASoC: amd: add vangogh pci driver pm ops Date: Tue, 20 Jul 2021 22:07:30 +0530 Message-ID: <20210720163732.23003-11-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> References: <20210720163732.23003-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ada2f880-510d-4287-7bf2-08d94b9a7843 X-MS-TrafficTypeDiagnostic: MWHPR12MB1488: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wgVsedyyt60S8NnJlH9fBL51/Y3FObhy0s94zutJQYhHszcEUnvPoisF/ltzDpw7TkmNIxG2b0D+mjnt1UIMQJ6LFN7rrNaZNsHFMqQBlayej51m2q6ODwL6sCwntaJVSYuX/c8M+VU7BcpNV6J90NF3wI7yauai2tWVkIZzprvfko5bsV4cKz6DQ7NiBEzgePZ9A7/mOHBSb5H+PPcx7JkUCXeMIdpEum0h0l0ckjEEl/LknKjWVhzZE2z8wYJ4foL4unrvzJpO3i94OrGaZQM5eyBwWj7Ul0Chi98t0zC5f/BFnVLCmxZfPxagmbaZgHBWZ3xbOGUuYxKvUpr5TVWUo3eQOewhtVdwhw0VaS071svJVlk1wi8yo85Kxmbhvbp6QfB9NtCVY6IdlDLXp+9EEHbfIa4E9fS2wClAKwhuCp44B0LJGGwT9lC23pQPSC0drv5vIgbw7hgRiX7wwIPmxaAeh4locEDvzGOko00TSKvWM2MOlDsiPP2jbTehrYhTfFp6hEsaB2YLt6148rJkJ742tuN5mY2EQxjdDbTC2F6CTkDHP4ASDlzZkn7+iMXGLV48d17bpEKkJTfvryrUx/g/92Q3NNXb6q/wrmDPA/9Nq3uFlUAzC2151Rv1XJNAdrzWdo6fr8qh8N7dQXqUZGHzwDvBX02/n13lRZSoA3YKC9PB8KvyZiEPxXNJYo4XI/ARa3jWb9JCU+rYuUCTU04L5w+rupalBNrPsbA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(7696005)(82310400003)(2906002)(356005)(5660300002)(47076005)(426003)(186003)(70586007)(2616005)(4326008)(36756003)(8676002)(6666004)(83380400001)(110136005)(54906003)(8936002)(336012)(36860700001)(1076003)(86362001)(70206006)(316002)(81166007)(508600001)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 16:21:46.2652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ada2f880-510d-4287-7bf2-08d94b9a7843 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1488 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add Vangogh acp pci driver pm ops. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/pci-acp5x.c | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c index 25b42a37ad3a..a57b762d9f2e 100644 --- a/sound/soc/amd/vangogh/pci-acp5x.c +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "acp5x.h" @@ -226,6 +227,10 @@ static int snd_acp5x_probe(struct pci_dev *pci, default: dev_info(&pci->dev, "ACP audio mode : %d\n", val); } + pm_runtime_set_autosuspend_delay(&pci->dev, 2000); + pm_runtime_use_autosuspend(&pci->dev); + pm_runtime_put_noidle(&pci->dev); + pm_runtime_allow(&pci->dev); return 0; unregister_devs: @@ -242,6 +247,41 @@ static int snd_acp5x_probe(struct pci_dev *pci, return ret; } +static int __maybe_unused snd_acp5x_suspend(struct device *dev) +{ + int ret; + struct acp5x_dev_data *adata; + + adata = dev_get_drvdata(dev); + ret = acp5x_deinit(adata->acp5x_base); + if (ret) + dev_err(dev, "ACP de-init failed\n"); + else + dev_dbg(dev, "ACP de-initialized\n"); + + return ret; +} + +static int __maybe_unused snd_acp5x_resume(struct device *dev) +{ + int ret; + struct acp5x_dev_data *adata; + + adata = dev_get_drvdata(dev); + ret = acp5x_init(adata->acp5x_base); + if (ret) { + dev_err(dev, "ACP init failed\n"); + return ret; + } + return 0; +} + +static const struct dev_pm_ops acp5x_pm = { + SET_RUNTIME_PM_OPS(snd_acp5x_suspend, + snd_acp5x_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume) +}; + static void snd_acp5x_remove(struct pci_dev *pci) { struct acp5x_dev_data *adata; @@ -255,6 +295,8 @@ static void snd_acp5x_remove(struct pci_dev *pci) ret = acp5x_deinit(adata->acp5x_base); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); + pm_runtime_forbid(&pci->dev); + pm_runtime_get_noresume(&pci->dev); pci_release_regions(pci); pci_disable_device(pci); } @@ -272,6 +314,9 @@ static struct pci_driver acp5x_driver = { .id_table = snd_acp5x_ids, .probe = snd_acp5x_probe, .remove = snd_acp5x_remove, + .driver = { + .pm = &acp5x_pm, + } }; module_pci_driver(acp5x_driver); -- 2.17.1