diff mbox series

[069/113] ASoC: google: use snd_pcm_is_playback/capture()

Message ID 87cymnyf77.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series [001/113] ALSA: add snd_pcm_is_playback/capture() macro | expand

Commit Message

Kuninori Morimoto Aug. 5, 2024, 12:40 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/google/chv3-i2s.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/google/chv3-i2s.c b/sound/soc/google/chv3-i2s.c
index 08e558f24af86..1bda70bcf57b3 100644
--- a/sound/soc/google/chv3-i2s.c
+++ b/sound/soc/google/chv3-i2s.c
@@ -142,7 +142,7 @@  static int chv3_dma_open(struct snd_soc_component *component,
 	if (res)
 		return res;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		i2s->rx_substream = substream;
 	else
 		i2s->tx_substream = substream;
@@ -155,7 +155,7 @@  static int chv3_dma_close(struct snd_soc_component *component,
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct chv3_i2s_dev *i2s = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream->pstr->stream))
 		chv3_i2s_wr(i2s, I2S_RX_ENABLE, 0);
 	else
 		chv3_i2s_wr(i2s, I2S_TX_ENABLE, 0);
@@ -208,7 +208,7 @@  static int chv3_dma_prepare(struct snd_soc_component *component,
 	period_bytes = snd_pcm_lib_period_bytes(substream);
 	period_size = substream->runtime->period_size;
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream->pstr->stream)) {
 		chv3_i2s_wr(i2s, I2S_SOFT_RESET, I2S_SOFT_RESET_RX_BIT);
 		chv3_i2s_wr(i2s, I2S_RX_BASE_ADDR, substream->dma_buffer.addr);
 		chv3_i2s_wr(i2s, I2S_RX_BUFFER_SIZE, buffer_bytes);
@@ -237,7 +237,7 @@  static snd_pcm_uframes_t chv3_dma_pointer(struct snd_soc_component *component,
 	frame_bytes = substream->runtime->frame_bits * 8;
 	buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream->pstr->stream)) {
 		idx_bytes = chv3_i2s_rd(i2s, I2S_RX_PRODUCER_IDX);
 	} else {
 		idx_bytes = chv3_i2s_rd(i2s, I2S_TX_CONSUMER_IDX);
@@ -259,7 +259,7 @@  static int chv3_dma_ack(struct snd_soc_component *component,
 	bytes = frames_to_bytes(runtime, runtime->control->appl_ptr);
 	idx = bytes & (snd_pcm_lib_buffer_bytes(substream) - 1);
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream->pstr->stream))
 		chv3_i2s_wr(i2s, I2S_RX_CONSUMER_IDX, idx);
 	else
 		chv3_i2s_wr(i2s, I2S_TX_PRODUCER_IDX, idx);