Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp67192rdh; Mon, 18 Dec 2023 04:44:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPB8sLBGlvwljiPlN6n0ReTTfZQ0JgkPQtW2Gln8PqpJC3MEZBo8bCbDmcCrkw//KkOPWa X-Received: by 2002:a2e:b1c8:0:b0:2cc:5e7a:ba6a with SMTP id e8-20020a2eb1c8000000b002cc5e7aba6amr1600729lja.13.1702903446421; Mon, 18 Dec 2023 04:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702903446; cv=none; d=google.com; s=arc-20160816; b=AERJuKmaHq0XWamKN/lX8/JD0xrI4Ydvpq3exr+cJspxhENC7mXUoSkJtqt0VKL0pE yYDnUiMW6sZjnmUyVmWquu/0/Tl2un3PxZh6lgjMjuruuXt/IuOq19xAh4N4Yfxprr0c bu9RHohp75b51eNioSAbOODDR0Sw+HvHhLV5gTMuqwFXvldg6g1jLoWIM5SS41eDzsJl 2O5EMTSw/3LkxWd/bU8S+Z5DC6ddioI1JjRb+xp7OUwz/24DOFz6h2KFwAG34L/GtjPX hN6YlV1Is0bEwep2rLkoCJbnqeMV9SSRLE22qrqQZWw9UOuS/e/473iratgIMtikx8Qn Ic9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=UiaPRtB78O/TxKdZ0KogRi45bm5TmsI0TncGDAFUtsc=; fh=tQDBYMLxw9pGRS61bl22/5Nh3Impw3/NQWSQ0aEjqug=; b=XwDjnXUHbwiBQalGuJ8x2C/p6QOwsKJaqOaNQrCThgN5ULr5ZSlR4zAo0XS23QmKrL ukAo8fXruXEZfhbDmLRoeGxE+DRNfkqjCIvaVgSqf/g+M71Hk6NGxTCSXWqiLn3Yq3Wr MX2+9mPo7qw44cP3oJeNwVCpVJpKFQ1N/cwX467ykJDcYRkLCU4pByOA2XCz8/9Qk3F+ lV4cOmoFxxypckmHAYdYo+F/lfHyym4iKEJlLmujZKIdinsJ+8/zG4S5IqAJCD/V839i bZn3/1hT2gPUHBhum7ZlLySSdwW7Dmxiu9IBzB+3QfEcWIFzF+9/q0RbDgVUNZGEsmYf Mn7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=METad6L9; spf=pass (google.com: domain of linux-kernel+bounces-3592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3592-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v23-20020a056402175700b005533e54351asi1036644edx.452.2023.12.18.04.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 04:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=METad6L9; spf=pass (google.com: domain of linux-kernel+bounces-3592-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3592-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0455A1F22CB0 for ; Mon, 18 Dec 2023 12:44:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 807EF7FBB9; Mon, 18 Dec 2023 12:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=savoirfairelinux.com header.i=@savoirfairelinux.com header.b="METad6L9" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4684F80E0B; Mon, 18 Dec 2023 12:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=savoirfairelinux.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=savoirfairelinux.com Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 6E4BA9C3FCC; Mon, 18 Dec 2023 07:42:57 -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 h0mG4bj41yIX; Mon, 18 Dec 2023 07:42:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id E89589C411B; Mon, 18 Dec 2023 07:42:56 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com E89589C411B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702903376; bh=UiaPRtB78O/TxKdZ0KogRi45bm5TmsI0TncGDAFUtsc=; h=From:To:Date:Message-Id:MIME-Version; b=METad6L94kc7G4Eakrs0kqCcancv7EvJVq+4UDcclNXM4EE0TtSg5Kpw/ztDRqj5t y/u5VCZHj5FOWfHHTXXGGA5RA9toRPr+ZdwG7BETSsojT5KWdEOn88rQRqpA+qtNax 1RBSp9VjjAS7V/bnPzNYqjD9juaLCg3Jo/XvEOrtbnBj5DRUjzD5sjM4Xq1TpclDsF HGwJsT5YpXTK5qtKvlMNoaBG+yL2GT5CPyUe1J/aueeNAfZJ3ItPuRi5Onowy2AmZx AvTiLvRD5C7dl+6W8tDw5eCBSbYx20WED0In+QDnCLw7NTgouY/F1T/uTE8xAU37pP G5h2To+2yu3gw== 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 XTv8GG-jZ0WP; Mon, 18 Dec 2023 07:42:56 -0500 (EST) Received: from gerard.rennes.sfl (unknown [192.168.216.3]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id E2AC99C3FCC; Mon, 18 Dec 2023 07:42:54 -0500 (EST) From: Elinor Montmasson To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, Elinor Montmasson , Philip-Dylan Subject: [PATCHv3 RESEND 04/10] ASoC: fsl-asoc-card: add new compatible for a generic codec use case Date: Mon, 18 Dec 2023 13:40:52 +0100 Message-Id: <20231218124058.2047167-5-elinor.montmasson@savoirfairelinux.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231218124058.2047167-1-elinor.montmasson@savoirfairelinux.com> References: <20231218124058.2047167-1-elinor.montmasson@savoirfairelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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] =3D { NULL, NULL }; + const char *generic_codec_dai_names[2]; const char *codec_dai_name; const char *codec_dev_name[2]; u32 asrc_fmt =3D 0; @@ -738,6 +739,11 @@ static int fsl_asoc_card_probe(struct platform_devic= e *pdev) priv->dai_fmt |=3D SND_SOC_DAIFMT_CBM_CFM; if (codec_dev[0]) priv->codec_priv[0].mclk =3D devm_clk_get(codec_dev[0], NULL); + } else if (of_device_is_compatible(np, "fsl,imx-audio-generic")) { + generic_codec_dai_names[0] =3D "dit-hifi"; + generic_codec_dai_names[1] =3D "dir-hifi"; + priv->dai_link[0].num_codecs =3D 2; + priv->dai_link[2].num_codecs =3D 2; } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret =3D -EINVAL; @@ -792,6 +798,12 @@ static int fsl_asoc_card_probe(struct platform_devic= e *pdev) ret =3D -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 =3D -EPROBE_DEFER; + goto asrc_fail; + } =20 /* 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_devi= ce *pdev) =20 /* Normal DAI Link */ priv->dai_link[0].cpus->of_node =3D cpu_np; - priv->dai_link[0].codecs[0].dai_name =3D codec_dai_name; =20 - 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 =3D + generic_codec_dai_names[0]; + priv->dai_link[0].codecs[1].dai_name =3D + generic_codec_dai_names[1]; + } else { + priv->dai_link[0].codecs[0].dai_name =3D codec_dai_name; + } + + if (!fsl_asoc_card_is_ac97(priv)) { priv->dai_link[0].codecs[0].of_node =3D codec_np[0]; - else { + if (of_device_is_compatible(np, "fsl,imx-audio-generic")) + priv->dai_link[0].codecs[1].of_node =3D codec_np[1]; + } else { u32 idx; =20 ret =3D of_property_read_u32(cpu_np, "cell-index", &idx); @@ -983,6 +1005,7 @@ static const struct of_device_id fsl_asoc_card_dt_id= s[] =3D { { .compatible =3D "fsl,imx-audio-si476x", }, { .compatible =3D "fsl,imx-audio-wm8958", }, { .compatible =3D "fsl,imx-audio-nau8822", }, + { .compatible =3D "fsl,imx-audio-generic", }, {} }; MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids); --=20 2.25.1