diff mbox series

[107/113] ASoC: loongson: use snd_pcm_is_playback/capture()

Message ID 87ttfzvlwm.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:44 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/loongson/loongson_dma.c | 2 +-
 sound/soc/loongson/loongson_i2s.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/loongson/loongson_dma.c b/sound/soc/loongson/loongson_dma.c
index 4fcc2868160bb..3a7018cae33e4 100644
--- a/sound/soc/loongson/loongson_dma.c
+++ b/sound/soc/loongson/loongson_dma.c
@@ -176,7 +176,7 @@  static int loongson_pcm_hw_params(struct snd_soc_component *component,
 		desc->daddr = prtd->dma_data->dev_addr;
 
 		desc->cmd = BIT(0);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			desc->cmd |= BIT(12);
 
 		desc->length = period_len >> 2;
diff --git a/sound/soc/loongson/loongson_i2s.c b/sound/soc/loongson/loongson_i2s.c
index d45228a3a558b..6b3a4d57a4b46 100644
--- a/sound/soc/loongson/loongson_i2s.c
+++ b/sound/soc/loongson/loongson_i2s.c
@@ -31,7 +31,7 @@  static int loongson_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			regmap_update_bits(i2s->regmap, LS_I2S_CTRL,
 					   I2S_CTRL_TX_EN | I2S_CTRL_TX_DMA_EN,
 					   I2S_CTRL_TX_EN | I2S_CTRL_TX_DMA_EN);
@@ -43,7 +43,7 @@  static int loongson_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			regmap_update_bits(i2s->regmap, LS_I2S_CTRL,
 					I2S_CTRL_TX_EN | I2S_CTRL_TX_DMA_EN, 0);
 		else
@@ -95,7 +95,7 @@  static int loongson_i2s_hw_params(struct snd_pcm_substream *substream,
 		regmap_read(i2s->regmap, LS_I2S_CFG, &val);
 		val |= (bits << 24);
 		val |= (bclk_ratio << 8);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			val |= (bits << 16);
 		else
 			val |= bits;