[PATCH 107/113] ASoC: loongson: 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/loongson/loongson_dma.c | 2 +-
 sound/soc/loongson/loongson_i2s.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

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;
-- 
2.43.0





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux