diff mbox series

[046/113] ASoC: amd: use snd_pcm_is_playback/capture()

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

Commit Message

Kuninori Morimoto Aug. 5, 2024, 12:38 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/amd/acp-pcm-dma.c           | 24 ++++++++++++------------
 sound/soc/amd/acp/acp-i2s.c           | 24 ++++++++++++------------
 sound/soc/amd/acp/acp-legacy-common.c |  8 ++++----
 sound/soc/amd/acp/acp-platform.c      |  2 +-
 sound/soc/amd/acp/acp-sdw-sof-mach.c  |  4 ++--
 sound/soc/amd/acp/amd.h               |  2 +-
 sound/soc/amd/ps/ps-pdm-dma.c         |  4 ++--
 sound/soc/amd/ps/ps-sdw-dma.c         |  4 ++--
 sound/soc/amd/raven/acp3x-i2s.c       |  8 ++++----
 sound/soc/amd/raven/acp3x-pcm-dma.c   | 10 +++++-----
 sound/soc/amd/raven/acp3x.h           |  2 +-
 sound/soc/amd/renoir/acp3x-pdm-dma.c  |  4 ++--
 sound/soc/amd/vangogh/acp5x-i2s.c     |  8 ++++----
 sound/soc/amd/vangogh/acp5x-pcm-dma.c | 10 +++++-----
 sound/soc/amd/vangogh/acp5x.h         |  2 +-
 sound/soc/amd/yc/acp6x-pdm-dma.c      |  4 ++--
 16 files changed, 60 insertions(+), 60 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index b857e2676fe8c..39d2b1538b27b 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -210,7 +210,7 @@  static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio,
 
 	for (i = 0; i < NUM_DSCRS_PER_CHANNEL; i++) {
 		dmadscr[i].xfer_val = 0;
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(direction)) {
 			dma_dscr_idx = dma_dscr_idx + i;
 			dmadscr[i].dest = sram_bank + (i * (size / 2));
 			dmadscr[i].src = ACP_INTERNAL_APERTURE_WINDOW_0_ADDRESS
@@ -268,7 +268,7 @@  static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size,
 
 	for (i = 0; i < NUM_DSCRS_PER_CHANNEL; i++) {
 		dmadscr[i].xfer_val = 0;
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(direction)) {
 			dma_dscr_idx = dma_dscr_idx + i;
 			dmadscr[i].src = sram_bank  + (i * (size / 2));
 			/* dmadscr[i].dest is unused by hardware. */
@@ -336,7 +336,7 @@  static void config_acp_dma(void __iomem *acp_mmio,
 	acp_pte_config(acp_mmio, rtd->dma_addr, rtd->num_of_pages,
 		       rtd->pte_offset);
 
-	if (rtd->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(rtd->direction)) {
 		ch_acp_sysmem = rtd->ch1;
 		ch_acp_i2s = rtd->ch2;
 	} else {
@@ -779,7 +779,7 @@  static int acp_dma_open(struct snd_soc_component *component,
 	if (!adata)
 		return -ENOMEM;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (intr_data->asic_type) {
 		case CHIP_STONEY:
 			runtime->hw = acp_st_pcm_hardware_playback;
@@ -819,7 +819,7 @@  static int acp_dma_open(struct snd_soc_component *component,
 	    !intr_data->play_i2s_micsp_stream)
 		acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		/*
 		 * For Stoney, Memory gating is disabled,i.e SRAM Banks
 		 * won't be turned off. The default state for SRAM banks is ON.
@@ -861,7 +861,7 @@  static int acp_dma_hw_params(struct snd_soc_component *component,
 		return -EINVAL;
 
 	if (pinfo) {
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			rtd->i2s_instance = pinfo->play_i2s_instance;
 		} else {
 			rtd->i2s_instance = pinfo->cap_i2s_instance;
@@ -871,7 +871,7 @@  static int acp_dma_hw_params(struct snd_soc_component *component,
 	if (adata->asic_type == CHIP_STONEY) {
 		val = acp_reg_read(adata->acp_mmio,
 				   mmACP_I2S_16BIT_RESOLUTION_EN);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			switch (rtd->i2s_instance) {
 			case I2S_BT_INSTANCE:
 				val |= ACP_I2S_BT_16BIT_RESOLUTION_EN;
@@ -898,7 +898,7 @@  static int acp_dma_hw_params(struct snd_soc_component *component,
 			      mmACP_I2S_16BIT_RESOLUTION_EN);
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (rtd->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			rtd->pte_offset = ACP_ST_BT_PLAYBACK_PTE_OFFSET;
@@ -1043,7 +1043,7 @@  static snd_pcm_uframes_t acp_dma_pointer(struct snd_soc_component *component,
 	if (!rtd)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		period_bytes = frames_to_bytes(runtime, runtime->period_size);
 		bytescount = acp_get_byte_count(rtd);
 		if (bytescount >= rtd->bytescount)
@@ -1092,7 +1092,7 @@  static int acp_dma_prepare(struct snd_soc_component *component,
 	if (!rtd)
 		return -EINVAL;
 
-	if (rtd->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(rtd->direction)) {
 		ch_acp_sysmem = rtd->ch1;
 		ch_acp_i2s = rtd->ch2;
 	} else {
@@ -1125,7 +1125,7 @@  static int acp_dma_trigger(struct snd_soc_component *component,
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 	case SNDRV_PCM_TRIGGER_RESUME:
 		rtd->bytescount = acp_get_byte_count(rtd);
-		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+		if (snd_pcm_is_capture(substream)) {
 			if (rtd->capture_channel == CAP_CHANNEL0) {
 				acp_dma_cap_channel_disable(rtd->acp_mmio,
 							    CAP_CHANNEL1);
@@ -1190,7 +1190,7 @@  static int acp_dma_close(struct snd_soc_component *component,
 	struct audio_substream_data *rtd = runtime->private_data;
 	struct audio_drv_data *adata = dev_get_drvdata(component->dev);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (rtd->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			adata->play_i2sbt_stream = NULL;
diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c
index 97258b4cf89b0..eafa6262e6feb 100644
--- a/sound/soc/amd/acp/acp-i2s.c
+++ b/sound/soc/amd/acp/acp-i2s.c
@@ -132,10 +132,10 @@  static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas
 
 	spin_lock_irq(&adata->acp_lock);
 	list_for_each_entry(stream, &adata->stream_list, list) {
-		if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
+		if (tx_mask && snd_pcm_is_playback(stream->dir))
 			adata->tdm_tx_fmt[stream->dai_id - 1] =
 					FRM_LEN | (slots << 15) | (slot_len << 18);
-		else if (rx_mask && stream->dir == SNDRV_PCM_STREAM_CAPTURE)
+		else if (rx_mask && snd_pcm_is_capture(stream->dir))
 			adata->tdm_rx_fmt[stream->dai_id - 1] =
 					FRM_LEN | (slots << 15) | (slot_len << 18);
 	}
@@ -176,7 +176,7 @@  static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (dai->driver->id) {
 		case I2S_BT_INSTANCE:
 			reg_val = ACP_BTTDM_ITER;
@@ -224,7 +224,7 @@  static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_
 	if (adata->tdm_mode) {
 		val = readl(adata->acp_base + reg_val);
 		writel(val | BIT(1), adata->acp_base + reg_val);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			tdm_fmt = adata->tdm_tx_fmt[dai->driver->id - 1];
 		else
 			tdm_fmt = adata->tdm_rx_fmt[dai->driver->id - 1];
@@ -318,7 +318,7 @@  static int acp_i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		stream->bytescount = acp_get_byte_count(adata, stream->dai_id, substream->stream);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			switch (dai->driver->id) {
 			case I2S_BT_INSTANCE:
 				water_val = ACP_BT_TX_INTR_WATERMARK_SIZE;
@@ -379,7 +379,7 @@  static int acp_i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct
 	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)) {
 			switch (dai->driver->id) {
 			case I2S_BT_INSTANCE:
 				reg_val = ACP_BTTDM_ITER;
@@ -444,7 +444,7 @@  static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
 
 	switch (dai->driver->id) {
 	case I2S_SP_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			reg_dma_size = ACP_I2S_TX_DMA_SIZE;
 			acp_fifo_addr = rsrc->sram_pte_offset +
 						SP_PB_FIFO_ADDR_OFFSET;
@@ -464,7 +464,7 @@  static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
 		}
 		break;
 	case I2S_BT_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			reg_dma_size = ACP_BT_TX_DMA_SIZE;
 			acp_fifo_addr = rsrc->sram_pte_offset +
 						BT_PB_FIFO_ADDR_OFFSET;
@@ -485,7 +485,7 @@  static int acp_i2s_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
 		}
 		break;
 	case I2S_HS_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			reg_dma_size = ACP_HS_TX_DMA_SIZE;
 			acp_fifo_addr = rsrc->sram_pte_offset +
 				HS_PB_FIFO_ADDR_OFFSET;
@@ -538,7 +538,7 @@  static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d
 
 	switch (dai->driver->id) {
 	case I2S_SP_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			irq_bit = BIT(I2S_TX_THRESHOLD(rsrc->offset));
 			stream->pte_offset = ACP_SRAM_SP_PB_PTE_OFFSET;
 			stream->fifo_offset = SP_PB_FIFO_ADDR_OFFSET;
@@ -549,7 +549,7 @@  static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d
 		}
 		break;
 	case I2S_BT_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			irq_bit = BIT(BT_TX_THRESHOLD(rsrc->offset));
 			stream->pte_offset = ACP_SRAM_BT_PB_PTE_OFFSET;
 			stream->fifo_offset = BT_PB_FIFO_ADDR_OFFSET;
@@ -560,7 +560,7 @@  static int acp_i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_d
 		}
 		break;
 	case I2S_HS_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			irq_bit = BIT(HS_TX_THRESHOLD(rsrc->offset));
 			stream->pte_offset = ACP_SRAM_HS_PB_PTE_OFFSET;
 			stream->fifo_offset = HS_PB_FIFO_ADDR_OFFSET;
diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c
index 4422cec81e3c4..35cd4b2b86cf2 100644
--- a/sound/soc/amd/acp/acp-legacy-common.c
+++ b/sound/soc/amd/acp/acp-legacy-common.c
@@ -112,7 +112,7 @@  static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
 
 	switch (dai->driver->id) {
 	case I2S_SP_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			reg_dma_size = ACP_I2S_TX_DMA_SIZE;
 			acp_fifo_addr = rsrc->sram_pte_offset +
 					SP_PB_FIFO_ADDR_OFFSET;
@@ -131,7 +131,7 @@  static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
 		}
 		break;
 	case I2S_BT_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			reg_dma_size = ACP_BT_TX_DMA_SIZE;
 			acp_fifo_addr = rsrc->sram_pte_offset +
 					BT_PB_FIFO_ADDR_OFFSET;
@@ -150,7 +150,7 @@  static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
 		}
 		break;
 	case I2S_HS_INSTANCE:
-		if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(dir)) {
 			reg_dma_size = ACP_HS_TX_DMA_SIZE;
 			acp_fifo_addr = rsrc->sram_pte_offset +
 					HS_PB_FIFO_ADDR_OFFSET;
@@ -199,7 +199,7 @@  int restore_acp_i2s_params(struct snd_pcm_substream *substream,
 
 	soc_runtime = snd_soc_substream_to_rtd(substream);
 	dai = snd_soc_rtd_to_cpu(soc_runtime, 0);
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		tdm_fmt = adata->tdm_tx_fmt[stream->dai_id - 1];
 		switch (stream->dai_id) {
 		case I2S_BT_INSTANCE:
diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index 4f409cd09c11c..d4b7355a1d989 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -192,7 +192,7 @@  static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subs
 
 	stream->substream = substream;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		runtime->hw = acp_pcm_hardware_playback;
 	else
 		runtime->hw = acp_pcm_hardware_capture;
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index 3419675e45a98..85f9fcbfe822b 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -450,8 +450,8 @@  static int create_sdw_dailink(struct snd_soc_card *card,
 			cpus[k].dai_name = cpu_name;
 		}
 
-		playback = (stream == SNDRV_PCM_STREAM_PLAYBACK);
-		capture = (stream == SNDRV_PCM_STREAM_CAPTURE);
+		playback = snd_pcm_is_playback(stream);
+		capture  = snd_pcm_is_capture(stream);
 		asoc_sdw_init_dai_link(dev, *dai_links, be_id, name,
 				       playback, capture,
 				       cpus, cpu_dai_num,
diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h
index 87a4813783f91..90b0716e5f2f5 100644
--- a/sound/soc/amd/acp/amd.h
+++ b/sound/soc/amd/acp/amd.h
@@ -253,7 +253,7 @@  static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int
 {
 	u64 byte_count = 0, low = 0, high = 0;
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (dai_id) {
 		case I2S_BT_INSTANCE:
 			high = readl(adata->acp_base + ACP_BT_TX_LINEARPOSITIONCNTR_HIGH);
diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c
index 7bbacbab10950..256271a270286 100644
--- a/sound/soc/amd/ps/ps-pdm-dma.c
+++ b/sound/soc/amd/ps/ps-pdm-dma.c
@@ -193,7 +193,7 @@  static int acp63_pdm_dma_open(struct snd_soc_component *component,
 	if (!pdm_data)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		runtime->hw = acp63_pdm_hardware_capture;
 
 	ret = snd_pcm_hw_constraint_integer(runtime,
@@ -206,7 +206,7 @@  static int acp63_pdm_dma_open(struct snd_soc_component *component,
 
 	acp63_enable_pdm_interrupts(adata);
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		adata->capture_stream = substream;
 
 	pdm_data->acp63_base = adata->acp63_base;
diff --git a/sound/soc/amd/ps/ps-sdw-dma.c b/sound/soc/amd/ps/ps-sdw-dma.c
index 2f630753278dc..0f253912f032e 100644
--- a/sound/soc/amd/ps/ps-sdw-dma.c
+++ b/sound/soc/amd/ps/ps-sdw-dma.c
@@ -228,7 +228,7 @@  static int acp63_sdw_dma_open(struct snd_soc_component *component,
 	if (!stream)
 		return -ENOMEM;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		runtime->hw = acp63_sdw_hardware_playback;
 	else
 		runtime->hw = acp63_sdw_hardware_capture;
@@ -270,7 +270,7 @@  static int acp63_sdw_dma_hw_params(struct snd_soc_component *component,
 		sdw_data->sdw0_dma_stream[stream_id] = substream;
 		water_mark_size_reg = sdw0_dma_ring_buf_reg[stream_id].water_mark_size_reg;
 		acp_ext_intr_cntl_reg = ACP_EXTERNAL_INTR_CNTL;
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			irq_mask = BIT(SDW0_DMA_TX_IRQ_MASK(stream_id));
 		else
 			irq_mask = BIT(SDW0_DMA_RX_IRQ_MASK(stream_id));
diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c
index e7f2a05e802cf..8debcd2487fe6 100644
--- a/sound/soc/amd/raven/acp3x-i2s.c
+++ b/sound/soc/amd/raven/acp3x-i2s.c
@@ -86,7 +86,7 @@  static int acp3x_i2s_hwparams(struct snd_pcm_substream *substream,
 	adata = snd_soc_dai_get_drvdata(dai);
 	pinfo = snd_soc_card_get_drvdata(card);
 	if (pinfo) {
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			rtd->i2s_instance = pinfo->play_i2s_instance;
 		else
 			rtd->i2s_instance = pinfo->cap_i2s_instance;
@@ -110,7 +110,7 @@  static int acp3x_i2s_hwparams(struct snd_pcm_substream *substream,
 	default:
 		return -EINVAL;
 	}
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (rtd->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			reg_val = mmACP_BTTDM_ITER;
@@ -163,7 +163,7 @@  static int acp3x_i2s_trigger(struct snd_pcm_substream *substream,
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		rtd->bytescount = acp_get_byte_count(rtd,
 						substream->stream);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			switch (rtd->i2s_instance) {
 			case I2S_BT_INSTANCE:
 				water_val =
@@ -209,7 +209,7 @@  static int acp3x_i2s_trigger(struct snd_pcm_substream *substream,
 	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)) {
 			switch (rtd->i2s_instance) {
 			case I2S_BT_INSTANCE:
 				reg_val = mmACP_BTTDM_ITER;
diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index 3a50558f67516..0a6d63db2e52f 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -113,7 +113,7 @@  static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
 
 	addr = rtd->dma_addr;
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (rtd->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			val = ACP_SRAM_BT_PB_PTE_OFFSET;
@@ -152,7 +152,7 @@  static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
 		addr += PAGE_SIZE;
 	}
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (rtd->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			reg_dma_size = mmACP_BT_TX_DMA_SIZE;
@@ -222,7 +222,7 @@  static int acp3x_dma_open(struct snd_soc_component *component,
 	if (!i2s_data)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		runtime->hw = acp3x_pcm_hardware_playback;
 	else
 		runtime->hw = acp3x_pcm_hardware_capture;
@@ -261,7 +261,7 @@  static int acp3x_dma_hw_params(struct snd_soc_component *component,
 		return -EINVAL;
 
 	if (pinfo) {
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			rtd->i2s_instance = pinfo->play_i2s_instance;
 			switch (rtd->i2s_instance) {
 			case I2S_BT_INSTANCE:
@@ -334,7 +334,7 @@  static int acp3x_dma_close(struct snd_soc_component *component,
 	if (!ins)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (ins->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			adata->play_stream = NULL;
diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h
index 7702f628ecd68..2200c4f5ebfdd 100644
--- a/sound/soc/amd/raven/acp3x.h
+++ b/sound/soc/amd/raven/acp3x.h
@@ -126,7 +126,7 @@  static inline u64 acp_get_byte_count(struct i2s_stream_instance *rtd,
 {
 	u64 byte_count;
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (rtd->i2s_instance) {
 		case I2S_BT_INSTANCE:
 			byte_count = rv_readl(rtd->acp3x_base +
diff --git a/sound/soc/amd/renoir/acp3x-pdm-dma.c b/sound/soc/amd/renoir/acp3x-pdm-dma.c
index c3b47e9bd2392..0bcd20ec70a6e 100644
--- a/sound/soc/amd/renoir/acp3x-pdm-dma.c
+++ b/sound/soc/amd/renoir/acp3x-pdm-dma.c
@@ -215,7 +215,7 @@  static int acp_pdm_dma_open(struct snd_soc_component *component,
 	if (!pdm_data)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		runtime->hw = acp_pdm_hardware_capture;
 
 	ret = snd_pcm_hw_constraint_integer(runtime,
@@ -228,7 +228,7 @@  static int acp_pdm_dma_open(struct snd_soc_component *component,
 
 	enable_pdm_interrupts(adata->acp_base);
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		adata->capture_stream = substream;
 
 	pdm_data->acp_base = adata->acp_base;
diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c
index 7dbe33f4b8678..9e05816d4f5c1 100644
--- a/sound/soc/amd/vangogh/acp5x-i2s.c
+++ b/sound/soc/amd/vangogh/acp5x-i2s.c
@@ -101,7 +101,7 @@  static int acp5x_i2s_hwparams(struct snd_pcm_substream *substream,
 	adata = snd_soc_dai_get_drvdata(dai);
 	pinfo = snd_soc_card_get_drvdata(card);
 	if (pinfo) {
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			rtd->i2s_instance = pinfo->play_i2s_instance;
 		else
 			rtd->i2s_instance = pinfo->cap_i2s_instance;
@@ -125,7 +125,7 @@  static int acp5x_i2s_hwparams(struct snd_pcm_substream *substream,
 	default:
 		return -EINVAL;
 	}
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (rtd->i2s_instance) {
 		case I2S_HS_INSTANCE:
 			reg_val = ACP_HSTDM_ITER;
@@ -249,7 +249,7 @@  static int acp5x_i2s_trigger(struct snd_pcm_substream *substream,
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		rtd->bytescount = acp_get_byte_count(rtd,
 						     substream->stream);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			switch (rtd->i2s_instance) {
 			case I2S_HS_INSTANCE:
 				water_val =
@@ -297,7 +297,7 @@  static int acp5x_i2s_trigger(struct snd_pcm_substream *substream,
 	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)) {
 			switch (rtd->i2s_instance) {
 			case I2S_HS_INSTANCE:
 				reg_val = ACP_HSTDM_ITER;
diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
index 491b16e52a72a..73b4d879bbfcc 100644
--- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c
+++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c
@@ -108,7 +108,7 @@  static void config_acp5x_dma(struct i2s_stream_instance *rtd, int direction)
 	dma_addr_t addr;
 
 	addr = rtd->dma_addr;
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (rtd->i2s_instance) {
 		case I2S_HS_INSTANCE:
 			val = ACP_SRAM_HS_PB_PTE_OFFSET;
@@ -146,7 +146,7 @@  static void config_acp5x_dma(struct i2s_stream_instance *rtd, int direction)
 		addr += PAGE_SIZE;
 	}
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (rtd->i2s_instance) {
 		case I2S_HS_INSTANCE:
 			reg_dma_size = ACP_HS_TX_DMA_SIZE;
@@ -217,7 +217,7 @@  static int acp5x_dma_open(struct snd_soc_component *component,
 	if (!i2s_data)
 		return -ENOMEM;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		runtime->hw = acp5x_pcm_hardware_playback;
 	else
 		runtime->hw = acp5x_pcm_hardware_capture;
@@ -255,7 +255,7 @@  static int acp5x_dma_hw_params(struct snd_soc_component *component,
 		return -EINVAL;
 
 	if (pinfo) {
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			rtd->i2s_instance = pinfo->play_i2s_instance;
 			switch (rtd->i2s_instance) {
 			case I2S_HS_INSTANCE:
@@ -328,7 +328,7 @@  static int acp5x_dma_close(struct snd_soc_component *component,
 	ins = substream->runtime->private_data;
 	if (!ins)
 		return -EINVAL;
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		switch (ins->i2s_instance) {
 		case I2S_HS_INSTANCE:
 			adata->play_stream = NULL;
diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h
index ac1936a8c43ff..0d08e734f0db6 100644
--- a/sound/soc/amd/vangogh/acp5x.h
+++ b/sound/soc/amd/vangogh/acp5x.h
@@ -154,7 +154,7 @@  static inline u64 acp_get_byte_count(struct i2s_stream_instance *rtd,
 {
 	union acp_dma_count byte_count;
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		switch (rtd->i2s_instance) {
 		case I2S_HS_INSTANCE:
 			byte_count.bcount.high =
diff --git a/sound/soc/amd/yc/acp6x-pdm-dma.c b/sound/soc/amd/yc/acp6x-pdm-dma.c
index 72c4591e451bd..74ecea36e3dd5 100644
--- a/sound/soc/amd/yc/acp6x-pdm-dma.c
+++ b/sound/soc/amd/yc/acp6x-pdm-dma.c
@@ -191,7 +191,7 @@  static int acp6x_pdm_dma_open(struct snd_soc_component *component,
 	if (!pdm_data)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		runtime->hw = acp6x_pdm_hardware_capture;
 
 	ret = snd_pcm_hw_constraint_integer(runtime,
@@ -204,7 +204,7 @@  static int acp6x_pdm_dma_open(struct snd_soc_component *component,
 
 	acp6x_enable_pdm_interrupts(adata->acp6x_base);
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		adata->capture_stream = substream;
 
 	pdm_data->acp6x_base = adata->acp6x_base;