All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Timur Tabi <timur@kernel.org>, Xiubo Li <Xiubo.Lee@gmail.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Shengjiu Wang <shengjiu.wang@gmail.com>,
	Sameer Pujar <spujar@nvidia.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Nicolin Chen <nicoleotsuka@gmail.com>,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Codrin Ciubotariu <codrin.ciubotariu@microchip.com>,
	alsa-devel@alsa-project.org, Fabio Estevam <festevam@gmail.com>,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: [PATCH v2 1/8] ASoC: soc-core: add snd_soc_daifmt_clock_provider_from_bitmap()
Date: 09 Jun 2021 11:13:46 +0900	[thread overview]
Message-ID: <87bl8fdbtx.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87czsvdc4o.wl-kuninori.morimoto.gx@renesas.com>

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch adds snd_soc_daifmt_clock_provider_from_bitmap() function
to judge clock/frame master from its bitmap.
This is prepare for snd_soc_of_parse_daifmt() cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 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..ea35e431e04e 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_from_bitmap(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..f271202f4049 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_from_bitmap(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_from_bitmap);
+
 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_from_bitmap((bit << 4) + frame);
 
 	return format;
 }
-- 
2.25.1


  reply	other threads:[~2021-06-09  2:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  2:07 [PATCH v2 0/8] ASoC: tidyup snd_soc_of_parse_daifmt() Kuninori Morimoto
2021-06-09  2:13 ` Kuninori Morimoto [this message]
2021-06-09  2:14 ` [PATCH v2 2/8] ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped() Kuninori Morimoto
2021-06-09  2:15 ` [PATCH v2 3/8] ASoC: soc-core: add snd_soc_daifmt_parse_format/clock_provider() Kuninori Morimoto
2021-06-09  2:15 ` [PATCH v2 4/8] ASoC: atmel: switch to use snd_soc_daifmt_parse_format/clock_provider() Kuninori Morimoto
2021-06-09  2:16 ` [PATCH v2 5/8] ASoC: fsl: " Kuninori Morimoto
2021-06-09  2:16 ` [PATCH v2 6/8] ASoC: meson: " Kuninori Morimoto
2021-06-09  7:11   ` Jerome Brunet
2021-06-09 23:02     ` Kuninori Morimoto
2021-06-09  2:16 ` [PATCH v2 7/8] ASoC: simple-card-utils: " Kuninori Morimoto
2021-06-09  2:17 ` [PATCH v2 8/8] ASoC: soc-core: remove snd_soc_of_parse_daifmt() Kuninori Morimoto
2021-06-09  5:27 ` [PATCH v2 9/8] ASoC: soc-core: add comment of return value for snd_soc_daifmt_parse_clock_provider_raw() Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bl8fdbtx.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=festevam@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=ludovic.desroches@microchip.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=narmstrong@baylibre.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=nicoleotsuka@gmail.com \
    --cc=shengjiu.wang@gmail.com \
    --cc=spujar@nvidia.com \
    --cc=timur@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.