From patchwork Fri Dec 15 14:39:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494538 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 857C6C35274 for ; Fri, 15 Dec 2023 14:42:35 +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 6B051E92; Fri, 15 Dec 2023 15:42:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6B051E92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651353; bh=4sMjpEWPnxTpFeZtEZi9FJ/TO2equr8HTkptmC/bILs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZdQVAEMF7zjrh/J0FOcQCXoaJgHeXrPWtsyXi0EiukUCCkAMijPY/yhm9ld+/F0yu O9fV6TuPWkjSyXjvqGnVb6f6b8c8MDMWlfdgJ1oktoRSvluOBbLJpSDyhwbeRpLuPF XL4L3kwy8lfo4tm0D8eHPMKPV5DVBIZnXPNZTVXw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9EDFFF805C3; Fri, 15 Dec 2023 15:41:50 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A7B74F805C8; Fri, 15 Dec 2023 15:41:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A74CCF8016A; Fri, 15 Dec 2023 15:41:34 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EB598F80114 for ; Fri, 15 Dec 2023 15:41:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EB598F80114 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=lfGSds8N Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 95DFF9C34B5; Fri, 15 Dec 2023 09:41:29 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 3UoH7cEvh9C5; Fri, 15 Dec 2023 09:41:29 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 3F66D9C40CA; Fri, 15 Dec 2023 09:41:29 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 3F66D9C40CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651289; bh=u9QYi3UK49RvCOM0jwOPRvXLix0O7m+OZA9DnyWKw9g=; h=From:To:Date:Message-Id:MIME-Version; b=lfGSds8NceELmpDGkIfOdxSVLeAzC359f9r5vPwrH1HB+0KrKb3XZtYSCK/o/s9TU DGwWn6e25pLc4AtUFWIxYCdR54jC9Cnym3uxKsKcbT2Yxsg55tJTiDmHrxGmLU2Xz+ 1YkAHZeDUGUh9wDcPIpv6uS3UE4lk0guYsfbA/HKMuO04Vt7EP4zgpOv5bgZMzl3Cc v9GY8Ys9LIVMgCaEpflIg+OMt/q5zhSLG09w0X4+zeX0y4lBOHAZxlm7tICkUVfSwH 2TibZ1R1dUcq3no2XSrhFIPBqb9TIbG88BwPRuzpjctZsKWtJgsEb/YQ2MQ7186SFJ 1ta36btbnzVzg== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id TPQJnDtSDriJ; Fri, 15 Dec 2023 09:41:29 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 560AC9C34B5; Fri, 15 Dec 2023 09:41:28 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 01/10] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Date: Fri, 15 Dec 2023 15:39:56 +0100 Message-Id: <20231215144005.934728-2-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: WO26NILSRKR2M2BDRJ4HEENYUGP6THDZ X-Message-ID-Hash: WO26NILSRKR2M2BDRJ4HEENYUGP6THDZ X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add support for dai links using multiple codecs for multi-codec use cases. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 7518ab9d768e..cde31fd38262 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -809,10 +809,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) /* Normal DAI Link */ priv->dai_link[0].cpus->of_node = cpu_np; - priv->dai_link[0].codecs->dai_name = codec_dai_name; + priv->dai_link[0].codecs[0].dai_name = codec_dai_name; if (!fsl_asoc_card_is_ac97(priv)) - priv->dai_link[0].codecs->of_node = codec_np; + priv->dai_link[0].codecs[0].of_node = codec_np; else { u32 idx; @@ -823,11 +823,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto asrc_fail; } - priv->dai_link[0].codecs->name = + priv->dai_link[0].codecs[0].name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "ac97-codec.%u", (unsigned int)idx); - if (!priv->dai_link[0].codecs->name) { + if (!priv->dai_link[0].codecs[0].name) { ret = -ENOMEM; goto asrc_fail; } @@ -838,13 +838,19 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->card.num_links = 1; if (asrc_pdev) { + int i; + struct snd_soc_dai_link_component *codec; + struct snd_soc_dai_link *link; + /* DPCM DAI Links only if ASRC exists */ priv->dai_link[1].cpus->of_node = asrc_np; priv->dai_link[1].platforms->of_node = asrc_np; - priv->dai_link[2].codecs->dai_name = codec_dai_name; - priv->dai_link[2].codecs->of_node = codec_np; - priv->dai_link[2].codecs->name = - priv->dai_link[0].codecs->name; + link = &(priv->dai_link[2]); + for_each_link_codecs(link, i, codec) { + codec->dai_name = priv->dai_link[0].codecs[i].dai_name; + codec->of_node = priv->dai_link[0].codecs[i].of_node; + codec->name = priv->dai_link[0].codecs[i].name; + } priv->dai_link[2].cpus->of_node = cpu_np; priv->dai_link[2].dai_fmt = priv->dai_fmt; priv->card.num_links = 3; From patchwork Fri Dec 15 14:39:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494539 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 31B82C35274 for ; Fri, 15 Dec 2023 14:42:57 +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 5C5D5E93; Fri, 15 Dec 2023 15:42:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5C5D5E93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651375; bh=UQRz6OZGcdlHiQ8T99odM6bhADT0UY0zrbTaih755+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HNF8iAo6cPc++cmwV//MVSAssNQTvgxag7X86hvfRdrpUxnlA17g2gwIsiqNm0IdY +QbmcI9EjxsXAJf4lQ8n5rtBE2bA1H0EIH9QEEUsxFIa+HYEVIdVYVj+962oh9ZkNY BGzOxcpkW5FWmrLDqMTIhyPqS8rrHHZzgpRtXALQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 16E7CF805F9; Fri, 15 Dec 2023 15:41:51 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3A31CF805AA; Fri, 15 Dec 2023 15:41:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 17EA1F8016A; Fri, 15 Dec 2023 15:41:43 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 491F2F80114 for ; Fri, 15 Dec 2023 15:41:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 491F2F80114 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=k3L6QNaa Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 28B589C284E; Fri, 15 Dec 2023 09:41:39 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id ev39ZESqhuOc; Fri, 15 Dec 2023 09:41:38 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id BD7249C34B5; Fri, 15 Dec 2023 09:41:38 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com BD7249C34B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651298; bh=Zuye7VoRd0C6JZdYDMaGdcEQy180udrCmVx/gGdxW00=; h=From:To:Date:Message-Id:MIME-Version; b=k3L6QNaajI8OSqp9YH96NfghqMoz8labEJ+GhmJP5yN/SaFOcMvFsZBy/WSkC97l3 MQIbxRx0Nh44K2PgXxzenbsPES3NvTWWJFJKtPfiBUtYRrZetqCBSIuBLph76YPo7t HbtzIuddqVvoAxtTYVYnAOSi4SwUUBC7SvHkX2qSSxxsHDzjbMOWouDwGAFlNQ288R h78OlAtsu3/Z6aB9ylhZ3nBkN0XuMw139qYeZDS+nezIrx6ubM3Oq2/yLBtDBYaJXg F9yyNzl+TCYwlAXk7Kaprq0+yuRsm23D8sKvB7F1bF+oI87nD0btMTpDvwd/lQ0XQE mY5RclRF0U2xw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id V2FJZDSFPrIi; Fri, 15 Dec 2023 09:41:38 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id D15D99C284E; Fri, 15 Dec 2023 09:41:37 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 02/10] ASoC: fsl-asoc-card: add second dai link component for codecs Date: Fri, 15 Dec 2023 15:39:57 +0100 Message-Id: <20231215144005.934728-3-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: X2DTQETMQKL4VHBP5W3X6WKAQ23GIBBU X-Message-ID-Hash: X2DTQETMQKL4VHBP5W3X6WKAQ23GIBBU X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add a second dai link component for codecs that will be used for the generic codec use case. It will use spdif_receiver and spdif_transmitter drivers as dummy codec drivers, needing 2 codecs slots for the links. To prevent deferring in use cases using only one codec, also set by default the number of codecs to 1 for the relevant dai links. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index cde31fd38262..a62f26fe9802 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -295,7 +295,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, SND_SOC_DAILINK_DEFS(hifi, DAILINK_COMP_ARRAY(COMP_EMPTY()), - DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_EMPTY(), COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(hifi_fe, @@ -305,7 +305,7 @@ SND_SOC_DAILINK_DEFS(hifi_fe, SND_SOC_DAILINK_DEFS(hifi_be, DAILINK_COMP_ARRAY(COMP_EMPTY()), - DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_EMPTY(), COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_DUMMY())); static const struct snd_soc_dai_link fsl_asoc_card_dai[] = { @@ -618,6 +618,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) memcpy(priv->dai_link, fsl_asoc_card_dai, sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link)); + priv->dai_link[0].num_codecs = 1; + priv->dai_link[2].num_codecs = 1; priv->card.dapm_routes = audio_map; priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); From patchwork Fri Dec 15 14:39:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494550 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 F2CB7C35274 for ; Fri, 15 Dec 2023 14:43:14 +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 CAC30E8C; Fri, 15 Dec 2023 15:43:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CAC30E8C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651392; bh=GWWuE548LAYXB4wcTCB7TiVUkJN/xLPViXcqV1s1VgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=U3Y8jYE/YbVdH5GCx30r5ZZnkp7WJais9y6epvlv9jMrDJGG5EgKZlbMb0JEVz3O0 IQMSPuK2Dt2AjgVnLEg9seEGBNvYsd4FXuvjSzEa+kSy4E4FMFfFh3sQ0KXC7XS5yV w2T3cMh8u2g5S0mE3VwjkDoqips4pc9a4YGx4aRo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C5DF1F8060A; Fri, 15 Dec 2023 15:42:03 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 75538F8060D; Fri, 15 Dec 2023 15:42:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7BB91F805F0; Fri, 15 Dec 2023 15:41:58 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 77DB7F805AF for ; Fri, 15 Dec 2023 15:41:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 77DB7F805AF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=J8JstCrc Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5C07E9C284E; Fri, 15 Dec 2023 09:41:46 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id btENrUOmHMkY; Fri, 15 Dec 2023 09:41:45 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 47FA29C40CB; Fri, 15 Dec 2023 09:41:45 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 47FA29C40CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651305; bh=HeMH17/3e3dpPsBU0lBJ2AfWK04qqF/RmKUslC/3Z08=; h=From:To:Date:Message-Id:MIME-Version; b=J8JstCrcMcSTKhKC0VnMkOcu6dG+hMPD46RIx4zRF6qmDvdD+DTXWeAGo6y0ZEhCk ofkzG5YaAWMBVSuGWk6lC160FypD9ccZUoeGubHkrDQ6JKWM5PoYVSxSViX4pbmFGF 3FfRbRUf8LuCiwGYweTDiygHsQ5npHLDb1S9QTFH9n+r88AOgKquj/yLYwmhEj47JO TnSl6+mrdln+MLyDnfIwUteA5gKEVsrrPOJ3jxccKo/meMxDKiZHTqvZExUpdH85hx KDHmPMjfGj6HLJGLjJOMzRHNXTOse9zREE2Os/WX80xE5HEP6oG6mt2MeMv6BAES4K Jbpd+bBJEE8AQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id RJVjOulGs7Mx; Fri, 15 Dec 2023 09:41:45 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 3EA889C284E; Fri, 15 Dec 2023 09:41:44 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 03/10] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links Date: Fri, 15 Dec 2023 15:39:58 +0100 Message-Id: <20231215144005.934728-4-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: ZI4YSTQ7MMHVBFOCSYUHCMDSSPYKPDUY X-Message-ID-Hash: ZI4YSTQ7MMHVBFOCSYUHCMDSSPYKPDUY X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Adapt the driver to work with configurations using two codecs or more. Modify fsl_asoc_card_probe() to handle use cases where 2 codecs are given in the device tree. This will be needed for the generic codec case. Use cases using one codec will ignore any given codecs other than the first. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 233 ++++++++++++++++++++-------------- 1 file changed, 136 insertions(+), 97 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index a62f26fe9802..5dd5493cb931 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -98,7 +98,7 @@ struct fsl_asoc_card_priv { struct simple_util_jack hp_jack; struct simple_util_jack mic_jack; struct platform_device *pdev; - struct codec_priv codec_priv; + struct codec_priv codec_priv[2]; struct cpu_priv cpu_priv; struct snd_soc_card card; u8 streams; @@ -171,11 +171,13 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; - struct codec_priv *codec_priv = &priv->codec_priv; + struct codec_priv *codec_priv; + struct snd_soc_dai *codec_dai; struct cpu_priv *cpu_priv = &priv->cpu_priv; struct device *dev = rtd->card->dev; unsigned int pll_out; int ret; + int i; priv->sample_rate = params_rate(params); priv->sample_format = params_format(params); @@ -207,28 +209,32 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, } /* Specific configuration for PLL */ - if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { - if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE) - pll_out = priv->sample_rate * 384; - else - pll_out = priv->sample_rate * 256; + for_each_rtd_codec_dais(rtd, i, codec_dai) { + codec_priv = &priv->codec_priv[i]; - ret = snd_soc_dai_set_pll(snd_soc_rtd_to_codec(rtd, 0), - codec_priv->pll_id, - codec_priv->mclk_id, - codec_priv->mclk_freq, pll_out); - if (ret) { - dev_err(dev, "failed to start FLL: %d\n", ret); - goto fail; - } + if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { + if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE) + pll_out = priv->sample_rate * 384; + else + pll_out = priv->sample_rate * 256; - ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), - codec_priv->fll_id, - pll_out, SND_SOC_CLOCK_IN); + ret = snd_soc_dai_set_pll(codec_dai, + codec_priv->pll_id, + codec_priv->mclk_id, + codec_priv->mclk_freq, pll_out); + if (ret) { + dev_err(dev, "failed to start FLL: %d\n", ret); + goto fail; + } - if (ret && ret != -ENOTSUPP) { - dev_err(dev, "failed to set SYSCLK: %d\n", ret); - goto fail; + ret = snd_soc_dai_set_sysclk(codec_dai, + codec_priv->fll_id, + pll_out, SND_SOC_CLOCK_IN); + + if (ret && ret != -ENOTSUPP) { + dev_err(dev, "failed to set SYSCLK: %d\n", ret); + goto fail; + } } } @@ -243,28 +249,34 @@ static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); - struct codec_priv *codec_priv = &priv->codec_priv; + struct codec_priv *codec_priv; + struct snd_soc_dai *codec_dai; struct device *dev = rtd->card->dev; int ret; + int i; priv->streams &= ~BIT(substream->stream); - if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { - /* Force freq to be free_freq to avoid error message in codec */ - ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), - codec_priv->mclk_id, - codec_priv->free_freq, - SND_SOC_CLOCK_IN); - if (ret) { - dev_err(dev, "failed to switch away from FLL: %d\n", ret); - return ret; - } + for_each_rtd_codec_dais(rtd, i, codec_dai) { + codec_priv = &priv->codec_priv[i]; - ret = snd_soc_dai_set_pll(snd_soc_rtd_to_codec(rtd, 0), - codec_priv->pll_id, 0, 0, 0); - if (ret && ret != -ENOTSUPP) { - dev_err(dev, "failed to stop FLL: %d\n", ret); - return ret; + if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { + /* Force freq to be free_freq to avoid error message in codec */ + ret = snd_soc_dai_set_sysclk(codec_dai, + codec_priv->mclk_id, + codec_priv->free_freq, + SND_SOC_CLOCK_IN); + if (ret) { + dev_err(dev, "failed to switch away from FLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_pll(codec_dai, + codec_priv->pll_id, 0, 0, 0); + if (ret && ret != -ENOTSUPP) { + dev_err(dev, "failed to stop FLL: %d\n", ret); + return ret; + } } } @@ -504,10 +516,11 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card) struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card); struct snd_soc_pcm_runtime *rtd = list_first_entry( &card->rtd_list, struct snd_soc_pcm_runtime, list); - struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); - struct codec_priv *codec_priv = &priv->codec_priv; + struct snd_soc_dai *codec_dai; + struct codec_priv *codec_priv; struct device *dev = card->dev; int ret; + int i; if (fsl_asoc_card_is_ac97(priv)) { #if IS_ENABLED(CONFIG_SND_AC97_CODEC) @@ -526,31 +539,36 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card) return 0; } - ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, - codec_priv->mclk_freq, SND_SOC_CLOCK_IN); - if (ret && ret != -ENOTSUPP) { - dev_err(dev, "failed to set sysclk in %s\n", __func__); - return ret; - } + for_each_rtd_codec_dais(rtd, i, codec_dai) { + codec_priv = &priv->codec_priv[i]; - if (!IS_ERR_OR_NULL(codec_priv->mclk)) - clk_prepare_enable(codec_priv->mclk); + ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, + codec_priv->mclk_freq, SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) { + dev_err(dev, "failed to set sysclk in %s\n", __func__); + return ret; + } + + if (!IS_ERR_OR_NULL(codec_priv->mclk)) + clk_prepare_enable(codec_priv->mclk); + } return 0; } static int fsl_asoc_card_probe(struct platform_device *pdev) { - struct device_node *cpu_np, *codec_np, *asrc_np; + struct device_node *cpu_np, *asrc_np; + struct device_node *codec_np[2]; struct device_node *np = pdev->dev.of_node; struct platform_device *asrc_pdev = NULL; struct device_node *bitclkprovider = NULL; struct device_node *frameprovider = NULL; struct platform_device *cpu_pdev; struct fsl_asoc_card_priv *priv; - struct device *codec_dev = NULL; + struct device *codec_dev[2] = { NULL, NULL }; const char *codec_dai_name; - const char *codec_dev_name; + const char *codec_dev_name[2]; u32 asrc_fmt = 0; u32 width; int ret; @@ -576,21 +594,25 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto fail; } - codec_np = of_parse_phandle(np, "audio-codec", 0); - if (codec_np) { - struct platform_device *codec_pdev; - struct i2c_client *codec_i2c; + codec_np[0] = of_parse_phandle(np, "audio-codec", 0); + codec_np[1] = of_parse_phandle(np, "audio-codec", 1); - codec_i2c = of_find_i2c_device_by_node(codec_np); - if (codec_i2c) { - codec_dev = &codec_i2c->dev; - codec_dev_name = codec_i2c->name; - } - if (!codec_dev) { - codec_pdev = of_find_device_by_node(codec_np); - if (codec_pdev) { - codec_dev = &codec_pdev->dev; - codec_dev_name = codec_pdev->name; + for (int i = 0; i < 2; i++) { + if (codec_np[i]) { + struct platform_device *codec_pdev; + struct i2c_client *codec_i2c; + + codec_i2c = of_find_i2c_device_by_node(codec_np[i]); + if (codec_i2c) { + codec_dev[i] = &codec_i2c->dev; + codec_dev_name[i] = codec_i2c->name; + } + if (!codec_dev[i]) { + codec_pdev = of_find_device_by_node(codec_np[i]); + if (codec_pdev) { + codec_dev[i] = &codec_pdev->dev; + codec_dev_name[i] = codec_pdev->name; + } } } } @@ -600,12 +622,14 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) asrc_pdev = of_find_device_by_node(asrc_np); /* Get the MCLK rate only, and leave it controlled by CODEC drivers */ - if (codec_dev) { - struct clk *codec_clk = clk_get(codec_dev, NULL); + for (int i = 0; i < 2; i++) { + if (codec_dev[i]) { + struct clk *codec_clk = clk_get(codec_dev[i], NULL); - if (!IS_ERR(codec_clk)) { - priv->codec_priv.mclk_freq = clk_get_rate(codec_clk); - clk_put(codec_clk); + if (!IS_ERR(codec_clk)) { + priv->codec_priv[i].mclk_freq = clk_get_rate(codec_clk); + clk_put(codec_clk); + } } } @@ -625,25 +649,27 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); priv->card.driver_name = DRIVER_NAME; - priv->codec_priv.fll_id = -1; - priv->codec_priv.pll_id = -1; + for (int i = 0; i < 2; i++) { + priv->codec_priv[i].fll_id = -1; + priv->codec_priv[i].pll_id = -1; + } /* Diversify the card configurations */ if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) { codec_dai_name = "cs42888"; - priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq; - priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq; + priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv[0].mclk_freq; + priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv[0].mclk_freq; priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; priv->cpu_priv.slot_width = 32; priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; } else if (of_device_is_compatible(np, "fsl,imx-audio-cs427x")) { codec_dai_name = "cs4271-hifi"; - priv->codec_priv.mclk_id = CS427x_SYSCLK_MCLK; + priv->codec_priv[0].mclk_id = CS427x_SYSCLK_MCLK; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; } else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) { codec_dai_name = "sgtl5000"; - priv->codec_priv.mclk_id = SGTL5000_SYSCLK; + priv->codec_priv[0].mclk_id = SGTL5000_SYSCLK; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; } else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic32x4")) { codec_dai_name = "tlv320aic32x4-hifi"; @@ -659,14 +685,14 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) { codec_dai_name = "wm8962"; - priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK; - priv->codec_priv.fll_id = WM8962_SYSCLK_FLL; - priv->codec_priv.pll_id = WM8962_FLL; + priv->codec_priv[0].mclk_id = WM8962_SYSCLK_MCLK; + priv->codec_priv[0].fll_id = WM8962_SYSCLK_FLL; + priv->codec_priv[0].pll_id = WM8962_FLL; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) { codec_dai_name = "wm8960-hifi"; - priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO; - priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO; + priv->codec_priv[0].fll_id = WM8960_SYSCLK_AUTO; + priv->codec_priv[0].pll_id = WM8960_SYSCLK_AUTO; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; } else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) { codec_dai_name = "ac97-hifi"; @@ -698,20 +724,20 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8958")) { codec_dai_name = "wm8994-aif1"; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; - priv->codec_priv.mclk_id = WM8994_FLL_SRC_MCLK1; - priv->codec_priv.fll_id = WM8994_SYSCLK_FLL1; - priv->codec_priv.pll_id = WM8994_FLL1; - priv->codec_priv.free_freq = priv->codec_priv.mclk_freq; + priv->codec_priv[0].mclk_id = WM8994_FLL_SRC_MCLK1; + priv->codec_priv[0].fll_id = WM8994_SYSCLK_FLL1; + priv->codec_priv[0].pll_id = WM8994_FLL1; + priv->codec_priv[0].free_freq = priv->codec_priv[0].mclk_freq; priv->card.dapm_routes = NULL; priv->card.num_dapm_routes = 0; } else if (of_device_is_compatible(np, "fsl,imx-audio-nau8822")) { codec_dai_name = "nau8822-hifi"; - priv->codec_priv.mclk_id = NAU8822_CLK_MCLK; - priv->codec_priv.fll_id = NAU8822_CLK_PLL; - priv->codec_priv.pll_id = NAU8822_CLK_PLL; + priv->codec_priv[0].mclk_id = NAU8822_CLK_MCLK; + priv->codec_priv[0].fll_id = NAU8822_CLK_PLL; + priv->codec_priv[0].pll_id = NAU8822_CLK_PLL; priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; - if (codec_dev) - priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL); + if (codec_dev[0]) + priv->codec_priv[0].mclk = devm_clk_get(codec_dev[0], NULL); } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; @@ -722,18 +748,30 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) * Allow setting mclk-id from the device-tree node. Otherwise, the * default value for each card configuration is used. */ - of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id); + for (int i = 0; i < 2; i++) { + of_property_read_u32_index(np, "mclk-id", i, + &priv->codec_priv[i].mclk_id); + } /* Format info from DT is optional. */ snd_soc_daifmt_parse_clock_provider_as_phandle(np, NULL, &bitclkprovider, &frameprovider); if (bitclkprovider || frameprovider) { unsigned int daifmt = snd_soc_daifmt_parse_format(np, NULL); + bool codec_bitclkprovider = false; + bool codec_frameprovider = false; + + for (int i = 0; i < 2; i++) { + if (bitclkprovider && codec_np[i] == bitclkprovider) + codec_bitclkprovider = true; + if (frameprovider && codec_np[i] == frameprovider) + codec_frameprovider = true; + } - if (codec_np == bitclkprovider) - daifmt |= (codec_np == frameprovider) ? + if (codec_bitclkprovider) + daifmt |= (codec_frameprovider) ? SND_SOC_DAIFMT_CBP_CFP : SND_SOC_DAIFMT_CBP_CFC; else - daifmt |= (codec_np == frameprovider) ? + daifmt |= (codec_frameprovider) ? SND_SOC_DAIFMT_CBC_CFP : SND_SOC_DAIFMT_CBC_CFC; /* Override dai_fmt with value from DT */ @@ -749,7 +787,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) of_node_put(bitclkprovider); of_node_put(frameprovider); - if (!fsl_asoc_card_is_ac97(priv) && !codec_dev) { + if (!fsl_asoc_card_is_ac97(priv) && !codec_dev[0]) { dev_dbg(&pdev->dev, "failed to find codec device\n"); ret = -EPROBE_DEFER; goto asrc_fail; @@ -789,7 +827,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) ret = snd_soc_of_parse_card_name(&priv->card, "model"); if (ret) { snprintf(priv->name, sizeof(priv->name), "%s-audio", - fsl_asoc_card_is_ac97(priv) ? "ac97" : codec_dev_name); + fsl_asoc_card_is_ac97(priv) ? "ac97" : codec_dev_name[0]); priv->card.name = priv->name; } priv->card.dai_link = priv->dai_link; @@ -814,7 +852,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_link[0].codecs[0].dai_name = codec_dai_name; if (!fsl_asoc_card_is_ac97(priv)) - priv->dai_link[0].codecs[0].of_node = codec_np; + priv->dai_link[0].codecs[0].of_node = codec_np[0]; else { u32 idx; @@ -922,7 +960,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) asrc_fail: of_node_put(asrc_np); - of_node_put(codec_np); + of_node_put(codec_np[0]); + of_node_put(codec_np[1]); put_device(&cpu_pdev->dev); fail: of_node_put(cpu_np); From patchwork Fri Dec 15 14:39:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494551 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 8108AC35274 for ; Fri, 15 Dec 2023 14:43:30 +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 D0542A4A; Fri, 15 Dec 2023 15:43:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D0542A4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651408; bh=A8MfXhmO0cUZAjyAbKT8qOjXN4eGyDGnvWLqKievLDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DhtHFz1crKllt1hQj8D1eSPp6vPiEg53tohSt4xpip218g4dfiITlwM21WZ79Tj5i m2hY8kNMHLvUtk4Cwc/H19tpD3bs0MZHT3rC5vvig87ILgUWZWo4UQP64MtA1uNPcO kJJ3Gi/Eg/kANul0xxo6++MhPltpwXSXldBTUN60= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CE944F8063A; Fri, 15 Dec 2023 15:42:06 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6B583F8063E; Fri, 15 Dec 2023 15:42:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E6229F80166; Fri, 15 Dec 2023 15:41:59 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8F1FDF805C7 for ; Fri, 15 Dec 2023 15:41:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8F1FDF805C7 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=fvoXpfG8 Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 39D0E9C284E; Fri, 15 Dec 2023 09:41:55 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 4iRhmJzQO8LN; Fri, 15 Dec 2023 09:41:54 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id C79929C40E8; Fri, 15 Dec 2023 09:41:54 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com C79929C40E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651314; bh=UiaPRtB78O/TxKdZ0KogRi45bm5TmsI0TncGDAFUtsc=; h=From:To:Date:Message-Id:MIME-Version; b=fvoXpfG8NMlTtDJ1lAMXRXEuoX/HRUnFqRxRmn9NDqKM4yP47XebKslkVHqOer6eO cWBlPQMTNih/zHH6UlH/8kDquXFBKBMs5xa/yWq41SIJCtvEoIWtWLDjz15YnrZk6B btjPI/1xBQPF7WjOsFqST563H2czdjURVs0iJDSbPfUTjVw5/pMr/5zdL0qMSdfMS5 DCBUWyRHOOwTM6DAGE9uICeYSuUsgF2VsobEUjS34q/t02y5VGvI+ZU8N2Ibi7qnxr ZjNK6nh1JnO7Gi7/pLeMHUSO9qojK0koqNzI6CLDkGB3nlcPK80iF2sB9OrgmvGKvV hHZr4uBbdTBMw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id ZSzFvIElhNmm; Fri, 15 Dec 2023 09:41:54 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id DA0E59C284E; Fri, 15 Dec 2023 09:41:53 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 04/10] ASoC: fsl-asoc-card: add new compatible for a generic codec use case Date: Fri, 15 Dec 2023 15:39:59 +0100 Message-Id: <20231215144005.934728-5-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: 5TVFCRSHOZQ4W45D63C2ZDBJDRSAFHNJ X-Message-ID-Hash: 5TVFCRSHOZQ4W45D63C2ZDBJDRSAFHNJ X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add the new compatible "fsl,imx-audio-generic" for a generic codec use case. It allows using the fsl-asoc-card driver with the spdif_receiver and spdif_transmitter codec drivers used as dummy codecs. It can be used for cases where there is no real codec or codecs which do not require declaring controls. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 5dd5493cb931..71048c1250ec 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -567,6 +567,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) struct platform_device *cpu_pdev; struct fsl_asoc_card_priv *priv; struct device *codec_dev[2] = { NULL, NULL }; + const char *generic_codec_dai_names[2]; const char *codec_dai_name; const char *codec_dev_name[2]; u32 asrc_fmt = 0; @@ -738,6 +739,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; if (codec_dev[0]) priv->codec_priv[0].mclk = devm_clk_get(codec_dev[0], NULL); + } else if (of_device_is_compatible(np, "fsl,imx-audio-generic")) { + generic_codec_dai_names[0] = "dit-hifi"; + generic_codec_dai_names[1] = "dir-hifi"; + priv->dai_link[0].num_codecs = 2; + priv->dai_link[2].num_codecs = 2; } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; @@ -792,6 +798,12 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) ret = -EPROBE_DEFER; goto asrc_fail; } + if (of_device_is_compatible(np, "fsl,imx-audio-generic") + && !codec_dev[1]) { + dev_dbg(&pdev->dev, "failed to find second codec device\n"); + ret = -EPROBE_DEFER; + goto asrc_fail; + } /* Common settings for corresponding Freescale CPU DAI driver */ if (of_node_name_eq(cpu_np, "ssi")) { @@ -849,11 +861,21 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) /* Normal DAI Link */ priv->dai_link[0].cpus->of_node = cpu_np; - priv->dai_link[0].codecs[0].dai_name = codec_dai_name; - if (!fsl_asoc_card_is_ac97(priv)) + if (of_device_is_compatible(np, "fsl,imx-audio-generic")) { + priv->dai_link[0].codecs[0].dai_name = + generic_codec_dai_names[0]; + priv->dai_link[0].codecs[1].dai_name = + generic_codec_dai_names[1]; + } else { + priv->dai_link[0].codecs[0].dai_name = codec_dai_name; + } + + if (!fsl_asoc_card_is_ac97(priv)) { priv->dai_link[0].codecs[0].of_node = codec_np[0]; - else { + if (of_device_is_compatible(np, "fsl,imx-audio-generic")) + priv->dai_link[0].codecs[1].of_node = codec_np[1]; + } else { u32 idx; ret = of_property_read_u32(cpu_np, "cell-index", &idx); @@ -983,6 +1005,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = { { .compatible = "fsl,imx-audio-si476x", }, { .compatible = "fsl,imx-audio-wm8958", }, { .compatible = "fsl,imx-audio-nau8822", }, + { .compatible = "fsl,imx-audio-generic", }, {} }; MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids); From patchwork Fri Dec 15 14:40:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494552 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 F0F93C35274 for ; Fri, 15 Dec 2023 14:43:41 +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 2981CDF6; Fri, 15 Dec 2023 15:43:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2981CDF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651420; bh=MnTxDQ/X0Gu1276RPY1f/BSXX1hXOKOfeOjfCfmzCv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EeMmO/QijUGjcuKbYlk9wmhzygIp+DxR2GQvVQvSg+D8EHk7TyWbWExLWFAStVANe X4gQXaShYJgNf2KCMzOD6CHZcvtEjxGDC5iGYvwJCqjaVQgJS0ladod89W1fEmMlF4 ohfOafpUmylmYrvYcFmbCl8qOh6jWXghd4jnfEQk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46973F80681; Fri, 15 Dec 2023 15:42:14 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D4C03F8067E; Fri, 15 Dec 2023 15:42:13 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E06AFF80564; Fri, 15 Dec 2023 15:42:09 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 48447F8065D for ; Fri, 15 Dec 2023 15:42:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 48447F8065D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=geDILowr Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 25F449C094E; Fri, 15 Dec 2023 09:42:04 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id Fjn4dQGGzuKW; Fri, 15 Dec 2023 09:42:03 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id B89109C411A; Fri, 15 Dec 2023 09:42:03 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com B89109C411A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651323; bh=6kRTwfd4Noi281HJPP4aTcZJSr5Bl9jyeAnw8yA/CC0=; h=From:To:Date:Message-Id:MIME-Version; b=geDILowrKgMXnQK+hOHkf3shzsjjZiZ7wGk2KEacXjLplZZw3Gc9xbIAe83eSsa6v L9JqxjK+ldOnU20DLXRGIIN5eWmr4wDTvEk2Mx1zC9pIvn3nAA5nLAM3MijkOFFyHe aLagTAqX4UZxcvhhxGtcm4H05dtOaSuwJbmnLCT81szRXglFJVLmC+q6bbGPFhUbMh f5n6cc86nW+/ZAqBhqCffuO4KoRidANphTTCzdAICv6HJmTCoSjOPHP2Snf+8mD40V aKjPW1+uLldR7Yd2SBTCL9iZynqOESu3WPI8ex6OnOMnAINCWHTrGwAcfMQUiKFjJB oczSWaV306esw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id rk1H7aOFXHlx; Fri, 15 Dec 2023 09:42:03 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id CD47E9C40F4; Fri, 15 Dec 2023 09:42:02 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 05/10] ASoC: fsl-asoc-card: set generic codec as clock provider Date: Fri, 15 Dec 2023 15:40:00 +0100 Message-Id: <20231215144005.934728-6-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: A2UNNJ7GNC3COTS4SL52CJ4DN2IDMWF4 X-Message-ID-Hash: A2UNNJ7GNC3COTS4SL52CJ4DN2IDMWF4 X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The default dai format defined by DAI_FMT_BASE doesn't set if the codec is consumer or provider of the bit and frame clocks. S/PDIF DIR usually converts audio signal to an asynchronous I2S/PCM stream, and doesn't consume a bit or frame clock. As S/PDIF DIR and DIT are used as codecs for the generic use case, set codecs as provider of both bit and frame clocks by default. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 71048c1250ec..3a57d9bfbb48 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -744,6 +744,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) generic_codec_dai_names[1] = "dir-hifi"; priv->dai_link[0].num_codecs = 2; priv->dai_link[2].num_codecs = 2; + priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; From patchwork Fri Dec 15 14:40:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494553 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 3C43FC35274 for ; Fri, 15 Dec 2023 14:44:07 +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 4463AE84; Fri, 15 Dec 2023 15:43:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4463AE84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651445; bh=HXCS5StPz/ifq66mFe/Jj3Q65TF3SlpI4W5seWeLOEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=NPJpXW4RCjd6KgavtoGCWjUs1mvfSwm8cqFHZqK7+eNZaGxpaeFg6MIfkVZ+g1Xi2 EINrrAx90YMzAOhOA474o0ge49pJ2QWpcpQUrhEjiT6g4WY34HTcW9JFsnvLk8z7jV AnYYUwQg3KpVfAt3hdCsDtjsS5rusoR5ynQnaoCk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2A880F8069D; Fri, 15 Dec 2023 15:42:16 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A8CE8F8069D; Fri, 15 Dec 2023 15:42:15 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4224AF80494; Fri, 15 Dec 2023 15:42:11 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 95410F8019B for ; Fri, 15 Dec 2023 15:42:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95410F8019B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=B/1d+ZDK Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id A7C139C094E; Fri, 15 Dec 2023 09:42:07 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id UrFSvh_CqOh1; Fri, 15 Dec 2023 09:42:07 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 640DD9C411A; Fri, 15 Dec 2023 09:42:07 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 640DD9C411A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651327; bh=1tWHBsC3u+nkZ6XpND0qMR0c3tv5xGsM8B4rjwBEpB0=; h=From:To:Date:Message-Id:MIME-Version; b=B/1d+ZDKai6iRqQ00hd2bzYtVIRc3vT77vfogHBM5/4H1PRRK8NZmCMB8soCAky1G ZjKWe8e8CLoCjO5uqihJ8Af5krlYjNKx8F3/7kjxS0oTofOrR434MdFtwBNnvsf1Xc lB0f0U8KZW7/I38Ax4GfKvtqRlIO/1SFYGFrbnEdxWPUKwrrs4gJb36SRV0U1Al5Na 8eyRCxbTfVhSZ7w4hq50rrDIDBHdzwW9QMJbUTst2g+pcmedi6W8z/MmhyzE9hq5Sa nQKFWFVUA3uzi4GAQrW42UOe26OjiT9sXEYHLfTy8ea/6op/GR0xI2vMY2DbAn4ZJL SgBbMCpuSU+HQ== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id kA6fq4dqu6iZ; Fri, 15 Dec 2023 09:42:07 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 7B56C9C094E; Fri, 15 Dec 2023 09:42:06 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 06/10] ASoC: fsl-asoc-card: add dts property "cpu-slot-width" Date: Fri, 15 Dec 2023 15:40:01 +0100 Message-Id: <20231215144005.934728-7-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: L5IBK2HELNITWRD6YDYV3F4G3G47E3YP X-Message-ID-Hash: L5IBK2HELNITWRD6YDYV3F4G3G47E3YP X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add new optional dts property "cpu-slot-width", which allows setting a custom TDM slot width in bits for the CPU DAI when using the generic codec. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 3a57d9bfbb48..012c8d3666aa 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -745,6 +745,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_link[0].num_codecs = 2; priv->dai_link[2].num_codecs = 2; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; + of_property_read_u32(np, "cpu-slot-width", &priv->cpu_priv.slot_width); } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; From patchwork Fri Dec 15 14:40:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494554 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 A26B7C35274 for ; Fri, 15 Dec 2023 14:44:19 +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 08F52E72; Fri, 15 Dec 2023 15:44:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 08F52E72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651458; bh=eIcgxwsPlmas7K2hDexMjPqCN1x9JjKMYN5z+zsn2Io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=I8t7JrVSioAIEpE7VEgPSPJweP0i5FERedLFNYknnrHhBgeHJk/U4AeOtN81td8eR T0VOphSExjh5CM4APHcORyU9gxjqkJ1fMzNDn85mMr4VVvawbA1Usky9By95f33BMN PfOwGUDSb6s6ge6DXOrH18tVaQ6Nn79Tn/9p+pCA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43DB9F8059F; Fri, 15 Dec 2023 15:42:22 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6A9D1F806BA; Fri, 15 Dec 2023 15:42:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 76600F8069E; Fri, 15 Dec 2023 15:42:17 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1F32BF8068C for ; Fri, 15 Dec 2023 15:42:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1F32BF8068C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=QO6eOh5T Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id C67EA9C284E; Fri, 15 Dec 2023 09:42:13 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id YKJ7g_qhioni; Fri, 15 Dec 2023 09:42:13 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 7A4869C40FC; Fri, 15 Dec 2023 09:42:13 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 7A4869C40FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651333; bh=qDza+013LR5YLHqPM6YnPsoEtdDkLVQiJ4ZqxAAikIw=; h=From:To:Date:Message-Id:MIME-Version; b=QO6eOh5TOa2hfv3fG0OrdDdpUIjozxKOJ4BlvSnt1MWV9QVa4HT9/zhAVh8/u6jie x0Xqwv1sZ4UuuPXWm7Yjze1U02soExP3JonWmqtvxA3lKMROqcBrnnijQY2RLHh6ON l4Lv8qk1HeuXLfUOYiIS1MhbtHNCSI//0spGBTZ6yqXeSkDROiVFIoGnZIiAUrZInw BML28WLIPIdphCRubUwVZRHrzTfOTYRvAblsthz+b8pCTwwTEI6RfauERViVcHt8Ag CePq2I3HaIgRvKRJZ8PY0/ZedPbPxC+6jq4//qf7+qAzHnMAu1xf6scx6kpFp3wtJO KyVSskOiJ/mTA== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id Qruv-a14I1tU; Fri, 15 Dec 2023 09:42:13 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 90B909C094E; Fri, 15 Dec 2023 09:42:12 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 07/10] ASoC: fsl-asoc-card: add dts property "cpu-slot-num" Date: Fri, 15 Dec 2023 15:40:02 +0100 Message-Id: <20231215144005.934728-8-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: DO5UZRWS57HEDGFLIQ272K4HC37D3UA7 X-Message-ID-Hash: DO5UZRWS57HEDGFLIQ272K4HC37D3UA7 X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add new optional dts property "cpu-slot-num", which allows setting a custom number of TDM slots for the CPU DAI when using the generic codec. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 012c8d3666aa..6f6cc8bd3acd 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -746,6 +746,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_link[2].num_codecs = 2; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; of_property_read_u32(np, "cpu-slot-width", &priv->cpu_priv.slot_width); + of_property_read_u32(np, "cpu-slot-num", &priv->cpu_priv.slot_num); } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; From patchwork Fri Dec 15 14:40:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494555 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 57BC4C35274 for ; Fri, 15 Dec 2023 14:44:37 +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 701BDE93; Fri, 15 Dec 2023 15:44:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 701BDE93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651475; bh=dc1LCqLuSPTEP4ibWpGKxG3/cyTLReiW3GApgwj4T4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Hwkqa3Yjlh5sdErbY1NL5GLuvxw5lf5Srlk5696EXuCCHqfvPJYKMz3j2kYLyHyem iA9ze/NrwOiHSGts5OEgUUuxccl6gpfvwWohugT1SYu8PPjuokVtxyMbRqtbj07Iz5 hAanzcU1o2Mo2g5udnSwxUQhMS7Rs3tqgC39nTGs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0BFE7F806CF; Fri, 15 Dec 2023 15:42:27 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 7A7F3F805AD; Fri, 15 Dec 2023 15:42:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 603FDF80580; Fri, 15 Dec 2023 15:42:23 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D1E7EF8057B for ; Fri, 15 Dec 2023 15:42:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1E7EF8057B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=ZAOE6ucD Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 97CFC9C094E; Fri, 15 Dec 2023 09:42:18 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id GKKHkKdrWI2Q; Fri, 15 Dec 2023 09:42:18 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 5141F9C284E; Fri, 15 Dec 2023 09:42:18 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 5141F9C284E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651338; bh=3qPcaZHdj1kfz+pc5ad/l6BFAvniuOuBLv61aSrT+ic=; h=From:To:Date:Message-Id:MIME-Version; b=ZAOE6ucDySLnjfVdyzQW42ai8ut9EqqZq6tKZE1u9/yBICjv+9sna/7wOHBK7YZN9 lddyH4ZBwzAecWwMy5Kw94n4/0WXEnlwkT9M0fqeLvNk0niYPdiOBVXiNrMOKmZScV QUfjFVbDmjKbXg4SMksgg/ohIMqyqbYuiPo6RJ0h8r2QtJKDil1Iw+gt1CMbDid4yV 4hVn1SC0bUHeeE7Za9kAiXEQ12E1ZYjZIbshaXM8PDnvz1zZ4w582IrlsmFIsZF4Sc OjB34ciKfIaFUYEa0frs6PYGvLbN4obO8Sz9jioIauoiEsYSkK6+COglTyJWhfqu5X vzXw/SyD1/L0g== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id KG1tCgaOww9l; Fri, 15 Dec 2023 09:42:18 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 67A159C094E; Fri, 15 Dec 2023 09:42:17 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 08/10] ASoC: fsl-asoc-card: add dts properties "cpu-sysclk-freq" Date: Fri, 15 Dec 2023 15:40:03 +0100 Message-Id: <20231215144005.934728-9-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: DITJ3CE7BHGR7PU7WFQDGZJUAF6R3UH5 X-Message-ID-Hash: DITJ3CE7BHGR7PU7WFQDGZJUAF6R3UH5 X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add new optional dts property "cpu-sysclk-freq" to set custom sysclk frequencies for the CPU DAI with the generic codec. The way values are used is up to the CPU DAI driver implementation. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 6f6cc8bd3acd..7b0d7df7ae27 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -747,6 +747,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; of_property_read_u32(np, "cpu-slot-width", &priv->cpu_priv.slot_width); of_property_read_u32(np, "cpu-slot-num", &priv->cpu_priv.slot_num); + of_property_read_u32(np, "cpu-sysclk-freq-rx", + (u32 *)&priv->cpu_priv.sysclk_freq[RX]); + of_property_read_u32(np, "cpu-sysclk-freq-tx", + (u32 *)&priv->cpu_priv.sysclk_freq[TX]); } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; From patchwork Fri Dec 15 14:40:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494556 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 43BCCC35274 for ; Fri, 15 Dec 2023 14:44:52 +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 9AA8AE86; Fri, 15 Dec 2023 15:44:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9AA8AE86 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651490; bh=eUKIlchFvAnm5RsuGG/p/fslRn62rv2jSMscgpfvjo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Gxb9H0t3VK0mINOGn6qJTjBqkiqO5AwG9fEA5BEsDYeznSgvioHDwj73pCn0iXGQW 7sl1Sr1IOE5Xt10ZGCUl25FOQENNVFN5bmKlIZhrSn5YlmvuY9ZVBv62FTK0zrBv0Q IlqZddyLqq8xPJ9+HE5gHMLYWri3zELBUimtqP+0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 28069F806D5; Fri, 15 Dec 2023 15:42:32 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8A3CAF805C8; Fri, 15 Dec 2023 15:42:31 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6F3EF806C8; Fri, 15 Dec 2023 15:42:28 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 47CB8F80568 for ; Fri, 15 Dec 2023 15:42:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 47CB8F80568 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=uSjsEpp0 Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 00F929C2A93; Fri, 15 Dec 2023 09:42:24 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id YKf96SW3eZAF; Fri, 15 Dec 2023 09:42:23 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id AB4719C094E; Fri, 15 Dec 2023 09:42:23 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com AB4719C094E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651343; bh=KtxwE8Nf9NfqMzcAEjPfPhN3k9SXvXZrYJX8fn3taU4=; h=From:To:Date:Message-Id:MIME-Version; b=uSjsEpp0zvLOaQOEiPm+EtYb6JyhGJsq3yuVL4uvyTNY2wUAnVdHk45EYtNpehkRR F6/510PwAqV7Lzp5Mm/31AAcU0wTx8pozkBAWQF8DM6AeeyZWfLNv9ZGrdy3iiqDk1 IMmlLHNEC6f2/3A7/41M7jez+2dT+Uz26BKWVFXbeJumw1zJHSdVgGdpzBE11nHePY LfKm+Jtkg02nBhUw63DarRB3ZkNzawEMkDdToaqgoNmiMmTgwuzYLRCSZynXM5zVNw 6G81YiIU/ieMbEtyN4Z+ZqhQanyyLAFsYVYRyTeA8C6iuHkd9pnNQP+XCyiRF8anGn faqI9NA3XPKGg== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id SLPl2DgJovb9; Fri, 15 Dec 2023 09:42:23 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id C18CB9C411B; Fri, 15 Dec 2023 09:42:22 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 09/10] ASoC: fsl-asoc-card: add dts properties "cpu-sysclk-dir-out" Date: Fri, 15 Dec 2023 15:40:04 +0100 Message-Id: <20231215144005.934728-10-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: MQKZJ7XZEVDGG2D62634PECJ34NGO7AN X-Message-ID-Hash: MQKZJ7XZEVDGG2D62634PECJ34NGO7AN X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add new optional dts properties "cpu-sysclk-dir-out" to set sysclk directions as "out" for the CPU DAI when using the generic codec. This can be set for Tx and Rx. If not set, the direction is "in". The way values are used is up to the CPU DAI driver implementation. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- sound/soc/fsl/fsl-asoc-card.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 7b0d7df7ae27..5f8fb724e29d 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -751,6 +751,12 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) (u32 *)&priv->cpu_priv.sysclk_freq[RX]); of_property_read_u32(np, "cpu-sysclk-freq-tx", (u32 *)&priv->cpu_priv.sysclk_freq[TX]); + priv->cpu_priv.sysclk_dir[RX] = + of_property_read_bool(np, "cpu-sysclk-dir-rx-out") ? + SND_SOC_CLOCK_OUT : SND_SOC_CLOCK_IN; + priv->cpu_priv.sysclk_dir[TX] = + of_property_read_bool(np, "cpu-sysclk-dir-tx-out") ? + SND_SOC_CLOCK_OUT : SND_SOC_CLOCK_IN; } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; From patchwork Fri Dec 15 14:40:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elinor Montmasson X-Patchwork-Id: 13494557 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 A8F7DC35274 for ; Fri, 15 Dec 2023 14:45:11 +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 07E58E97; Fri, 15 Dec 2023 15:45:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 07E58E97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1702651510; bh=LZmYwa5LHN+DsiJFj22hCc9pBAlyk8nJoEcQXHi/X5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=mZ3I4FhoCToy2jeQ9StCAdskjBTcxJJrWM1LUATWSPgQ/wfp+6Z1WJb9VEJWRWDfn 9yF4al23BcgXYZ8G8rb+ymkDuR0wpju0LB7yv8T7PrrfCPvbrpGL8mBSX6aMSjwPuS /Ehcg6vCr0MdoZ5vNa2ShrzDAltKbtHW8EjarCq0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1425F806ED; Fri, 15 Dec 2023 15:42:44 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 4B2C2F806E9; Fri, 15 Dec 2023 15:42:44 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 877E1F805B5; Fri, 15 Dec 2023 15:42:40 +0100 (CET) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2E369F80568 for ; Fri, 15 Dec 2023 15:42:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2E369F80568 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.a=rsa-sha256 header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=p4LoiDxy Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id B37D99C330F; Fri, 15 Dec 2023 09:42:27 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 1jlQhslCdQGa; Fri, 15 Dec 2023 09:42:27 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 495B69C2A93; Fri, 15 Dec 2023 09:42:27 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 495B69C2A93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702651347; bh=wnU4drmFs7+PVEutyZt+DCTB9q3agXsjLpBTQyLApvY=; h=From:To:Date:Message-Id:MIME-Version; b=p4LoiDxyIIacNk5QPStgVni9+19KozcIkM88/sOlC7VxXMDFUn0K1ELaxNxZdDKs5 bH7ygMNVEkPBnHfAl2nYyySw2YI/MS8bWjwp7BRf3TaHJyhXhReRgrVvfCdpWF3/g+ Y+E2tqEFO7/kuwf3rBD/r+5KCk5n8AJ65qzRrIHBg7K/iJ69f2MDVv6cTdJlPQB77Q iOyENT7kEiTUtVvJDc0bqZ+lY6lI1iyEpjD//SmCK1dp7lIVuF5z3OAYT+pdzzHKqk asbfc3WqDkYIcnAMnXe5C5LV0baUboEzAyolPf9XkAO8hhVy3SdExthxYrjlVJ3i48 qP+C09FnjZZkA== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 1SajDL0HTNBN; Fri, 15 Dec 2023 09:42:27 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 5BC399C330F; Fri, 15 Dec 2023 09:42:26 -0500 (EST) From: Elinor Montmasson To: shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, broonie@kernel.org Cc: elinor.montmasson@savoirfairelinux.com, alsa-devel@alsa-project.org, philip-dylan.gleonec@savoirfairelinux.com Subject: [PATCHv3 10/10] ASoC: bindings: fsl-asoc-card: add compatible for generic codec Date: Fri, 15 Dec 2023 15:40:05 +0100 Message-Id: <20231215144005.934728-11-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> References: <20231215144005.934728-1-elinor.montmasson@savoirfairelinux.com> MIME-Version: 1.0 Message-ID-Hash: M5P5I5I7LC5F6IZZHZDYDD5Y3SADHUGI X-Message-ID-Hash: M5P5I5I7LC5F6IZZHZDYDD5Y3SADHUGI X-MailFrom: elinor.montmasson@savoirfairelinux.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add documentation about new dts bindings following new support for compatible "fsl,imx-audio-generic". Some CPU DAI don't require a real audio codec. The new compatible "fsl,imx-audio-generic" allows using the driver with codec drivers SPDIF DIT and SPDIF DIR as dummy codecs. It also allows using not pre-configured audio codecs which don't require specific control through a codec driver. The new dts properties give the possibility to set some parameters about the CPU DAI usually set through the codec configuration. Signed-off-by: Elinor Montmasson Co-authored-by: Philip-Dylan Gleonec --- .../bindings/sound/fsl-asoc-card.txt | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index 4e8dbc5abfd1..f137ef2154e3 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -17,6 +17,9 @@ Note: The card is initially designed for those sound cards who use AC'97, I2S and PCM DAI formats. However, it'll be also possible to support those non AC'97/I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, as long as the driver has been properly upgraded. + To use CPU DAIs that do not require a codec such as an S/PDIF controller, + or to use a DAI to output or capture raw I2S/TDM data, you can + use the compatible "fsl,imx-audio-generic". The compatible list for this generic sound card currently: @@ -48,6 +51,8 @@ The compatible list for this generic sound card currently: "fsl,imx-audio-nau8822" + "fsl,imx-audio-generic" + Required properties: - compatible : Contains one of entries in the compatible list. @@ -56,7 +61,11 @@ Required properties: - audio-cpu : The phandle of an CPU DAI controller - - audio-codec : The phandle of an audio codec + - audio-codec : The phandle of an audio codec. + If using the "fsl,imx-audio-generic" compatible, + give instead a pair of phandles with the + spdif_transmitter first (driver SPDIF DIT) and the + spdif_receiver second (driver SPDIF DIR). Optional properties: @@ -87,6 +96,23 @@ Optional properties: - frame-inversion : dai-link uses frame clock inversion, for details see simple-card.yaml. - bitclock-inversion : dai-link uses bit clock inversion, for details see simple-card.yaml. - mclk-id : main clock id, specific for each card configuration. + For multi-codec configurations, an array of ids can be + given, one for each codec. + +Optional, relevant only with the "fsl,imx-audio-generic" compatible: + + - cpu-slot-width : Indicates a specific TDM slot width in bits. + - cpu-slot-num : Indicates a specific number of TDM slots per frame. + + - cpu-sysclk-freq-rx : Frequency of the CPU DAI sys clock for Rx. + - cpu-sysclk-freq-tx : Frequency of the CPU DAI sys clock for Tx. + + - cpu-sysclk-dir-rx-out : Boolean property. Specifies sys clock direction + as 'out' on initialization for Rx. + If not set, default direction is 'in'. + - cpu-sysclk-dir-tx-out : Boolean property. Specifies sys clock direction + as 'out' on initialization for Tx. + If not set, default direction is 'in'. Optional unless SSI is selected as a CPU DAI: