[PATCH 061/113] ASoC: intel: avs: use snd_pcm_is_playback/capture()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can use snd_pcm_is_playback/capture(). Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 sound/soc/intel/avs/path.c |  2 +-
 sound/soc/intel/avs/pcm.c  | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index f31d5e2caa7b0..dab52a90f4c31 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -171,7 +171,7 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
 
 		if (t->cfg_ext->copier.blob_fmt)
 			fmt = t->cfg_ext->copier.blob_fmt;
-		else if (direction == SNDRV_PCM_STREAM_CAPTURE)
+		else if (snd_pcm_is_capture(direction))
 			fmt = t->in_fmt;
 		else
 			fmt = t->cfg_ext->copier.out_fmt;
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index c76b86254a8b4..df71a0292d4a6 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -40,7 +40,7 @@ avs_dai_find_path_template(struct snd_soc_dai *dai, bool is_fe, int direction)
 	struct snd_soc_dapm_path *dp;
 	enum snd_soc_dapm_direction dir;
 
-	if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(direction)) {
 		dir = is_fe ? SND_SOC_DAPM_DIR_OUT : SND_SOC_DAPM_DIR_IN;
 	} else {
 		dir = is_fe ? SND_SOC_DAPM_DIR_IN : SND_SOC_DAPM_DIR_OUT;
@@ -331,7 +331,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn
 	if (!link)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		snd_hdac_ext_bus_link_clear_stream_id(link, hdac_stream(link_stream)->stream_tag);
 
 	return 0;
@@ -372,7 +372,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
 	if (!link)
 		return -EINVAL;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		snd_hdac_ext_bus_link_set_stream_id(link, hdac_stream(link_stream)->stream_tag);
 
 	ret = avs_dai_prepare(substream, dai);
@@ -695,7 +695,7 @@ static void avs_hda_stream_start(struct hdac_bus *bus, struct hdac_ext_stream *h
 	 * disable L1SEN to avoid sound clipping.
 	 */
 	if (!first_running) {
-		if (hdac_stream(host_stream)->direction == SNDRV_PCM_STREAM_CAPTURE)
+		if (snd_pcm_is_capture(hdac_stream(host_stream)->direction))
 			avs_hda_l1sen_enable(adev, false);
 		snd_hdac_stream_start(hdac_stream(host_stream));
 		return;
@@ -707,7 +707,7 @@ static void avs_hda_stream_start(struct hdac_bus *bus, struct hdac_ext_stream *h
 	 * re-enable L1SEN.
 	 */
 	if (list_entry_is_head(pos, &bus->stream_list, list) &&
-	    first_running->direction == SNDRV_PCM_STREAM_CAPTURE)
+	    snd_pcm_is_capture(first_running->direction))
 		avs_hda_l1sen_enable(adev, true);
 }
 
@@ -733,7 +733,7 @@ static void avs_hda_stream_stop(struct hdac_bus *bus, struct hdac_ext_stream *ho
 	 */
 	if (!first_running) {
 		snd_hdac_stream_stop(hdac_stream(host_stream));
-		if (hdac_stream(host_stream)->direction == SNDRV_PCM_STREAM_CAPTURE)
+		if (snd_pcm_is_capture(hdac_stream(host_stream)->direction))
 			avs_hda_l1sen_enable(adev, true);
 		return;
 	}
@@ -743,7 +743,7 @@ static void avs_hda_stream_stop(struct hdac_bus *bus, struct hdac_ext_stream *ho
 	 * left, disable L1SEN to avoid sound clipping.
 	 */
 	if (list_entry_is_head(pos, &bus->stream_list, list) &&
-	    first_running->direction == SNDRV_PCM_STREAM_CAPTURE)
+	    snd_pcm_is_capture(first_running->direction))
 		avs_hda_l1sen_enable(adev, false);
 
 	snd_hdac_stream_stop(hdac_stream(host_stream));
@@ -1602,7 +1602,7 @@ static int avs_component_hda_open(struct snd_soc_component *component,
 		}
 
 		/* RESUME unsupported for de-coupled HD-Audio capture. */
-		if (dir == SNDRV_PCM_STREAM_CAPTURE)
+		if (snd_pcm_is_capture(dir))
 			hwparams.info &= ~SNDRV_PCM_INFO_RESUME;
 
 		return snd_soc_set_runtime_hwparams(substream, &hwparams);
-- 
2.43.0





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux