diff mbox series

[051/113] ASoC: pxa: use snd_pcm_is_playback/capture()

Message ID 8734njzttx.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/pxa/mmp-sspa.c    | 6 +++---
 sound/soc/pxa/pxa-ssp.c     | 6 +++---
 sound/soc/pxa/pxa2xx-ac97.c | 6 +++---
 sound/soc/pxa/pxa2xx-i2s.c  | 8 ++++----
 4 files changed, 13 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index abfaf3cdf5bb6..229b1ebe720d9 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -266,7 +266,7 @@  static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
 					params_channels(params) * bits);
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		__raw_writel(sspa_ctrl, sspa->tx_base + SSPA_CTL);
 		__raw_writel(0x1, sspa->tx_base + SSPA_FIFO_UL);
 	} else {
@@ -296,7 +296,7 @@  static int mmp_sspa_trigger(struct snd_pcm_substream *substream, int cmd,
 		if (!sspa->running_cnt)
 			mmp_sspa_rx_enable(sspa);
 
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			mmp_sspa_tx_enable(sspa);
 
 		sspa->running_cnt++;
@@ -307,7 +307,7 @@  static int mmp_sspa_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		sspa->running_cnt--;
 
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			mmp_sspa_tx_disable(sspa);
 
 		/* have no capture stream, disable rx port */
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index b8a3cb8b75978..82f91f951619a 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -88,7 +88,7 @@  static int pxa_ssp_startup(struct snd_pcm_substream *substream,
 	dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
 	if (!dma)
 		return -ENOMEM;
-	dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
+	dma->chan_name = snd_pcm_is_playback(substream) ?
 		"tx" : "rx";
 
 	snd_soc_dai_set_dma_data(cpu_dai, substream, dma);
@@ -551,7 +551,7 @@  static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
 	 */
 	pxa_ssp_set_dma_params(ssp,
 		((chn == 2) && (ttsa != 1)) || (width == 32),
-		substream->stream == SNDRV_PCM_STREAM_PLAYBACK, dma_data);
+			       snd_pcm_is_playback(substream), dma_data);
 
 	/* we can only change the settings if the port is not in use */
 	if (pxa_ssp_read_reg(ssp, SSCR0) & SSCR0_SSE)
@@ -683,7 +683,7 @@  static void pxa_ssp_set_running_bit(struct snd_pcm_substream *substream,
 	if (value && (sscr0 & SSCR0_SSE))
 		pxa_ssp_write_reg(ssp, SSCR0, sscr0 & ~SSCR0_SSE);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		if (value)
 			sscr1 |= SSCR1_TSRE;
 		else
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 80e0ea0ec9fb3..9a8e08b30ebfa 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -95,7 +95,7 @@  static int pxa2xx_ac97_hifi_startup(struct snd_pcm_substream *substream,
 {
 	struct snd_dmaengine_dai_dma_data *dma_data;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dma_data = &pxa2xx_ac97_pcm_stereo_out;
 	else
 		dma_data = &pxa2xx_ac97_pcm_stereo_in;
@@ -110,7 +110,7 @@  static int pxa2xx_ac97_aux_startup(struct snd_pcm_substream *substream,
 {
 	struct snd_dmaengine_dai_dma_data *dma_data;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dma_data = &pxa2xx_ac97_pcm_aux_mono_out;
 	else
 		dma_data = &pxa2xx_ac97_pcm_aux_mono_in;
@@ -123,7 +123,7 @@  static int pxa2xx_ac97_aux_startup(struct snd_pcm_substream *substream,
 static int pxa2xx_ac97_mic_startup(struct snd_pcm_substream *substream,
 				   struct snd_soc_dai *cpu_dai)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		return -ENODEV;
 	snd_soc_dai_set_dma_data(cpu_dai, substream,
 				 &pxa2xx_ac97_pcm_mic_mono_in);
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 849fbf176a70f..664116396e8ff 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -163,7 +163,7 @@  static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 	clk_ena = 1;
 	pxa_i2s_wait();
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dma_data = &pxa2xx_i2s_pcm_stereo_out;
 	else
 		dma_data = &pxa2xx_i2s_pcm_stereo_in;
@@ -179,7 +179,7 @@  static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 		writel(readl(i2s_reg_base + SACR0) | (SACR0_RFTH(14) | SACR0_TFTH(1)), i2s_reg_base + SACR0);
 		writel(readl(i2s_reg_base + SACR1) | (pxa_i2s.fmt), i2s_reg_base + SACR1);
 	}
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		writel(readl(i2s_reg_base + SAIMR) | (SAIMR_TFS), i2s_reg_base + SAIMR);
 	else
 		writel(readl(i2s_reg_base + SAIMR) | (SAIMR_RFS), i2s_reg_base + SAIMR);
@@ -218,7 +218,7 @@  static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			writel(readl(i2s_reg_base + SACR1) & (~SACR1_DRPL), i2s_reg_base + SACR1);
 		else
 			writel(readl(i2s_reg_base + SACR1) & (~SACR1_DREC), i2s_reg_base + SACR1);
@@ -240,7 +240,7 @@  static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream,
 				struct snd_soc_dai *dai)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		writel(readl(i2s_reg_base + SACR1) | (SACR1_DRPL), i2s_reg_base + SACR1);
 		writel(readl(i2s_reg_base + SAIMR) & (~SAIMR_TFS), i2s_reg_base + SAIMR);
 	} else {