From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CF98C433F5 for ; Sat, 19 Mar 2022 11:41:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242860AbiCSLm4 (ORCPT ); Sat, 19 Mar 2022 07:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242844AbiCSLmv (ORCPT ); Sat, 19 Mar 2022 07:42:51 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1410911BE6F; Sat, 19 Mar 2022 04:41:26 -0700 (PDT) X-UUID: 4f25938e9bc94dfbae8904fc58aa7ef8-20220319 X-UUID: 4f25938e9bc94dfbae8904fc58aa7ef8-20220319 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 44584759; Sat, 19 Mar 2022 19:41:21 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 19:41:20 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 19 Mar 2022 19:41:19 +0800 From: Jiaxin Yu To: , , CC: , , , , , , , , , , , Jiaxin Yu Subject: [v5 3/4] ASoC: mediatek: mt8192: refactor for I2S8/I2S9 DAI links of headset Date: Sat, 19 Mar 2022 19:41:10 +0800 Message-ID: <20220319114111.11496-4-jiaxin.yu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220319114111.11496-1-jiaxin.yu@mediatek.com> References: <20220319114111.11496-1-jiaxin.yu@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MT8192 platform use rt5682 codec, so through the snd_soc_of_get_dai_link_codes() to complete the configuration of I2S8/I2S9 dai_link's codecs. Signed-off-by: Jiaxin Yu --- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index e42bbb5d7c35..d77f7c701513 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -28,9 +28,6 @@ #define RT1015_DEV0_NAME "rt1015.1-0028" #define RT1015_DEV1_NAME "rt1015.1-0029" -#define RT5682_CODEC_DAI "rt5682-aif1" -#define RT5682_DEV0_NAME "rt5682.1-001a" - struct mt8192_mt6359_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack hdmi_jack; @@ -626,14 +623,12 @@ SND_SOC_DAILINK_DEFS(i2s7, SND_SOC_DAILINK_DEFS(i2s8, DAILINK_COMP_ARRAY(COMP_CPU("I2S8")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(i2s9, DAILINK_COMP_ARRAY(COMP_CPU("I2S9")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(connsys_i2s, @@ -1114,7 +1109,7 @@ static int mt8192_mt6359_card_set_be_link(struct snd_soc_card *card, static int mt8192_mt6359_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; - struct device_node *platform_node, *hdmi_codec, *speaker_codec; + struct device_node *platform_node, *hdmi_codec, *headset_codec, *speaker_codec; int ret, i; struct snd_soc_dai_link *dai_link; struct mt8192_mt6359_priv *priv; @@ -1145,6 +1140,13 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_speaker_codec; } + headset_codec = of_get_child_by_name(pdev->dev.of_node, "mediatek,headset-codec"); + if (!headset_codec) { + ret = -EINVAL; + dev_err_probe(&pdev->dev, ret, "Property 'headset_codec' missing or invalid\n"); + goto err_headset_codec; + } + for_each_card_prelinks(card, i, dai_link) { ret = mt8192_mt6359_card_set_be_link(card, dai_link, speaker_codec, "I2S3"); if (ret) { @@ -1153,6 +1155,20 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_probe; } + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S8"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S9"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) { dai_link->codecs->of_node = hdmi_codec; dai_link->ignore = 0; @@ -1183,6 +1199,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) dev_err_probe(&pdev->dev, ret, "%s snd_soc_register_card fail\n", __func__); err_probe: + of_node_put(headset_codec); +err_headset_codec: of_node_put(speaker_codec); err_speaker_codec: of_node_put(hdmi_codec); -- 2.18.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 DAA1CC433EF for ; Sat, 19 Mar 2022 11:43:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 30256174E; Sat, 19 Mar 2022 12:42:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 30256174E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1647690228; bh=oEm6bPiIvkubvs3Nic5CWcjBgGBMr+XaB1ooWoTzZgA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jqsmeWWz3JSD9KoT4UFeL8hnQAS3U5QUP/zMME0pIubMV6p7NjnD0PY1DhCMISJsb J8hC9aFMLVy2iwjN8YYP4tTLrafclZSYVqScBeltfo7+uvrMkq/4QOs1KEPYKcc3o+ dTvn/YwgIJRD3W9Uixc+aK5mJTgJ7NFRda330raI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B66FEF8025E; Sat, 19 Mar 2022 12:41:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9AD9DF8051D; Sat, 19 Mar 2022 12:41:40 +0100 (CET) Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6C32DF8025E for ; Sat, 19 Mar 2022 12:41:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6C32DF8025E X-UUID: 4f25938e9bc94dfbae8904fc58aa7ef8-20220319 X-UUID: 4f25938e9bc94dfbae8904fc58aa7ef8-20220319 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 44584759; Sat, 19 Mar 2022 19:41:21 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 19:41:20 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 19 Mar 2022 19:41:19 +0800 From: Jiaxin Yu To: , , Subject: [v5 3/4] ASoC: mediatek: mt8192: refactor for I2S8/I2S9 DAI links of headset Date: Sat, 19 Mar 2022 19:41:10 +0800 Message-ID: <20220319114111.11496-4-jiaxin.yu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220319114111.11496-1-jiaxin.yu@mediatek.com> References: <20220319114111.11496-1-jiaxin.yu@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N Cc: devicetree@vger.kernel.org, linmq006@gmail.com, alsa-devel@alsa-project.org, Jiaxin Yu , linux-kernel@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com, linux-mediatek@lists.infradead.org, trevor.wu@mediatek.com, matthias.bgg@gmail.com, aaronyu@google.com, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" MT8192 platform use rt5682 codec, so through the snd_soc_of_get_dai_link_codes() to complete the configuration of I2S8/I2S9 dai_link's codecs. Signed-off-by: Jiaxin Yu --- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index e42bbb5d7c35..d77f7c701513 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -28,9 +28,6 @@ #define RT1015_DEV0_NAME "rt1015.1-0028" #define RT1015_DEV1_NAME "rt1015.1-0029" -#define RT5682_CODEC_DAI "rt5682-aif1" -#define RT5682_DEV0_NAME "rt5682.1-001a" - struct mt8192_mt6359_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack hdmi_jack; @@ -626,14 +623,12 @@ SND_SOC_DAILINK_DEFS(i2s7, SND_SOC_DAILINK_DEFS(i2s8, DAILINK_COMP_ARRAY(COMP_CPU("I2S8")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(i2s9, DAILINK_COMP_ARRAY(COMP_CPU("I2S9")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(connsys_i2s, @@ -1114,7 +1109,7 @@ static int mt8192_mt6359_card_set_be_link(struct snd_soc_card *card, static int mt8192_mt6359_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; - struct device_node *platform_node, *hdmi_codec, *speaker_codec; + struct device_node *platform_node, *hdmi_codec, *headset_codec, *speaker_codec; int ret, i; struct snd_soc_dai_link *dai_link; struct mt8192_mt6359_priv *priv; @@ -1145,6 +1140,13 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_speaker_codec; } + headset_codec = of_get_child_by_name(pdev->dev.of_node, "mediatek,headset-codec"); + if (!headset_codec) { + ret = -EINVAL; + dev_err_probe(&pdev->dev, ret, "Property 'headset_codec' missing or invalid\n"); + goto err_headset_codec; + } + for_each_card_prelinks(card, i, dai_link) { ret = mt8192_mt6359_card_set_be_link(card, dai_link, speaker_codec, "I2S3"); if (ret) { @@ -1153,6 +1155,20 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_probe; } + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S8"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S9"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) { dai_link->codecs->of_node = hdmi_codec; dai_link->ignore = 0; @@ -1183,6 +1199,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) dev_err_probe(&pdev->dev, ret, "%s snd_soc_register_card fail\n", __func__); err_probe: + of_node_put(headset_codec); +err_headset_codec: of_node_put(speaker_codec); err_speaker_codec: of_node_put(hdmi_codec); -- 2.18.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8971EC433F5 for ; Sat, 19 Mar 2022 11:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UdwnpQKHBaOSvJ7qkYJMxcUrCfWCnWwYJOvRskxVZtg=; b=NsvidItt1NyM0X AppY3nqWw1urq1ltTwkTxURAw6IaaVkRc0ZuHR+Y4ImWkkvmXjtNefxm9ZHvaSpsFQyTTYcbWhZVD TbLnypMpE6KZ30mlS0h6b+hc4ziXBoKY+rKGPGXZ4LQXBZHOi9zrKDdCpjLzwCemXX+BysQNn8lUJ qtW1gZNGyXtT0B/0nC9lb0TUBM7qnvP1QhX9DfCG0/Ujb0i3UmE2Y/eVaQm29OqgRvvDXrKFrK507 fYSbtwjYagzZmRqafMHvnkzt31HQEpTjBUR7eU/Sd/6jhE95cQoZPvGHZMX/CdOWXFoqhrdyRDxgW zAEQa1P0EgUfCHV4iHgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nVXce-003hap-Gi; Sat, 19 Mar 2022 11:51:52 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nVXcH-003hTT-Uo; Sat, 19 Mar 2022 11:51:31 +0000 X-UUID: 1cc1333723c54ee597eead418961fdfa-20220319 X-UUID: 1cc1333723c54ee597eead418961fdfa-20220319 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1305228245; Sat, 19 Mar 2022 04:51:21 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 04:41:21 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 19:41:20 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 19 Mar 2022 19:41:19 +0800 From: Jiaxin Yu To: , , CC: , , , , , , , , , , , Jiaxin Yu Subject: [v5 3/4] ASoC: mediatek: mt8192: refactor for I2S8/I2S9 DAI links of headset Date: Sat, 19 Mar 2022 19:41:10 +0800 Message-ID: <20220319114111.11496-4-jiaxin.yu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220319114111.11496-1-jiaxin.yu@mediatek.com> References: <20220319114111.11496-1-jiaxin.yu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220319_045130_032669_FC43EB93 X-CRM114-Status: GOOD ( 12.93 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org MT8192 platform use rt5682 codec, so through the snd_soc_of_get_dai_link_codes() to complete the configuration of I2S8/I2S9 dai_link's codecs. Signed-off-by: Jiaxin Yu --- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index e42bbb5d7c35..d77f7c701513 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -28,9 +28,6 @@ #define RT1015_DEV0_NAME "rt1015.1-0028" #define RT1015_DEV1_NAME "rt1015.1-0029" -#define RT5682_CODEC_DAI "rt5682-aif1" -#define RT5682_DEV0_NAME "rt5682.1-001a" - struct mt8192_mt6359_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack hdmi_jack; @@ -626,14 +623,12 @@ SND_SOC_DAILINK_DEFS(i2s7, SND_SOC_DAILINK_DEFS(i2s8, DAILINK_COMP_ARRAY(COMP_CPU("I2S8")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(i2s9, DAILINK_COMP_ARRAY(COMP_CPU("I2S9")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(connsys_i2s, @@ -1114,7 +1109,7 @@ static int mt8192_mt6359_card_set_be_link(struct snd_soc_card *card, static int mt8192_mt6359_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; - struct device_node *platform_node, *hdmi_codec, *speaker_codec; + struct device_node *platform_node, *hdmi_codec, *headset_codec, *speaker_codec; int ret, i; struct snd_soc_dai_link *dai_link; struct mt8192_mt6359_priv *priv; @@ -1145,6 +1140,13 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_speaker_codec; } + headset_codec = of_get_child_by_name(pdev->dev.of_node, "mediatek,headset-codec"); + if (!headset_codec) { + ret = -EINVAL; + dev_err_probe(&pdev->dev, ret, "Property 'headset_codec' missing or invalid\n"); + goto err_headset_codec; + } + for_each_card_prelinks(card, i, dai_link) { ret = mt8192_mt6359_card_set_be_link(card, dai_link, speaker_codec, "I2S3"); if (ret) { @@ -1153,6 +1155,20 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_probe; } + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S8"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S9"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) { dai_link->codecs->of_node = hdmi_codec; dai_link->ignore = 0; @@ -1183,6 +1199,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) dev_err_probe(&pdev->dev, ret, "%s snd_soc_register_card fail\n", __func__); err_probe: + of_node_put(headset_codec); +err_headset_codec: of_node_put(speaker_codec); err_speaker_codec: of_node_put(hdmi_codec); -- 2.18.0 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1606CC433EF for ; Sat, 19 Mar 2022 11:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lqQbrCG+IrktDb/yW3Xe0NdiHvO+X/MJtMs/gecF0Rw=; b=ml7MY/kRFPLcfr x0urG1en5CoAslU2PXy9f3cYO7KmfZhKAJlN1l3wVWbh8g3mWVeO9vptrPDK8+ADgS6zo+GBsShWd qZV4ukUAVFL1C7drRNT027IwbxIhpyn5CfKqMkJPDwuX3l+AJDj1KJxx6Ujou+yQxF7mzFn5SRcDI LfKcLn6jxRlAb5DhUerTLpAI0Q2YK+1V+IuIEaa9GvLtbn79w3pFsQjJxsckT8vfH6l8qrB2POV8v CAwdWltLiSOvXnlM9MeD6tEj0p3lKPO4+OB8YGwDMeiH3ISoj7g8qlwlhkLJDYilC6pzI8zM/f8xo 9udSSK2odhCdkN2b3T/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nVXch-003hbW-4n; Sat, 19 Mar 2022 11:51:55 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nVXcH-003hTT-Uo; Sat, 19 Mar 2022 11:51:31 +0000 X-UUID: 1cc1333723c54ee597eead418961fdfa-20220319 X-UUID: 1cc1333723c54ee597eead418961fdfa-20220319 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1305228245; Sat, 19 Mar 2022 04:51:21 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 04:41:21 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 19 Mar 2022 19:41:20 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 19 Mar 2022 19:41:19 +0800 From: Jiaxin Yu To: , , CC: , , , , , , , , , , , Jiaxin Yu Subject: [v5 3/4] ASoC: mediatek: mt8192: refactor for I2S8/I2S9 DAI links of headset Date: Sat, 19 Mar 2022 19:41:10 +0800 Message-ID: <20220319114111.11496-4-jiaxin.yu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220319114111.11496-1-jiaxin.yu@mediatek.com> References: <20220319114111.11496-1-jiaxin.yu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220319_045130_032669_FC43EB93 X-CRM114-Status: GOOD ( 12.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org MT8192 platform use rt5682 codec, so through the snd_soc_of_get_dai_link_codes() to complete the configuration of I2S8/I2S9 dai_link's codecs. Signed-off-by: Jiaxin Yu --- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c index e42bbb5d7c35..d77f7c701513 100644 --- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c @@ -28,9 +28,6 @@ #define RT1015_DEV0_NAME "rt1015.1-0028" #define RT1015_DEV1_NAME "rt1015.1-0029" -#define RT5682_CODEC_DAI "rt5682-aif1" -#define RT5682_DEV0_NAME "rt5682.1-001a" - struct mt8192_mt6359_priv { struct snd_soc_jack headset_jack; struct snd_soc_jack hdmi_jack; @@ -626,14 +623,12 @@ SND_SOC_DAILINK_DEFS(i2s7, SND_SOC_DAILINK_DEFS(i2s8, DAILINK_COMP_ARRAY(COMP_CPU("I2S8")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(i2s9, DAILINK_COMP_ARRAY(COMP_CPU("I2S9")), - DAILINK_COMP_ARRAY(COMP_CODEC(RT5682_DEV0_NAME, - RT5682_CODEC_DAI)), + DAILINK_COMP_ARRAY(COMP_EMPTY()), DAILINK_COMP_ARRAY(COMP_EMPTY())); SND_SOC_DAILINK_DEFS(connsys_i2s, @@ -1114,7 +1109,7 @@ static int mt8192_mt6359_card_set_be_link(struct snd_soc_card *card, static int mt8192_mt6359_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; - struct device_node *platform_node, *hdmi_codec, *speaker_codec; + struct device_node *platform_node, *hdmi_codec, *headset_codec, *speaker_codec; int ret, i; struct snd_soc_dai_link *dai_link; struct mt8192_mt6359_priv *priv; @@ -1145,6 +1140,13 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_speaker_codec; } + headset_codec = of_get_child_by_name(pdev->dev.of_node, "mediatek,headset-codec"); + if (!headset_codec) { + ret = -EINVAL; + dev_err_probe(&pdev->dev, ret, "Property 'headset_codec' missing or invalid\n"); + goto err_headset_codec; + } + for_each_card_prelinks(card, i, dai_link) { ret = mt8192_mt6359_card_set_be_link(card, dai_link, speaker_codec, "I2S3"); if (ret) { @@ -1153,6 +1155,20 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) goto err_probe; } + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S8"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + + ret = mt8192_mt6359_card_set_be_link(card, dai_link, headset_codec, "I2S9"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "%s set headset_codec fail\n", + dai_link->name); + goto err_probe; + } + if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) { dai_link->codecs->of_node = hdmi_codec; dai_link->ignore = 0; @@ -1183,6 +1199,8 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) dev_err_probe(&pdev->dev, ret, "%s snd_soc_register_card fail\n", __func__); err_probe: + of_node_put(headset_codec); +err_headset_codec: of_node_put(speaker_codec); err_speaker_codec: of_node_put(hdmi_codec); -- 2.18.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel