From patchwork Mon Oct 23 09:54:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFzbyBIdWFuZyAo6buD5Yqg56u5KQ==?= X-Patchwork-Id: 13432974 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 BB49AC00A8F for ; Mon, 23 Oct 2023 14:41:02 +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 D0632DEB; Mon, 23 Oct 2023 16:40:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D0632DEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698072055; bh=8OnbphDMvRs+P56TvEvwoKIjoy9LXGdfKcLNCZWOBmI=; 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=Z4o4isVXSoJHmlXPJKtYBB7MqG7JWzkWpqtLxokfZ4Pb/reonj8ftKdJUDOV58ruc qnFbwt3JkIOfeUitOhE+gLf9PUw0K/wXv0yj1CW0SvC0/Phx0Fyu+tj2clcitZ3sU5 MuheH89DZ9PCPoWxCWb3qxs77eiQE0Rchcf9jhcU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B8A7EF80527; Mon, 23 Oct 2023 16:39:39 +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 A6445F804F3; Mon, 23 Oct 2023 16:39:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8D3A2F8060D; Mon, 23 Oct 2023 11:55:29 +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 C8C8AF8060D for ; Mon, 23 Oct 2023 11:55:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C8C8AF8060D 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=YJkkxnr2 X-UUID: 42f44efc718a11ee8051498923ad61e6-20231023 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=knB+uMvpmxTF3yJ9XiU/mohcSPtntRiZjuCKxsC5XOw=; b=YJkkxnr2xN/2G5wdsVd9zoOnumgwPnV/zAmhmOXlaxH0ulYqirZoCBZZPuVL0Na3mxAFwi9WLZ9BJzK8zbjSs52D8Iul7Yz4N/0SqpFAy9ZWVj7bOybXfBqSA6zvFuO2xVQnhfaJ3kINHvZcuuHLNNvhVEzszS2IVm+H8px2YtY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:562cd2e6-56bc-484f-bef2-955635f42848,IP:0,U RL:0,TC:0,Content:0,EDM:-30,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-30 X-CID-META: VersionHash:5f78ec9,CLOUDID:0613a9fb-4a48-46e2-b946-12f04f20af8c,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:2,IP:nil,UR L:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,D KR: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: 42f44efc718a11ee8051498923ad61e6-20231023 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 876049281; Mon, 23 Oct 2023 17:55:13 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 23 Oct 2023 17:55:13 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 23 Oct 2023 17:55:13 +0800 From: Maso Huang To: Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Jaroslav Kysela , Takashi Iwai , , , , CC: Maso Huang Subject: [PATCH 1/2] ASoC: mediatek: mt7986: remove redundant remove function Date: Mon, 23 Oct 2023 17:54:52 +0800 Message-ID: <20231023095453.4860-2-maso.huang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231023095453.4860-1-maso.huang@mediatek.com> References: <20231023095453.4860-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: AFHMBEDQVD3JHGWNSLL3BQGEWX4SOXOB X-Message-ID-Hash: AFHMBEDQVD3JHGWNSLL3BQGEWX4SOXOB X-Mailman-Approved-At: Mon, 23 Oct 2023 14:39:31 +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 redundant remove function of mt7986-wm8960. Signed-off-by: Maso Huang --- sound/soc/mediatek/mt7986/mt7986-wm8960.c | 43 +++++++---------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/sound/soc/mediatek/mt7986/mt7986-wm8960.c b/sound/soc/mediatek/mt7986/mt7986-wm8960.c index 364d13b1c426..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,20 +149,11 @@ 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; } -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 +166,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 Mon Oct 23 09:54:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFzbyBIdWFuZyAo6buD5Yqg56u5KQ==?= X-Patchwork-Id: 13432975 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 340EBC001E0 for ; Mon, 23 Oct 2023 14:41:05 +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 311F0AE8; Mon, 23 Oct 2023 16:40:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 311F0AE8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698072063; bh=RwY3dDLpeAesLaiZlzIUY7BoWh1b7beYCEgejVK43Y8=; 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=ZNwivAj6Cibw5MrKxJbuWZfoR34qpW3OGzxUfYKJI5K44MOgUXHdF4dJP6IMdBmYN e1Q1LFL3pU7xD0VpvOf72Pv4SQ5Vz9TIAMO+30yDRcJSlNsCyR+Pv0z2HqD1Qq7QAW kfpiYh2mX9Y1v4S9dPC3LMGXpRsW0QUH82KEJ13w= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5B6CBF805AA; Mon, 23 Oct 2023 16:39:51 +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 C1F4EF8057B; Mon, 23 Oct 2023 16:39:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 820C6F8061E; Mon, 23 Oct 2023 11:55:30 +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 A1536F8060C for ; Mon, 23 Oct 2023 11:55:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A1536F8060C 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=XA0HCV06 X-UUID: 44c815d8718a11eea33bb35ae8d461a2-20231023 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=Jkw7gW1AVmrX/Nr58wDn+UzhFqI704qvqC+4AjLfSfk=; b=XA0HCV06g16G5cGuD7lwpieNY/w9MmEQD40b36NsbEBaDZcQQJphhre0qOIktGsewPPzD7H2wdInihYEfx0zjMBDwNpWHl39jFMfx6EdO5qrQ+vbnxAGHfHX8jYOxrG9K5BbXP04mFRcZwI9ZpRUevLfxKcXFO9IDyaL+DQemH0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:be9aa962-ec20-4742-a659-0ddef35e5e58,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:c8550b7d-ccd9-4df5-91ce-9df5fea3ae01,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: 44c815d8718a11eea33bb35ae8d461a2-20231023 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1444177331; Mon, 23 Oct 2023 17:55:16 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) 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; Mon, 23 Oct 2023 17:55:15 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 23 Oct 2023 17:55:15 +0800 From: Maso Huang To: Liam Girdwood , Mark Brown , Matthias Brugger , AngeloGioacchino Del Regno , Jaroslav Kysela , Takashi Iwai , , , , CC: Maso Huang Subject: [PATCH 2/2] ASoC: mediatek: mt7986: add sample rate checker Date: Mon, 23 Oct 2023 17:54:53 +0800 Message-ID: <20231023095453.4860-3-maso.huang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20231023095453.4860-1-maso.huang@mediatek.com> References: <20231023095453.4860-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--1.222300-8.000000 X-TMASE-MatchedRID: xvSVK/1RoEatDMl6rQjWQgPZZctd3P4B9DuzN5Up01sOUs4CTUgKyzDK cAWm/vH3OfAiJ/eonC1mJS6k736MTF+1yB6ph7kzngIgpj8eDcAZ1CdBJOsoY8RB0bsfrpPI34T 9cYMsdwzHaTdqG3iWhhuHbDe2QawKVRjg2m4p6wZby31Am35MsCb7uY8ruzzlbTNil8EW6FkBjo g7tEcVQ80AvBonNwk5yqhYRUc589COh+wyNBrFXDJiNuKohDcKzKSG3JdyKAPqtV2AGMNPaiHWP YzouJUy X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.222300-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 4D0FF03452DC1FE5C8A4082C1A7BBA4D960451FB6C3A5B663ADC3AABEF886F3E2000: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: LKNBEJ4BCUNH4EEJZRM4YT5HHYKAEM2U X-Message-ID-Hash: LKNBEJ4BCUNH4EEJZRM4YT5HHYKAEM2U X-Mailman-Approved-At: Mon, 23 Oct 2023 14:39:47 +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 --- sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 22 +++++++++++++++++---- 1 file changed, 18 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..270852ce3dd9 100644 --- a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c +++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c @@ -237,12 +237,26 @@ 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_warn(afe->dev, "%s(), sample rate: %d is not supported\n", __func__, rate); + dev_warn(afe->dev, "%s(), only support 8/12/16/24/32/48/96/192 kHz\n", __func__); + return -EINVAL; + } } static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd,