diff mbox series

[055/113] ASoC: sof: intel: use snd_pcm_is_playback/capture()

Message ID 87wmkvyf8y.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:39 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/sof/intel/hda-dai-ops.c | 2 +-
 sound/soc/sof/intel/hda-dai.c     | 4 ++--
 sound/soc/sof/intel/hda-dsp.c     | 2 +-
 sound/soc/sof/intel/hda-loader.c  | 2 +-
 sound/soc/sof/intel/hda-pcm.c     | 4 ++--
 sound/soc/sof/intel/hda-stream.c  | 6 +++---
 6 files changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-dai-ops.c b/sound/soc/sof/intel/hda-dai-ops.c
index 484c761478853..c00fc981f8059 100644
--- a/sound/soc/sof/intel/hda-dai-ops.c
+++ b/sound/soc/sof/intel/hda-dai-ops.c
@@ -198,7 +198,7 @@  static unsigned int hda_calc_stream_format(struct snd_sof_dev *sdev,
 	unsigned int format_val;
 	unsigned int bits;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		link_bps = codec_dai->driver->playback.sig_bits;
 	else
 		link_bps = codec_dai->driver->capture.sig_bits;
diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index 1c823f9eea570..0b5d3c5693ab0 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -123,7 +123,7 @@  int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_st
 	if (!hlink)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		stream_tag = hdac_stream(hext_stream)->stream_tag;
 		snd_hdac_ext_bus_link_clear_stream_id(hlink, stream_tag);
 	}
@@ -174,7 +174,7 @@  static int hda_link_dma_hw_params(struct snd_pcm_substream *substream,
 	hstream = &hext_stream->hstream;
 	stream_tag = hstream->stream_tag;
 
-	if (hext_stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(hext_stream->hstream.direction))
 		snd_hdac_ext_bus_link_set_stream_id(hlink, stream_tag);
 
 	/* set the hdac_stream in the codec dai */
diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 4c88522d40484..f5be61a6f4ba5 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -542,7 +542,7 @@  static bool hda_dsp_d0i3_streaming_applicable(struct snd_sof_dev *sdev)
 			if (!spcm->stream[dir].d0i3_compatible)
 				return false;
 
-			if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+			if (snd_pcm_is_playback(dir))
 				playback_active = true;
 		}
 	}
diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c
index 75f6240cf3e1d..ec46529974a5e 100644
--- a/sound/soc/sof/intel/hda-loader.c
+++ b/sound/soc/sof/intel/hda-loader.c
@@ -262,7 +262,7 @@  int hda_cl_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
 	int sd_offset = SOF_STREAM_SD_OFFSET(hstream);
 	int ret = 0;
 
-	if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(hstream->direction))
 		ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0);
 	else
 		snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset,
diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c
index f6e24edd7adbe..d5a630da5a218 100644
--- a/sound/soc/sof/intel/hda-pcm.c
+++ b/sound/soc/sof/intel/hda-pcm.c
@@ -237,11 +237,11 @@  int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
 	 * All playback streams are DMI L1 capable, capture streams need
 	 * pause push/release to be disabled
 	 */
-	if (hda_always_enable_dmi_l1 && direction == SNDRV_PCM_STREAM_CAPTURE)
+	if (hda_always_enable_dmi_l1 && snd_pcm_is_capture(direction))
 		runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE;
 
 	if (hda_always_enable_dmi_l1 ||
-	    direction == SNDRV_PCM_STREAM_PLAYBACK ||
+	    snd_pcm_is_playback(direction) ||
 	    spcm->stream[substream->stream].d0i3_compatible)
 		flags |= SOF_HDA_STREAM_DMI_L1_COMPATIBLE;
 
diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c
index 3ac63ce67ab1c..c83b260c35f92 100644
--- a/sound/soc/sof/intel/hda-stream.c
+++ b/sound/soc/sof/intel/hda-stream.c
@@ -33,7 +33,7 @@  EXPORT_SYMBOL_NS(sof_hda_position_quirk, SND_SOC_SOF_INTEL_HDA_COMMON);
 
 static inline const char *hda_hstream_direction_str(struct hdac_stream *hstream)
 {
-	if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(hstream->direction))
 		return "Playback";
 	else
 		return "Capture";
@@ -667,7 +667,7 @@  int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev,
 				SOF_HDA_CL_DMA_SD_INT_MASK);
 
 	/* read FIFO size */
-	if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(hstream->direction)) {
 		hstream->fifo_size =
 			snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR,
 					 sd_offset +
@@ -1030,7 +1030,7 @@  snd_pcm_uframes_t hda_dsp_stream_get_position(struct hdac_stream *hstream,
 		 * is not accurate enough, its update may be completed
 		 * earlier than the data written to DDR.
 		 */
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(direction)) {
 			pos = snd_sof_dsp_read(sdev, HDA_DSP_HDA_BAR,
 					       AZX_REG_VS_SDXDPIB_XBASE +
 					       (AZX_REG_VS_SDXDPIB_XINTERVAL *