From patchwork Wed Dec 21 11:26:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3467770wrn; Wed, 21 Dec 2022 03:24:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXunjAJJTH5NaEWpkgbon7bLDO9Wak4nWCuJrtDQWqBDHCDTpV8cd7CDn8+T/HSMeVG4b7rb X-Received: by 2002:a17:90a:8c01:b0:219:4b5:1775 with SMTP id a1-20020a17090a8c0100b0021904b51775mr17177675pjo.39.1671621866010; Wed, 21 Dec 2022 03:24:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671621865; cv=pass; d=google.com; s=arc-20160816; b=Ey89eeE6OzqaXcsP6Jszhcnyb3+UIRje6+k16R9oS00u8R2r4ClV6lkYBTwdUoKzpB rWO7nbMpKfdxdx/yBPDfyhQsOP9lE4q6+bsdTBVafCCFxGOdLJsRVYeHI5CdoMngU7/h Ptt3LuFOMfllkcGaeWvCJbAcDynQY4/uhGtMfgwHDd8mt/rhyDYK9fHbxPkpReI7FrCq J7QKXn8GpN6R/62aXhBXGdicC/9ddzccnnOTvLa6Fr4V9iUd3Yf4ZDV9CA7lhKRbPSIR TNGvuIPNnI76plWk8f6MIVUQCjak/sy6w7l1ljNM/hvG/zyrlZ1eCESctS9lcCjIneF+ PmKw== 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=m1GVwBYvoHa0SIGmiUy1ZqDZSdZAxyh1wI56roI5VLg=; b=oco/0DtkHA7vjPuTGdCKhL9//ON7u15WJjbi5ukZn0IiuQXNvYpExLNUSgQSsk7vKA aelcwNNSt0FcmCqnvKJrA37iz+PoVEcTfVaU5TpC081CBbRY5txP78xnMG7w7xAU6wmZ TccbRwCdExZR+FmTq8g8l1T9qIiv1jiEopIJCYutv37oyIQqWuZ59e8cIcEsUO/KBAEm aNEifapITjDJjfA+iXCCG3Ujq8mIC5PxRyA8o60p/mu4tOyElHUgi9tcxVTR6VUAx/3B RYvYr+E+W41qRr8rWPx8HGUO2oQ3hoWALrFROUOdE1rP4SXHAqn3x2a+UFxeb9bILTAk tPYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JnX2uD5q; 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 i3-20020a635843000000b004776a50bd21si17330826pgm.579.2022.12.21.03.24.12; Wed, 21 Dec 2022 03:24:25 -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=JnX2uD5q; 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 S233998AbiLULXj (ORCPT + 99 others); Wed, 21 Dec 2022 06:23:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbiLULXf (ORCPT ); Wed, 21 Dec 2022 06:23:35 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F1702BD2 for ; Wed, 21 Dec 2022 03:23:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HoRts4uqDTRP9vOGFppuiA5hisI2VK80bTocIzcrLGbMwIDyeR0c7YRRu7aoTVl+4GA9gxkxCSJkYsHPZdpEvmNwV+XJqZ77BVyRr0N8XibVGpc7aGyh7XIDvQgmHWSZDsuEysnX4bBCr2ks9CzsI69bYLUNPrD/BNBkKeypqjh587/KZVKvLQ9EJuMJ4wccU3QIJfmlLQSxjdpJN1BqeH1ZjzQnlPE+0fJXZFWTmOZFcSelaeeSx/JeYZlU18Uqo42EPLMGixjtNZr9U7LI7eB4qhT7PR/LAMya+bZQQYh2Gh86Z2KgFhxYBSXNMtp3q4yaKhaoUdtrnMEyHTNhug== 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=m1GVwBYvoHa0SIGmiUy1ZqDZSdZAxyh1wI56roI5VLg=; b=nAjTCUVbxuVS70wErjUb+EHFyHu2ld8c4iMepabvWo0dAcfR9u9IoE0aLgxJYF9lBO7+Agf6XAOyyCOC5VEsBbkL5Qi6fAPfEYQPn/Y+k0DC/vdAlRKGkUV98i8V1Me/Q9EgXT4p4DnWuSigz/oYXbpQK1ORE2hGP0hHTtQ7G8qT+ISkDUWvoDqs7XM6R0I8PJj0R/KWY0wSYV0mcxm9HHJV0YIAXdbHtP64nJIkj2CLcu9CHa6j31eFdlAddIEEMDHMu9EHIj6SeDDKeg2jvMzVEMdJ0iQA14qxwNj0yQHohA1CoABW3HrDZ7h+826W8O8ejBeoFTwEyX8w6Z9Ebg== 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=m1GVwBYvoHa0SIGmiUy1ZqDZSdZAxyh1wI56roI5VLg=; b=JnX2uD5qWe4Rakc8Rr+GcPrgjLzf+UDKyx0t+/jfeKQ32eXxlScohXvg+pPn/IHRGq9RgzJ75ddtiqfKiwC20Dwba8oFQKZk8lF6uI+qESE6cP54JG3DIaJzPaNNGY46vCs9NC+ijmtxF5G6XpqyfaAH4/eOUx6ZJe2UMpSCOJ0= Received: from DM6PR01CA0027.prod.exchangelabs.com (2603:10b6:5:296::32) by SJ1PR12MB6195.namprd12.prod.outlook.com (2603:10b6:a03:457::12) 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 11:23:32 +0000 Received: from DM6NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::60) by DM6PR01CA0027.outlook.office365.com (2603:10b6:5:296::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.11 via Frontend Transport; Wed, 21 Dec 2022 11:23:32 +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 DM6NAM11FT094.mail.protection.outlook.com (10.13.172.195) 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 11:23:32 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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 05:23:31 -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 05:23:31 -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 05:23:28 -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 16:56:03 +0530 Message-ID: <20221221112611.1373278-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: DM6NAM11FT094:EE_|SJ1PR12MB6195:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f7bf640-ee03-448d-92b0-08dae345cae1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ox0+U49w6OrcDT9z8dAXH14la9lOq5AfV2ZQFBdB9vTGR/Go9/9FhPt7+9prZMfrHkT5z7FAc/yuae7T3TiBCq7Ps/sqgtk9w9j7L1iv3VWCuYqJH8jawe/Xx68r5nUnN91C3MYk7DNRmaugmFS9QXoGyPhHPZKXGFr8BDLrBuOUIk1LkkLc5huEPc6s5hEE5jGkH2tpN0yOyZlaJov62Dk52VXOqPmTbeVF4HVi97I+LCYyQxQ9Us1Vt/ZF4aVX7kQsKdcj8CrpQRdbAD32i+CxcPzB9k40fLtJO0ZDu01EjMVP7qAwb4D4pKY1j6ZgG72uSsByDRbd8D8S85dNDvmcvSK7VxuVKM1cJ6Lb6BxlZReVXvLz8ZQm3JzA/i+tGJiJfHy8WCMP1L52oKvtXsWuqyeCaPGlpJTTTxq/j/88KBZ0u4k4aOpmEkMaNWCMkq5qmaLFcGN1NbyRxhKVNl0SlY/tiuAq+hQJQqaoPxSPjbEzxS8Lui1PwxOXWuInSDoUmuUMd4ZL6VIdiMdYAeZL9kDIkE+9l5lql7aGYyzxpG6WzDMnyHTk9+lKNg7Qjx80kQBkwpr1Cmzdg/dJxT7SNWrh71EhhhNRLMF+OULZGCwjV1EGWMFkzPRFYlntPYlYF5TP9k+OyDP5S5ojjO9LN8WCde7vwes0WXx7gy7WRznk/5+CMxn9CRgetJzNsozGrap+xsp9PZhmiVomnvH4b0VDbce/Y6Ec4x4Wcys= 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)(136003)(346002)(39860400002)(451199015)(40470700004)(36840700001)(46966006)(7696005)(478600001)(36756003)(2906002)(186003)(336012)(26005)(40460700003)(110136005)(81166007)(41300700001)(1076003)(82310400005)(8676002)(70206006)(70586007)(47076005)(5660300002)(83380400001)(426003)(4326008)(316002)(8936002)(40480700001)(54906003)(356005)(86362001)(36860700001)(82740400003)(2616005)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 11:23:32.1594 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f7bf640-ee03-448d-92b0-08dae345cae1 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: DM6NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6195 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?1752822569305061049?= 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 --- v1->v2: - used ACP_DMIC_DEV macro instead of hard coded value - changed is_dmic_dev variable initialization - changed debug level sound/soc/amd/ps/acp63.h | 7 +++++++ sound/soc/amd/ps/pci-ps.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 42 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..9066a625e501 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -132,6 +132,38 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id) return IRQ_NONE; } +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 +215,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 +228,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), ACP_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 11:26:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3467803wrn; Wed, 21 Dec 2022 03:24:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXtekctoNGUKtD9Gqmt0Fa3u0kD3zbtaux1dyY0WqYIoR6Ayaw9/HC5L/9biM3IDY1OPrjkt X-Received: by 2002:a05:6a20:3c8f:b0:ac:5bc1:cca6 with SMTP id b15-20020a056a203c8f00b000ac5bc1cca6mr2978140pzj.8.1671621871155; Wed, 21 Dec 2022 03:24:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671621871; cv=pass; d=google.com; s=arc-20160816; b=GE8FRfgYmdPAKdyWucPzLdLfVQHtUzRIBVOXuGjbWI9f7Qf7DaHupVy64u734d4Z0j q6I4xGN5XJdR+HrF8QQGvlWXghDVvq2nsAV4rjHQVDWPAIPY74Zj3h/4WbE/9Uoa3Oqa smDfk1gnSvvavTj+k540OCAG6fHLnyRjS0RdF2lsm53JZcHXwFvcsEG8FqTIN2HVx8+7 77/08o0Yo+npAKXLu/CNwx3c+9ag0pcKv1LXWBFZkOudX2FntKpPZcqSCZ6aUSqzcLgS 42p6OacT2FF3fcJPZy5PxvaoSAK28UznugQbxBohPEM3FtRwbygfL4TnluMHYO0/9mHq tFUQ== 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=SXTqjWg71aKGF5fHihhDaov1GE7G3h/d81d5AMa72WE=; b=T76Yh604Lq03wNLksRq90kjqbJYyFj52uAcGN88qinec5qZ99OgknFvk6czjjGWSe0 1QjLSYnzoJFCsQy5BWzZVu+jDw4me0N8uiNatZbgUmLDS06QpYKJhr+7Ox1XmVG8xD42 Fn4DGQPEN0ENd8FCq7/sWtn1t/5QsetxhJ0aOTjXntHUSLGcPtzgpLB+EG5FYhqCQnjy bW5LeZMBh41K/n1VME4dUmzz14JJ9sMAdA+xdYA3PnTqnRKIBIW5nlkK+VMDvD2u2wGh xQTrWM5LNOeaRHW+xR0/JZm00a5aYgivcwoFZ6aTeshMSu+poQZPw8+mSJ4DmT7nk5IS /Waw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=PfgOAu0R; 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 a65-20020a639044000000b004751c9dcf62si15170869pge.509.2022.12.21.03.24.17; Wed, 21 Dec 2022 03:24:31 -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=PfgOAu0R; 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 S234535AbiLULX7 (ORCPT + 99 others); Wed, 21 Dec 2022 06:23:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234471AbiLULXv (ORCPT ); Wed, 21 Dec 2022 06:23:51 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 799C52253B for ; Wed, 21 Dec 2022 03:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LHMV0oYREVaIZ4ZtNqlOaN5NrM9NgU++Oogl4f0Esuzko+rqq/kAFdN+uh9jzzHh3vuDKTBMYDPMCqIHvvsBICpLFd6XwX8Rd434tfDSYm1CZtPRd9g+XJTlxZb4g871aXALqNkb4gbsqSDWsskiWaW9QCGADhObUbYraP9qWb2J14eSlHOsjG0m6Ghvj9BkrXEJNVfrCNexzoC2WlennZVOhzAjPBDMHZuMQwJyrpmB7YLSLMzKL9TWyug/mdRJppBBrE/HxyUPTtAHfXbM/KLYv3uslvUT5j8ah1Mkm+I57fmaZTneCBUMfGEzG0NS68wAmdLJtyWjV9wXWww0wA== 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=SXTqjWg71aKGF5fHihhDaov1GE7G3h/d81d5AMa72WE=; b=k2uzrQZyO0c7MJDTn/P6O6yWqJ4Zb0V9SFl44qV3JmXhPiUqxmcpwSb2k9nBWfdAU+wc4RM7kI1HORE5H7wllZ2bAVaeGD5hhobIBOIKo+mQVhx9Luw2bcPNvPLw5/ZJcyG/gHF5zHxWl5nIHqZcblDl32qYC6MxReWeNalLJK3GFlXOr5flCj6bEd8/ewWpOHQNGfWjG/hhQQm/WejzTEZmNRSr6wAvZn+Nml91kKlmkr3/DvcX95Pz5nQeDXgtxtrMf+jHQGW7/74XGxQpsSv283hF8cef30TRaYeruLzcrkpb22dxDBODlTTS9ymT6YCS6+0xCxNVVWe8TFEaGg== 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=SXTqjWg71aKGF5fHihhDaov1GE7G3h/d81d5AMa72WE=; b=PfgOAu0RljRSa1bnOfzUeN5/cibBpSItKtNT4hiiOHhEu+9FLmhLGqBhixDIuALrqYIFd1v4jqRgDV9JFUFIhcVuTqc//qMbVe8O3KWN7ICHHoGaDIgduuFPsjAiwL2+NRLHmH8Hmm2AepTCnl8L2F4KD9A+mWPy3LTudYO5qkY= Received: from MW3PR05CA0007.namprd05.prod.outlook.com (2603:10b6:303:2b::12) by DS0PR12MB6437.namprd12.prod.outlook.com (2603:10b6:8:cb::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 11:23:46 +0000 Received: from CO1NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2b:cafe::18) by MW3PR05CA0007.outlook.office365.com (2603:10b6:303:2b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.5 via Frontend Transport; Wed, 21 Dec 2022 11:23:45 +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 CO1NAM11FT022.mail.protection.outlook.com (10.13.175.199) 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 11:23:45 +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 05:23:44 -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 05:23:35 -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 16:56:04 +0530 Message-ID: <20221221112611.1373278-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com> References: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT022:EE_|DS0PR12MB6437:EE_ X-MS-Office365-Filtering-Correlation-Id: 61ede624-a985-49d9-9e00-08dae345d2ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oJMwVvj9Isf1snGYDi2CIfCaQuN+MmeP947+H+nlbybJvw21CKYOXaKZXGUJkAGxMBTeJziO0MHl9myY0TBHFK5wB4VoQI16gHiBO4E4xQx/vfV8PQj/Cy1WAVATzhlnfMwgCOtZ72F6glbWm5TkcCSskE2bghV2IR1eGxnzmAnyb9rvvsUSFTSyNQXXZOpj/RnoR14Zhoy1ILeD0oySCERrPp1CKgiJ6Ofrs1vht7uNftaauig83NxCYmHh16Ij2/220q+jwTmmtdi8R7YS80IpM9ZWXtdpRaRiGvKDOCHSIuEJpsXKRo9jJKfOEVi/PCN/AprQ9nDpmtiF7emE4Ai+5Vzr2QWZBiV3IvWuWPPFDqbI72n/8NM+V1vKfqqIdxyhOsjYpy+XPfVvcVxDlqspX2m3DrKm1Eh8cMjI08wKQhVxouh++BguurNASHaShF5+4rwl83RmtkXz9hj8G3qKW1x47XOeuEbDo3/rdehytGxK7aJv+Js5KnwAaM+i4ykqQC4MjZBHZZplgX92zc/n87HvMBSl9mRLDSWfQ0oOjrxy+GXLrzWJJAjDA8e0MzVY23W3lASX76vnIb2jLOgupLlwueOYaTyj9cEAQHahLKhO+UO1xDDVgpYl4uS/1HnLolINC2CEXBIsu7/8py5eYecSHUk5T/JCMCEq4WMZ9KY6Kh4iay7nFwC6Jgt9wUX7rpxstPfLnGug88bIK+eZ/ArVobpeAU+NMnvN8wE= 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)(136003)(396003)(346002)(376002)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(82740400003)(7696005)(26005)(186003)(2616005)(336012)(1076003)(40460700003)(426003)(47076005)(478600001)(36860700001)(6666004)(36756003)(83380400001)(41300700001)(82310400005)(40480700001)(316002)(110136005)(8936002)(5660300002)(81166007)(356005)(4326008)(86362001)(2906002)(70586007)(8676002)(70206006)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 11:23:45.5754 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 61ede624-a985-49d9-9e00-08dae345d2ec 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: CO1NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6437 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?1752822575246801261?= X-GMAIL-MSGID: =?utf-8?q?1752822575246801261?= 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 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 */ @@ -216,82 +285,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), ACP_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"); @@ -338,10 +348,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 11:26:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3468302wrn; Wed, 21 Dec 2022 03:26:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXsjwPM5YaxWf91rl/2GffepQWGZyaCe2/ycd7gPkVJsDpXDgZkT3b0mn0V3mjFmdbeYMHvl X-Received: by 2002:a05:6402:28cd:b0:46c:fabc:5897 with SMTP id ef13-20020a05640228cd00b0046cfabc5897mr1210622edb.7.1671621961918; Wed, 21 Dec 2022 03:26:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671621961; cv=pass; d=google.com; s=arc-20160816; b=B6rXlB4nAchqeTnANlim7hips0qnbNb12LF1v0QKXVx6WllW0ILiKleAxzOZTNpTG+ O4g/A22FxkKPQxmnw0yfhF3M0ag4y8DeZIZWNo4htaB96KHbLNgHVofhuFprg59RDMSw 1MO8/Twwwo3m267ilZQOY5FBGUw68ozxxcvEa4eKNoRv65tT+QbI7MdMQr7Xp4Aa5TDa IPWqIaTsTGyMjyBlTnvVF95DQvWsjyVBEUnuyCxiZViQTBgmpOZEI6eNebzFc3nhfFhG Ric8nJq5Wl0jLXIFQuIcfHeHPzICBZMgJJcMT3nUxamEZ8iR4DfDaThBuPOXwZrMsK8E 0AZQ== 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=OaXirGc4eefVb9eOXcEIZCUFJnxvbTNszCNokeXLiQw=; b=KnNvF0b7Fx1AMUM6gGGOCFYFABVE3QuPyfA6y1Fxe5t4a1G4c+oeuh6EX6F/eNGUSa lVDJo6WWiuIrO6ILm7BPeefU41wl1Tllug0rxM9XGPotBHGXoW4Iy6TTPkTzTZng/3AM 0FD+5OQarnB79z9wHLztcAzZM/L8DZjCGo5g5bpqc6uQRN7hwQePdiPyjE4HBzy+Q12l 32Pcdu3a2dFQSaEUNdYVacZKqB+Gb+K3RGUchFhBK54VMWs+iuizI8QNh54ksvGWfnO6 85zOGhDQPVA09NdKJ/Dnc/dalCSj/vIPCVxCRdsFl/N67kEUI4onSDGVuaV9D8a5wAnM 6yIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=vSkjp6FN; 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 v6-20020a056402348600b004627d582888si14483174edc.24.2022.12.21.03.25.37; Wed, 21 Dec 2022 03:26:01 -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=vSkjp6FN; 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 S234538AbiLULYQ (ORCPT + 99 others); Wed, 21 Dec 2022 06:24:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234544AbiLULYB (ORCPT ); Wed, 21 Dec 2022 06:24:01 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2078.outbound.protection.outlook.com [40.107.237.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F40422B2F for ; Wed, 21 Dec 2022 03:23:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bj+sfpgWiowUCszZS/jo3DV0ikU24QuaiIvzVbW2Ye/FcAAvah4JWvHRb0n3Zv3DeyiHF1jhxfpuqaG/95uYGCKkiRmHkt0aW5hUyhrQj5PW8Wr/kQ8tOe05BEkLRYGBeIccHPly4FoMp3pGj2oYppRe3DWFAmpPQVuXf2p6GHYrXpDGc5C1lqObNjZ3mHtQEAS1JEAtR03+VmeRVjvfr/HnxLXxHI4K9Z93nZDEiE5UTD8Tx+MbhMl9tEtZRG4jLMqTqVUpp3feDbq55b9S/YRCbxv1cE3vQh5w7VF1/3cl/WfDKrgLDOVqZ5xdbm4sk/NFUuoIVYBwVGnrg9OmGA== 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=OaXirGc4eefVb9eOXcEIZCUFJnxvbTNszCNokeXLiQw=; b=U6b3EVOOV52G/m6hp4jnRAh4RzyZQbQ8Zt3JhEn4oqvCzPoWTBKvryrSt4r17iZQ0feadpdDh9Gi5USCD0IuyKnb2Wd5DrpuTunUBTKYaBbr3W1uF/88Jf6jddql6B7BOIAG0g6dJkmPwxi5G1IlAQMzsXauCgSapkBPejs5YjGPfjBWGPe1zaHIFJFj6B3op/jsN6hnMYAZPEUfmFSzb6prOEId7iVZSMFqkTwDcvyar7yQkW1yIYc+7FYPeLneR+IQ4xXkC2/CRMYHdGPxvVLeE8j0Tbe+ASOrMTSbbLMF9HlvglvqZp4j3jMsRq4kuZnLuYeeIHagVTTNX08hxA== 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=OaXirGc4eefVb9eOXcEIZCUFJnxvbTNszCNokeXLiQw=; b=vSkjp6FNEYVyuHf2Y0C6SNDoZKk1jqu2m4hMVpISu55H/dNRh2ndRxzdDH8KwmT8xZT4VEXBNWVgh2tQsP216Hyvh+4pJQDjuX11o9dcbdh8G6looDcRjLjpzt1Q+pf+Hnv/SYCjzZtY63a/S7yyPjFoaKW2CnMegSJQAacnHRQ= Received: from MW3PR06CA0019.namprd06.prod.outlook.com (2603:10b6:303:2a::24) by DM6PR12MB4880.namprd12.prod.outlook.com (2603:10b6:5:1bc::10) 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 11:23:53 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::1d) by MW3PR06CA0019.outlook.office365.com (2603:10b6:303:2a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19 via Frontend Transport; Wed, 21 Dec 2022 11:23:53 +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 CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) 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 11:23:52 +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 05:23:49 -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 05:23:46 -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 16:56:05 +0530 Message-ID: <20221221112611.1373278-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com> References: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT044:EE_|DM6PR12MB4880:EE_ X-MS-Office365-Filtering-Correlation-Id: dead2501-9f48-4ff2-0ec7-08dae345d74a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IRFH5ZJ/F9n+DaxwixZw1N2PwbikgC5UTsp+bKSROg/ugo34BQwCs5CL3xW7oqcpz2OKDpGFLXw3bu2vh2+3Jele7HE88ed6DegJ/AnspAZrGSy8/FC5SQEyG7zECSXTRe/Cg05qFWybT0TnOcQlT1P82wbirU3jWxo6UUxF1th0F3smWgHwnZuCMK7O6GxS51cAfZHKpwosdGfYt85LeAjhCuM0B4i1HdpFU9Z4NR8cTZ5U5CUQJZTO6/4zQ/mDDsgRk+K8BfW+X3s02hZlWtT4bTCOQso4PfxGWf4zwNDHW326ys5E9CvYfq2kq8oeUktf1I5NRFgehEptqLwrXgw1h1cmu6QUM0d8HUz76g81iAlvl+MhXpyZ8/VQeF+ip+kjYjhAdiSpEoxcApIS+yyphsuL0blQmfx1b1+Fzyc6BYehG50gfiN+lIfN0jRR/U0TAIhRrceDpddVuq5npdpTZmw992klSh18TQ1K5FQ0Dlpg3YbAWsJDMg+e0am0RXd4uTSyhUZ9s9Kp4eoZRybx97tTKACo1cXP4BPjXIjfXh2j2rTrQ11nHoGK0wOb8ckMsg14hFEDd1SgxajpsO0ktGUPJInJrlXoIaDBz5sk8C3mN3ZDQBarVRNZkN3p9f5vuSK5PmxSJVwhR4QxMlVyAk6NDguPXUoH4fJEqidPmrU6uD5ZdFum5e5ifdZhb5d8E6JaCBcsOO+4cMu3iQGZ+MPj3gQvXKfmA+tNStc= 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)(396003)(376002)(346002)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(82740400003)(81166007)(2906002)(356005)(40480700001)(5660300002)(41300700001)(83380400001)(47076005)(426003)(1076003)(4326008)(70206006)(8676002)(36860700001)(316002)(70586007)(336012)(8936002)(36756003)(26005)(82310400005)(2616005)(40460700003)(186003)(86362001)(54906003)(478600001)(110136005)(7696005)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 11:23:52.8987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dead2501-9f48-4ff2-0ec7-08dae345d74a 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: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4880 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?1752822670310201863?= X-GMAIL-MSGID: =?utf-8?q?1752822670310201863?= 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 3033185ea39c..b3628fbfdafd 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 11:26:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mukunda,Vijendar" X-Patchwork-Id: 35343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3468879wrn; Wed, 21 Dec 2022 03:27:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXuVua0S0Hxx7xa3kLYRvD6cKXjq5vWNyc3fVNTcs1T5Vd7UctFgg36EIDCtXedv30W9ZmIS X-Received: by 2002:a17:906:f6c5:b0:7c1:8704:80c4 with SMTP id jo5-20020a170906f6c500b007c1870480c4mr1078586ejb.47.1671622049082; Wed, 21 Dec 2022 03:27:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671622049; cv=pass; d=google.com; s=arc-20160816; b=vTYsc5XY+7gTidHeVauFolBwg0OqtX8snrsTtTacUeCLXkMUjRIVvy81B6X1YC49u3 05q8WITlnXj8LZG0eeZdTW1fqGJu7CAs3qD874Nb6LKYLs+qf2NLTk0bb/kbozQqTexX mTZe8pvYxqL29aHdu5LHwdvKxpe9Rq4PljVyNNFYbucS/R1tk8DAIflVz132vmlGX59E VkLWplR+cPc9R10jtfLQ3dNU5YOm/OdMlpLdacfNwHw+Uns4/aqXiNURf26OpMHjs4+I PU9UdxiIeZPUE295nktPllKGOqFUECRRITVwEXVD5q9qwuAUtbQyc6x/KR463Cdj/FF2 yGdA== 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=uJhMraZG3QiDMzz8izQF4l8reSkpJsTuXfPMT1boYMQ=; b=hZ3C5ilR/+WbNVjhGVFQtSsM1J2kj1niBy2Ix4BzzYVPXuuZag//YAVq9omscEzm/p 4bPf95cQdqZbVRMr/X3uB6BOFMqouIZExF/Z8W8kUscBVCZrJLP/xRa5vFWcAQ/QXelc J1YfvvuCYZWENkihjhRM3NFsFAU8yw3S9Wcu9J5CxPLsnQEi+4hrz036+6C28vYcr7Ec 348miPEZaZA8Pftel9XNIcWPtplYdTo4ZqyvhCrXkOu9p3gOGVhxp0kTYfURuhUQuVPn exbvNQDXiT5jBmFCMjKWUrTqrSHG4c+F4AqzBFjrwGjYZC8iee/54k0PeYWbf6t1DTI+ 8B1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=nxUUa307; 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 s4-20020a17090699c400b0078c3197bf86si15301259ejn.533.2022.12.21.03.27.05; Wed, 21 Dec 2022 03:27:29 -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=nxUUa307; 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 S234619AbiLULYW (ORCPT + 99 others); Wed, 21 Dec 2022 06:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234500AbiLULYD (ORCPT ); Wed, 21 Dec 2022 06:24:03 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E283D2CD for ; Wed, 21 Dec 2022 03:23:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BrFJmvXMKs5k/GRPYpUZP6MKX902/SW1kAhleM56Ea3/yQ32U5IjpF9WzgSMno9W62TnipLebWBwRvluODEsUdNoFx53Jc+XSZPVmd1j3EwHZDHlx/bQATj896AN1/cKQTRt6N6ncQfx6puBXtEuIzOG341ozYX7whxe4lZrxXv8wwyc1QwVk7D2xqF4oHk4FbPda0lb4k+UBKqPfwctb92JZPJ9UdY+Ux6alPM9ldchNkpXFxw4U1waK/K4YCy7eNJ8d+ia8RjdUNB+/BrAP+YKkXhGqtC3fiikRIPYDQAM1IVLmmCLADK+gTMyRCIGF1yDhOxI2lcNBajP2B/CTA== 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=uJhMraZG3QiDMzz8izQF4l8reSkpJsTuXfPMT1boYMQ=; b=fpnljTUE9uURjlJpHKxhzylWxOwwN9tOTcJqp28XI/SYfNyRcMKiR+KActftL0X05GWXO9FH4SyMGPOxbFGPfOPpuCpEauP75WFZC9lmpLShKVKfrv31H4a/UNCC4A+xhGPjV8Ukx6hUmb9isjyLg1noIQg0Qzp4emW12uocLFMGrnUPaBqmDo4u8OqBtRYp0vYL+gQHIL56mTQlYLdbo8dXy/scxyt8Ny/zGNxtJ1RiM1oIxNqoarTPeEbk8XvqeCkYWQ8lXgZo3HGclAOdsNpHhpnx1x4CO2+YahIcm5XSWWSkrzr3G9RbzrfzrO6m86WFQ6G/GNGHRZOusXCerQ== 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=uJhMraZG3QiDMzz8izQF4l8reSkpJsTuXfPMT1boYMQ=; b=nxUUa307sA919AX0y06KAInqBPMgCMTwCrGYqPaotNGV7wiMkzIFQGbF4/Mq2+gSuk1lWebGSqVc8u1phIcvP/zBOqz95W1ZJe2p1XIsRafuz5n0NKKGOMmKEn3XtOC2fbub+1d7zWqczfp3KemjvyJYoU3rDX9QWUrKDqqed/o= Received: from MW3PR06CA0012.namprd06.prod.outlook.com (2603:10b6:303:2a::17) by DS7PR12MB5934.namprd12.prod.outlook.com (2603:10b6:8:7d::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 11:23:57 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::b3) by MW3PR06CA0012.outlook.office365.com (2603:10b6:303:2a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.17 via Frontend Transport; Wed, 21 Dec 2022 11:23:57 +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 CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) 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 11:23:57 +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 05:23:55 -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 05:23:54 -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 05:23:51 -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 16:56:06 +0530 Message-ID: <20221221112611.1373278-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com> References: <20221221112611.1373278-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT044:EE_|DS7PR12MB5934:EE_ X-MS-Office365-Filtering-Correlation-Id: 16d5eb0d-7f09-4e13-9712-08dae345d9e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V4Uy1ucvuwMLvydiDtXbmFmfvk9ShY7TKdl+nRogKU0kdjpQmcSJW9PDUxKVCefaLDBolxuHyrgei8UJ9f0J0R/BDavE1o4YDZi/kzi6n7v4W3xX1mCwHbNpJwxBU/8dPUmD2ggGTsJdSozTZO27T/27aNXnMlhDgqMc4vXQMP3mxBniafXV+yHQJultmIyKpN5V5FYMd/KPKbENMJztpBGAlUOhSO/AOo2UWKaXYcRJBNR8DKPgCUJodkI0DhiYYnA2hi7KoSYrfzUzV0tngSedClVG1xE2ZVMjAT14Jj809XPpJNoFEEduwniCeipB1Xt6rbYa1gXdXXcakIdYr5hOX2CLLYjPtH+coeCNU6a6+Q0Nd6/Bu+JPTDGnJAg1Vy63hycqKgGBM227o+lYVYTo6SXX5HX4Jvx9sDAuB7j9qgtnAi5fmWgUNiDhSErqArM7lAyMFSGlOaGpoomSJpLId1jzbid9TO2+yqGQ4xBsD7FKDoSEV6xkiTCgePDvDiC2rQc9JE/p8C2/Nj+vNjQtWSR84AXNgAEH0AycCWw8KmUka9ApDMWyarfzRO4tmuaFH3hW6XiNk6W9gygHdR4CvnlA9r0lOvlWMDvzLqovtQPovXLiUw7X4VNyq16th3rqSiB0gagPVwSv2aQLW2RejhjTKteAkCBMD/OkFJb+dgw2MPkXF9GYt5e42FEEQ66tbukLfe0Sn0ZSKH6PxwPrEFEBjn8vtFHPosm5QCg= 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)(136003)(346002)(39860400002)(376002)(396003)(451199015)(46966006)(36840700001)(40470700004)(36756003)(82310400005)(70586007)(186003)(26005)(336012)(4326008)(41300700001)(2616005)(478600001)(1076003)(8676002)(2906002)(86362001)(54906003)(40480700001)(83380400001)(47076005)(8936002)(5660300002)(70206006)(7696005)(81166007)(6666004)(36860700001)(426003)(110136005)(316002)(40460700003)(82740400003)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 11:23:57.2891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16d5eb0d-7f09-4e13-9712-08dae345d9e5 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: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5934 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?1752822761581962163?= X-GMAIL-MSGID: =?utf-8?q?1752822761581962163?= 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 b3628fbfdafd..4ec03e576376 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -285,6 +285,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); @@ -292,13 +298,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);