From patchwork Tue Oct 24 03:50:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maso Huang X-Patchwork-Id: 737881 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 A5180C00A8F for ; Tue, 24 Oct 2023 08:49:20 +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 5A665DEF; Tue, 24 Oct 2023 10:48:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5A665DEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698137358; bh=mwMfBtcV/pJ7zmHmZA12r8/1GgBefmysIDlJKK/dSPY=; 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=PGVx2X1IUCacdG5lLRG6kk07Kc87xkXoElVXeZD3Kr2CkDacbmvo+jOPFcYoua+Yz 8lv4JeTolHU6aRP9gZYFcQ6uEM4ATgahvgJ2vC76LrNvs/5C3i5bRVPP+69hYHGvv0 0UP/6mJ3ewRl8fvITT47oCG+MFmfg5Vmr3UQC9l4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2E260F805AB; Tue, 24 Oct 2023 10:47:26 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8BFB1F8057D; Tue, 24 Oct 2023 10:47:26 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 15B08F80165; Tue, 24 Oct 2023 05:51:50 +0200 (CEST) Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (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 6F440F8012B for ; Tue, 24 Oct 2023 05:50:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F440F8012B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=e1HhZCOP X-UUID: 834a1522722011ee8051498923ad61e6-20231024 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=QfVVtZBb9l5MkYex/BrRtzyJ2IeY7PLkE34QeN8pkSQ=; b=e1HhZCOPG2VBJGY1NG3BVi4+f/XIDerEVOlus5kHYJw3afd5UTMkjk6gz+UmjnpJOqtCCIMH6TRr/KvMSlSQHSYMA3zVFTPMGDwMOlWTyaHPQSLfpTKX8AF/Y2JsO9meenhBi2hwBRE3ik884FbneCWeCdIDk48geQ00uq0iwfQ=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32, REQID:6ecd9648-9318-448e-95bf-75ea406d78ff, IP:0, U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:5f78ec9, CLOUDID:94a58d94-10ce-4e4b-85c2-c9b5229ff92b, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 834a1522722011ee8051498923ad61e6-20231024 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 977540919; Tue, 24 Oct 2023 11:50:46 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 24 Oct 2023 11:50:45 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 24 Oct 2023 11:50:45 +0800 From: Maso Huang To: Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Jaroslav Kysela , Takashi Iwai , , , , CC: Maso Huang Subject: [PATCH v2 1/3] ASoC: mediatek: mt7986: drop the remove callback of mt7986_wm8960 Date: Tue, 24 Oct 2023 11:50:17 +0800 Message-ID: <20231024035019.11732-2-maso.huang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231024035019.11732-1-maso.huang@mediatek.com> References: <20231024035019.11732-1-maso.huang@mediatek.com> MIME-Version: 1.0 X-MailFrom: maso.huang@mediatek.com X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: 4KL62GL7ZSEESARJJUL6Q22OU334AGB3 X-Message-ID-Hash: 4KL62GL7ZSEESARJJUL6Q22OU334AGB3 X-Mailman-Approved-At: Tue, 24 Oct 2023 08:47:22 +0000 X-Mailman-Version: 3.3.8 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: Drop the remove callback of mt7986_wm8960. Signed-off-by: Maso Huang --- sound/soc/mediatek/mt7986/mt7986-wm8960.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sound/soc/mediatek/mt7986/mt7986-wm8960.c b/sound/soc/mediatek/mt7986/mt7986-wm8960.c index 364d13b1c426..f6b9794b7229 100644 --- a/sound/soc/mediatek/mt7986/mt7986-wm8960.c +++ b/sound/soc/mediatek/mt7986/mt7986-wm8960.c @@ -163,15 +163,6 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) return ret; } -static void mt7986_wm8960_machine_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - struct mt7986_wm8960_priv *priv = snd_soc_card_get_drvdata(card); - - of_node_put(priv->codec_node); - of_node_put(priv->platform_node); -} - static const struct of_device_id mt7986_wm8960_machine_dt_match[] = { {.compatible = "mediatek,mt7986-wm8960-sound"}, { /* sentinel */ } @@ -184,7 +175,6 @@ static struct platform_driver mt7986_wm8960_machine = { .of_match_table = mt7986_wm8960_machine_dt_match, }, .probe = mt7986_wm8960_machine_probe, - .remove_new = mt7986_wm8960_machine_remove, }; module_platform_driver(mt7986_wm8960_machine); From patchwork Tue Oct 24 03:50:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maso Huang X-Patchwork-Id: 737882 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 90F66C07545 for ; Tue, 24 Oct 2023 08:48:54 +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 ABC06DEC; Tue, 24 Oct 2023 10:48:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ABC06DEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698137331; bh=CFKa03cgt/AOOgj++H5pOxt7eL6aR9PJfLITWqq5rhI=; 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=upgl12IpvSjWv8lXHnX7hy1fa18ggjEKRV8HohARJLOUrgYlBy3T/o0apW3om7QRG Ips9CyyvzMsEs/8vnmDesLHuo699DdUABqayh96n020PKiGESrfJWB5qXqUDvV9DHS GOxrjC8m+nPkjeySMzrglhiyB2sI/KAhmeeDGO5g= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0A1FBF8057B; Tue, 24 Oct 2023 10:47:19 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6DD1AF80537; Tue, 24 Oct 2023 10:47:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ADB42F8028D; Tue, 24 Oct 2023 05:51:48 +0200 (CEST) Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (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 C139FF80165 for ; Tue, 24 Oct 2023 05:50:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C139FF80165 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=CJXfn8d/ X-UUID: 85b63340722011ee8051498923ad61e6-20231024 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=7BreaDgCH7mRp5CSo98g29nYk3nW8Yu1AIFy53p6Y/I=; b=CJXfn8d/wyUDfFeGKn9UG1PQazyiexpxAbXW8E17y95LARaiPHHM6GuDZRb9sIfXKfG3PuFOZpV+ijayl1GzZiOpnxyhGHOoiCiMCO7JVYJhVce2m7y5fsqeiIAuQr3jX/Rg31/nSDp0oVNemIlh16z9A3MGlnaqazGlPHOwEio=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32, REQID:e8b26b00-aa94-4de8-8fd4-eb0983131630, IP:0, U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9, CLOUDID:b7a58d94-10ce-4e4b-85c2-c9b5229ff92b, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 85b63340722011ee8051498923ad61e6-20231024 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1306072661; Tue, 24 Oct 2023 11:50:50 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 24 Oct 2023 11:50:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 24 Oct 2023 11:50:48 +0800 From: Maso Huang To: Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Jaroslav Kysela , Takashi Iwai , , , , CC: Maso Huang Subject: [PATCH v2 2/3] ASoC: mediatek: mt7986: remove the mt7986_wm8960_priv structure Date: Tue, 24 Oct 2023 11:50:18 +0800 Message-ID: <20231024035019.11732-3-maso.huang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231024035019.11732-1-maso.huang@mediatek.com> References: <20231024035019.11732-1-maso.huang@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--2.396400-8.000000 X-TMASE-MatchedRID: fmS20tPE9ksZ9uxgtDtJQgPZZctd3P4BCt59Uh3p/NUKogmGusPLb7uA YZFvH/IiJ7vDzKaAUziGwpg7pPpeGdEdmUPXI8FxRnmgWPGIUuN9LQinZ4QefPcjNeVeWlqY+gt Hj7OwNO34ZhR52Rc1agOckpztc5q9DTKwjifCv/JaBY1H+rGnJmceWHNlxh0NYxCRwJSgalga8k 2hFPMqR5nyvuWwh3WTLDv877bId1VPpulV5YAHJ0ma3zYT97IFAYfQIAUhBayZvmCbKVb49sZL6 x5U/HridGByp+zdaDg= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.396400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: F482FDE8C42D897BE79991F8C5C7B1E56E94812EDF60B7011729E2E99BD7179F2000:8 X-MailFrom: maso.huang@mediatek.com X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: B536HWNPU2SLAROPJPC5BSVBTFHJUWFE X-Message-ID-Hash: B536HWNPU2SLAROPJPC5BSVBTFHJUWFE X-Mailman-Approved-At: Tue, 24 Oct 2023 08:47:14 +0000 X-Mailman-Version: 3.3.8 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: Remove the mt7986_wm8960_priv structure. Signed-off-by: Maso Huang --- sound/soc/mediatek/mt7986/mt7986-wm8960.c | 33 +++++++++-------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/sound/soc/mediatek/mt7986/mt7986-wm8960.c b/sound/soc/mediatek/mt7986/mt7986-wm8960.c index f6b9794b7229..c1390b373410 100644 --- a/sound/soc/mediatek/mt7986/mt7986-wm8960.c +++ b/sound/soc/mediatek/mt7986/mt7986-wm8960.c @@ -12,11 +12,6 @@ #include "mt7986-afe-common.h" -struct mt7986_wm8960_priv { - struct device_node *platform_node; - struct device_node *codec_node; -}; - static const struct snd_soc_dapm_widget mt7986_wm8960_widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_MIC("AMIC", NULL), @@ -92,20 +87,18 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) struct snd_soc_card *card = &mt7986_wm8960_card; struct snd_soc_dai_link *dai_link; struct device_node *platform, *codec; - struct mt7986_wm8960_priv *priv; + struct device_node *platform_dai_node, *codec_dai_node; int ret, i; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; + card->dev = &pdev->dev; platform = of_get_child_by_name(pdev->dev.of_node, "platform"); if (platform) { - priv->platform_node = of_parse_phandle(platform, "sound-dai", 0); + platform_dai_node = of_parse_phandle(platform, "sound-dai", 0); of_node_put(platform); - if (!priv->platform_node) { + if (!platform_dai_node) { dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n"); return -EINVAL; } @@ -117,24 +110,22 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) for_each_card_prelinks(card, i, dai_link) { if (dai_link->platforms->name) continue; - dai_link->platforms->of_node = priv->platform_node; + dai_link->platforms->of_node = platform_dai_node; } - card->dev = &pdev->dev; - codec = of_get_child_by_name(pdev->dev.of_node, "codec"); if (codec) { - priv->codec_node = of_parse_phandle(codec, "sound-dai", 0); + codec_dai_node = of_parse_phandle(codec, "sound-dai", 0); of_node_put(codec); - if (!priv->codec_node) { - of_node_put(priv->platform_node); + if (!codec_dai_node) { + of_node_put(platform_dai_node); dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n"); return -EINVAL; } } else { - of_node_put(priv->platform_node); + of_node_put(platform_dai_node); dev_err(&pdev->dev, "Property 'codec' missing or invalid\n"); return -EINVAL; } @@ -142,7 +133,7 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) for_each_card_prelinks(card, i, dai_link) { if (dai_link->codecs->name) continue; - dai_link->codecs->of_node = priv->codec_node; + dai_link->codecs->of_node = codec_dai_node; } ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); @@ -158,8 +149,8 @@ static int mt7986_wm8960_machine_probe(struct platform_device *pdev) } err_of_node_put: - of_node_put(priv->codec_node); - of_node_put(priv->platform_node); + of_node_put(platform_dai_node); + of_node_put(codec_dai_node); return ret; } From patchwork Tue Oct 24 03:50:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maso Huang X-Patchwork-Id: 737580 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 A73A7C00A8F for ; Tue, 24 Oct 2023 08:49:43 +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 835FF9F6; Tue, 24 Oct 2023 10:48:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 835FF9F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698137381; bh=JPs1KLu0WRdYJlmRszBJsFuKVbjuK2aTEu2v7DlZtbQ=; 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=EtqSeolUStXEP2Du+y5yGs7i76E0P62HhL+4kKZ4NLTN0HfoN4e7ut4z1XgTArPVN rJBCOMfyNhwEFxQmY8YbjpbxzODloPGg8OdBgVGf2NHOmMA6avqtFBaDBUF+E8fqgE 720xFmH5wcOlAVGGc6s64tRd8ThC6pDYsM0PBAgQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26DFCF805B1; Tue, 24 Oct 2023 10:47:29 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 512BDF805AF; Tue, 24 Oct 2023 10:47:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0DE75F80157; Tue, 24 Oct 2023 05:51:56 +0200 (CEST) Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 2FD9CF8019B for ; Tue, 24 Oct 2023 05:51:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2FD9CF8019B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=ZAtbjqhL X-UUID: 86e65fba722011eea33bb35ae8d461a2-20231024 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Hzi+kjq1QCG+TxJwfKjMZ8NZ7VLcxkHOjhgyuRv3grs=; b=ZAtbjqhLEC3Phj/sfE1wRmh7bYNDNxDQDQabtBKbODJfpmQkSqAbe7YLSOCz1/2tStXGtxgmFew7lArJYnNG1eS+NZIp6Mo44oeKdiQbZ4B+tDg8l+qplYQ0Nq8kurcegbjaYAr1x/n70y7HMAH7gzidwsF4mRHVsZup+q1xYZU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32, REQID:24b6c52f-7136-465e-bf3f-a467d2bd27cb, IP:0, U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9, CLOUDID:c4153dd7-04a0-4e50-8742-3543eab8cb8e, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 86e65fba722011eea33bb35ae8d461a2-20231024 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1219510997; Tue, 24 Oct 2023 11:50:52 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 24 Oct 2023 11:50:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 24 Oct 2023 11:50:50 +0800 From: Maso Huang To: Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Jaroslav Kysela , Takashi Iwai , , , , CC: Maso Huang Subject: [PATCH v2 3/3] ASoC: mediatek: mt7986: add sample rate checker Date: Tue, 24 Oct 2023 11:50:19 +0800 Message-ID: <20231024035019.11732-4-maso.huang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231024035019.11732-1-maso.huang@mediatek.com> References: <20231024035019.11732-1-maso.huang@mediatek.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--0.254500-8.000000 X-TMASE-MatchedRID: WkwGkWg/ZspKHSI+NapVgED6z8N1m1ALjZfFaL+4qfbfUZT83lbkEEFN G6vV64NpO3riJykx75rW3uke8Pv2jOF/B1jEjV+6syw+ZJnFumSO7tU+Bv65zZsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNRqXnrxrKCOXCZj5fT4j8U275XnfFOTeSbM3sLfmvJJnL8byqNXfKSxrcR mc7SDNwoCTKY6V6aLxs+jdM0RxJufk5os5jdQqLeFh/bIV6nmTF0aD5ljt43pMcHZD6gqu7wxMj fifIXfowkvVoA11Twp+3BndfXUhXQ== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.254500-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: D6FCDEDC649C83FF83C52FDACE0A28DEEB531C3639EE048AE42732BB07E90FCF2000:8 X-MailFrom: maso.huang@mediatek.com X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: 6BEBQWYCVT2ZRBOR6WQMB3JAPZRX3E6X X-Message-ID-Hash: 6BEBQWYCVT2ZRBOR6WQMB3JAPZRX3E6X X-Mailman-Approved-At: Tue, 24 Oct 2023 08:47:23 +0000 X-Mailman-Version: 3.3.8 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: mt7986 only supports 8/12/16/24/32/48/96/192 kHz Signed-off-by: Maso Huang Reviewed-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 23 +++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c index e523d33846fe..d57971413a04 100644 --- a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c +++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c @@ -237,12 +237,27 @@ static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { + unsigned int rate = params_rate(params); struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); - mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK); - mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE); - - return 0; + switch (rate) { + case 8000: + case 12000: + case 16000: + case 24000: + case 32000: + case 48000: + case 96000: + case 192000: + mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK); + mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE); + return 0; + default: + dev_err(afe->dev, + "Sample rate %d invalid. Supported rates: 8/12/16/24/32/48/96/192 kHz\n", + rate); + return -EINVAL; + } } static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd,