From patchwork Tue Jun 8 00:11:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 455889 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4DADC47082 for ; Tue, 8 Jun 2021 00:13:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AA7AF611BD for ; Tue, 8 Jun 2021 00:13:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA7AF611BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 87DE71696; Tue, 8 Jun 2021 02:12:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87DE71696 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111190; bh=FcqiyY7EK2fXdMUR9aDFm4eutKKdhxiq9DSzSf05/ZM=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PlY+V5nqqpfCFz1y5iLSTRuPuLdKLRI1fVj+uBWyEV6IPA29XNkbbKr4hWqcLdAlH aOH+1GcZHBNGUqVhvg8LWQ48DhavGa/KWu3Ytn7Lokdt+nLOzfC9aaXUgg03M7v4AM hUowvW89yrEplPO9gIfoKR2z2REN0jYz8RCB8438= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0EFC9F8027C; Tue, 8 Jun 2021 02:12:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 338D7F8027C; Tue, 8 Jun 2021 02:12:02 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 4EF45F800DF for ; Tue, 8 Jun 2021 02:11:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4EF45F800DF Date: 08 Jun 2021 09:11:50 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83682260" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 08 Jun 2021 09:11:50 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D7DF5400F781; Tue, 8 Jun 2021 09:11:50 +0900 (JST) Message-ID: <874ke9dxkp.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/9] ASoC: soc-core: don't use discriminatory terms on snd_soc_runtime_get_dai_fmt() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto snd_soc_runtime_get_dai_fmt() is using discriminatory terms. This patch fixup it. Fixes: ba9e82a1c891 ("ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()") Signed-off-by: Kuninori Morimoto --- sound/soc/soc-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4daa9b22b33c..44e65f984a5c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1211,8 +1211,8 @@ static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd) mask |= SND_SOC_DAIFMT_CLOCK_MASK; if (!(dai_link->dai_fmt & SND_SOC_DAIFMT_INV_MASK)) mask |= SND_SOC_DAIFMT_INV_MASK; - if (!(dai_link->dai_fmt & SND_SOC_DAIFMT_MASTER_MASK)) - mask |= SND_SOC_DAIFMT_MASTER_MASK; + if (!(dai_link->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK)) + mask |= SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK; dai_link->dai_fmt |= (dai_fmt & mask); } From patchwork Tue Jun 8 00:11:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AF2BC47094 for ; Tue, 8 Jun 2021 00:13:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C52B161182 for ; Tue, 8 Jun 2021 00:13:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C52B161182 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 3A4AE1695; Tue, 8 Jun 2021 02:12:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3A4AE1695 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111194; bh=ZEknXgrZ1M/GjdB8Anim8RAViofv04Y77DhfoPBJpKs=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rRk/Bkbfj8KBJCG71/v4A4qIbd8Xdwom9fBSTZk60Cv5LbMXCYNvuQFSNiS+J60Dd a9qgKw/i+rrRBOxwXE4S7qRlOERUV9TbFPAKb5g4xZBAybhLbBBNdGLoJD7LrXqt4x kKrRC5YcLw3ifNXIPD85AiLfnsfs5xVPPUK2u77E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BB2ADF8032D; Tue, 8 Jun 2021 02:12:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DB5AAF804BD; Tue, 8 Jun 2021 02:12:08 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 0B661F8026C for ; Tue, 8 Jun 2021 02:12:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0B661F8026C Date: 08 Jun 2021 09:11:59 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83526892" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 08 Jun 2021 09:11:59 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 7CBDC4120ACE; Tue, 8 Jun 2021 09:11:59 +0900 (JST) Message-ID: <8735ttdxkg.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/9] ASoC: soc-core: add snd_soc_daifmt_clock_provider_pickup() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto This patch adds snd_soc_daifmt_clock_provider_pickup() function to judge clock/frame master. This is prepare for snd_soc_of_parse_daifmt() cleanup. Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 1 + sound/soc/soc-core.c | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index e746da996351..e852cfbaf572 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1232,6 +1232,7 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card, int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, const char *propname); int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname); +unsigned int snd_soc_daifmt_clock_provider_pickup(unsigned int bit_frame); unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 44e65f984a5c..2ce73bf77c05 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3017,6 +3017,24 @@ int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname) } EXPORT_SYMBOL_GPL(snd_soc_of_parse_aux_devs); +unsigned int snd_soc_daifmt_clock_provider_pickup(unsigned int bit_frame) +{ + /* Codec base */ + switch (bit_frame) { + case 0x11: + return SND_SOC_DAIFMT_CBP_CFP; + case 0x10: + return SND_SOC_DAIFMT_CBP_CFC; + case 0x01: + return SND_SOC_DAIFMT_CBC_CFP; + default: + return SND_SOC_DAIFMT_CBC_CFC; + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_pickup); + unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, @@ -3115,20 +3133,7 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, if (frame && framemaster) *framemaster = of_parse_phandle(np, prop, 0); - switch ((bit << 4) + frame) { - case 0x11: - format |= SND_SOC_DAIFMT_CBM_CFM; - break; - case 0x10: - format |= SND_SOC_DAIFMT_CBM_CFS; - break; - case 0x01: - format |= SND_SOC_DAIFMT_CBS_CFM; - break; - default: - format |= SND_SOC_DAIFMT_CBS_CFS; - break; - } + format |= snd_soc_daifmt_clock_provider_pickup((bit << 4) + frame); return format; } From patchwork Tue Jun 8 00:12:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 455888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F126C47094 for ; Tue, 8 Jun 2021 00:13:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 50798611BD for ; Tue, 8 Jun 2021 00:13:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 50798611BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 A21F916AD; Tue, 8 Jun 2021 02:12:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A21F916AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111229; bh=dtFGuBCWHIh/TNe4J9+dg55hvJW0mQHKd2MUqeSta8Q=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PNFo4QEKvW+eeoTmGQh0UF4Jk+MnT8CLvEsTEF79C0wBQWPC3kOKQ6cL+g0Zo0aem 7ZCbaPdkBCv+T13PR10s06mwcAt5QDFARm9Hf9M5H+O3pAOfAn25M38Fr/7RyfcMrR fc5ctXV6cCXbVsesIyYBW0aJl2OR205eOB5hM45c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 886AAF804CA; Tue, 8 Jun 2021 02:12:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 03267F804C2; Tue, 8 Jun 2021 02:12:15 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 22258F804C2 for ; Tue, 8 Jun 2021 02:12:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 22258F804C2 Date: 08 Jun 2021 09:12:08 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83682286" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:08 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 9B4B64120AFF; Tue, 8 Jun 2021 09:12:08 +0900 (JST) Message-ID: <871r9ddxk7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/9] ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto Sometimes we want to get CLOCK_PROVIDER fliped dai_fmt. This patch adds new snd_soc_daifmt_clock_provider_fliped() for it. Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 2 ++ sound/soc/soc-core.c | 40 +++++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index e852cfbaf572..0f25d4be92ae 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1232,6 +1232,8 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card, int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, const char *propname); int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname); + +unsigned int snd_soc_daifmt_clock_provider_fliped(unsigned int dai_fmt); unsigned int snd_soc_daifmt_clock_provider_pickup(unsigned int bit_frame); unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2ce73bf77c05..fd5a3b60aeb3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1249,21 +1249,8 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, * Flip the polarity for the "CPU" end of a CODEC<->CODEC link * the component which has non_legacy_dai_naming is Codec */ - inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK; - switch (dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) { - case SND_SOC_DAIFMT_CBM_CFM: - inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; - break; - case SND_SOC_DAIFMT_CBM_CFS: - inv_dai_fmt |= SND_SOC_DAIFMT_CBS_CFM; - break; - case SND_SOC_DAIFMT_CBS_CFM: - inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFS; - break; - case SND_SOC_DAIFMT_CBS_CFS: - inv_dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; - break; - } + inv_dai_fmt = snd_soc_daifmt_clock_provider_fliped(dai_fmt); + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { unsigned int fmt = dai_fmt; @@ -3017,6 +3004,29 @@ int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname) } EXPORT_SYMBOL_GPL(snd_soc_of_parse_aux_devs); +unsigned int snd_soc_daifmt_clock_provider_fliped(unsigned int dai_fmt) +{ + unsigned int inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK; + + switch (dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { + case SND_SOC_DAIFMT_CBP_CFP: + inv_dai_fmt |= SND_SOC_DAIFMT_CBC_CFC; + break; + case SND_SOC_DAIFMT_CBP_CFC: + inv_dai_fmt |= SND_SOC_DAIFMT_CBC_CFP; + break; + case SND_SOC_DAIFMT_CBC_CFP: + inv_dai_fmt |= SND_SOC_DAIFMT_CBP_CFC; + break; + case SND_SOC_DAIFMT_CBC_CFC: + inv_dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; + break; + } + + return inv_dai_fmt; +} +EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_fliped); + unsigned int snd_soc_daifmt_clock_provider_pickup(unsigned int bit_frame) { /* Codec base */ From patchwork Tue Jun 8 00:12:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CDE7C47094 for ; Tue, 8 Jun 2021 00:14:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C24FC61168 for ; Tue, 8 Jun 2021 00:14:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C24FC61168 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 60B8D16B0; Tue, 8 Jun 2021 02:13:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 60B8D16B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111242; bh=GAcxzWAzpAkpv6FFh+jZk8RMvLpD1IWqphcC2JejlEo=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Z+QPHKhaJ7VnCabmaiSOuFSZVs7B3xgwNkHMQLMrRyWF6bPkGXqqxrJWUC/UWk+ji vIRjsLlJqPYubtnytg6quBZwhxwrjsbakOIDdCG+4jjjPht+P68VwYXPPiP1b84eCb zVLQmgAhSky+gVcxPaKh+gqrPoQWgyB5SxP2ErKM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 16001F804BD; Tue, 8 Jun 2021 02:12:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E4200F804CB; Tue, 8 Jun 2021 02:12:29 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 60FEAF8020D for ; Tue, 8 Jun 2021 02:12:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 60FEAF8020D Date: 08 Jun 2021 09:12:24 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83526918" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:24 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 27325400F782; Tue, 8 Jun 2021 09:12:24 +0900 (JST) Message-ID: <87zgw1cizb.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 4/9] ASoC: soc-core: add snd_soc_daifmt_parse_format/clock_provider() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto snd_soc_of_parse_daifmt() parses daifmt, but bitclock/frame provider parsing part is one of headache, because we are assuming below both cases. A) node { bitclock-master; frame-master; ... }; B) link { bitclock-master = <&xxx>; frame-master = <&xxx>; ... }; The original was style A), and style B) was added later by commit b3ca11ff59bc ("ASoC: simple-card: Move dai-link level properties away from dai subnodes"). snd_soc_of_parse_daifmt() parses A) style as original style, and user need to update to B) style for clock_provider part if needed. In such case, user need to re-parse it, like below. daifmt = snd_soc_of_parse_daifmt(..., &bitclkmaster, &framemaster); daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; if (codec == bitclkmaster) daifmt |= (codec == framemaster) ? SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS; else daifmt |= (codec == framemaster) ? SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS; This patch adds new functions which separetes snd_soc_of_parse_daifmt() helper function into parsing format part (= snd_soc_daifmt_parse_format()), and parsing clock_provider part (= snd_soc_daifmt_parse_clock_provider()). User can use snd_soc_daifmt_clock_provider_pickup/fliped() helper function with it. style A) bit_frame = snd_soc_daifmt_parse_clock_provider(); daifmt = snd_soc_daifmt_parse_format(...) | /* format part */ snd_soc_daifmt_clock_provider_pickup(bit_frame); /* clock part */ style B) snd_soc_daifmt_parse_clock_provider(..., &bit, &frame); daifmt = snd_soc_daifmt_parse_format(...) | /* format part */ snd_soc_daifmt_clock_provider_pickup( /* clock part */ ((codec == bit) << 4) + (codec == frame)); Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 6 +++ sound/soc/soc-core.c | 114 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 0f25d4be92ae..f402b259a255 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1235,6 +1235,12 @@ int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname); unsigned int snd_soc_daifmt_clock_provider_fliped(unsigned int dai_fmt); unsigned int snd_soc_daifmt_clock_provider_pickup(unsigned int bit_frame); +unsigned int snd_soc_daifmt_parse_format(struct device_node *np, + const char *prefix); +unsigned int snd_soc_daifmt_parse_clock_provider(struct device_node *np, + const char *prefix, + struct device_node **bitclkmaster, + struct device_node **framemaster); unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index fd5a3b60aeb3..a9cb39c3d8c5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3045,6 +3045,120 @@ unsigned int snd_soc_daifmt_clock_provider_pickup(unsigned int bit_frame) } EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_pickup); +unsigned int snd_soc_daifmt_parse_format(struct device_node *np, + const char *prefix) +{ + int ret, i; + char prop[128]; + unsigned int format = 0; + int bit, frame; + const char *str; + struct { + char *name; + unsigned int val; + } of_fmt_table[] = { + { "i2s", SND_SOC_DAIFMT_I2S }, + { "right_j", SND_SOC_DAIFMT_RIGHT_J }, + { "left_j", SND_SOC_DAIFMT_LEFT_J }, + { "dsp_a", SND_SOC_DAIFMT_DSP_A }, + { "dsp_b", SND_SOC_DAIFMT_DSP_B }, + { "ac97", SND_SOC_DAIFMT_AC97 }, + { "pdm", SND_SOC_DAIFMT_PDM}, + { "msb", SND_SOC_DAIFMT_MSB }, + { "lsb", SND_SOC_DAIFMT_LSB }, + }; + + if (!prefix) + prefix = ""; + + /* + * check "dai-format = xxx" + * or "[prefix]format = xxx" + * SND_SOC_DAIFMT_FORMAT_MASK area + */ + ret = of_property_read_string(np, "dai-format", &str); + if (ret < 0) { + snprintf(prop, sizeof(prop), "%sformat", prefix); + ret = of_property_read_string(np, prop, &str); + } + if (ret == 0) { + for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) { + if (strcmp(str, of_fmt_table[i].name) == 0) { + format |= of_fmt_table[i].val; + break; + } + } + } + + /* + * check "[prefix]continuous-clock" + * SND_SOC_DAIFMT_CLOCK_MASK area + */ + snprintf(prop, sizeof(prop), "%scontinuous-clock", prefix); + if (of_property_read_bool(np, prop)) + format |= SND_SOC_DAIFMT_CONT; + else + format |= SND_SOC_DAIFMT_GATED; + + /* + * check "[prefix]bitclock-inversion" + * check "[prefix]frame-inversion" + * SND_SOC_DAIFMT_INV_MASK area + */ + snprintf(prop, sizeof(prop), "%sbitclock-inversion", prefix); + bit = !!of_get_property(np, prop, NULL); + + snprintf(prop, sizeof(prop), "%sframe-inversion", prefix); + frame = !!of_get_property(np, prop, NULL); + + switch ((bit << 4) + frame) { + case 0x11: + format |= SND_SOC_DAIFMT_IB_IF; + break; + case 0x10: + format |= SND_SOC_DAIFMT_IB_NF; + break; + case 0x01: + format |= SND_SOC_DAIFMT_NB_IF; + break; + default: + /* SND_SOC_DAIFMT_NB_NF is default */ + break; + } + + return format; +} +EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_format); + +unsigned int snd_soc_daifmt_parse_clock_provider(struct device_node *np, + const char *prefix, + struct device_node **bitclkmaster, + struct device_node **framemaster) +{ + char prop[128]; + unsigned int bit, frame; + + if (!prefix) + prefix = ""; + + /* + * check "[prefix]bitclock-master" + * check "[prefix]frame-master" + */ + snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); + bit = !!of_get_property(np, prop, NULL); + if (bit && bitclkmaster) + *bitclkmaster = of_parse_phandle(np, prop, 0); + + snprintf(prop, sizeof(prop), "%sframe-master", prefix); + frame = !!of_get_property(np, prop, NULL); + if (frame && framemaster) + *framemaster = of_parse_phandle(np, prop, 0); + + return (bit << 4) + frame; +} +EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_clock_provider); + unsigned int snd_soc_of_parse_daifmt(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, From patchwork Tue Jun 8 00:12:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 455887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C55C47082 for ; Tue, 8 Jun 2021 00:14:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B3C23611BD for ; Tue, 8 Jun 2021 00:14:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3C23611BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 200811692; Tue, 8 Jun 2021 02:13:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 200811692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111282; bh=6dPkFODJB868haOxvRUIvCnNDsil8VrAcprzLv07IPA=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ee9sR17e94x/MXQKN8pecHwjWTUY9AQqpca3StYi9PFjze+caDyrD9XUPmjeR9XpU VwXB/eOWt2kqYLYXufig4iwk4AJqIr7m+GebW8grNWZgZVItyYUboI9hktxMT5b3fH 8ZmMqNOeZzNmaaM9OAoSQ+LDT6jqjEPz0epasq4g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 41510F804DF; Tue, 8 Jun 2021 02:12:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C8511F804E0; Tue, 8 Jun 2021 02:12:39 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 460F1F804DA for ; Tue, 8 Jun 2021 02:12:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 460F1F804DA Date: 08 Jun 2021 09:12:32 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83682312" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:32 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 0DD41400F782; Tue, 8 Jun 2021 09:12:32 +0900 (JST) Message-ID: <87y2blciz3.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 5/9] ASoC: atmel: switch to use snd_soc_daifmt_parse_format/clock_provider() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from snd_soc_of_parse_daifmt(). Signed-off-by: Kuninori Morimoto --- sound/soc/atmel/mikroe-proto.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/soc/atmel/mikroe-proto.c b/sound/soc/atmel/mikroe-proto.c index f9a85fd01b79..eeb2effed1e4 100644 --- a/sound/soc/atmel/mikroe-proto.c +++ b/sound/soc/atmel/mikroe-proto.c @@ -69,6 +69,7 @@ static int snd_proto_probe(struct platform_device *pdev) struct device_node *bitclkmaster = NULL; struct device_node *framemaster = NULL; unsigned int dai_fmt; + unsigned int bit_frame; int ret = 0; if (!np) { @@ -120,19 +121,18 @@ static int snd_proto_probe(struct platform_device *pdev) dai->cpus->of_node = cpu_np; dai->platforms->of_node = cpu_np; - dai_fmt = snd_soc_of_parse_daifmt(np, NULL, - &bitclkmaster, &framemaster); + bit_frame = snd_soc_daifmt_parse_clock_provider(np, NULL, &bitclkmaster, &framemaster); if (bitclkmaster != framemaster) { dev_err(&pdev->dev, "Must be the same bitclock and frame master\n"); return -EINVAL; } - if (bitclkmaster) { - dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK; - if (codec_np == bitclkmaster) - dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; - else - dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; - } + if (bitclkmaster) + bit_frame = ((codec_np == bitclkmaster) << 4) + + (codec_np == framemaster); + + dai_fmt = snd_soc_daifmt_parse_format(np, NULL) | + snd_soc_daifmt_clock_provider_pickup(bit_frame); + of_node_put(bitclkmaster); of_node_put(framemaster); dai->dai_fmt = dai_fmt; From patchwork Tue Jun 8 00:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59853C47094 for ; Tue, 8 Jun 2021 00:14:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D2A4161182 for ; Tue, 8 Jun 2021 00:14:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2A4161182 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 6E65584D; Tue, 8 Jun 2021 02:14:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6E65584D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111295; bh=JVncMb+TtqMCRvfKH04bSGWSD7lMPj5b3LwqjpZPkSU=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jV34ZGhRXBVb1unoTlBWS0sWmWhK1pstsseu9tg0E7WAQYWWTqvXpqUmSpchRQUAP 1pTIGl0w6+4+RqH6p3XOM9Nd7CjfMt1buIELVtz/ZivCwUQA0SCWiUN3Zu1+Ge7EDe BgWQdZRFCQoCzb3m2ZMvT88TnWN6Lpk7dW2aolv0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E510DF804E1; Tue, 8 Jun 2021 02:12:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 143EAF804E3; Tue, 8 Jun 2021 02:12:44 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 4955EF804D8 for ; Tue, 8 Jun 2021 02:12:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4955EF804D8 Date: 08 Jun 2021 09:12:36 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83682316" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:36 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C509D4120AFF; Tue, 8 Jun 2021 09:12:36 +0900 (JST) Message-ID: <87wnr5ciyz.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 6/9] ASoC: fsl: switch to use snd_soc_daifmt_parse_format/clock_provider() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from snd_soc_of_parse_daifmt(). Signed-off-by: Kuninori Morimoto --- sound/soc/fsl/fsl-asoc-card.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index c62bfd1c3ac7..6a6f098da0dc 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -540,7 +540,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) struct device *codec_dev = NULL; const char *codec_dai_name; const char *codec_dev_name; - unsigned int daifmt; u32 width; int ret; @@ -684,19 +683,12 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) } /* Format info from DT is optional. */ - daifmt = snd_soc_of_parse_daifmt(np, NULL, - &bitclkmaster, &framemaster); - daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + snd_soc_daifmt_parse_clock_provider(np, NULL, &bitclkmaster, &framemaster); if (bitclkmaster || framemaster) { - if (codec_np == bitclkmaster) - daifmt |= (codec_np == framemaster) ? - SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS; - else - daifmt |= (codec_np == framemaster) ? - SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS; - /* Override dai_fmt with value from DT */ - priv->dai_fmt = daifmt; + priv->dai_fmt = snd_soc_daifmt_parse_format(np, NULL) | + snd_soc_daifmt_clock_provider_pickup(((codec_np == bitclkmaster) << 4) + + (codec_np == framemaster)); } /* Change direction according to format */ From patchwork Tue Jun 8 00:12:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 455886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D050C47094 for ; Tue, 8 Jun 2021 00:15:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 80A53611BD for ; Tue, 8 Jun 2021 00:15:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80A53611BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 DBFD3167B; Tue, 8 Jun 2021 02:14:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DBFD3167B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111320; bh=SUh4zdbVL+Vk8YUbkHb8sSI9pDq/7bwAerbLE6Et9xk=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uw+C4x/hMCpQCUjv5qXvZEQLhO+MPwsHran9EMNuq7Ys6u8Sl9NTjPsWj4GodcQeW Qx942XN28MnkhjQJepAlNyESAothnUEyt/9eG0+jd5J5/WL0R6b4YNfR8gSRgWaj/v jF9RXy2ipfu9K3nytWgemZ0QpAZ8D2kQ/4H/Zq1c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7FD26F804E2; Tue, 8 Jun 2021 02:12:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F118AF804E2; Tue, 8 Jun 2021 02:12:44 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 45E4CF804E1 for ; Tue, 8 Jun 2021 02:12:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 45E4CF804E1 Date: 08 Jun 2021 09:12:41 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83682320" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:41 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C264A4120AFD; Tue, 8 Jun 2021 09:12:41 +0900 (JST) Message-ID: <87v96pciyu.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 7/9] ASoC: meson: switch to use snd_soc_daifmt_parse_format/clock_provider() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from snd_soc_of_parse_daifmt(). Signed-off-by: Kuninori Morimoto --- sound/soc/meson/meson-card-utils.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c index 300ac8be46ef..60959e2c71b8 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -119,18 +119,13 @@ unsigned int meson_card_parse_daifmt(struct device_node *node, struct device_node *framemaster = NULL; unsigned int daifmt; - daifmt = snd_soc_of_parse_daifmt(node, "", - &bitclkmaster, &framemaster); - daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + snd_soc_daifmt_parse_clock_provider(node, "", &bitclkmaster, &framemaster); /* If no master is provided, default to cpu master */ - if (!bitclkmaster || bitclkmaster == cpu_node) { - daifmt |= (!framemaster || framemaster == cpu_node) ? - SND_SOC_DAIFMT_CBS_CFS : SND_SOC_DAIFMT_CBS_CFM; - } else { - daifmt |= (!framemaster || framemaster == cpu_node) ? - SND_SOC_DAIFMT_CBM_CFS : SND_SOC_DAIFMT_CBM_CFM; - } + daifmt = snd_soc_daifmt_parse_format(node, "") | + snd_soc_daifmt_clock_provider_pickup( + ((bitclkmaster && bitclkmaster != cpu_node) << 4) + + (framemaster && framemaster != cpu_node)); of_node_put(bitclkmaster); of_node_put(framemaster); From patchwork Tue Jun 8 00:12:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8B6BC47082 for ; Tue, 8 Jun 2021 00:15:36 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5779161182 for ; Tue, 8 Jun 2021 00:15:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5779161182 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 E45D716B8; Tue, 8 Jun 2021 02:14:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E45D716B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111335; bh=qOtSmHow+XzucrEMVi/UqaWzqUKh+BqBjr+ZC/hc2GA=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KgsicqCF9Wu6JmyK9671/aWTFhg/c1UPfKmSea8vKaU+yHIvcrPheOe2dqWtDaU7s trbrYaVnqiYQDed96+uT6SntdkT6oCdFhKHeO73RTJaNCL6sySii/sVyNpjcxXwDj6 RK0bfTksZ63ZGjOyGLg8LCQHNM3DAMK+hVPhvHQc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 627AAF804EB; Tue, 8 Jun 2021 02:12:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43DE2F804ED; Tue, 8 Jun 2021 02:12:54 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 3789FF804EB for ; Tue, 8 Jun 2021 02:12:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3789FF804EB Date: 08 Jun 2021 09:12:47 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83526938" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:47 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id F1760400F781; Tue, 8 Jun 2021 09:12:46 +0900 (JST) Message-ID: <87tum9ciyp.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 8/9] ASoC: simple-card-utils: switch to use snd_soc_daifmt_parse_format/clock_provider() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from snd_soc_of_parse_daifmt(). Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card-utils.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index fa1247f0dda1..de23e6e7f3f3 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -60,10 +60,9 @@ int asoc_simple_parse_daifmt(struct device *dev, struct device_node *bitclkmaster = NULL; struct device_node *framemaster = NULL; unsigned int daifmt; + unsigned int bit_frame; - daifmt = snd_soc_of_parse_daifmt(node, prefix, - &bitclkmaster, &framemaster); - daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + snd_soc_daifmt_parse_clock_provider(node, prefix, &bitclkmaster, &framemaster); if (!bitclkmaster && !framemaster) { /* @@ -73,17 +72,15 @@ int asoc_simple_parse_daifmt(struct device *dev, */ dev_dbg(dev, "Revert to legacy daifmt parsing\n"); - daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) | - (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK); + bit_frame = snd_soc_daifmt_parse_clock_provider(codec, NULL, NULL, NULL); } else { - if (codec == bitclkmaster) - daifmt |= (codec == framemaster) ? - SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS; - else - daifmt |= (codec == framemaster) ? - SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS; + bit_frame = ((codec == bitclkmaster) << 4) + + (codec == framemaster); } + daifmt = snd_soc_daifmt_parse_format(node, prefix) | + snd_soc_daifmt_clock_provider_pickup(bit_frame); + of_node_put(bitclkmaster); of_node_put(framemaster); From patchwork Tue Jun 8 00:12:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 455885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 487B4C47082 for ; Tue, 8 Jun 2021 00:16:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DE73B61168 for ; Tue, 8 Jun 2021 00:16:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE73B61168 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 7B276169D; Tue, 8 Jun 2021 02:15:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7B276169D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623111363; bh=JWuI5VLxlsQR7YKrmhgsjQJPeNNC40WdY07OMdF9njs=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=f/lRWGMjuFD+yyIfl7kKEhbctWZEcdy4LAlGvU3buUikcneqwSGYiCh314tqAgaub dEhpHq0X3WYkwHEfKOK1H1Kvsue9znmbG+DerasKELfqgpoE6i/KpZpOLpyHnvS4DT Og155YrLzedyqPoTxn6qmAIeFIx5ATlfV8wn6vf0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6D8D1F804F3; Tue, 8 Jun 2021 02:12:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8884FF804FA; Tue, 8 Jun 2021 02:12:56 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 7C575F804E7 for ; Tue, 8 Jun 2021 02:12:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7C575F804E7 Date: 08 Jun 2021 09:12:52 +0900 X-IronPort-AV: E=Sophos;i="5.83,256,1616425200"; d="scan'208";a="83682324" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 08 Jun 2021 09:12:52 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 430984003EB4; Tue, 8 Jun 2021 09:12:52 +0900 (JST) Message-ID: <87sg1tciyj.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 9/9] ASoC: soc-core: remove snd_soc_of_parse_daifmt() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Liam Girdwood , Mark Brown In-Reply-To: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> References: <875yypdxlm.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Alexandre Belloni , Timur Tabi , Xiubo Li , Martin Blumenstingl , Shengjiu Wang , Sameer Pujar , Neil Armstrong , Nicolas Ferre , Nicolin Chen , Ludovic Desroches , Kevin Hilman , Codrin Ciubotariu , alsa-devel@alsa-project.org, Fabio Estevam , Jerome Brunet 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" From: Kuninori Morimoto No driver is using snd_soc_of_parse_daifmt(). This patch removes it. Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 4 -- sound/soc/soc-core.c | 104 ------------------------------------------- 2 files changed, 108 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index f402b259a255..75ad899fd84f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1241,10 +1241,6 @@ unsigned int snd_soc_daifmt_parse_clock_provider(struct device_node *np, const char *prefix, struct device_node **bitclkmaster, struct device_node **framemaster); -unsigned int snd_soc_of_parse_daifmt(struct device_node *np, - const char *prefix, - struct device_node **bitclkmaster, - struct device_node **framemaster); int snd_soc_get_dai_id(struct device_node *ep); int snd_soc_get_dai_name(const struct of_phandle_args *args, const char **dai_name); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a9cb39c3d8c5..3009a315a4a6 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3159,110 +3159,6 @@ unsigned int snd_soc_daifmt_parse_clock_provider(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_clock_provider); -unsigned int snd_soc_of_parse_daifmt(struct device_node *np, - const char *prefix, - struct device_node **bitclkmaster, - struct device_node **framemaster) -{ - int ret, i; - char prop[128]; - unsigned int format = 0; - int bit, frame; - const char *str; - struct { - char *name; - unsigned int val; - } of_fmt_table[] = { - { "i2s", SND_SOC_DAIFMT_I2S }, - { "right_j", SND_SOC_DAIFMT_RIGHT_J }, - { "left_j", SND_SOC_DAIFMT_LEFT_J }, - { "dsp_a", SND_SOC_DAIFMT_DSP_A }, - { "dsp_b", SND_SOC_DAIFMT_DSP_B }, - { "ac97", SND_SOC_DAIFMT_AC97 }, - { "pdm", SND_SOC_DAIFMT_PDM}, - { "msb", SND_SOC_DAIFMT_MSB }, - { "lsb", SND_SOC_DAIFMT_LSB }, - }; - - if (!prefix) - prefix = ""; - - /* - * check "dai-format = xxx" - * or "[prefix]format = xxx" - * SND_SOC_DAIFMT_FORMAT_MASK area - */ - ret = of_property_read_string(np, "dai-format", &str); - if (ret < 0) { - snprintf(prop, sizeof(prop), "%sformat", prefix); - ret = of_property_read_string(np, prop, &str); - } - if (ret == 0) { - for (i = 0; i < ARRAY_SIZE(of_fmt_table); i++) { - if (strcmp(str, of_fmt_table[i].name) == 0) { - format |= of_fmt_table[i].val; - break; - } - } - } - - /* - * check "[prefix]continuous-clock" - * SND_SOC_DAIFMT_CLOCK_MASK area - */ - snprintf(prop, sizeof(prop), "%scontinuous-clock", prefix); - if (of_property_read_bool(np, prop)) - format |= SND_SOC_DAIFMT_CONT; - else - format |= SND_SOC_DAIFMT_GATED; - - /* - * check "[prefix]bitclock-inversion" - * check "[prefix]frame-inversion" - * SND_SOC_DAIFMT_INV_MASK area - */ - snprintf(prop, sizeof(prop), "%sbitclock-inversion", prefix); - bit = !!of_get_property(np, prop, NULL); - - snprintf(prop, sizeof(prop), "%sframe-inversion", prefix); - frame = !!of_get_property(np, prop, NULL); - - switch ((bit << 4) + frame) { - case 0x11: - format |= SND_SOC_DAIFMT_IB_IF; - break; - case 0x10: - format |= SND_SOC_DAIFMT_IB_NF; - break; - case 0x01: - format |= SND_SOC_DAIFMT_NB_IF; - break; - default: - /* SND_SOC_DAIFMT_NB_NF is default */ - break; - } - - /* - * check "[prefix]bitclock-master" - * check "[prefix]frame-master" - * SND_SOC_DAIFMT_MASTER_MASK area - */ - snprintf(prop, sizeof(prop), "%sbitclock-master", prefix); - bit = !!of_get_property(np, prop, NULL); - if (bit && bitclkmaster) - *bitclkmaster = of_parse_phandle(np, prop, 0); - - snprintf(prop, sizeof(prop), "%sframe-master", prefix); - frame = !!of_get_property(np, prop, NULL); - if (frame && framemaster) - *framemaster = of_parse_phandle(np, prop, 0); - - format |= snd_soc_daifmt_clock_provider_pickup((bit << 4) + frame); - - return format; -} -EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt); - int snd_soc_get_dai_id(struct device_node *ep) { struct snd_soc_component *component;