From patchwork Mon Jan 9 13:21:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Prasad Potturu X-Patchwork-Id: 40856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2149948wrt; Mon, 9 Jan 2023 05:18:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXtcPsAHhxU7nPKOoazKeszNo72uMVS5lGvUiMl1tKmbtBn0FnKNYfrTpyfnM/4nsEZH+Qwe X-Received: by 2002:aa7:d60e:0:b0:488:f6a3:2dd6 with SMTP id c14-20020aa7d60e000000b00488f6a32dd6mr37422336edr.41.1673270280184; Mon, 09 Jan 2023 05:18:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673270280; cv=pass; d=google.com; s=arc-20160816; b=jL5SLtQc4VvqRNalhIXFRBx5rHaXHjB6R3jUjwKhJSCSdgqgiYVpZUOiWEfwlrSwEX 8H6ursf8C+7A7efkQWVeZmCvQPoFrnf6aNQxRnWxeu1qZPpJNc8ho6430eH2EWE1404y An+GDsiCpi0vUSRxU0CiUSXbgCEAPAXRtEmkSwQaJShte8LqjeIYo40OFS/OSbimvTzt bld2hGuH1gjzo++j1UMFOue6YgXys3grtddfR1ukP9AQmtJ1990www5c2AuCtnTwBsnj xgAdC1bYXAEA9QDkqSoVQ5/Fn6X37ZGyqZNcPEVpf3gnPy9mFylhALc1G34uQ3eQfm64 xm2g== 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=9yfcAl7POneQ0uR3Cfw3nXjoLLHffyl4xyfJdMbwd5E=; b=b8LfgX/cKIB5h93zYRcLSSci+J91cLKF1x0xfTHVu7iMS/06AG7E+8zZExAOApiizx /9ILqY3UuMZTDKp16qIvEoGP0tf0l5Q/R7xANlX2yRFSwrDVoW/uvw3lKjxuluhnrms6 tcuXGFk3OIzKB/Q7F9liJv4zJytOOKP0APw8IK5zxEx4n/G9dfXEwqWa90ZI0/cYo5xC D8L1pyEREZ5HQ+vbnCDL0NNB3FEaorGt4TRxIGlwTCWzFYlwyibpDHB+0orC1bcP1VJ/ Vg1j95Hmxhs5Xp2FS/I3eliGqVD0d5tSsOhJuUgkyZsI8OmQB1K6QFrbyky0HJ60cocs GLoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0ATASPz8; 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 g13-20020a056402090d00b0047531b0169asi10474942edz.301.2023.01.09.05.17.33; Mon, 09 Jan 2023 05:18:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0ATASPz8; 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 S236558AbjAINR1 (ORCPT + 99 others); Mon, 9 Jan 2023 08:17:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjAINRZ (ORCPT ); Mon, 9 Jan 2023 08:17:25 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2051.outbound.protection.outlook.com [40.107.243.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F19AB1D8 for ; Mon, 9 Jan 2023 05:17:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jACECCT9MRLFv3pYd84W3Tkel+sxfOs/0hqfvV0ulYCSpVrDT6x2Kg50PA3mcJ7dPZL+yajEb5q5r1PwRNmy00RIeim3DFhf1pa7cFw/biUSnPO1UkBpVJNOegnRYzC9rCkJOoLOyVjA+4Wlc1YzY8hZZHD9yinSjdGFx58HZTjhJrmk9VyXL9TQLaOEQkR7ZpjsSLi0IRI5wUcy6dfj5VjtQnnsdFgZxe382dna5D45i9SFi0vc9jKmv7nQeTi1T/+BgX1rx93kcCus1gyjmX+LiKrvM2pL7CSeAe4dkH3oDfuBn9F9CalQLWGO8Jrt/27oKRboS55TOTiQtOcLnw== 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=9yfcAl7POneQ0uR3Cfw3nXjoLLHffyl4xyfJdMbwd5E=; b=QMdblCIjf1qILX3IqaOC3z6c+0qSILBhAH26XKvDg08hzMf0yNrXWFxUJk3TtUHR0mdxZsQoZc3WUMInRbFUUZeWNZw/bgsD8bLypDmdyMVvMO+YxKTBAy0b2Dq/V7AX9iZZOZog/NWPfW/lfciRUVJmA4ZhP4dqiJPX/qL7vIwwhqSlmbBIqMvc/oasOVA1SgmgzFAVgQK5knNwdBIjVskQonHN8FE6URFnQOEsA+3DbVgXuFd9FdgOivS7XdpEyhuLC1WtIVtpHp8+fvUgy7mUh2SHoWm0kR53seNVeJJNrmE3hlewTJYWxmo0ou80vVt9NLCoQ/og4MgNjguzog== 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=9yfcAl7POneQ0uR3Cfw3nXjoLLHffyl4xyfJdMbwd5E=; b=0ATASPz8M0JBzvkFOmQtKO9AX0MQQa+tw5o+4SJQI63QgDBlqm/J7ZPS2LF/J4puO5o2dsLqwLqSqSNzw3Ak9qYi4ubcqt4SJFP3fSif6RDLdFJN3VU+kSmC6c1g5/nI5mz3Sp9HOYn0MkfEQOCqD9azmog58ekYO42q3eL249g= Received: from BL1P223CA0002.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::7) by IA1PR12MB6185.namprd12.prod.outlook.com (2603:10b6:208:3e7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Mon, 9 Jan 2023 13:17:14 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:208:2c4:cafe::3) by BL1P223CA0002.outlook.office365.com (2603:10b6:208:2c4::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:14 +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 BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.15 via Frontend Transport; Mon, 9 Jan 2023 13:17:13 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Mon, 9 Jan 2023 07:17:05 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 07:17:02 -0600 Received: from amd-System-Product-Name.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; Mon, 9 Jan 2023 07:16:52 -0600 From: Venkata Prasad Potturu To: , CC: , , , , , Venkata Prasad Potturu , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Ajit Kumar Pandey , Akihiko Odaki , ye xingchen , Jia-Ju Bai , open list Subject: [PATCH v2 1/5] ASoC: amd: acp: Add new cpu dai's in machine driver Date: Mon, 9 Jan 2023 18:51:00 +0530 Message-ID: <20230109132104.1259479-2-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> References: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|IA1PR12MB6185:EE_ X-MS-Office365-Filtering-Correlation-Id: 29a6d233-cd6b-458b-261c-08daf243d2be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Uacn6So2RnrWsJpV85kPa/vGdqXkrduT6WDEHFjcAU1lEk5Wt0hPO5l2+wDoJFEqz0bFBzBYjpuSEJ2bnVjLiYGYtzK+XqHjL22ht/rrx9l33Z0QH0W7xJiYUDsDbt4HXGuCNz/Nvrb8uT1upvUzLAfaoTrm2R5v1Vx4zmhUTfrWzQS4HyN6TTln6S2zxLvF4I9Z8k4lNNm16EOCWzBzCBmzXa2l+MlbftfgEUXxttIglQusX1ikgUNCoEHgpc37LbjliWWiLPRJS7DNZjvuIXLViDkRe6TEuQP2d4yIIStYlVGb3ncyBfFpPr2SzJBcMWzbipz3EGONRGA7SWV7iwjgqrzprGG0Xlmtlsf3XQhaA1udJPjVHZDudFGIRjoHBSn8BDXd4/mS/x1LfGWkrzyZ+vqlW6aMZexCXopu1sMYfwlmmBZ154+3agNuFOZk45MK2YrwrzW4kW94qjl88NSK/e5GfwKh62telNuldT0yRP0TJU6MEu3NWXTs9ctOhy4DFDI/+vUqh4V6O63vAnHiXeHdCsPgP9k8wuhvF0rlGMCz1HzQ7+9IP14c6sXniwsRc+zjdmVvSnjLWnyTs5mumM9S/5ookfUBCHwWfDtw9sqh2t4mqZc6XLxkBAVFg8AU9MX065kV5aPJOySS71Gn63fGGGJyj8h2ud7FCNtaaj1UGHyN442QWaW8PqHpq1DyhLyyhx6XZuDFGK03+Gf6c5/+HhMewfkhV6EkrWM= 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)(376002)(136003)(396003)(346002)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(6666004)(316002)(110136005)(186003)(81166007)(26005)(54906003)(4326008)(2616005)(336012)(70586007)(1076003)(70206006)(7696005)(8676002)(478600001)(426003)(83380400001)(41300700001)(8936002)(47076005)(356005)(2906002)(5660300002)(36860700001)(82740400003)(36756003)(86362001)(40460700003)(82310400005)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:17:13.8285 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29a6d233-cd6b-458b-261c-08daf243d2be 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: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6185 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?1754551056876697427?= X-GMAIL-MSGID: =?utf-8?q?1754551056876697427?= when using same cpu dai for 2 different dai links below error is reported. error: can't find BE for DAI ACPHS_VIRTUAL1.OUT To avoid this error add new cpu dai. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-mach-common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index a78cf29387a7..86fc5ec5ea08 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -565,8 +565,12 @@ SND_SOC_DAILINK_DEF(i2s_hs, DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-hs"))); SND_SOC_DAILINK_DEF(sof_sp, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp"))); +SND_SOC_DAILINK_DEF(sof_sp_virtual, + DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp-virtual"))); SND_SOC_DAILINK_DEF(sof_hs, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs"))); +SND_SOC_DAILINK_DEF(sof_hs_virtual, + DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs-virtual"))); SND_SOC_DAILINK_DEF(sof_dmic, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic"))); SND_SOC_DAILINK_DEF(pdm_dmic, @@ -701,8 +705,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) if (drv_data->amp_cpu_id == I2S_SP) { links[i].name = "acp-amp-codec"; links[i].id = AMP_BE_ID; - links[i].cpus = sof_sp; - links[i].num_cpus = ARRAY_SIZE(sof_sp); + links[i].cpus = sof_sp_virtual; + links[i].num_cpus = ARRAY_SIZE(sof_sp_virtual); links[i].platforms = sof_component; links[i].num_platforms = ARRAY_SIZE(sof_component); links[i].dpcm_playback = 1; @@ -733,8 +737,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) if (drv_data->amp_cpu_id == I2S_HS) { links[i].name = "acp-amp-codec"; links[i].id = AMP_BE_ID; - links[i].cpus = sof_hs; - links[i].num_cpus = ARRAY_SIZE(sof_hs); + links[i].cpus = sof_hs_virtual; + links[i].num_cpus = ARRAY_SIZE(sof_hs_virtual); links[i].platforms = sof_component; links[i].num_platforms = ARRAY_SIZE(sof_component); links[i].dpcm_playback = 1; From patchwork Mon Jan 9 13:21:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Prasad Potturu X-Patchwork-Id: 40857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2150053wrt; Mon, 9 Jan 2023 05:18:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMwHsDRxrAzrla/K0TT36F7EtHkVokIdTOytkPKiIgwKa9TC0WFnKJW2npFKQn0fnu7bW9 X-Received: by 2002:a17:907:80ca:b0:7c1:540c:e214 with SMTP id io10-20020a17090780ca00b007c1540ce214mr57572154ejc.47.1673270294787; Mon, 09 Jan 2023 05:18:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673270294; cv=pass; d=google.com; s=arc-20160816; b=eE602lOgA90wmn9CrgteKpeDKArgclSgu6nCvYRR54X5zckxsCYVzqdpQIuz0+gT4f V63D/brwDIWU9TVfQovhferCkuZK873BN44wovWG+JgrquIbmrbJUzoek289J6INDdqy YK0zlKd05etNn9km8RKQiR8v2ike5rUz/lu23FZYZCL2rBt10AdXiN2+LCTDUAxTbi9y kE4l5w8WjjZ+nmnWxCAIZAAJqllwsrILvz0Aq8qLwups9jZ38FoGPoNcaiMXDDVzet0r ZSG7UvoB8wkcqs1ZT4t8ZQI6QmoBi7G9Civ8UJh9LAlVjWLLtCJHWXqETNvJRiATi0yd XCpQ== 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=RfclZNvBHapvGE/Y3fHTq9addqDu8tBou8Um1F8nuFY=; b=XaWvDcmojyfwrR+8BYT/pA9ZczP6J9dZ9KRdOgQBXw2uE3fwXLp0yIQ9N9GY8zwlq2 pZafA1/GaLe5Yf1uPyxuAdXzW8yb8nhxnVMHCBYWW8syJuVu1g335BmXBLl1iTaSGzZ9 jMmaMz3oRWSPDuSxNbKBO5ZP9AaT34juUKQBMad6Hma94b5xkiXvWphQl+Lc5FNM8u0H Lr9VnaqjElTf2oImKs9xQTA7bKUtVTe9JmOEVSoinmYqrCs3BJnbBK0a35c6R2GBQKnP oZtHHkVkOKrS1/b/AQMREn28vOC63PjS8wii8A7xqJelvUOCMLaeDewjKLdAxZF/CL0R /9Eg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UFFkl8yw; 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 ds16-20020a170907725000b0084d4e0424fbsi1310348ejc.340.2023.01.09.05.17.50; Mon, 09 Jan 2023 05:18:14 -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=UFFkl8yw; 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 S236699AbjAINRa (ORCPT + 99 others); Mon, 9 Jan 2023 08:17:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236362AbjAINR0 (ORCPT ); Mon, 9 Jan 2023 08:17:26 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1F7B1FF for ; Mon, 9 Jan 2023 05:17:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D3HlNjK0SvGf0rfDHbnkEIEOxzfHqsnvEy3x02Z32QaaBoXfu2AwRg/1EE/aMemhCQEwP8/Ni5Uq0PFZIP33tlKbZirPsORnUTkkqrpXdAZJ6d7VaCZ4CPcHNZ/88yeeLi569DdN3BO9tKqV8UVIou8vabMkgCdbhc31KsDWdtKL2/MuBj6QC1zqxHI9sULTPlWCJwiDpHzLjIj580M8D+gYlq8yFsIaQu0OnQQSamd1/qw027jZbyrMDJTsTowqhNOHqkwD1u9D10vUqDK/tkxrE/JjCJ6rEG32/ywjbvPZR9lghI+DJ/MXfszUvANCl+szFpQ71rRC3pYhqFOVQQ== 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=RfclZNvBHapvGE/Y3fHTq9addqDu8tBou8Um1F8nuFY=; b=TJulgxnBkrPreF/8T3UY62J9zEuAu8Ppv61jqnIoZeXQ8WploRUocrzrV/uCa/BcxDGTUC+byN9d0xZD8ogYA3fKmBuKNmeVtUSGvbJAYkOiUdcostcMpZk36k3cB/H6WswL27x16RE2Lvy7n7J2b84S5U1n21zorMpGzllgAOeqkflKklnFKEdArPNzMfoGDyGjN/ajWE+d2wqx08m3MymHo5MVx+vvch1N8JAqOTJuDSqIoAUTOUSQtX847D99KoBZZwk1tPEkN5M3Vss/tQpaIvykbID+NFoSmyQUa4RKj/dg6pPvsvMQbEF3opxX13oZgRXhUQh0+ti/n2m1Ag== 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=RfclZNvBHapvGE/Y3fHTq9addqDu8tBou8Um1F8nuFY=; b=UFFkl8yw7HeODY030eVnSm3WAvfYjYltacs2X+aB/FlrOretz131mODJTxP32vo2E0AZnilTvMTV1rkA+9GxqqW7vWu2Y56z0JTR7Cm+k4Lo3WNOBfIIADxKTruG+sTOl1jKDRLvYydPnhdZfhCM81C+lOtTxeN+X59ozhSFQyg= Received: from DM6PR02CA0046.namprd02.prod.outlook.com (2603:10b6:5:177::23) by SA0PR12MB4461.namprd12.prod.outlook.com (2603:10b6:806:9c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:17:22 +0000 Received: from DM6NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::4f) by DM6PR02CA0046.outlook.office365.com (2603:10b6:5:177::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:22 +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 DM6NAM11FT049.mail.protection.outlook.com (10.13.172.188) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:22 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Mon, 9 Jan 2023 07:17:13 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 07:17:13 -0600 Received: from amd-System-Product-Name.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; Mon, 9 Jan 2023 07:17:03 -0600 From: Venkata Prasad Potturu To: , CC: , , , , , Venkata Prasad Potturu , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Ajit Kumar Pandey , Akihiko Odaki , Jia-Ju Bai , open list Subject: [PATCH v2 2/5] ASoC: amd: acp: Refactor dai format implementation Date: Mon, 9 Jan 2023 18:51:01 +0530 Message-ID: <20230109132104.1259479-3-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> References: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT049:EE_|SA0PR12MB4461:EE_ X-MS-Office365-Filtering-Correlation-Id: 42a378de-1a6a-4c44-7191-08daf243d7eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VW6WfOAKAh+hbzcrNJCUZYhK6pJlaXHEVvh6WlaZAvhhJiTnhH/huhKnye44peohg8NKo6y1/jYs6/M/mPsTSVHXcEGrgPS9FP96WkPRinnAw//LiT/cg9SfILoFOzBfVFL50qFAwWO/lUfq0YgWFvJfhPgPIY7XMaV9Vt24Y7tl9bCXeaQ4aVZHY6jYV50Xr7pjb9NexLVnCXu2rsca56w4UCZ5HAvhr/68ZurTboQP9bvBVMu0q04sKazc2RSc5SxqmSGinACir12NJiqgRGm5iJzctpmesGW5DhrHEUAxqJboYpORvzQDaL+BrVS/m2/T05kJFC8HHRD9mX4j1BHdVgQOn8gqJgQ8xqYH8CCb+qfbFY7iDo9NzUnjCGqXlElfws7wdET9rTjZ0WpNddKioPGmp8EkRNbawfxrsMf131k4+MytJKpV/FE6v2SbYj73ifFrU8657StzhK6FkyWX+4Wm3Q0vXlxIKbzMBPabtztdU9yeYNIByh85GkWN/+57/baWvPvxpZq2pBPFIE+54gXxMhERUfftGvibUSdwaEAzqXyMGG+HZONX4YqT7nSV2Og1D0UXQ9e5A8McLeoBX+gj8kyakzOLhGs/DGCHRUmULGjrkK55MimtS6k38caQXYHmSi17jDqEQMxz2WT2XozWaRk7QMcVx1lBm9dRYAETaQ/FbTRqxiV00FFZDqGLmGK+YE+C1xmbQimB4NTBm2qVpDV2mBq3Gzn2IW8= 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)(39860400002)(136003)(396003)(376002)(346002)(451199015)(36840700001)(46966006)(40470700004)(82310400005)(41300700001)(8936002)(36756003)(5660300002)(2906002)(8676002)(70586007)(70206006)(316002)(7696005)(110136005)(54906003)(47076005)(40480700001)(478600001)(26005)(336012)(4326008)(186003)(2616005)(1076003)(426003)(40460700003)(86362001)(83380400001)(36860700001)(82740400003)(81166007)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:17:22.4514 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42a378de-1a6a-4c44-7191-08daf243d7eb 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: DM6NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4461 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?1754551072537252153?= X-GMAIL-MSGID: =?utf-8?q?1754551072537252153?= Refactor dai format implementation in dai_link specific snd_soc_ops. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-mach-common.c | 152 ++++++++++++++++++++++------ 1 file changed, 122 insertions(+), 30 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 86fc5ec5ea08..75beb6e41e99 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -86,13 +86,6 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != RT5682) return -EINVAL; - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBP_CFP); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } - ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL2, RT5682_PLL2_S_MCLK, PCO_PLAT_CLK, RT5682_PLL_FREQ); if (ret < 0) { @@ -191,9 +184,41 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream) clk_disable_unprepare(drvdata->wclk); } +static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + int ret; + unsigned int fmt; + + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_fmt(codec_dai, fmt); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + return 0; +} + static const struct snd_soc_ops acp_card_rt5682_ops = { .startup = acp_card_hs_startup, .shutdown = acp_card_shutdown, + .hw_params = acp_card_rt5682_hw_params, }; /* Define RT5682S CODEC component*/ @@ -212,7 +237,6 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_component *component = codec_dai->component; - unsigned int fmt; int ret; dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); @@ -220,17 +244,6 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != RT5682S) return -EINVAL; - if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; - else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } - ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL2, RT5682S_PLL_S_MCLK, PCO_PLAT_CLK, RT5682_PLL_FREQ); if (ret < 0) { @@ -281,8 +294,40 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682s_map, ARRAY_SIZE(rt5682s_map)); } +static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + int ret; + unsigned int fmt; + + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_fmt(codec_dai, fmt); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + return 0; +} + static const struct snd_soc_ops acp_card_rt5682s_ops = { .startup = acp_card_hs_startup, + .hw_params = acp_card_rt5682s_hw_params, }; static const unsigned int dmic_channels[] = { @@ -351,13 +396,26 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, struct snd_soc_card *card = rtd->card; struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai; + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int srate, i, ret = 0; + unsigned int fmt; srate = params_rate(params); if (drvdata->amp_codec_id != RT1019) return -EINVAL; + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + for_each_rtd_codec_dais(rtd, i, codec_dai) { if (strcmp(codec_dai->name, "rt1019-aif")) continue; @@ -426,9 +484,33 @@ static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd) ARRAY_SIZE(max98360a_map)); } +static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + unsigned int fmt; + int ret; + + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + return 0; +} + static const struct snd_soc_ops acp_card_maxim_ops = { .startup = acp_card_amp_startup, .shutdown = acp_card_shutdown, + .hw_params = acp_card_maxim_hw_params, }; /* Declare nau8825 codec components */ @@ -446,7 +528,6 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_component *component = codec_dai->component; - unsigned int fmt; int ret; dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); @@ -454,16 +535,6 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != NAU8825) return -EINVAL; - if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; - else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } ret = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_BTN_0 | SND_JACK_BTN_1 | @@ -492,8 +563,12 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int ret; + unsigned int fmt; ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, (48000 * 256), SND_SOC_CLOCK_IN); @@ -507,6 +582,23 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_fmt(codec_dai, fmt); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + return ret; } From patchwork Mon Jan 9 13:21:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Prasad Potturu X-Patchwork-Id: 40858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2150263wrt; Mon, 9 Jan 2023 05:18:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXtWoGKYT0p40K4/60C9CZ/FAUJT9TaQKxlIjH6PEiWvkOFVNPWsyjDRu6+4+sMw/FINVrAS X-Received: by 2002:a17:906:5e04:b0:7c0:e803:4ebb with SMTP id n4-20020a1709065e0400b007c0e8034ebbmr54465496eju.70.1673270320428; Mon, 09 Jan 2023 05:18:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673270320; cv=pass; d=google.com; s=arc-20160816; b=jCioxrvs+eyUosZmLYsV4MZaiihcEWG12dh8cfFXRLKwLp8XpIDyOrcHEY+0yWZzUL U0gNkDDEI/hSuGYLXXuAqE45+dzG0Ij/4/oZzoY/tDCcK5nzZyEY0Glpz8xhRb/569Ng 3IlK8vPSyCwy9mxtTASyh/kNey7k1Moo5boNQege4NpvqY1N8FYpwFarKhyiYWRt10Of 9cK0ASIa8lssIOsSjRqAV6Yq+xsBJfYCnrV70T9Y1p5GqgzN3o9pRXnhOpE8xAU8IXHx UVDP47ds2eF/uTOmC0ea4f0H3gkjxv1Za19amz80zvu3I5ecaA9T1JpZr74G82K/dudn KtUA== 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=ZFJJv7o355mKu4mAMJbAgFIqJG+NRGxHnZ0Vm69X1wM=; b=u2cpXiYiRJFbosZCdj/ievRC4Qc+vmubAmQJ6XO0D2h4DM+kHf6v3Es+XxyB4+Uofg ujhXJQRqdOMNnqpaX+xmHu+VJQrJg5AobwwHY1U3pJ/f8u6vYXaUBPjEWfKMXWAi5DTb UMNQh724s7Gz30vVWkjjFaOKSxH7yxW4Ztcyzr02eNGPtcmcFt+qy6NQ2SCwAWKY/ywy ENzDWpnm2718RvI4N8ngvbIqSxhQqDEXEKsipLoNizuLzre3XP//7fbNYOqbBtnuG10R kz4IOvIldLp69uTB/IljUo20gli1Zn0yW/K1II0EXczJW556Zhi1/CRXBoGeq8GNm+HI LDGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=AkXBUwgW; 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 sa41-20020a1709076d2900b0084cb98e14e2si9135359ejc.621.2023.01.09.05.18.16; Mon, 09 Jan 2023 05:18:40 -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=AkXBUwgW; 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 S234756AbjAINRe (ORCPT + 99 others); Mon, 9 Jan 2023 08:17:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234483AbjAINR3 (ORCPT ); Mon, 9 Jan 2023 08:17:29 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2047.outbound.protection.outlook.com [40.107.243.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44B0BB1D8 for ; Mon, 9 Jan 2023 05:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U/kf0DxFdguPmHIWJJ8f7BwrjcToHapHXB0vUMgax44e0NJZaQmEU4smhJbf+DRakWF/7odRp2hX9Wv8D57K1wVNJyCYhI8pu+BgTA6udzHME292Xo4kRCe2ppfMwHENE7pOAIdc7RTMYCc0lMEuzhAd3JEqHozGTVBsQqyh7iIp/7isOQbNcCvtBtHPIykQQVWR8DZHfrDsUNxOdOaXft8V7Cy31AhGQPyoy0v6LmVgd178If5dIEr5EWoq3SV86U+9Q+asioF5Jg0VtUUZAlgFtU5Nmo4xV3WErtORuRLWP6XwjbV+lpo0KbM3UK03g2DNPnT5E3lfiUtEy4IgSQ== 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=ZFJJv7o355mKu4mAMJbAgFIqJG+NRGxHnZ0Vm69X1wM=; b=K6itUB3VbQLJkNKMlTm0isfNf83ksGrNGSU0tomFQRAbMEEkpm791ItoBOJJ38f6crp8Swi020E7L2NaxFdzjEyiQaj5ZJgTs0zMtV4bQY2acrLqp5qxldLaUF4yr9oTNtjg08tTHggeuGs0uvpKAPMls5ZfGrzsJIjXNaveHyz6ZuZfwsomrWE5DTdlNJ2LKlLg/4Ao2VqDPdIRhNq2uj2hza0Ldq+GVen/Sp5wvs/or9CA4SFvlOAVjC/vARJNzKiyIjBoBiJYN34O5y3CDPiyZRXeDBtrR116POVBTaTar+lmPTX8PsghjFDppZIsSuW7QxlrP2zjLlR8zIcDrQ== 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=ZFJJv7o355mKu4mAMJbAgFIqJG+NRGxHnZ0Vm69X1wM=; b=AkXBUwgW6lwdGbIocicersJrsB154kk/qRIAVDxbUVDFBYwYzQgPoGXNH1KA6pwnie/KxrjSvCdC0nDdaFXgfFRY5MIHcrKZgIpi2R/O8W2hmbHXDe2IZDCFBRZuPFn4PXwRcXdlIjSyBjiwODTbmSPwiRHDg9nMiup5NWPGyKI= Received: from DS7PR03CA0185.namprd03.prod.outlook.com (2603:10b6:5:3b6::10) by DS7PR12MB8202.namprd12.prod.outlook.com (2603:10b6:8:e1::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:17:24 +0000 Received: from DM6NAM11FT111.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::dc) by DS7PR03CA0185.outlook.office365.com (2603:10b6:5:3b6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:24 +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 DM6NAM11FT111.mail.protection.outlook.com (10.13.173.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:24 +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; Mon, 9 Jan 2023 07:17:24 -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; Mon, 9 Jan 2023 07:17:23 -0600 Received: from amd-System-Product-Name.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; Mon, 9 Jan 2023 07:17:14 -0600 From: Venkata Prasad Potturu To: , CC: , , , , , Venkata Prasad Potturu , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Ajit Kumar Pandey , Akihiko Odaki , Jia-Ju Bai , open list Subject: [PATCH v2 3/5] ASoC: amd: acp: Refactor i2s clocks programming sequence Date: Mon, 9 Jan 2023 18:51:02 +0530 Message-ID: <20230109132104.1259479-4-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> References: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT111:EE_|DS7PR12MB8202:EE_ X-MS-Office365-Filtering-Correlation-Id: 297f1a71-26a1-42d9-f48c-08daf243d939 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 23H0CkNC/3hSfVb8okQmxAtiNEZdkxTDQTQgE/P9aJ8ErogqPGeoRrO77kne9qXpqkrKTdAim1qmoNaQOGf3SEQTpbeIeyMBFhcTvTtMVnNnrCt2y/qgRUJYCo7Ar3szX5bAcZWeLfZH893eZvb4UVw7cgA/dZhQeKIzQWU3Uv4xdjWIyOeHW93CRjQd7lI80pzuYCsRICBqWCmjaTH6Zb+/vXZkDnFcRUPDJ97Z7PN5g9WIo83kCjJJRxCvuN2DotyYKBiwD60hc7K/PEaGn1tIaIazCmR+zt4ekmhXSDnazqsjJzTtC9rc2xk7uEliULnPCQfXLLjaUW+ji5JT5zp9HEWKqJdkcfi5pp2Efz0lYYon45YohkBtJ/a8ueegFnzSruey595IzTJcFXDAjxT7bHpeWJC/iVOjPE6Zl24ekKbwx/fO7HAIawBqoPVVdIc8FDrapuliY0izSfuEnAPp5p8JKKEQerko7q//HpUiPxfO+eMB1ibZUtcl3QNZRtnn2bN5m6jVMt5brN+jdeAxDODucbBX2dy1EE2ubzucwHxtg/Pb0bG0f2JJOsnMRKiD0RJwo6sKGFP9pJMcI/Cs9B0DsmJjAaTpqtUVjQqSf6gng5DxOajxl5jRFtzuTWf1FQhQmxq1LkIZHIyahMsNjHqkWHg+fXYFCFov4HWyH15Bpb738jRe4KAlUzE3W8vmgepUOiVHEiiu4w6srQrYxCLEPkPA9Zf/qYuoc2A= 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)(396003)(376002)(451199015)(36840700001)(46966006)(40470700004)(82310400005)(2906002)(8936002)(5660300002)(36756003)(41300700001)(6666004)(70586007)(70206006)(8676002)(316002)(7696005)(110136005)(54906003)(4326008)(40480700001)(26005)(478600001)(186003)(336012)(2616005)(1076003)(426003)(86362001)(47076005)(36860700001)(83380400001)(40460700003)(356005)(81166007)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:17:24.6749 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 297f1a71-26a1-42d9-f48c-08daf243d939 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: DM6NAM11FT111.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8202 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?1754551099578092123?= X-GMAIL-MSGID: =?utf-8?q?1754551099578092123?= Refactor i2s clock values based on hw_params and use srate and bclk_ratio variables in clock enable API instead hard-code values. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-mach-common.c | 169 ++++++++++++++++------------ 1 file changed, 94 insertions(+), 75 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 75beb6e41e99..88c194902157 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -54,10 +54,11 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = { .mask = 0, }; -static int acp_clk_enable(struct acp_card_drvdata *drvdata) +static int acp_clk_enable(struct acp_card_drvdata *drvdata, + unsigned int srate, unsigned int bclk_ratio) { - clk_set_rate(drvdata->wclk, 48000); - clk_set_rate(drvdata->bclk, 48000 * 64); + clk_set_rate(drvdata->wclk, srate); + clk_set_rate(drvdata->bclk, srate * bclk_ratio); return clk_prepare_enable(drvdata->wclk); } @@ -86,27 +87,6 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != RT5682) return -EINVAL; - ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL2, RT5682_PLL2_S_MCLK, - PCO_PLAT_CLK, RT5682_PLL_FREQ); - if (ret < 0) { - dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); - return ret; - } - - ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL2, - RT5682_PLL_FREQ, SND_SOC_CLOCK_IN); - if (ret < 0) { - dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); - return ret; - } - - /* Set tdm/i2s1 master bclk ratio */ - ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64); - if (ret < 0) { - dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret); - return ret; - } - drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); @@ -161,16 +141,6 @@ static int acp_card_hs_startup(struct snd_pcm_substream *substream) snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); - if (strcmp(codec_dai->name, "rt5682s-aif1") && strcmp(codec_dai->name, "rt5682s-aif2")) { - if (!drvdata->soc_mclk) { - ret = acp_clk_enable(drvdata); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret); - return ret; - } - } - } - return ret; } @@ -193,7 +163,11 @@ static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int ret; - unsigned int fmt; + unsigned int fmt, srate, ch, format; + + srate = params_rate(params); + ch = params_channels(params); + format = 8 * params_format(params); if (drvdata->soc_mclk) fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; @@ -212,6 +186,35 @@ static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream, return ret; } + ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL2, RT5682_PLL2_S_MCLK, + PCO_PLAT_CLK, RT5682_PLL_FREQ); + if (ret < 0) { + dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL2, + RT5682_PLL_FREQ, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); + return ret; + } + + /* Set tdm/i2s1 master bclk ratio */ + ret = snd_soc_dai_set_bclk_ratio(codec_dai, ch * format); + if (ret < 0) { + dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret); + return ret; + } + + if (!drvdata->soc_mclk) { + ret = acp_clk_enable(drvdata, srate, ch * format); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret); + return ret; + } + } + return 0; } @@ -244,27 +247,6 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != RT5682S) return -EINVAL; - ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL2, RT5682S_PLL_S_MCLK, - PCO_PLAT_CLK, RT5682_PLL_FREQ); - if (ret < 0) { - dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); - return ret; - } - - ret = snd_soc_dai_set_sysclk(codec_dai, RT5682S_SCLK_S_PLL2, - RT5682_PLL_FREQ, SND_SOC_CLOCK_IN); - if (ret < 0) { - dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); - return ret; - } - - /* Set tdm/i2s1 master bclk ratio */ - ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64); - if (ret < 0) { - dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret); - return ret; - } - if (!drvdata->soc_mclk) { drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); @@ -303,7 +285,11 @@ static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int ret; - unsigned int fmt; + unsigned int fmt, srate, ch, format; + + srate = params_rate(params); + ch = params_channels(params); + format = 8 * params_format(params); if (drvdata->soc_mclk) fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; @@ -322,6 +308,30 @@ static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, return ret; } + ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL2, RT5682S_PLL_S_MCLK, + PCO_PLAT_CLK, RT5682_PLL_FREQ); + if (ret < 0) { + dev_err(rtd->dev, "Failed to set codec PLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, RT5682S_SCLK_S_PLL2, + RT5682_PLL_FREQ, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(rtd->dev, "Failed to set codec SYSCLK: %d\n", ret); + return ret; + } + + /* Set tdm/i2s1 master bclk ratio */ + ret = snd_soc_dai_set_bclk_ratio(codec_dai, ch * format); + if (ret < 0) { + dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret); + return ret; + } + + clk_set_rate(drvdata->wclk, srate); + clk_set_rate(drvdata->bclk, srate * ch * format); + return 0; } @@ -397,10 +407,12 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); - int srate, i, ret = 0; - unsigned int fmt; + int i, ret = 0; + unsigned int fmt, srate, ch, format; srate = params_rate(params); + ch = params_channels(params); + format = 8 * params_format(params); if (drvdata->amp_codec_id != RT1019) return -EINVAL; @@ -421,7 +433,7 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, continue; ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, - 64 * srate, 256 * srate); + ch * format * srate, 256 * srate); if (ret < 0) return ret; @@ -431,16 +443,20 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, return ret; } + if (!drvdata->soc_mclk) { + ret = acp_clk_enable(drvdata, srate, ch * format); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret); + return ret; + } + } + return 0; } static int acp_card_amp_startup(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); - struct snd_soc_card *card = rtd->card; - struct acp_card_drvdata *drvdata = card->drvdata; - int ret = 0; runtime->hw.channels_max = DUAL_CHANNEL; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, @@ -448,14 +464,7 @@ static int acp_card_amp_startup(struct snd_pcm_substream *substream) snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); - if (!drvdata->soc_mclk) { - ret = acp_clk_enable(drvdata); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret); - return ret; - } - } - return ret; + return 0; } static const struct snd_soc_ops acp_card_rt1019_ops = { @@ -491,9 +500,13 @@ static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, struct snd_soc_card *card = rtd->card; struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); - unsigned int fmt; + unsigned int fmt, srate, ch, format; int ret; + srate = params_rate(params); + ch = params_channels(params); + format = 8 * params_format(params); + if (drvdata->soc_mclk) fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else @@ -504,6 +517,14 @@ static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); return ret; } + + if (!drvdata->soc_mclk) { + ret = acp_clk_enable(drvdata, srate, ch * format); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to enable AMP clk: %d\n", ret); + return ret; + } + } return 0; } @@ -692,8 +713,6 @@ static int acp_rtk_set_bias_level(struct snd_soc_card *card, switch (level) { case SND_SOC_BIAS_STANDBY: if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { - clk_set_rate(drvdata->wclk, 48000); - clk_set_rate(drvdata->bclk, 48000 * 64); /* Increase bclk's enable_count */ ret = clk_prepare_enable(drvdata->bclk); From patchwork Mon Jan 9 13:21:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Prasad Potturu X-Patchwork-Id: 40860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2150822wrt; Mon, 9 Jan 2023 05:19:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXvx23aFPOP1pw/msolUfh0/V8iQaOjd58sM6v+g4y7tc7pEoe/tjZ3RpWmP1d5Ka8j5Rckm X-Received: by 2002:a17:906:d052:b0:7be:e26a:6104 with SMTP id bo18-20020a170906d05200b007bee26a6104mr56986872ejb.52.1673270389151; Mon, 09 Jan 2023 05:19:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673270389; cv=pass; d=google.com; s=arc-20160816; b=sKCSeCZaREkLUIh2abIWQO3SZwBAMHenw/w9+IXzzGrPW1yZzCT1uHIdaprGgALqLz 36UIi36OcKKfrOeMORsirmKFqkDxRevguzgC5+29vRU9KofsQ3RU5MxZK7YId+v6Abui SpYT8J3kSDMIup+GL35F7tbNa934XZpKSlDBN/1hadUXPiIRjHeNb4llpOBkICcWnR8N nxYgeytMSkTRyOsqvn0OjJajT0f3gD+js0qEWAItZtvsCvUaCpIfsmG60pZNqlfjxh9H Xgs8Z3Z+Npf1r25wSJeG8MbNyJjxyjj9KShgAS/5PppMw87NIoo2II0jvESJ1hRhjRCA QuZQ== 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=KwIsoUV4Xz78gOWvHzmRckn1ERz6f/Vf2/LsuwvslEs=; b=V5PYAc7jKnRm2iNTyG4+6xDSNwWUCp88jO3begjhd2OlhtvLuP4VK/+nqlqATCg0b7 pZr5esaHqUIHbZUGnI2ZNGEYVK6pCKsizhc6DsTq9nvRU9DPRbEj2I3nVxcvkYftgm6W JxCqfBzxdp1sbst2NxT0qQGSB7Y97Lo+JhYWkv2BFiF5j+V/rCtAVCzGdGZfG1F/XRFB aE55Q+qN9Z6JbVbFjjttDNaER8fSvin2EbabutjKfQBlV5fV/sD+zbzPT6luABYLUHeg 8Nv3Te1/UX1RyMBL7zk1LuVdQ6TxhzQs7JWLy2H8Ne44zExg3DUH3DE123EGMnmen3Ip YZZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TgbOObhr; 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 k12-20020a50ce4c000000b00458ff6921e6si9296552edj.79.2023.01.09.05.19.25; Mon, 09 Jan 2023 05:19:49 -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=TgbOObhr; 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 S236960AbjAINRt (ORCPT + 99 others); Mon, 9 Jan 2023 08:17:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236851AbjAINRr (ORCPT ); Mon, 9 Jan 2023 08:17:47 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2079.outbound.protection.outlook.com [40.107.243.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2E7F12D2D for ; Mon, 9 Jan 2023 05:17:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LObz/BHuUMJruTrr3HcuPgpp85680dqLgsHfeQmtNu4oZR/Va7uf8ZG8Rk8+cgqiRRZNF4yc6dvjnsifRgjVFrtH5P++YzwEB80QEQwK/4TkEmpT44cdCO0jXqffSVscyuLNOZJApypqMPw/I06bifDT3qIvIdDfl7mknVT2VIynYJAXJzRjhK2npNqwOWxjyL0J9+ihKqYBNl2yD1OQUS6Twv8x1AW+JvFM6AcKjfN8BYnUUB8wttEX4V/Or05X9fpDPS7/IPtnVQ5M5ujYBc9iIFC+MAm9oF8X0uVrJ6uYd/NCqgF1lLGX8iyUCrJuQxV4EM+lSzUuqzRmzfoiOw== 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=KwIsoUV4Xz78gOWvHzmRckn1ERz6f/Vf2/LsuwvslEs=; b=MdUtyrcIpMnDBYezeMxiRfGs9xlh149PNtZSspxk/Vorp7lY2tQorI83SswlAizk9Lx1hj4jaY/Q1gMmDIiNWOFgBxrQ+mtGbhtbx6qPcr6SDS0ABj8i3hi9jMLkB6Vj5SP1YRK85xs/hR93lnO+oScP2jj24Lg2ShJVKZL9BDueP6gIhv+0/zoo0/Xpgu1CQ0KbppsFWz+lvQZm5pDUjdiZhbOQx1p/WeJRemb3mu0rAa0JzNcfOGgnqLyHcOnVdvWLfAW8GRpcTbCLdZnALpMqT73DBE5chiraVy6aB12nd6/UaOydxx5qfqcCy73sNvXyuukMuYBfJDzJcG0u1Q== 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=KwIsoUV4Xz78gOWvHzmRckn1ERz6f/Vf2/LsuwvslEs=; b=TgbOObhr0/RzLx/2dKgwm9NtY1+R/cb7b/K1lkULxyUdplvWQzfUc8yDxv259VkydpWY8gyevqRt/raDzHmQaAVlT4sxHdPQLmNCKein4OYh+A7qdyShZlaLePAqta2+Z8mp7UgQ/YfQSrbmUMv006jakeAroibFGMH8tuq557Q= Received: from DM6PR04CA0001.namprd04.prod.outlook.com (2603:10b6:5:334::6) by DM6PR12MB4482.namprd12.prod.outlook.com (2603:10b6:5:2a8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:17:38 +0000 Received: from DM6NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::b2) by DM6PR04CA0001.outlook.office365.com (2603:10b6:5:334::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:38 +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 DM6NAM11FT035.mail.protection.outlook.com (10.13.172.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:38 +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; Mon, 9 Jan 2023 07:17:38 -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; Mon, 9 Jan 2023 07:17:37 -0600 Received: from amd-System-Product-Name.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; Mon, 9 Jan 2023 07:17:28 -0600 From: Venkata Prasad Potturu To: , CC: , , , , , Venkata Prasad Potturu , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Ajit Kumar Pandey , V sujith kumar Reddy , Akihiko Odaki , Jia-Ju Bai , ye xingchen , open list Subject: [PATCH v2 4/5] ASoC: amd: acp: Add i2s tdm support in machine driver Date: Mon, 9 Jan 2023 18:51:03 +0530 Message-ID: <20230109132104.1259479-5-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> References: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT035:EE_|DM6PR12MB4482:EE_ X-MS-Office365-Filtering-Correlation-Id: b6ecddeb-c89e-4b68-f825-08daf243e195 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YgS9uDMdOpg1Rh7bhV7fs/AbKVC+Wi77K3LoOsy3Dh/nU/9ta27EIQLECFiuvOE2dvtOklSMxerEE08pC34wsVjOcP9QnmNPKS/qfZIm/0ks47Q3A24Lu+ZPvWhd7/YVsYR+pR+pemPoyVTI/V2maCiftTJoE9Dc//vYMDkn9ir7raRrc9tWosIcTP0Gw8/6vRlI176Mp2TejnofdugcveJS/X3oK470h0vy2pobUuXgN1VHohxnXMDOxbgGPZcbU7XMXWBTsLQdeK7SSav1SDaroKDmBI7dn0xBxeRTq6jRd9GjQIvvT+oL7wBodCRtj7O2aNe2oRkicusdjVBmE4Mht5aM4LX39j8ulXaxJIerLDne84r2SBYYn3j8v3Ml3qhyJjEXOdZn4fuGaMMA2DDhB2jbSJ3ieo04JPxSU93LAGLtU5Ttq1vxYn3RiMRI2EV89N15tq1eawb+QXgzLun1wdOFKjHntV1tjsrbmnJyKZg8A/SIYY4403ZHvEpIgSxv2kSD8d0Sk1W2PyHgXWGR3PP5mAYG+0aDpj9QgfCEc4ngMOfmxox5Bp+gHgFuxYU+hxG5Hz6oKlaBWJhqv6FzII1bxQgx0NcTkz5yGScJxSV5AbJuQlzh0b4e8hF0Gkuulelkmkb80FE/u7Y3Qi0dPFXYzqay8v9sZ05p080+ojGaDJiRuOXekgkJm5SLKb/zeQ31miFhxIDsiP59mqRFNvdEWbWZTnRo3vxDt1Q= 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)(376002)(136003)(346002)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(81166007)(41300700001)(36860700001)(30864003)(70586007)(70206006)(4326008)(8936002)(8676002)(5660300002)(82310400005)(356005)(83380400001)(7696005)(316002)(336012)(47076005)(426003)(1076003)(40480700001)(86362001)(2906002)(82740400003)(6666004)(478600001)(40460700003)(2616005)(54906003)(186003)(26005)(36756003)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:17:38.6997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6ecddeb-c89e-4b68-f825-08daf243e195 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: DM6NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4482 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?1754551171334800344?= X-GMAIL-MSGID: =?utf-8?q?1754551171334800344?= Add i2s tdm support for amd platforms. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-legacy-mach.c | 5 + sound/soc/amd/acp/acp-mach-common.c | 162 +++++++++++++++++++++++++--- sound/soc/amd/acp/acp-mach.h | 3 + sound/soc/amd/acp/acp-sof-mach.c | 6 ++ 4 files changed, 162 insertions(+), 14 deletions(-) diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c index 1f4878ff7d37..d508792dba4f 100644 --- a/sound/soc/amd/acp/acp-legacy-mach.c +++ b/sound/soc/amd/acp/acp-legacy-mach.c @@ -27,6 +27,7 @@ static struct acp_card_drvdata rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata rt5682s_max_data = { @@ -36,6 +37,7 @@ static struct acp_card_drvdata rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata rt5682s_rt1019_data = { @@ -45,6 +47,7 @@ static struct acp_card_drvdata rt5682s_rt1019_data = { .hs_codec_id = RT5682S, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata max_nau8825_data = { @@ -56,6 +59,7 @@ static struct acp_card_drvdata max_nau8825_data = { .dmic_codec_id = DMIC, .soc_mclk = true, .platform = REMBRANDT, + .tdm_mode = false, }; static struct acp_card_drvdata rt5682s_rt1019_rmb_data = { @@ -67,6 +71,7 @@ static struct acp_card_drvdata rt5682s_rt1019_rmb_data = { .dmic_codec_id = DMIC, .soc_mclk = true, .platform = REMBRANDT, + .tdm_mode = false, }; static const struct snd_kcontrol_new acp_controls[] = { diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 88c194902157..ffab6328baf0 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -124,10 +124,15 @@ static int acp_card_hs_startup(struct snd_pcm_substream *substream) int ret; unsigned int fmt; + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(codec_dai, fmt); if (ret < 0) { @@ -169,10 +174,15 @@ static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream, ch = params_channels(params); format = 8 * params_format(params); + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -186,6 +196,23 @@ static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 0 and slot 1 for playback and capture. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 8, 16); + if (ret < 0) { + dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); + return ret; + } + } + ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL2, RT5682_PLL2_S_MCLK, PCO_PLAT_CLK, RT5682_PLL_FREQ); if (ret < 0) { @@ -291,10 +318,15 @@ static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, ch = params_channels(params); format = 8 * params_format(params); + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -308,6 +340,23 @@ static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 0 and slot 1 for playback and capture. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 8, 16); + if (ret < 0) { + dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); + return ret; + } + } + ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL2, RT5682S_PLL_S_MCLK, PCO_PLAT_CLK, RT5682_PLL_FREQ); if (ret < 0) { @@ -417,10 +466,15 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, if (drvdata->amp_codec_id != RT1019) return -EINVAL; + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -428,12 +482,28 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 2 and slot 3 for playback. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xC, 0, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + } + for_each_rtd_codec_dais(rtd, i, codec_dai) { if (strcmp(codec_dai->name, "rt1019-aif")) continue; - ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, - ch * format * srate, 256 * srate); + if (drvdata->tdm_mode) + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, + TDM_CHANNELS * format * srate, 256 * srate); + else + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, + ch * format * srate, 256 * srate); + if (ret < 0) return ret; @@ -441,6 +511,33 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, 256 * srate, SND_SOC_CLOCK_IN); if (ret < 0) return ret; + + if (drvdata->tdm_mode) { + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A + | SND_SOC_DAIFMT_NB_NF); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + /** + * As codec supports slot 2 for left channel playback. + */ + if (!strcmp(codec_dai->component->name, "i2c-10EC1019:00")) { + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x4, 0x4, 8, 16); + if (ret < 0) + break; + } + + /** + * As codec supports slot 3 for right channel playback. + */ + if (!strcmp(codec_dai->component->name, "i2c-10EC1019:01")) { + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x8, 0x8, 8, 16); + if (ret < 0) + break; + } + } } if (!drvdata->soc_mclk) { @@ -507,10 +604,15 @@ static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, ch = params_channels(params); format = 8 * params_format(params); + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -518,6 +620,17 @@ static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 2 and slot 3 for playback. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xC, 0, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + } + if (!drvdata->soc_mclk) { ret = acp_clk_enable(drvdata, srate, ch * format); if (ret < 0) { @@ -603,10 +716,15 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -620,6 +738,22 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 4 and slot 5 for playback and slot 6 for capture. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x30, 0xC0, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x40, 0x30, 8, 16); + if (ret < 0) { + dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); + return ret; + } + } return ret; } diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h index 20583ef902df..9f87439b3cfd 100644 --- a/sound/soc/amd/acp/acp-mach.h +++ b/sound/soc/amd/acp/acp-mach.h @@ -18,6 +18,8 @@ #include #include +#define TDM_CHANNELS 8 + enum be_id { HEADSET_BE_ID = 0, AMP_BE_ID, @@ -58,6 +60,7 @@ struct acp_card_drvdata { struct clk *wclk; struct clk *bclk; bool soc_mclk; + bool tdm_mode; }; int acp_sofdsp_dai_links_create(struct snd_soc_card *card); diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index f19f064a7527..f3ba22a25962 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -27,6 +27,7 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682_max_data = { @@ -36,6 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = { .hs_codec_id = RT5682, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_rt1019_data = { @@ -45,6 +47,7 @@ static struct acp_card_drvdata sof_rt5682s_rt1019_data = { .hs_codec_id = RT5682S, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_max_data = { @@ -54,6 +57,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_nau8825_data = { @@ -64,6 +68,7 @@ static struct acp_card_drvdata sof_nau8825_data = { .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, .soc_mclk = true, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { @@ -74,6 +79,7 @@ static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { .amp_codec_id = RT1019, .dmic_codec_id = DMIC, .soc_mclk = true, + .tdm_mode = false, }; static const struct snd_kcontrol_new acp_controls[] = { From patchwork Mon Jan 9 13:21:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Prasad Potturu X-Patchwork-Id: 40859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2150665wrt; Mon, 9 Jan 2023 05:19:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3DqrGxHTmRvHsjYZEgeyTSbxuysnl9RnQ1cudW0SOWIYlSZsUQKZU3gxRiVwMBCLA9v3Q X-Received: by 2002:a05:6402:e0f:b0:468:58d4:a0f2 with SMTP id h15-20020a0564020e0f00b0046858d4a0f2mr62365153edh.23.1673270374489; Mon, 09 Jan 2023 05:19:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673270374; cv=pass; d=google.com; s=arc-20160816; b=phxw91FZiY3RRarULs38qZJEwfosdShonw9jhwQSckElN5resCbDkLbwnCNq8Kmxr7 THULZ+tEL7LAe1h4llx3v+29mG4DEhkTXbqST0CwV/Bj37x/AJv5ePCNnq1EF0fxDagQ DS5HPSut2dDVP4sFAb596yDW+zU+MT4yTmGrDq3gQTpVhqYBEelJRZSBEey/fmVnDlQv o1xKVoygMxFYqYpX4WxQyoVOIvzzaLriybI0UXxt8oBVOrlyrxQooqUX3KWNp01zJuWe bQ02OQV+f65LVZtOp4vwYM6t1JEbJCR/oeWtixJt5Mh4ESJhC1CPUKVl7Jx8QBi760+L UFmA== 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=Ri/h6paH/3Qy6PA6nANoA2FSo6zPjGIKEUPaduyvixU=; b=dxeXioolu2LB4yryFXgKwuxYknf11FbCZnyx8gRqXRCJf1WNfCRQ2bSLa5BpMNt53D tMMH1OXZVSisvgvqdUnt7fI1QkSqWRnRlNa9YY+TMml/a3up7NybuKc/Gn3b/+sWevGU TT9x0LET8Ui9Nq8pFPceVi2LqgZp9nlVXVCSftKTVtlYs+dvxUyEvqN5/BdGu/o/5ruB /D3xz6hBoTYSwtapPH+iZTSciJh10MkxFZX7UtWnaNrOKngI7SVKgKz4QIK44Dk6evKx KDO9I96iUTG+4lIOLr+NXUMbxW8DcFu+xU8e5NJStGM7SJFTKDjkWHy6fZFsb0qcajeY 6nKA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2RNIPUrB; 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 x5-20020a056402414500b0048102b658e6si9227585eda.216.2023.01.09.05.19.08; Mon, 09 Jan 2023 05:19:34 -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=2RNIPUrB; 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 S237107AbjAINSP (ORCPT + 99 others); Mon, 9 Jan 2023 08:18:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237149AbjAINSG (ORCPT ); Mon, 9 Jan 2023 08:18:06 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C0417E01 for ; Mon, 9 Jan 2023 05:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sqo1W0aWkY8xbKhztQgw/DiD98z57JgLfkXFQv5Rk0OKKD5HLYIIN5Krsh/PviReRUIPqMIziDN8ZZdhjYFK3jcPxaYgFAeILBXgsKCjyAeuRgmNzsliD/80aHDuQQ44gSmGGmYmIh2Xj5pw/kkUpOcR5ZWzO5Aole+KLOrzvMdMh38m9JJTEwuim8IfmUEQGOfAaD3F27Ri1+nuhXRM0wnrY+wyEulciQygbOAj4LB/diGNbvJ+/u/nILxK4orgDsJfZvrIxcNWq0i6iGQFBp4p2QOM6t5YhcYHr6OreGxJK3JqlZAt31g0spBiMQxq5R8GvyEXEvbmp6x4+N3EFw== 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=Ri/h6paH/3Qy6PA6nANoA2FSo6zPjGIKEUPaduyvixU=; b=MNL8J/coN5ckZ9yEb+BsW2pyJ0O4m+U1fDGeUrozgLbCXzuOxxtZXOsvJdzWfGnT7NgbK36w3GLXYmsFqafCrRYNj3+37w8kgc5MO3t9Y2EE+FEqHNaQdNSusfTTK0rKyy/S3D9S4iPAywBtmAqQiy4hZwAfPEae31125IKRN5Wk8yPEkMJiX7gKgxkxRK1geLOAASvocsPDvGJehc3X2CoUA27qTD/COqs0uhN8ZmhIkhvUxZpGol916thZQZPItTx1gVJZkYeGkcJ2Foj3dAhsSWZKIBU6GsjvNKxk9Qcg0qHNv7+OFo0u0B9t7JnB/GOXXWtrxcGhM0rneIMwjw== 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=Ri/h6paH/3Qy6PA6nANoA2FSo6zPjGIKEUPaduyvixU=; b=2RNIPUrBJFgS0CK407tMgvwX6DF4DWl4GVAxcUznc8XA/1BRoUlSTNOxTsXvmUvmYnecQybjSbw+aRrqHqAwXIdnnjsOETVWeUjo7/CfKEjFpEYhAx7Atn1y656GOIBPvOiCTDjGE/r2tA7rfN+2V76tLATEtQPXA7H6GY5RK7s= Received: from DM6PR07CA0075.namprd07.prod.outlook.com (2603:10b6:5:337::8) by BL1PR12MB5142.namprd12.prod.outlook.com (2603:10b6:208:312::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:17:52 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:337:cafe::43) by DM6PR07CA0075.outlook.office365.com (2603:10b6:5:337::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:52 +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 DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5986.18 via Frontend Transport; Mon, 9 Jan 2023 13:17:52 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 07:17:51 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 05:17:51 -0800 Received: from amd-System-Product-Name.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; Mon, 9 Jan 2023 07:17:42 -0600 From: Venkata Prasad Potturu To: , CC: , , , , , Venkata Prasad Potturu , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Ajit Kumar Pandey , V sujith kumar Reddy , Akihiko Odaki , Jia-Ju Bai , open list Subject: [PATCH v2 5/5] ASoC: amd: acp: Enable i2s tdm support for skyrim platforms Date: Mon, 9 Jan 2023 18:51:04 +0530 Message-ID: <20230109132104.1259479-6-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> References: <20230109132104.1259479-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT004:EE_|BL1PR12MB5142:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e6d7a84-16af-4c25-89e7-08daf243e9b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bhr/8eh519SVX0GYkRCr1XI+fxW8bcxPtxkl0B8pOSDBUi57sp2ek8qumjkOMs9SA78td0DjRJKc3RIGNnjnB1luqZT+148pd5z2cxO7jkvk/otqgDU7qWeUb/YZnJNOEsWoilyB9NHkitktZhYVMgWaUky3ZKDL/UdCXrB8u5xued0upK779EAWHxVIfV0Q8NlopyObFIu93oHdTO/VskDvZGSZiQ7ey7xRqKiEc+bbk0/xjePtrmDjr8AuSU2JjgxRzJZ01dIJxLxWAxGNAwG+KMF7dWmEfBbL6r/7p1avP4Q6q52TceJPnv5m8q2Ze1xgdJwlmA8ITcBAwIRsuu0DsRXGicbZnMNgexXo7pxA2+WGT9o0a76E2XqlyAqX3LqqQmCNYmhEO9wMyTGi/dME/ei0qXMRDV04xwTxcZ2+7VZmO4JRHsNPcgR7Ow9Y2PQdEfLhlepkBgi7khn9ofKNKW439PEG/XZtfBO9zngzFDrHVJOj5b4P1pEEHsoZ+bXpdo2ZDCuAFqB86/pTRQG6rl0ROt1ydUu0L1Pq6mcdgeo6WAuvI29oHBOUOy2qt5EXlsUM7j0R7JYuuzvG36q4JaFFtIESMktUm+peghjoagcpqWvz288sqv08EBQyQvWvG2qwmfTaNoWgxpttwsLVgpg0i7OATeMhgYQwd68Kj+/B/Z/zdQYvAkq2DUvoUl29XUJzY7sy4NnbnhTJR5i65vQX2gkWTipVZy9+9kM= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(346002)(39860400002)(396003)(376002)(136003)(451199015)(40470700004)(46966006)(36840700001)(82310400005)(8936002)(40460700003)(2906002)(5660300002)(426003)(47076005)(41300700001)(81166007)(7696005)(4326008)(70586007)(8676002)(70206006)(316002)(356005)(110136005)(54906003)(186003)(26005)(82740400003)(40480700001)(2616005)(1076003)(336012)(36860700001)(86362001)(36756003)(478600001)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:17:52.3350 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e6d7a84-16af-4c25-89e7-08daf243e9b6 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5142 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?1754551156353634386?= X-GMAIL-MSGID: =?utf-8?q?1754551156353634386?= Enable i2s tdm support for skyrim platform using dmi quirks. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-legacy-mach.c | 8 ++++++++ sound/soc/amd/acp/acp-mach-common.c | 14 ++++++++++++++ sound/soc/amd/acp/acp-mach.h | 1 + sound/soc/amd/acp/acp-sof-mach.c | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c index d508792dba4f..676ad50638d0 100644 --- a/sound/soc/amd/acp/acp-legacy-mach.c +++ b/sound/soc/amd/acp/acp-legacy-mach.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "acp-mach.h" @@ -95,6 +96,8 @@ static int acp_asoc_probe(struct platform_device *pdev) { struct snd_soc_card *card = NULL; struct device *dev = &pdev->dev; + const struct dmi_system_id *dmi_id; + struct acp_card_drvdata *acp_card_drvdata; int ret; if (!pdev->id_entry) @@ -113,6 +116,11 @@ static int acp_asoc_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; + acp_card_drvdata = card->drvdata; + dmi_id = dmi_first_match(acp_quirk_table); + if (dmi_id && dmi_id->driver_data) + acp_card_drvdata->tdm_mode = dmi_id->driver_data; + acp_legacy_dai_links_create(card); ret = devm_snd_soc_register_card(&pdev->dev, card); diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index ffab6328baf0..b83ae946b3e4 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -32,6 +32,20 @@ #define DUAL_CHANNEL 2 #define FOUR_CHANNEL 4 +#define TDM_MODE_ENABLE 1 + +const struct dmi_system_id acp_quirk_table[] = { + { + /* Google skyrim proto-0 */ + .matches = { + DMI_EXACT_MATCH(DMI_PRODUCT_FAMILY, "Google_Skyrim"), + }, + .driver_data = (void *)TDM_MODE_ENABLE, + }, + {} +}; +EXPORT_SYMBOL_GPL(acp_quirk_table); + static struct snd_soc_jack pco_jack; static const unsigned int channels[] = { diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h index 9f87439b3cfd..165f407697c0 100644 --- a/sound/soc/amd/acp/acp-mach.h +++ b/sound/soc/amd/acp/acp-mach.h @@ -65,5 +65,6 @@ struct acp_card_drvdata { int acp_sofdsp_dai_links_create(struct snd_soc_card *card); int acp_legacy_dai_links_create(struct snd_soc_card *card); +extern const struct dmi_system_id acp_quirk_table[]; #endif diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index f3ba22a25962..99a7d3879340 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "acp-mach.h" @@ -102,6 +103,8 @@ static int acp_sof_probe(struct platform_device *pdev) { struct snd_soc_card *card = NULL; struct device *dev = &pdev->dev; + const struct dmi_system_id *dmi_id; + struct acp_card_drvdata *acp_card_drvdata; int ret; if (!pdev->id_entry) @@ -120,6 +123,11 @@ static int acp_sof_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; + acp_card_drvdata = card->drvdata; + dmi_id = dmi_first_match(acp_quirk_table); + if (dmi_id && dmi_id->driver_data) + acp_card_drvdata->tdm_mode = dmi_id->driver_data; + acp_sofdsp_dai_links_create(card); ret = devm_snd_soc_register_card(&pdev->dev, card);