From patchwork Wed Jun 9 02:14:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456864 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 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 4C0C0C4743D for ; Wed, 9 Jun 2021 02:15:40 +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 6F76561287 for ; Wed, 9 Jun 2021 02:15:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F76561287 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 E247C16CE; Wed, 9 Jun 2021 04:14:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E247C16CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623204938; bh=J/7aGgLansjWS+nprUPaQqsqpDAhoZ8xJCb5z64dp+c=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sKt6EZIHshQWRcYnrRIFc/IlfvTa79hFwLpQktwFhBAzrxcT5C3pElRRNROKpmSGA RgRJ0+KCbtBQ2FEOb1d//HF8pZ3k21C72/t4k9LzDXfEO0MdGlAQkPNFtHblY8JLJB 89Xz1wH7/O79ABaIT48fURprrjEET7HdjFwavFtw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 829BDF8027C; Wed, 9 Jun 2021 04:14:26 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DB0F6F802A0; Wed, 9 Jun 2021 04:14:25 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 1EACFF80276 for ; Wed, 9 Jun 2021 04:14:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1EACFF80276 Date: 09 Jun 2021 11:14:11 +0900 X-IronPort-AV: E=Sophos;i="5.83,259,1616425200"; d="scan'208";a="83661601" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Jun 2021 11:14:11 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 3AEB040116D0; Wed, 9 Jun 2021 11:14:11 +0900 (JST) Message-ID: <87a6nzdbt8.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 2/8] 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: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com> References: <87czsvdc4o.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 ea35e431e04e..45f3da277c5d 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_from_bitmap(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 f271202f4049..0a8143e3fcdb 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_from_bitmap(unsigned int bit_frame) { /* Codec base */ From patchwork Wed Jun 9 02:15:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456863 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 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 AF0A5C4743D for ; Wed, 9 Jun 2021 02:16:43 +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 D94BC60FE4 for ; Wed, 9 Jun 2021 02:16:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D94BC60FE4 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 7F24216CA; Wed, 9 Jun 2021 04:15:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7F24216CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623205001; bh=IyWPpms7kSwKaTM6CaDyAvOZkwFY1fNKbBD8wQ8rU7U=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Rpj6mThxWWUaXXpzer2VRfpdVKBF1ExbIyC/PardO1H8fVtULrzZxh7ipoWw35VLJ HDNN9fEAtNnIXWWpgZrvsJ4shvObZ6XSFvVi/d6/qshd4QNtbW2Wd12MA8R30XK1ZB 3HKRXLkJJC4FSVaRsCaFEstMwIr2ZQaVLYoSirfg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 21694F80276; Wed, 9 Jun 2021 04:15:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9FF2DF802A0; Wed, 9 Jun 2021 04:15:48 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id EA820F80276 for ; Wed, 9 Jun 2021 04:15:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EA820F80276 Date: 09 Jun 2021 11:15:44 +0900 X-IronPort-AV: E=Sophos;i="5.83,259,1616425200"; d="scan'208";a="83815836" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 09 Jun 2021 11:15:44 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 91A9A40116D1; Wed, 9 Jun 2021 11:15:44 +0900 (JST) Message-ID: <877dj3dbqn.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 4/8] 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: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com> References: <87czsvdc4o.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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/soc/atmel/mikroe-proto.c b/sound/soc/atmel/mikroe-proto.c index f9a85fd01b79..5bdba38ec408 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 dai_clk; int ret = 0; if (!np) { @@ -120,22 +121,25 @@ 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); + dai_fmt = snd_soc_daifmt_parse_format(np, NULL); + snd_soc_daifmt_parse_clock_provider_as_phandle(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; + dai_clk = SND_SOC_DAIFMT_CBM_CFM; else - dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; + dai_clk = SND_SOC_DAIFMT_CBS_CFS; + } else { + dai_clk = snd_soc_daifmt_parse_clock_provider_as_flag(np, NULL); } + of_node_put(bitclkmaster); of_node_put(framemaster); - dai->dai_fmt = dai_fmt; + dai->dai_fmt = dai_fmt | dai_clk; of_node_put(codec_np); of_node_put(cpu_np); From patchwork Wed Jun 9 02:16: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: 456862 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 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 CD256C4743D for ; Wed, 9 Jun 2021 02:17:25 +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 4741960FDB for ; Wed, 9 Jun 2021 02:17:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4741960FDB 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 DABBA16CE; Wed, 9 Jun 2021 04:16:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DABBA16CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623205043; bh=rBI8pf6cpCvz8bZSUbL29q/TbzqmktGcosoN4G2lJKI=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=f8G74YpczZjwogJ5h+4BmkOmDKIl93xBBjuX0fPI5826HWiaSEBV7VrA1GpYptbeP h+E/2Hgzn+7Gh3y7K6gXhj3w4jIMSjEWE1/K+64kz4gKyPb5+S/vxaq4FtjIniTC+H kWVy4wqxfwNbhbWzICaNIE/r924OKb39TwatrDV0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7EF84F802DF; Wed, 9 Jun 2021 04:16:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1613DF8032B; Wed, 9 Jun 2021 04:16:32 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 80522F800F4 for ; Wed, 9 Jun 2021 04:16:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 80522F800F4 Date: 09 Jun 2021 11:16:24 +0900 X-IronPort-AV: E=Sophos;i="5.83,259,1616425200"; d="scan'208";a="83815903" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 09 Jun 2021 11:16:24 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 447624003EB4; Wed, 9 Jun 2021 11:16:24 +0900 (JST) Message-ID: <874ke7dbpj.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 6/8] 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: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com> References: <87czsvdc4o.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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c index 300ac8be46ef..779ac282e36d 100644 --- a/sound/soc/meson/meson-card-utils.c +++ b/sound/soc/meson/meson-card-utils.c @@ -118,24 +118,25 @@ unsigned int meson_card_parse_daifmt(struct device_node *node, struct device_node *bitclkmaster = NULL; struct device_node *framemaster = NULL; unsigned int daifmt; + unsigned int daiclk; - daifmt = snd_soc_of_parse_daifmt(node, "", - &bitclkmaster, &framemaster); - daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + daifmt = snd_soc_daifmt_parse_format(node, NULL); + + snd_soc_daifmt_parse_clock_provider_as_phandle(node, NULL, &bitclkmaster, &framemaster); /* If no master is provided, default to cpu master */ if (!bitclkmaster || bitclkmaster == cpu_node) { - daifmt |= (!framemaster || framemaster == cpu_node) ? + daiclk = (!framemaster || framemaster == cpu_node) ? SND_SOC_DAIFMT_CBS_CFS : SND_SOC_DAIFMT_CBS_CFM; } else { - daifmt |= (!framemaster || framemaster == cpu_node) ? + daiclk = (!framemaster || framemaster == cpu_node) ? SND_SOC_DAIFMT_CBM_CFS : SND_SOC_DAIFMT_CBM_CFM; } of_node_put(bitclkmaster); of_node_put(framemaster); - return daifmt; + return daifmt | daiclk; } EXPORT_SYMBOL_GPL(meson_card_parse_daifmt); From patchwork Wed Jun 9 02:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456861 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 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 130A6C4743D for ; Wed, 9 Jun 2021 02:18: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 912C961287 for ; Wed, 9 Jun 2021 02:18:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 912C961287 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 34AF216C8; Wed, 9 Jun 2021 04:17:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 34AF216C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623205091; bh=8Nc3jORATOXtRfYOBfYQLOExfYXKg6uzJlB2HkKtlUA=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jZXiPMSfTz/eU0XvhwX+2KRM7I4+/4y09js4mEdHQvTg9TJ9FO4tp8QFpIMTZzSFg TNO9jds5UCNNvQ3RgtAtrecafiijwPEgpMJTuiHh5/yZCC3Va6uGf+iEf4iBoa7zdQ sHpsIo3jPznIqGXXnPj/vkDY+GRs1fOtyKCnEUC8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4E7CBF80116; Wed, 9 Jun 2021 04:17:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B4EB6F804BD; Wed, 9 Jun 2021 04:17:11 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 7B4CEF80116 for ; Wed, 9 Jun 2021 04:17:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7B4CEF80116 Date: 09 Jun 2021 11:17:07 +0900 X-IronPort-AV: E=Sophos;i="5.83,259,1616425200"; d="scan'208";a="83815950" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 09 Jun 2021 11:17:07 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id F0CD241542FD; Wed, 9 Jun 2021 11:17:06 +0900 (JST) Message-ID: <871r9bdbod.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 8/8] 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: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com> References: <87czsvdc4o.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 63194a8773cd..675849d07284 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1249,10 +1249,6 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, snd_soc_daifmt_clock_provider_from_bitmap( \ snd_soc_daifmt_parse_clock_provider_as_bitmap(np, prefix)) -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 b6790d2a0447..70361e8da258 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_raw(struct device_node *np, } EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_clock_provider_raw); -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_from_bitmap((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; From patchwork Wed Jun 9 05:27:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 456860 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 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 3FB53C47095 for ; Wed, 9 Jun 2021 05:28:46 +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 BC22E611BD for ; Wed, 9 Jun 2021 05:28:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC22E611BD 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 9D92D16C3; Wed, 9 Jun 2021 07:27:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9D92D16C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623216522; bh=EaHG+9z//75KBjsOzvr4mrwE1V4qV7XTSMHsQ0NryJg=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BKgOeSRZ4SQ0BFXLTOM/PSS/cTuGvttdCxVXi6hOksvAuoveK5aPvbDePC7YOtLjl RCSXkfp/5XqaA2x1M7P73BuDa9XWcCwEe4DNGsMNVhYhnQ/pEHPGJ3lwu3dYdqvC/6 579S7PKY/86Ml8YBXvJoGzB9dZ9osoM/KiY78piI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3847FF800F4; Wed, 9 Jun 2021 07:27:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6AAA4F8026C; Wed, 9 Jun 2021 07:27:50 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id F1D7EF800F4 for ; Wed, 9 Jun 2021 07:27:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F1D7EF800F4 Date: 09 Jun 2021 14:27:33 +0900 X-IronPort-AV: E=Sophos;i="5.83,260,1616425200"; d="scan'208";a="83680465" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 09 Jun 2021 14:27:33 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 84BA1418D0D9; Wed, 9 Jun 2021 14:27:33 +0900 (JST) Message-ID: <87y2bjboai.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 9/8] ASoC: soc-core: add comment of return value for snd_soc_daifmt_parse_clock_provider_raw() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Liam Girdwood , Mark Brown In-Reply-To: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com> References: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com> 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 return value from snd_soc_daifmt_parse_clock_provider_raw() will be used at snd_soc_daifmt_clock_provider_from_bitmap(). But it is very difficult to know that without any comments. This patch adds it. Signed-off-by: Kuninori Morimoto --- Hi Mark snd_soc_daifmt_clock_provider_from_bitmap() was used from snd_soc_of_parse_daifmt() too. [8/8] patch removes it, and this patch was postponed until it. But I forgot to include this. Thus this patch has strange numbering [9/8]. sound/soc/soc-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 638dc6beecdd..0fa4966eddfc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3021,6 +3021,11 @@ EXPORT_SYMBOL_GPL(snd_soc_daifmt_clock_provider_fliped); unsigned int snd_soc_daifmt_clock_provider_from_bitmap(unsigned int bit_frame) { + /* + * bit_frame is return value from + * snd_soc_daifmt_parse_clock_provider_raw() + */ + /* Codec base */ switch (bit_frame) { case 0x11: @@ -3149,6 +3154,11 @@ unsigned int snd_soc_daifmt_parse_clock_provider_raw(struct device_node *np, if (frame && framemaster) *framemaster = of_parse_phandle(np, prop, 0); + /* + * return bitmap. + * It will be parameter of + * snd_soc_daifmt_clock_provider_from_bitmap() + */ return (bit << 4) + frame; } EXPORT_SYMBOL_GPL(snd_soc_daifmt_parse_clock_provider_raw);