diff mbox series

[074/113] ASoC: codecs: wm*: use snd_pcm_is_playback/capture()

Message ID 875xsfyf6c.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New
Headers show
Series ALSA: add snd_pcm_is_playback/capture() macro | expand

Commit Message

Kuninori Morimoto Aug. 5, 2024, 12:41 a.m. UTC
We can use snd_pcm_is_playback/capture(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/codecs/wm2200.c | 4 ++--
 sound/soc/codecs/wm5100.c | 4 ++--
 sound/soc/codecs/wm8350.c | 2 +-
 sound/soc/codecs/wm8580.c | 2 +-
 sound/soc/codecs/wm8900.c | 2 +-
 sound/soc/codecs/wm8940.c | 2 +-
 sound/soc/codecs/wm8960.c | 4 ++--
 sound/soc/codecs/wm8961.c | 4 ++--
 sound/soc/codecs/wm8994.c | 6 +++---
 sound/soc/codecs/wm8995.c | 4 ++--
 sound/soc/codecs/wm8996.c | 4 ++--
 sound/soc/codecs/wm9705.c | 2 +-
 sound/soc/codecs/wm9712.c | 4 ++--
 sound/soc/codecs/wm9713.c | 4 ++--
 14 files changed, 24 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index 841247173d98e..b755be789c4c7 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1749,7 +1749,7 @@  static int wm2200_hw_params(struct snd_pcm_substream *substream,
 
 	lrclk = bclk_rates[bclk] / params_rate(params);
 	dev_dbg(component->dev, "Setting %dHz LRCLK\n", bclk_rates[bclk] / lrclk);
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+	if (snd_pcm_is_playback(substream) ||
 	    wm2200->symmetric_rates)
 		snd_soc_component_update_bits(component, WM2200_AUDIO_IF_1_7,
 				    WM2200_AIF1RX_BCPF_MASK, lrclk);
@@ -1758,7 +1758,7 @@  static int wm2200_hw_params(struct snd_pcm_substream *substream,
 				    WM2200_AIF1TX_BCPF_MASK, lrclk);
 
 	i = (wl << WM2200_AIF1TX_WL_SHIFT) | wl;
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		snd_soc_component_update_bits(component, WM2200_AUDIO_IF_1_9,
 				    WM2200_AIF1RX_WL_MASK |
 				    WM2200_AIF1RX_SLOT_LEN_MASK, i);
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 11bbc94a282c7..b55c90f00ac5e 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1478,7 +1478,7 @@  static int wm5100_hw_params(struct snd_pcm_substream *substream,
 
 	lrclk = bclk_rates[bclk] / params_rate(params);
 	dev_dbg(component->dev, "Setting %dHz LRCLK\n", bclk_rates[bclk] / lrclk);
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+	if (snd_pcm_is_playback(substream) ||
 	    wm5100->aif_symmetric[dai->id])
 		snd_soc_component_update_bits(component, base + 7,
 				    WM5100_AIF1RX_BCPF_MASK, lrclk);
@@ -1487,7 +1487,7 @@  static int wm5100_hw_params(struct snd_pcm_substream *substream,
 				    WM5100_AIF1TX_BCPF_MASK, lrclk);
 
 	i = (wl << WM5100_AIF1TX_WL_SHIFT) | fl;
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		snd_soc_component_update_bits(component, base + 9,
 				    WM5100_AIF1RX_WL_MASK |
 				    WM5100_AIF1RX_SLOT_LEN_MASK, i);
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 66bd281095e1c..05178509bdfab 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -931,7 +931,7 @@  static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
 	/* The sloping stopband filter is recommended for use with
 	 * lower sample rates to improve performance.
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		if (params_rate(params) < 24000)
 			wm8350_set_bits(wm8350, WM8350_DAC_MUTE_VOLUME,
 					WM8350_DAC_SB_FILT);
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 73a8edc797fb2..f00c3c1e62332 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -576,7 +576,7 @@  static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
 	dev_dbg(component->dev, "Running at %dfs with %dHz clock\n",
 		wm8580_sysclk_ratios[i], wm8580->sysclk[dai->driver->id]);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (ratio) {
 		case 128:
 		case 192:
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index e44fdf97796f3..f084143c8171e 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -649,7 +649,7 @@  static int wm8900_hw_params(struct snd_pcm_substream *substream,
 
 	snd_soc_component_write(component, WM8900_REG_AUDIO1, reg);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		reg = snd_soc_component_read(component, WM8900_REG_DACCTRL);
 
 		if (params_rate(params) <= 24000)
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 8a532f7d750c8..cda6c4d8e129b 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -408,7 +408,7 @@  static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 
 	/* LoutR control */
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE
+	if (snd_pcm_is_capture(substream)
 	    && params_channels(params) == 2)
 		iface |= (1 << 9);
 
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 00858b9c95686..9ba1edd5ba9a9 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -833,7 +833,7 @@  static int wm8960_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_component *component = dai->component;
 	struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
 	u16 iface = snd_soc_component_read(component, WM8960_IFACE1) & 0xfff3;
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	int i;
 
 	wm8960->bclk = snd_soc_params_to_bclk(params);
@@ -891,7 +891,7 @@  static int wm8960_hw_free(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_component *component = dai->component;
 	struct wm8960_priv *wm8960 = snd_soc_component_get_drvdata(component);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 
 	wm8960->is_stream_in_use[tx] = false;
 
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index d1c731e25777b..6b0e1f76358ec 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -531,12 +531,12 @@  static int wm8961_hw_params(struct snd_pcm_substream *substream,
 	/* Select a CLK_SYS/fs ratio equal to or higher than required */
 	target = wm8961->sysclk / fs;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && target < 64) {
+	if (snd_pcm_is_playback(substream) && target < 64) {
 		dev_err(component->dev,
 			"SYSCLK must be at least 64*fs for DAC\n");
 		return -EINVAL;
 	}
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && target < 256) {
+	if (snd_pcm_is_capture(substream) && target < 256) {
 		dev_err(component->dev,
 			"SYSCLK must be at least 256*fs for ADC\n");
 		return -EINVAL;
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index a99908582a50a..d4adbefae32be 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -2934,7 +2934,7 @@  static int wm8994_hw_params(struct snd_pcm_substream *substream,
 		aif2_reg = WM8994_AIF1_CONTROL_2;
 		bclk_reg = WM8994_AIF1_BCLK;
 		rate_reg = WM8994_AIF1_RATE;
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+		if (snd_pcm_is_playback(substream) ||
 		    wm8994->lrclk_shared[0]) {
 			lrclk_reg = WM8994_AIF1DAC_LRCLK;
 		} else {
@@ -2947,7 +2947,7 @@  static int wm8994_hw_params(struct snd_pcm_substream *substream,
 		aif2_reg = WM8994_AIF2_CONTROL_2;
 		bclk_reg = WM8994_AIF2_BCLK;
 		rate_reg = WM8994_AIF2_RATE;
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+		if (snd_pcm_is_playback(substream) ||
 		    wm8994->lrclk_shared[1]) {
 			lrclk_reg = WM8994_AIF2DAC_LRCLK;
 		} else {
@@ -3069,7 +3069,7 @@  static int wm8994_hw_params(struct snd_pcm_substream *substream,
 	snd_soc_component_update_bits(component, rate_reg, WM8994_AIF1_SR_MASK |
 			    WM8994_AIF1CLK_RATE_MASK, rate_val);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (dai->id) {
 		case 1:
 			wm8994->dac_rates[0] = params_rate(params);
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 1f9a9b6369350..2c2074b9a6bdf 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -1563,7 +1563,7 @@  static int wm8995_hw_params(struct snd_pcm_substream *substream,
 		aif1_reg = WM8995_AIF1_CONTROL_1;
 		bclk_reg = WM8995_AIF1_BCLK;
 		rate_reg = WM8995_AIF1_RATE;
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK /* ||
+		if (snd_pcm_is_playback(substream) /* ||
 			wm8995->lrclk_shared[0] */) {
 			lrclk_reg = WM8995_AIF1DAC_LRCLK;
 		} else {
@@ -1575,7 +1575,7 @@  static int wm8995_hw_params(struct snd_pcm_substream *substream,
 		aif1_reg = WM8995_AIF2_CONTROL_1;
 		bclk_reg = WM8995_AIF2_BCLK;
 		rate_reg = WM8995_AIF2_RATE;
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK /* ||
+		if (snd_pcm_is_playback(substream) /* ||
 		    wm8995->lrclk_shared[1] */) {
 			lrclk_reg = WM8995_AIF2DAC_LRCLK;
 		} else {
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 5c06cea09bd18..d9c0bd6b09925 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -1740,7 +1740,7 @@  static int wm8996_hw_params(struct snd_pcm_substream *substream,
 
 	switch (dai->id) {
 	case 0:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+		if (snd_pcm_is_playback(substream) ||
 		    (snd_soc_component_read(component, WM8996_GPIO_1)) & WM8996_GP1_FN_MASK) {
 			aifdata_reg = WM8996_AIF1RX_DATA_CONFIGURATION;
 			lrclk_reg = WM8996_AIF1_RX_LRCLK_1;
@@ -1751,7 +1751,7 @@  static int wm8996_hw_params(struct snd_pcm_substream *substream,
 		dsp_shift = 0;
 		break;
 	case 1:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
+		if (snd_pcm_is_playback(substream) ||
 		    (snd_soc_component_read(component, WM8996_GPIO_2)) & WM8996_GP2_FN_MASK) {
 			aifdata_reg = WM8996_AIF2RX_DATA_CONFIGURATION;
 			lrclk_reg = WM8996_AIF2_RX_LRCLK_1;
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index 5c6aebe29cf13..97f3c9c7a4413 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -236,7 +236,7 @@  static int ac97_prepare(struct snd_pcm_substream *substream,
 
 	snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		reg = AC97_PCM_FRONT_DAC_RATE;
 	else
 		reg = AC97_PCM_LR_ADC_RATE;
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index e63921de0c37a..d3a190c06ea9c 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -529,7 +529,7 @@  static int ac97_prepare(struct snd_pcm_substream *substream,
 
 	snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		reg = AC97_PCM_FRONT_DAC_RATE;
 	else
 		reg = AC97_PCM_LR_ADC_RATE;
@@ -546,7 +546,7 @@  static int ac97_aux_prepare(struct snd_pcm_substream *substream,
 	snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x1, 0x1);
 	snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000);
 
-	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+	if (!snd_pcm_is_playback(substream))
 		return -ENODEV;
 
 	return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate);
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 64b69316e4c70..bf2824be4f0d4 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1032,7 +1032,7 @@  static int ac97_hifi_prepare(struct snd_pcm_substream *substream,
 
 	snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		reg = AC97_PCM_FRONT_DAC_RATE;
 	else
 		reg = AC97_PCM_LR_ADC_RATE;
@@ -1049,7 +1049,7 @@  static int ac97_aux_prepare(struct snd_pcm_substream *substream,
 	snd_soc_component_update_bits(component, AC97_EXTENDED_STATUS, 0x0001, 0x0001);
 	snd_soc_component_update_bits(component, AC97_PCI_SID, 0x8000, 0x8000);
 
-	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+	if (!snd_pcm_is_playback(substream))
 		return -ENODEV;
 
 	return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate);