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: Vijendar Mukunda X-Patchwork-Id: 635976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C9E3C4332F for ; Wed, 21 Dec 2022 11:24:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3038916C9; Wed, 21 Dec 2022 12:23:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3038916C9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671621872; bh=Aos4UZPUOjYZZoJ7r8YEpPr7xlRQQeIEM1ENQ5nQinc=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=GQXDFhfYODbyHpT1AzjUFglcYXy6B1OZmBGD0wwy9kIOpO7DspILwXaDEI5w+/za3 trFVhE2t5uM334fUMzBslAKtO5I7rH7p6CgHh1dX8eoGBQ0KudIjSKHaUgBjhj+9F7 MOPpRDcY8iUcDPOtNu9mqljXcSTEu3Eg9g0aKuKY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C0F42F8024D; Wed, 21 Dec 2022 12:23:41 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 22EF6F8047B; Wed, 21 Dec 2022 12:23:40 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BF2D9F80022 for ; Wed, 21 Dec 2022 12:23:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BF2D9F80022 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=JnX2uD5q 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: , 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-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Mario.Limonciello@amd.com, Vijendar Mukunda , Syed Saba Kareem Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Vijendar Mukunda X-Patchwork-Id: 635650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DF56C4332F for ; Wed, 21 Dec 2022 11:24:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7BD0716E1; Wed, 21 Dec 2022 12:24:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7BD0716E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671621896; bh=0GXG1Fwr/CX/1/N3SXsU7mO+6fYF6lcEY6Aw/ChgA6A=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=qPnYnSW/+BfqmY4bouzhWHc2baehZuDTYx5HHVM0FkrUptkpwBy3nRn6JoXf3O+kH mMnNqXg8N+W12tfe7pUa7xkYAFJXRekq0NxCl2DFzlKaAd6+fbz0fLPC44R2NVIjhn J4CZkXFpJLD/p9a6Vlb37j1a8e3Q75BD1qWXUD9I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7CE2AF804CB; Wed, 21 Dec 2022 12:23:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 53315F804CB; Wed, 21 Dec 2022 12:23:53 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2043.outbound.protection.outlook.com [40.107.93.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 34A9AF804B0 for ; Wed, 21 Dec 2022 12:23:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 34A9AF804B0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=PfgOAu0R 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: , 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-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Mario.Limonciello@amd.com, Vijendar Mukunda , Syed Saba Kareem Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Vijendar Mukunda X-Patchwork-Id: 635975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DE38C4332F for ; Wed, 21 Dec 2022 11:25:15 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9E26416CE; Wed, 21 Dec 2022 12:24:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9E26416CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671621913; bh=bJ9QQfQtGPyWtLj3U3PqAORaYW6U6Pv0oLVd3w3A2VA=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=CZG2KZKJOO2OR1zHXbqzZbEihLq1xn+EA1aljp60DPfblC8cncQaFx00KilJWy34i h0Y/lMFL7t8g7HVqRbq9wc9OBQROxDGvCxVtKyTwHEWYOQMwuo9rD4/eI/unhiuOHi FcpacPzPdSuAmkH0hihOlRnDPpLsStHzM5EH2PrI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8AC28F8053A; Wed, 21 Dec 2022 12:24:01 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 953DBF80539; Wed, 21 Dec 2022 12:23:59 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9A88DF80537 for ; Wed, 21 Dec 2022 12:23:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9A88DF80537 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=vSkjp6FN 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: , 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-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Mario.Limonciello@amd.com, Vijendar Mukunda , Syed Saba Kareem Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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: Vijendar Mukunda X-Patchwork-Id: 635649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F8D6C4332F for ; Wed, 21 Dec 2022 11:25:24 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B9FD016F2; Wed, 21 Dec 2022 12:24:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B9FD016F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671621922; bh=4bOcMNL5ZzuXxqX4KFsZCqSin/nsjaGnWHG+DkYfWuE=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=a8ahB2kNAaMOSCMdoML/etSWASX+Nf/wfnniFrPL2R3VnrlUNgbciHzEZSOalNdd1 GrnPzIv+gfxiQiWtGKo42Xuy42YnzLhZao8F0/X/bMgrNjnsijc2rFXJjt5Fx81peO wwlRNaMNZvvZTMkPfzWCd0OszinHsEtmIC98f15k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 564ECF804B0; Wed, 21 Dec 2022 12:24:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B1BE5F8053D; Wed, 21 Dec 2022 12:24:04 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 95AB6F8053D for ; Wed, 21 Dec 2022 12:24:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95AB6F8053D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=nxUUa307 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: , 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-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil-kumar.Dommati@amd.com, open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Mario.Limonciello@amd.com, Vijendar Mukunda , Syed Saba Kareem Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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);