From patchwork Wed Dec 21 17:28:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3650718wrn; Wed, 21 Dec 2022 09:31:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXuVRWTIuiEFGWBDg1mahTfU/c+3EGGPPUmw5Ep1VXk6ZlEQd9IU8TNXc7KMSGf/pyiL14U5 X-Received: by 2002:aa7:d689:0:b0:46c:3f90:f5d9 with SMTP id d9-20020aa7d689000000b0046c3f90f5d9mr2166118edr.5.1671643896604; Wed, 21 Dec 2022 09:31:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671643896; cv=pass; d=google.com; s=arc-20160816; b=JCtaUzSeXFB3hti+cczeeSGuUXdHi+VqCsPWnel2AVKpg4g8IGKmnUaYTiZ8q/GYeX xNR/otMmLyWdPjy/qRhB1xLF6IuJkfdh1+ZJIqQtogYuV+oXJiYUuX0YykFN3vffvEeL hGbK09I75kcWrSOX29GZmbkiukIJ1ujH5GSLg7A+uXt5AlE8AQL1R1vsB8uR+r31I8ea MwXsL/LqS73Em79PTJPekNEPucknI66tuUq4TWu94Ot0su3645DV/DDMzc9pcE128G5a QQpdid/HLZc37FVRoDz6LZZkMIkjsjPhCUpGyqLI64sVE7LbYgct1PY5MokZRsByb4VG 87Wg== ARC-Message-Signature: i=2; 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=J96pzOxwZFlgg0y0WXIGl2xP84XmZEDfli4PLk6EJVA=; b=JSzI3QVog/pDeQiufvcxmSvjsnF4WeTE1sFJVmwTOl1QhjLBH8mOCdTbGkNBTOYcBC 58w+8Z4D40zw9qpQKIS6uqibqiZwcrTJ7sLLxZKuAcfKsBrt2YMdC7kq61T52J9C7FBE SGDxze+QI9QQDwQZbO3+q/wgeAm31qXqUk2xLeflD6T0XwV8dNOQxZ7i2nuBWg0MBb0n f0dmAhEKtUj5qLhHXugNpPJwGZpKxlC+0LKyBOIIS3qcCvuM91o+wDIwcAkMUBRLiyhu xr7gVSg1NU9tZqLoJYZqHzzDV2H9lI8ow6IO0K67GJ/8PR3URvKsf4hpPkfwkh215R+m zdgg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1AohLLTy; 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 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a056402035200b0046aeca41c55si12878789edw.212.2022.12.21.09.31.12; Wed, 21 Dec 2022 09:31:36 -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=@amd.com header.s=selector1 header.b=1AohLLTy; 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 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbiLUR0Y (ORCPT + 99 others); Wed, 21 Dec 2022 12:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiLUR0U (ORCPT ); Wed, 21 Dec 2022 12:26:20 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2075.outbound.protection.outlook.com [40.107.100.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60F205FFF for ; Wed, 21 Dec 2022 09:26:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=An3imOhKDwCgcFKLAea/Fl4ceJIquEcDGMVG6cT/tg+rmbnZ7UHHMxeUoCqtzzv6cKdr6buX9kZudI8a5ZPSWYFDaNbLto/w7BedUmY72PdylqqawlNc/4nZtRxHGZKmKyZUrkD9V9RAxdIYJbWj3dWj8VAAOPGg6Z1UWOcnZ3wKuIqt8kUdA0DQ62pVwbCFvz2rfKHGwbfLosV1El9jWtaJ53dS/nFSDR5vG+aA9hWbmLNMAJXq9wwAotkMQxGQBzQkBEN/q2O/7OqGsh8EewoTmoe1gcBx0ko8TUgGGzR6X0c+4s1tH+hHRcBU7f/xNevEIZJSLon8Crnlpf3Q9A== 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=J96pzOxwZFlgg0y0WXIGl2xP84XmZEDfli4PLk6EJVA=; b=E8+Y/y0r/RaQS3q/XEYW8MSu2B38IKLum1l3dTWSyi9G3mCMqW2MhSdfOzBiOn6KDUFiYedYAT7nzVW/G/y1FwyIFCpuC57QX0xGP5WdIKpF7rq0j14CoIBtJfloTVq/INH7Ru0YXnDoQyOP7bFabqZRCHaFKCfBsno5Y4VACBfXWeuv0/amrm48JRMce4VrbNKdfADJefgbWYeoeEl3HcuMpVSp7tsV8hDeDq4JD0F5pKXvIaAX99xWelPNEckdWOWe1yniE5ckjag+eZJaqOlvZMeIg1U/SlQ0LrN5NIujz+6tc95FNwMDcGYYFeM4urG9cEheyCRlpSLf5NdLZQ== 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=J96pzOxwZFlgg0y0WXIGl2xP84XmZEDfli4PLk6EJVA=; b=1AohLLTyczqe1EzJ9nAVE0di5vNgO+P5Qvd9bkfoHFXcpSb1eBVdCdYaaoROyWeAKOeZ0PWBRbnAQUgTvo6PYE25rtigoGDkXiuEpd9DEAOoiurhGzSvZtmKynA7iH+CpJS7qUlKAmg27FAfx7tQWkXTZf+YXjDn/L3XUQow3Fg= Received: from BN9P222CA0008.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::13) by MN2PR12MB4472.namprd12.prod.outlook.com (2603:10b6:208:267::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 17:26:17 +0000 Received: from BN8NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10c:cafe::9e) by BN9P222CA0008.outlook.office365.com (2603:10b6:408:10c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 17:26:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT004.mail.protection.outlook.com (10.13.176.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 17:26:17 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 11:26:16 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 09:26:16 -0800 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 21 Dec 2022 11:26:13 -0600 From: Vijendar Mukunda To: , CC: , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , open list Subject: [PATCH V2 1/4] ASoC: amd: ps: implement api to retrieve acp device config Date: Wed, 21 Dec 2022 22:58:48 +0530 Message-ID: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT004:EE_|MN2PR12MB4472:EE_ X-MS-Office365-Filtering-Correlation-Id: c1ed88a8-e432-4bd7-95f9-08dae37877e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9JTpQ96ka+t5OPr58AVNogKyAdlUBN4oqrwa3DYF1b0CfY26VU4MOnAmBJh90pe8OJ8h6d4+knALFKhkwOPRo70JLWI8QdQ5CH0zh5Aujz1M9HDSajeEqURE3FsjUGP0n4Wxbhj9PvX2WwfcfOSMYD+Em3XuGI1m4UaQW8dQtCOhf5UteZGv6qTM0FaJBu6h01RiqNVZ04lUidJnxif9gOHfA2TPtmgl4stchEDACMWCSe+48AXCChXlioWDNKccZKFL7zGdZh48qmIcdY/gn2MIpcoqQhlg+tav4TXLWawpsMGw07eEHU+LsH5Z2zOg+7Jh8sYil5NIg/V4+NKwpmt38cbVGCklYdJVLZdbTkbj/wADOmuUW9HOcTa7REjPG5ykstAOQzyezhqOGzXFdtGWU8FnGCSajvNnFlWCibGDWcK+9pReMnVu9DT10X0DvdfqEyJ+O+0H6WYBFUVSVrFVCidQRm8ncEisRyJ/0qStSIq5GTno9rJ5g4f/vmcAf44b/8h6bteo5vCcUwQQDRWQlC0lFD68M5tSprD7K4FuhoyUU9jtRBimhrKQI+jGQbb3P01WbePHS2uNpYEw8YFJp1XvsYJCDgXiMg2PoS22QYF7nG6ZRwsKUsUQ5oS6Te5wZ0yzzxXusoNlVg7CN0o905XnR/W6thxKRm0q6TOGwpUttfKm0hkTPlUBlVzCi06htAvuxx9iiVIvros9pj6D8yfmw5ZC0JLByLST+co= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(396003)(39860400002)(376002)(136003)(451199015)(36840700001)(40470700004)(46966006)(336012)(2616005)(426003)(1076003)(86362001)(316002)(40460700003)(54906003)(7696005)(2906002)(26005)(186003)(110136005)(478600001)(36756003)(6666004)(82740400003)(40480700001)(70586007)(47076005)(36860700001)(41300700001)(82310400005)(8676002)(5660300002)(4326008)(83380400001)(81166007)(356005)(8936002)(70206006)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 17:26:17.2796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1ed88a8-e432-4bd7-95f9-08dae37877e2 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4472 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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?1752822569305061049?= X-GMAIL-MSGID: =?utf-8?q?1752845670510310327?= Implement API to retrieve acp device config and calculate platform device count and dev mask for platform device node creation. Currently for DMIC configuration, mask and dev count are calculated. Same api will be used to extend support for different ACP device configurations. Signed-off-by: Vijendar Mukunda --- since v1: - fixed below build error sound/soc/amd/ps/pci-ps.c:231:60: error: use of undeclared identifier 'ACP_DMIC_ADDR' - fixed below kernel warning >> sound/soc/amd/ps/pci-ps.c:135:6: warning: no previous prototype for >> function 'get_acp63_device_config' [-Wmissing-prototypes] sound/soc/amd/ps/acp63.h | 7 +++++++ sound/soc/amd/ps/pci-ps.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h index 5e7f9c1c1b0e..b015e845e5fa 100644 --- a/sound/soc/amd/ps/acp63.h +++ b/sound/soc/amd/ps/acp63.h @@ -54,6 +54,11 @@ /* time in ms for runtime suspend delay */ #define ACP_SUSPEND_DELAY_MS 2000 +#define ACP63_DMIC_ADDR 2 +#define ACP63_PDM_MODE_DEVS 3 +#define ACP63_PDM_DEV_MASK 1 +#define ACP_DMIC_DEV 2 + enum acp_config { ACP_CONFIG_0 = 0, ACP_CONFIG_1, @@ -102,4 +107,6 @@ struct acp63_dev_data { struct resource *res; bool acp63_audio_mode; struct platform_device *pdev[ACP63_DEVS]; + u16 pdev_mask; + u16 pdev_count; }; diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 489f01a20699..86af94f6f06e 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -132,6 +132,39 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id) return IRQ_NONE; } +static void get_acp63_device_config(u32 config, struct pci_dev *pci, + struct acp63_dev_data *acp_data) +{ + struct acpi_device *dmic_dev; + const union acpi_object *obj; + bool is_dmic_dev = false; + + dmic_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0); + if (dmic_dev) { + if (!acpi_dev_get_property(dmic_dev, "acp-audio-device-type", + ACPI_TYPE_INTEGER, &obj) && + obj->integer.value == ACP_DMIC_DEV) + is_dmic_dev = true; + } + + switch (config) { + case ACP_CONFIG_0: + case ACP_CONFIG_1: + case ACP_CONFIG_2: + case ACP_CONFIG_3: + case ACP_CONFIG_9: + case ACP_CONFIG_15: + dev_dbg(&pci->dev, "Audio Mode %d\n", config); + break; + default: + if (is_dmic_dev) { + acp_data->pdev_mask = ACP63_PDM_DEV_MASK; + acp_data->pdev_count = ACP63_PDM_MODE_DEVS; + } + break; + } +} + static int snd_acp63_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -183,6 +216,7 @@ static int snd_acp63_probe(struct pci_dev *pci, if (ret) goto release_regions; val = acp63_readl(adata->acp63_base + ACP_PIN_CONFIG); + get_acp63_device_config(val, pci, adata); switch (val) { case ACP_CONFIG_0: case ACP_CONFIG_1: @@ -195,14 +229,14 @@ static int snd_acp63_probe(struct pci_dev *pci, default: /* Checking DMIC hardware*/ - adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), 0x02, 0); + adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0); if (!adev) break; if (!acpi_dev_get_property(adev, "acp-audio-device-type", ACPI_TYPE_INTEGER, &obj) && - obj->integer.value == 2) { + obj->integer.value == ACP_DMIC_DEV) { adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); if (!adata->res) { ret = -ENOMEM; From patchwork Wed Dec 21 17:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3650736wrn; Wed, 21 Dec 2022 09:31:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvXRs9+c0smH+XeJmw7k/dUksMI+jrav8BHEo1Q9PXnBtMuDlgdTWOH1Q5F/E2JASjLieuL X-Received: by 2002:a05:6a20:e61a:b0:a9:f48e:aea0 with SMTP id my26-20020a056a20e61a00b000a9f48eaea0mr22054433pzb.9.1671643898896; Wed, 21 Dec 2022 09:31:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671643898; cv=pass; d=google.com; s=arc-20160816; b=ZwbEGa17p0q+wuplohw6MpHz8Quzk+cPczsk27zEJku/i8JgnCRK7zdXirV3ReBMAc DBoSqJrHr4VdnuU5z7XnTfhbUaFINXuCtRxrjQvbU1HLO4M/Px7lhOj5FgyrC2HzinDD 22s5JcZ+nhfQo53Y/6Kogi3mkY7LxuUzeSy4CLOlLPzJb6jiqKDl/iyugg7i/KcEj6Uo RygbJ6TJ2iDxJbSNUqls/TGqqpLV69PIETL+k145+90mYtak71pRySrwebQlczONud5e hCBRYgJDB3tGZnXSctC+FsGdREMV3T7S9NwaLuxpTqtX3mXN9kaZNtESKMpbqWPMrLEi +6WA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5z00SgJc1Cu9y8djs0JrTonvqMUDxTFxkvm0puBZ4R8=; b=lmkrA5ZJj+6QK7V30rEpX2loBZAE2C0wWjH+6gO6re63eeTUJB/3kvq3b75g+o6TZ5 uNg5YIJo7nCd0aj3eOARlbH3koYAummgIDXXcHNtC6O06rIuVtFOFKLTXPpCTpQeTscU nYBm9P7Kar/SLvWxsYKpcF1rplNAfCPOrbNf0Ap57FV69iT26D3mcFubuftci6o5YGzi n+Jlr2aGwBrq/deDFcZZyfPVn6HIjFjIyMp4JQRAa0+UXPsgsP+OXq+hzvPACk/KkbjF qIht1S390Wu9krhmKCx42CIdrXiVzgXBdzZGb941dMwVivAMPuXUy+JF8IH9RXBqVVhB snLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="a9h+m/I2"; 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 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a63f544000000b00476a48051edsi17209568pgk.476.2022.12.21.09.31.25; Wed, 21 Dec 2022 09:31:38 -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=@amd.com header.s=selector1 header.b="a9h+m/I2"; 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 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231422AbiLUR0c (ORCPT + 99 others); Wed, 21 Dec 2022 12:26:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiLUR0a (ORCPT ); Wed, 21 Dec 2022 12:26:30 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A633963FF for ; Wed, 21 Dec 2022 09:26:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVelmiWlWoqOYEBXAGCaQQCQbFsUxlZ1AxPlwPJYvnJQbtZoQGuAF0+doNCc5lz8x5S7RB9DKX13SmKk/Z55g6J02w+yll7pC5lhxpronRjYq1yplXZ7FZpfhi1WI/jlHzEavJTCgYdv/gP02NJY+StB6385OPO+vWJA9Th8cyjV6WnuxYaeJee+2hO/+fNvGdTgVTVinzbdZCsv/VbWqlM98mxlzWvX33DZlgTbuDox5RP6x0cfXzXru/m034GS19DrVjjZvhjnDzV7mqVqd9jPMOCUPc/RxxsvEIjrXY45+zl4LsPQVcI1LOhCb2x6auAJw1FXQp3BbuL1+r8Row== 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=5z00SgJc1Cu9y8djs0JrTonvqMUDxTFxkvm0puBZ4R8=; b=T/hUV2YPk8XaDfAmIdDYXg69s6iRbmHAQc29DLtZZAnSLAQxacbdWIQfVazIiGuhY9OfOxGQnk+2Mxv7edzA6H28wlmcsicoCzUafBfku+/mVeGe3SpRgPdGwd9qgiWcsejQOoY5ymyp/0Zb7YbReD9RmhEpvHEgwU89SZhEKwAXmB1+iYBDu/rD0IseuUGs2jcwnNDaVx9qD/FzOlmR0GNxkozBvZ6TbPrGc6dZ/gZZkR2D0+/Lfkj5uDJmf3uanm9Fa1YgHFUre+19iSoiRmjjtnfKEhMRn7ix6Sz0ywFwB0ZIWDU+ZeWOpnTboxn0rGC9U5dzTrEEju23FkUt1Q== 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=5z00SgJc1Cu9y8djs0JrTonvqMUDxTFxkvm0puBZ4R8=; b=a9h+m/I2pj4Z3/d75IChcFcRvzlhM5zAOACt6ajxaF6nEDe67kvPaxYlwHDUsQSBA3GEveioe+GvnWpyAQq1QdakBL2a4G1N2AspMHz4wqiDK7WsvUqP6Twr8r/f0lnGm0sWByAN8wPn1uariQwB220h66gPjfquoxh2v92XgpE= Received: from MW4PR04CA0259.namprd04.prod.outlook.com (2603:10b6:303:88::24) by BL3PR12MB6474.namprd12.prod.outlook.com (2603:10b6:208:3ba::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 17:26:25 +0000 Received: from CO1NAM11FT093.eop-nam11.prod.protection.outlook.com (2603:10b6:303:88:cafe::91) by MW4PR04CA0259.outlook.office365.com (2603:10b6:303:88::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 17:26:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT093.mail.protection.outlook.com (10.13.175.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 17:26:25 +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.2375.34; Wed, 21 Dec 2022 11:26:24 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2375.34; Wed, 21 Dec 2022 09:26:24 -0800 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 21 Dec 2022 11:26:21 -0600 From: Vijendar Mukunda To: , CC: , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , open list Subject: [PATCH V2 2/4] ASoC: amd: ps: refactor platform device creation logic Date: Wed, 21 Dec 2022 22:58:49 +0530 Message-ID: <20221221172855.1618766-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> References: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT093:EE_|BL3PR12MB6474:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cce849b-6579-484a-a836-08dae3787c9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5H2GQzCpLWuSfmw2aS0gs9RtJdmmY44jy9ONSlccilQ2QURlxqiIzMRhv7OxWe2b9OyTXaWdZlAVO/TDCxkAZzIgkZ9jV8/lFBliXxZ/grNyzKY+x9JZYKpzbJGMQdlgykH8u557d+siiSynVwKeqFNMorr15qdk4aatL/41QlZyLn3OQRhIe6wAqR5f3S7d1KhsY/tIzr6zieaDmxL3KVEgkFMxmj8XJUiAO6TAJSUAFZOALXHr3NpB19YUTfHPiGJJ+Y0ZHEV6Ax8KHsnVjT6+86Gv02A+fdK1f4rP/4RCBlAwuRY50OdLyUVvRJ02oM0jOI7sJD4UzKI3IeplVAghV36fxXF2v2PYZe97wbQvY/2bt0zSsFmxDIa62wyjDNd1wTt9qldZQ71bEX0cVygHtxWTSWM1a2s+DxN5B1LW5MPH+IsyMTU6bSQEOQpJalyNJm3UcgrfMNcOG484hwQzOnOoWbWOgkUDTpthNCoN/Vl7v0qGVFEgg4JsWTGWECk0K88+FwX0W3tQgPbQXLMIMyrCyo2GUVqM3w82ri3GMBMv+zaWIMwyWVEQK1MdYvTDaVD1aH4HOo6i8awXo9LRh2DQOy1Bkcl7f/SVi+/46ZMf4Rh2SOu96EPsMrPrmRdwF4gQcrwzi/7OKndtrLTwcSn0wbWPZS0f2ZzENnQWtFxUUZ+jsKrYEEn9k42KGJba6tfFF8zp6NxP13HH22ZV7wjq0IrQiH3oYpiDJ1U= 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:(13230022)(4636009)(396003)(376002)(39860400002)(136003)(346002)(451199015)(36840700001)(46966006)(40470700004)(478600001)(54906003)(41300700001)(8936002)(6666004)(110136005)(7696005)(36756003)(336012)(26005)(70206006)(70586007)(186003)(8676002)(4326008)(5660300002)(82740400003)(81166007)(47076005)(2906002)(82310400005)(2616005)(356005)(36860700001)(316002)(40480700001)(40460700003)(1076003)(426003)(83380400001)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 17:26:25.1137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cce849b-6579-484a-a836-08dae3787c9e 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: CO1NAM11FT093.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6474 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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?1752845672835141642?= X-GMAIL-MSGID: =?utf-8?q?1752845672835141642?= Refactor platform device creation implementation. Based on platform dev count and pdev mask create platform devices. Use common API to fill platform dev information. Use pdev count variable in remove callback for unregistering platform devices. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/acp63.h | 2 +- sound/soc/amd/ps/pci-ps.c | 168 ++++++++++++++++++++------------------ 2 files changed, 89 insertions(+), 81 deletions(-) diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h index b015e845e5fa..8f024cb309c9 100644 --- a/sound/soc/amd/ps/acp63.h +++ b/sound/soc/amd/ps/acp63.h @@ -11,7 +11,6 @@ #define ACP63_REG_START 0x1240000 #define ACP63_REG_END 0x1250200 #define ACP63_DEVS 3 -#define ACP63_PDM_MODE 1 #define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 #define ACP_PGFSM_CNTL_POWER_ON_MASK 1 @@ -109,4 +108,5 @@ struct acp63_dev_data { struct platform_device *pdev[ACP63_DEVS]; u16 pdev_mask; u16 pdev_count; + u16 pdm_dev_index; }; diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 86af94f6f06e..8ae7bdfb0e8c 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -165,17 +165,86 @@ static void get_acp63_device_config(u32 config, struct pci_dev *pci, } } +void acp63_fill_platform_dev_info(struct platform_device_info *pdevinfo, struct device *parent, + struct fwnode_handle *fw_node, char *name, unsigned int id, + const struct resource *res, unsigned int num_res, + const void *data, size_t size_data) +{ + pdevinfo->name = name; + pdevinfo->id = id; + pdevinfo->parent = parent; + pdevinfo->num_res = num_res; + pdevinfo->res = res; + pdevinfo->data = data; + pdevinfo->size_data = size_data; + pdevinfo->fwnode = fw_node; +} + +static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data *adata, u32 addr) +{ + struct platform_device_info pdevinfo[ACP63_DEVS]; + struct device *parent; + int index; + int ret; + + parent = &pci->dev; + dev_dbg(&pci->dev, + "%s pdev_mask:0x%x pdev_count:0x%x\n", __func__, adata->pdev_mask, + adata->pdev_count); + if (adata->pdev_mask) { + adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); + if (!adata->res) { + ret = -ENOMEM; + goto de_init; + } + adata->res->flags = IORESOURCE_MEM; + adata->res->start = addr; + adata->res->end = addr + (ACP63_REG_END - ACP63_REG_START); + memset(&pdevinfo, 0, sizeof(pdevinfo)); + } + + switch (adata->pdev_mask) { + case ACP63_PDM_DEV_MASK: + adata->pdm_dev_index = 0; + acp63_fill_platform_dev_info(&pdevinfo[0], parent, NULL, "acp_ps_pdm_dma", + 0, adata->res, 1, NULL, 0); + acp63_fill_platform_dev_info(&pdevinfo[1], parent, NULL, "dmic-codec", + 0, NULL, 0, NULL, 0); + acp63_fill_platform_dev_info(&pdevinfo[2], parent, NULL, "acp_ps_mach", + 0, NULL, 0, NULL, 0); + break; + default: + dev_dbg(&pci->dev, "No PDM devices found\n"); + goto de_init; + } + + for (index = 0; index < adata->pdev_count; index++) { + adata->pdev[index] = platform_device_register_full(&pdevinfo[index]); + if (IS_ERR(adata->pdev[index])) { + dev_err(&pci->dev, + "cannot register %s device\n", pdevinfo[index].name); + ret = PTR_ERR(adata->pdev[index]); + goto unregister_devs; + } + } + return 0; +unregister_devs: + for (--index; index >= 0; index--) + platform_device_unregister(adata->pdev[index]); +de_init: + if (acp63_deinit(adata->acp63_base, &pci->dev)) + dev_err(&pci->dev, "ACP de-init failed\n"); + return ret; +} + static int snd_acp63_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { struct acp63_dev_data *adata; - struct platform_device_info pdevinfo[ACP63_DEVS]; - int index, ret; - int val = 0x00; - struct acpi_device *adev; - const union acpi_object *obj; u32 addr; - unsigned int irqflags; + u32 irqflags; + int val; + int ret; irqflags = IRQF_SHARED; /* Pink Sardine device check */ @@ -217,82 +286,23 @@ static int snd_acp63_probe(struct pci_dev *pci, goto release_regions; val = acp63_readl(adata->acp63_base + ACP_PIN_CONFIG); get_acp63_device_config(val, pci, adata); - switch (val) { - case ACP_CONFIG_0: - case ACP_CONFIG_1: - case ACP_CONFIG_2: - case ACP_CONFIG_3: - case ACP_CONFIG_9: - case ACP_CONFIG_15: - dev_info(&pci->dev, "Audio Mode %d\n", val); - break; - default: - - /* Checking DMIC hardware*/ - adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0); - - if (!adev) - break; - - if (!acpi_dev_get_property(adev, "acp-audio-device-type", - ACPI_TYPE_INTEGER, &obj) && - obj->integer.value == ACP_DMIC_DEV) { - adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL); - if (!adata->res) { - ret = -ENOMEM; - goto de_init; - } - - adata->res->name = "acp_iomem"; - adata->res->flags = IORESOURCE_MEM; - adata->res->start = addr; - adata->res->end = addr + (ACP63_REG_END - ACP63_REG_START); - adata->acp63_audio_mode = ACP63_PDM_MODE; - - memset(&pdevinfo, 0, sizeof(pdevinfo)); - pdevinfo[0].name = "acp_ps_pdm_dma"; - pdevinfo[0].id = 0; - pdevinfo[0].parent = &pci->dev; - pdevinfo[0].num_res = 1; - pdevinfo[0].res = adata->res; - - pdevinfo[1].name = "dmic-codec"; - pdevinfo[1].id = 0; - pdevinfo[1].parent = &pci->dev; - - pdevinfo[2].name = "acp_ps_mach"; - pdevinfo[2].id = 0; - pdevinfo[2].parent = &pci->dev; - - for (index = 0; index < ACP63_DEVS; index++) { - adata->pdev[index] = - platform_device_register_full(&pdevinfo[index]); - - if (IS_ERR(adata->pdev[index])) { - dev_err(&pci->dev, - "cannot register %s device\n", - pdevinfo[index].name); - ret = PTR_ERR(adata->pdev[index]); - goto unregister_devs; - } - ret = devm_request_irq(&pci->dev, pci->irq, acp63_irq_handler, - irqflags, "ACP_PCI_IRQ", adata); - if (ret) { - dev_err(&pci->dev, "ACP PCI IRQ request failed\n"); - goto unregister_devs; - } - } - } - break; + ret = create_acp63_platform_devs(pci, adata, addr); + if (ret < 0) { + dev_err(&pci->dev, "ACP platform devices creation failed\n"); + goto de_init; + } + ret = devm_request_irq(&pci->dev, pci->irq, acp63_irq_handler, + irqflags, "ACP_PCI_IRQ", adata); + if (ret) { + dev_err(&pci->dev, "ACP PCI IRQ request failed\n"); + goto de_init; } + pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&pci->dev); pm_runtime_put_noidle(&pci->dev); pm_runtime_allow(&pci->dev); return 0; -unregister_devs: - for (--index; index >= 0; index--) - platform_device_unregister(adata->pdev[index]); de_init: if (acp63_deinit(adata->acp63_base, &pci->dev)) dev_err(&pci->dev, "ACP de-init failed\n"); @@ -339,10 +349,8 @@ static void snd_acp63_remove(struct pci_dev *pci) int ret, index; adata = pci_get_drvdata(pci); - if (adata->acp63_audio_mode == ACP63_PDM_MODE) { - for (index = 0; index < ACP63_DEVS; index++) - platform_device_unregister(adata->pdev[index]); - } + for (index = 0; index < adata->pdev_count; index++) + platform_device_unregister(adata->pdev[index]); ret = acp63_deinit(adata->acp63_base, &pci->dev); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); From patchwork Wed Dec 21 17:28:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3650903wrn; Wed, 21 Dec 2022 09:31:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXsa+TOCODMNehUaZe/or38SvAmBZqIPNJcEoRamfT0pZ3M8QpaFQNnc2Z7pd5QcXKP8KObF X-Received: by 2002:a05:6402:1298:b0:470:411f:3609 with SMTP id w24-20020a056402129800b00470411f3609mr2397535edv.1.1671643914422; Wed, 21 Dec 2022 09:31:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671643914; cv=pass; d=google.com; s=arc-20160816; b=YUHxhHuqpOJwDc7VVZL9GW0SrYHjG6yTn2j4L147/TZgtpT+bhEwAWs6TsuryEJIxg Zd0XXS6KbpnC1IE8SmltQQ6XRj/Hw5/j0+BJ0MtjpF8bq1l8EDrki+PgdL+w3mXlZ/a9 ojOJm9Z03xlKE87XdWPH6t6lxPAgt2wc7dGjlwZ6lphh8IfCmytT8/aiUgMxpxXDJWjq TDrZPZ7QCWPfYTrz5W4a+NjoMJOuK1GJyej0tFCboSB/vqR6msH4NlHLJow8AZL1L16F KK//7xPefZMKf1i+I6v25AQ/yFgmGtZU8h9199hkqR5ew5EZuuB6zD4HvYEjoI0a5dRg Ojdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W1Wg2Sr8Um6WI5KE93rI10l+9dfj4VSJ5c4l8C3nJ/M=; b=SYukWvms6l5nMm0XT21g0leFHA4LkYR5NGwPt9iIxaEZN9tpBOmXyVvoss6pwY/MPK EIXVe36zqCdM+x2riZ9XXczXXsL3Z9nn7PK0/Ti+mS83djOpUSt+OFUCfwHOuG4b0zCh wGHXX7lVZRq9J8hM3mk9GhGmX81THnQjVPQ3TtuLNs6EpK9FLW9ToELtQQkMDcCMdTFK XvUfbkC4MQIxlXPYdBISel2SUNhmXUKyN+CTEyhXi2mSZROAoer71NR1HZ/beTSzEWuq CZPp4Z3T4OAIgDnAFLzZaI/khe5KGkyoYLl6v70zldcfnsnafG9IW7ngQPqNR02aatjj mVyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ThE9TW1G; 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 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a05640206ca00b0047252b54cd8si12532921edy.230.2022.12.21.09.31.29; Wed, 21 Dec 2022 09:31:54 -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=@amd.com header.s=selector1 header.b=ThE9TW1G; 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 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233777AbiLUR0g (ORCPT + 99 others); Wed, 21 Dec 2022 12:26:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiLUR0d (ORCPT ); Wed, 21 Dec 2022 12:26:33 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2076.outbound.protection.outlook.com [40.107.220.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A06C6359 for ; Wed, 21 Dec 2022 09:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eULAdynaDW5EFgAhehcCieQIu7dkUMRrYJTTrBUFP9ENlRaAnj6nZQP2R4k7ROcQM5SHhyZEqzgsVpLbKuy/H3dTHS2w8VF4xGBR4FFa5Xymnz590uphoxImvTEWcT0cwcyrs9ztN6dsetvsD1DfeW432HJ28M7rydmDCMcZ2QX2ROEUb4kEKZzjJCQ8UQJcwdA1zvria8Gkry9bhmQmyHDXtnthgyAuQblStJPz8FuqwTVDCQ9cTT8+ABPE6/hM5qzyX2RjZc5xcRTwUsXPyyPMCDu+fJ6acG5tTOIFvD0Rr9YvhauzYOr52lFSX9RbevFDz4z9BvypRwD3WzYplA== 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=W1Wg2Sr8Um6WI5KE93rI10l+9dfj4VSJ5c4l8C3nJ/M=; b=eMsXshOR600Xqtu3ZlxrZa/gz7MMp92McyS3RZdHPT5h4lA3kKbdyO4Trg4JwuPpUnZFaqiyovEZsuJqzZL4AdKGSv6DqD1FAOl0ua5CsMfqeu99nXeSbNcIxmGmnNsVbU3k4ClzbuWlnjAbFLFEyoNh0Vb0gKmOycg+qzd/XvJAtWFKCFz3NF8G3+wL3VkEwoFiUBLt0mT1Xh2vgUENmGG5A3cU+b98QgJWMHpYtqSmyL737NrteHRCW9i6oF8rUOCpnIjm9z692S3oeQG8+q9J7FP7xF1xD7Q3KsK3mYN9U2AZ48QddcgKO3ZN1JDslUPg+g6ERNSMCEcgfcczaQ== 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=W1Wg2Sr8Um6WI5KE93rI10l+9dfj4VSJ5c4l8C3nJ/M=; b=ThE9TW1GkeoYz9AZWexwKufBj4dzwcO7NUWSHDKZgitfxf8C40lfUmrcvuUA2F9qwm5ZJQDHjmh+i7GnR0ENyLazokU2PH9LSdLlYPrNJPYvX8potzcxPnbda5DTzelh5TADYzV3uE59xDq0baX+OZzo7G/5b0CN9g9FwhOz0lg= Received: from BN9PR03CA0521.namprd03.prod.outlook.com (2603:10b6:408:131::16) by MW4PR12MB5668.namprd12.prod.outlook.com (2603:10b6:303:16b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 17:26:30 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:131:cafe::30) by BN9PR03CA0521.outlook.office365.com (2603:10b6:408:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 17:26:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.6 via Frontend Transport; Wed, 21 Dec 2022 17:26:29 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 11:26:29 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 11:26:29 -0600 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 21 Dec 2022 11:26:26 -0600 From: Vijendar Mukunda To: , CC: , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , open list Subject: [PATCH V2 3/4] ASoC: amd: ps: update dev index value in irq handler Date: Wed, 21 Dec 2022 22:58:50 +0530 Message-ID: <20221221172855.1618766-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> References: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT048:EE_|MW4PR12MB5668:EE_ X-MS-Office365-Filtering-Correlation-Id: f6eb4930-e27b-492e-fd28-08dae3787f46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xb4AJF33VVv8KMugtuWUqa887j3uyZ4bRHkuPjJbjCMP1GNQxBk5FjRlwwQuXB+sWECO0hTmf0umh6lK4tYStM285lTaYKoP2QmYy4jsHjz3QXd9cpr9C3dNCv15qijnRovynX5pl1Hh+16E4t5dqVkSP21BV2fO5nY20xztV2Y/UX+FAO0FlsZaIEkO/yBT04Ai/2NWwvNj2HAuk1VzSnZBkpwXiOTCOWPzpUWpBGyJUCXq5MeGRjSoCEufxmD2x6E+i3CNmw4Hj7KkoTgncFid/Zq0oyPTD/yvdLgpd0W5Y09SEFYjlsu8wPJuQW++VjiHhAT7JgEM7SnAVG3/qmHzwOfmgwplkUr6TyaywJwsJrV0+W9uIkv+nfpaxUvhlWfaubKeTim2MZm7LC5YQaBTroi9UhMkxvUZKDo2efzBOKvWKRqiB6Fq8lFlj9N+pElOmGq5Wxscn8xTiNVErcIObHKqqXTGSAHjCy5gkiLZ9t+5FOLcUPPbhJpAcveb4soa7n8WLUvCb1Joco+jpUxwTCRlSAi2fO0rLfcBz4iVHFslQmQtWtRvFqvCz+a9PtgejpqgC54yp8BPGUT7SJSvwk37uvS/68LR+3zmFSqdqx30OJhGEi+qUeBgEXIHaaBmCv9XftExZyRKdIe46ur4ffF1bueD6+/sRf6MOnkk/Q/8JwjEFn5mG0eWH7XndE7OnPEPEhk6ko4B+K9GorbDKVholZUSLLlNWds8mpw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(136003)(39860400002)(396003)(451199015)(46966006)(40470700004)(36840700001)(2906002)(40460700003)(316002)(54906003)(336012)(110136005)(36756003)(82310400005)(86362001)(36860700001)(1076003)(2616005)(83380400001)(47076005)(426003)(26005)(7696005)(81166007)(6666004)(478600001)(186003)(356005)(82740400003)(40480700001)(4326008)(8936002)(41300700001)(5660300002)(8676002)(70206006)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 17:26:29.6817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6eb4930-e27b-492e-fd28-08dae3787f46 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5668 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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?1752845689054163924?= X-GMAIL-MSGID: =?utf-8?q?1752845689054163924?= Instead of using hard coded index value for platform device index, retrieve the device index based on platform devices created. In PDM config case, ACP PCI driver retrieves dev index from pdm_dev_index variable. This will avoid overhead when multiple endpoint combinations support is added later. platform device index will vary based on audio endpoint configuration. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/pci-ps.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 8ae7bdfb0e8c..4553e81da164 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -116,6 +116,7 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id) struct acp63_dev_data *adata; struct pdm_dev_data *ps_pdm_data; u32 val; + u16 pdev_index; adata = dev_id; if (!adata) @@ -123,7 +124,8 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id) val = acp63_readl(adata->acp63_base + ACP_EXTERNAL_INTR_STAT); if (val & BIT(PDM_DMA_STAT)) { - ps_pdm_data = dev_get_drvdata(&adata->pdev[0]->dev); + pdev_index = adata->pdm_dev_index; + ps_pdm_data = dev_get_drvdata(&adata->pdev[pdev_index]->dev); acp63_writel(BIT(PDM_DMA_STAT), adata->acp63_base + ACP_EXTERNAL_INTR_STAT); if (ps_pdm_data->capture_stream) snd_pcm_period_elapsed(ps_pdm_data->capture_stream); From patchwork Wed Dec 21 17:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3650949wrn; Wed, 21 Dec 2022 09:32:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXuPzE2RsDxrku7UVC2bQAZ0JjZCHUFzfDYqWpL5xXrV/0LhDP3XSYAllhx4nVzMVcnXt5+o X-Received: by 2002:aa7:c3d0:0:b0:471:4ba9:f138 with SMTP id l16-20020aa7c3d0000000b004714ba9f138mr5334184edr.36.1671643920222; Wed, 21 Dec 2022 09:32:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671643920; cv=pass; d=google.com; s=arc-20160816; b=sqTV9FZlebq/EP+SxP7OjhAm1v1oPQ6WCNk1HUZHrUfxyGq3JgF1azfnl6oeQe1jBE BUGPbZF0d+EuWxEMEj7biX4+PLKICfUe2ZvvKiIFPFln4NJs6RhMBDM7xlhjCMogpnAh OqNx81DRPcEK6M+48Yxuql/Zb4XB1+nBMAnkCg+J321JqPJgbSmosA3VQofIXnAs+xQ+ nkjttPd6iGL+uJHpMfoL+OiDgzGaZzZGFbQcaoWtS5gvM4c1I6ZwxiMOG0OHfdIlErUf 7ZsFB7bc4wdLANdQujVMDyopYzefyHjwuDkTV7Iu+oudpvtQVLkFsAe+0FuOPjLjfgOX LbiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5l4KBL+oE/e3tAtN6J6KA2TBGDjfJusjUQrFLnvb6rs=; b=xLRRq7PpOo67NWMSpGhagsRjfSeu3TY/Zy/IAzUXTPMT0xTyaZvJDzx2DBw2731X2i a2BQMGZdOrSPhw5jUt/9vGAS5IrTTeBvPB9XJ74806DM4Va2RkIPaZKhvO6BtQ0+qbtO lqlUdOS/6wWqpfgt/qfJirhYSwNVHoooXHgaEUqZhIdy86hdgDe9KZWwCYx7Ib+p9Lxq A/uURAbIvEsBpfjBwsjIDyG7rjb7rxCp7YTwBrclEvDGVreGxmvZyT9rEZN7eLJYRanG 3tAPFQ0YdOwI/46T4g8JCwVemsaTAF9zq27eVVSqJtJDogT7+bVc24uPRechIcL+zfYi gh2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4ctHqtsN; 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 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=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a056402280300b0046b392e8c56si16558995ede.10.2022.12.21.09.31.31; Wed, 21 Dec 2022 09:32:00 -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=@amd.com header.s=selector1 header.b=4ctHqtsN; 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 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=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234491AbiLUR0r (ORCPT + 99 others); Wed, 21 Dec 2022 12:26:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234489AbiLUR0n (ORCPT ); Wed, 21 Dec 2022 12:26:43 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2057.outbound.protection.outlook.com [40.107.212.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BD3563FF for ; Wed, 21 Dec 2022 09:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iGBwRJcAW6EtVR4lWq5S4T11n2kKJGdsKwZl0evc48M0oMGlgyEXh1SPJjIl3llgdwcrpTWKd4881V4ym9L5uijL89e/YkWY/OGuZansvENlFfWsVDtLlBLmm86T8c3/DWY0kXEr9O1rnmOYtaBsnDVP+7ffAScIrRXCaI49jLRJ1Xki0TGDuaUb7gTu1N0z7IHOwd5Acai2yRDg2OxGhhLySAXyZjjPWMahzMvEUPIWvunLukJK9RB82U3axxqxvpvHZFbQohL6mCCxAca4AhTBPJzsFTjZq7JL9W2yZzpYE9T1K6Eodnwkg/PaxOWOT/Jkj1C34A8VWs8JRLRUNA== 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=5l4KBL+oE/e3tAtN6J6KA2TBGDjfJusjUQrFLnvb6rs=; b=hrMFAO9vHg5+PtieWgsiYwsKNuMtNmpQG1mVDkwJobeto0jO0htsusXnDlQsaaRT2I9rgW30oQEOudBZualW8akd+wwVbDL45xVOk/mOGo9/+p9xFWRqvqAJj+hvX0v17u6wSEYXOZbV6oHEmt1yoNfwSs6a2XLdUi2ueOvoibQHqwV2LTxRHOcDqA+cQyfCKagXkCys8hLlwt2KPg140/EZ+05e23qaOMO0akKEA4RbpTsxOUnFlqcFTwM+0ImN+1ETzp3eTNrl79kA+XGlGa3/H+KJs1xup9Lecinc+ZLO5qOfaPnfOp7UGaeWxJAIwOQ+DonlzguO9yJp3U9tfw== 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=5l4KBL+oE/e3tAtN6J6KA2TBGDjfJusjUQrFLnvb6rs=; b=4ctHqtsNzeFU5huuQ53x5IHvRVzjEHmZqPwCgUyU5nKjrhgAPCHzy6rNcS6n8NtarBVPmjTWPcs0v2TEQ4flssKj0D8n2T5M1y4yxLv8jL7IWl0B8ammB3BYJIgmiO7WQl4ypTTSL8ZmwRTf22oUEyqRwEXVya85KHTgGlo4fHQ= Received: from BN9PR03CA0765.namprd03.prod.outlook.com (2603:10b6:408:13a::20) by SA3PR12MB7949.namprd12.prod.outlook.com (2603:10b6:806:31a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 17:26:35 +0000 Received: from BN8NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13a:cafe::8b) by BN9PR03CA0765.outlook.office365.com (2603:10b6:408:13a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 17:26:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT073.mail.protection.outlook.com (10.13.177.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 17:26:34 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 21 Dec 2022 11:26:34 -0600 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 21 Dec 2022 11:26:31 -0600 From: Vijendar Mukunda To: , CC: , , , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , open list Subject: [PATCH V2 4/4] ASoC: amd: ps: move irq handler registration Date: Wed, 21 Dec 2022 22:58:51 +0530 Message-ID: <20221221172855.1618766-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> References: <20221221172855.1618766-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT073:EE_|SA3PR12MB7949:EE_ X-MS-Office365-Filtering-Correlation-Id: 07d63ac8-4029-4171-89fd-08dae378825f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EXYKxy6BtTkriklTWoiNPRylLSu5OVjwBGGEPQmUzEKBqc/QXK9uY7RFh2ciRRMNEN01+ExAiho+RU0v4jdsot9K5vzNxc2eljG5IbuBj1qArL6P9Q1vVY/bY/6zoG1YQw6uLwfhwnGCJgxfXpdqziO74Jh6zQuf7MOrRRAqw4gPkhosWe/CJ1FUrA0cEoxkHTrwpRMSQNCD2ZQkzLHs87dJKMq+T5UVEbX5PFOSHmYCPVExN0B9FV19qEAQY9BW8QtFsXfCFToPhmpaMp+6AICqhamCwiR/8iQFXZI58ZsH7kMxiC3wjbYVj+b6/ZETwO52qpSlVqrC8fPO90E/3lfOA9aB5Q83Kx+ku3Ncu3wM5S6PfPuNvUE5FA1isWDXqCsibY1nIirxAQmrKHv+sngMqkmjSzWhJ6rLuJeCp8Vn4AWFBsrRGMLfmH4j7jlzC+gOf4ERmjQwvk9FHeNWl0qgPa5j+21cXq97q3vJF/YblGn1+P1/TxrKB932hQooTAs2AQSBVmOP31TryDnPsMRRE/CTKGaReN7UmX+dNO8YkpVMdyb/MsmgrYFkw+dXoIFbR6zy1vCpVnEHHJ6w5e1Bc1gIYNy0ID+6ASCtb21N8a2qieaK61bULnxQhfuUyCNxefI5DZ6VljanMR9tVqQUKRzFSKvMtJA/rfECvFRXYhOc85dW8jXoehmqW8yLWCQZeRa1NVnKwpYGmT99Sg3xWsCeoyViyDrp/YzijQc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199015)(40470700004)(46966006)(36840700001)(478600001)(7696005)(6666004)(2906002)(4326008)(186003)(47076005)(426003)(40460700003)(36756003)(2616005)(83380400001)(1076003)(8676002)(82310400005)(5660300002)(82740400003)(36860700001)(26005)(54906003)(8936002)(110136005)(336012)(316002)(70206006)(70586007)(356005)(86362001)(40480700001)(41300700001)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 17:26:34.8757 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07d63ac8-4029-4171-89fd-08dae378825f 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7949 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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?1752845695132718715?= X-GMAIL-MSGID: =?utf-8?q?1752845695132718715?= Move irq handler registration prior to platform device creation logic. This will avoid irq handling missing scenario when platform device raise interrrupts during it's probe sequence. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/ps/pci-ps.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 4553e81da164..401cfd0036be 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -286,6 +286,12 @@ static int snd_acp63_probe(struct pci_dev *pci, ret = acp63_init(adata->acp63_base, &pci->dev); if (ret) goto release_regions; + ret = devm_request_irq(&pci->dev, pci->irq, acp63_irq_handler, + irqflags, "ACP_PCI_IRQ", adata); + if (ret) { + dev_err(&pci->dev, "ACP PCI IRQ request failed\n"); + goto de_init; + } val = acp63_readl(adata->acp63_base + ACP_PIN_CONFIG); get_acp63_device_config(val, pci, adata); ret = create_acp63_platform_devs(pci, adata, addr); @@ -293,13 +299,6 @@ static int snd_acp63_probe(struct pci_dev *pci, dev_err(&pci->dev, "ACP platform devices creation failed\n"); goto de_init; } - ret = devm_request_irq(&pci->dev, pci->irq, acp63_irq_handler, - irqflags, "ACP_PCI_IRQ", adata); - if (ret) { - dev_err(&pci->dev, "ACP PCI IRQ request failed\n"); - goto de_init; - } - pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS); pm_runtime_use_autosuspend(&pci->dev); pm_runtime_put_noidle(&pci->dev);