[PATCH 049/113] ASoC: fsl: 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/fsl/fsl-asoc-card.c    |  2 +-
 sound/soc/fsl/fsl_asrc.c         |  2 +-
 sound/soc/fsl/fsl_asrc_dma.c     |  8 ++++----
 sound/soc/fsl/fsl_audmix.c       |  2 +-
 sound/soc/fsl/fsl_dma.c          | 10 +++++-----
 sound/soc/fsl/fsl_easrc.c        |  2 +-
 sound/soc/fsl/fsl_esai.c         |  4 ++--
 sound/soc/fsl/fsl_qmc_audio.c    | 10 +++++-----
 sound/soc/fsl/fsl_sai.c          |  8 ++++----
 sound/soc/fsl/fsl_spdif.c        |  8 ++++----
 sound/soc/fsl/fsl_ssi.c          |  6 +++---
 sound/soc/fsl/fsl_xcvr.c         |  8 ++++----
 sound/soc/fsl/imx-audmix.c       |  4 ++--
 sound/soc/fsl/imx-hdmi.c         |  2 +-
 sound/soc/fsl/imx-pcm-fiq.c      |  8 ++++----
 sound/soc/fsl/imx-pcm-rpmsg.c    | 24 ++++++++++++------------
 sound/soc/fsl/lpc3xxx-i2s.c      | 10 +++++-----
 sound/soc/fsl/mpc5200_dma.c      | 10 +++++-----
 sound/soc/fsl/mpc5200_dma.h      |  2 +-
 sound/soc/fsl/mpc5200_psc_ac97.c |  2 +-
 20 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index f6c3aeff0d8ea..29f32bf65c19f 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -171,7 +171,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	struct codec_priv *codec_priv;
 	struct snd_soc_dai *codec_dai;
 	struct cpu_priv *cpu_priv = &priv->cpu_priv;
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index b793263291dc8..42d08db984e17 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -719,7 +719,7 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
 	config.pair = pair->index;
 	config.channel_num = channels;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		config.input_format   = params_format(params);
 		config.output_format  = asrc->asrc_format;
 		config.input_sample_rate  = rate;
diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index f501f47242fb0..abde5badf8383 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -55,7 +55,7 @@ static void fsl_asrc_dma_complete(void *arg)
 static int fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream,
 					   struct snd_soc_component *component)
 {
-	u8 dir = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? OUT : IN;
+	u8 dir = snd_pcm_is_playback(substream) ? OUT : IN;
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct fsl_asrc_pair *pair = runtime->private_data;
 	struct device *dev = component->dev;
@@ -131,7 +131,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
 	enum dma_slave_buswidth buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
 	enum sdma_peripheral_type be_peripheral_type = IMX_DMATYPE_SSI;
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	struct snd_dmaengine_dai_dma_data *dma_params_fe = NULL;
 	struct snd_dmaengine_dai_dma_data *dma_params_be = NULL;
 	struct snd_pcm_runtime *runtime = substream->runtime;
@@ -308,7 +308,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
 static int fsl_asrc_dma_hw_free(struct snd_soc_component *component,
 				struct snd_pcm_substream *substream)
 {
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct fsl_asrc_pair *pair = runtime->private_data;
 	u8 dir = tx ? OUT : IN;
@@ -329,7 +329,7 @@ static int fsl_asrc_dma_hw_free(struct snd_soc_component *component,
 static int fsl_asrc_dma_startup(struct snd_soc_component *component,
 				struct snd_pcm_substream *substream)
 {
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_dmaengine_dai_dma_data *dma_data;
diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
index 1671a3037c604..1ee3f8f919695 100644
--- a/sound/soc/fsl/fsl_audmix.c
+++ b/sound/soc/fsl/fsl_audmix.c
@@ -283,7 +283,7 @@ static int fsl_audmix_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 	unsigned long lock_flags;
 
 	/* Capture stream shall not be handled */
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream))
 		return 0;
 
 	switch (cmd) {
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index c4bc9395dff7d..6754ea7372da0 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -166,7 +166,7 @@ static void fsl_dma_update_pointers(struct fsl_dma_private *dma_private)
 	 * system, we also need to update the ESAD bits.  We also set (keep) the
 	 * snoop bits.  See the comments in fsl_dma_hw_params() about snooping.
 	 */
-	if (dma_private->substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(dma_private->substream)) {
 		link->source_addr = cpu_to_be32(dma_private->dma_buf_next);
 #ifdef CONFIG_PHYS_64BIT
 		link->source_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP |
@@ -395,7 +395,7 @@ static int fsl_dma_open(struct snd_soc_component *component,
 		dev_err(dev, "can't allocate dma private data\n");
 		return -ENOMEM;
 	}
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		dma_private->ssi_sxx_phys = dma->ssi_stx_phys;
 	else
 		dma_private->ssi_sxx_phys = dma->ssi_srx_phys;
@@ -473,7 +473,7 @@ static int fsl_dma_open(struct snd_soc_component *component,
 
 	/* For playback, we want the destination address to be held.  For
 	   capture, set the source address to be held. */
-	mr |= (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+	mr |= (snd_pcm_is_playback(substream)) ?
 		CCSR_DMA_MR_DAHE : CCSR_DMA_MR_SAHE;
 
 	out_be32(&dma_channel->mr, mr);
@@ -633,7 +633,7 @@ static int fsl_dma_hw_params(struct snd_soc_component *component,
 		 * get more performance by not snooping, and you'll still be
 		 * okay.  You'll need to update fsl_dma_update_pointers() also.
 		 */
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			link->source_addr = cpu_to_be32(temp_addr);
 			link->source_attr = cpu_to_be32(CCSR_DMA_ATR_SNOOP |
 				upper_32_bits(temp_addr));
@@ -683,7 +683,7 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_soc_component *component,
 	 * only have 32-bit DMA addresses.  This function is typically called
 	 * in interrupt context, so we need to optimize it.
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		position = in_be32(&dma_channel->sar);
 #ifdef CONFIG_PHYS_64BIT
 		position |= (u64)(in_be32(&dma_channel->satr) &
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 962f309120918..ba577bd9ab477 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1461,7 +1461,7 @@ static int fsl_easrc_hw_params(struct snd_pcm_substream *substream,
 	 * Set the input and output ratio so we can compute
 	 * the resampling ratio in RS_LOW/HIGH
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ctx_priv->in_params.sample_rate = rate;
 		ctx_priv->in_params.sample_format = format;
 		ctx_priv->out_params.sample_rate = easrc->asrc_rate;
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index d0d8a01da9bdd..000abee37d0da 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -537,7 +537,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
 			      struct snd_soc_dai *dai)
 {
 	struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	u32 width = params_width(params);
 	u32 channels = params_channels(params);
 	u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
@@ -758,7 +758,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
 			    struct snd_soc_dai *dai)
 {
 	struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	unsigned long lock_flags;
 
 	esai_priv->channels[tx] = substream->runtime->channels;
diff --git a/sound/soc/fsl/fsl_qmc_audio.c b/sound/soc/fsl/fsl_qmc_audio.c
index 8668abd352080..bc7eef100c8ad 100644
--- a/sound/soc/fsl/fsl_qmc_audio.c
+++ b/sound/soc/fsl/fsl_qmc_audio.c
@@ -250,7 +250,7 @@ static int qmc_audio_pcm_trigger(struct snd_soc_component *component,
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		bitmap_zero(prtd->chans_pending, 64);
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			for (i = 0; i < prtd->channels; i++)
 				prtd->qmc_dai->chans[i].prtd_tx = prtd;
 
@@ -513,7 +513,7 @@ static int qmc_dai_constraints_interleaved(struct snd_pcm_substream *substream,
 	u64 access;
 	int ret;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		hw_rule_channels_by_format = qmc_dai_hw_rule_capture_channels_by_format;
 		hw_rule_format_by_channels = qmc_dai_hw_rule_capture_format_by_channels;
 		frame_bits = qmc_dai->nb_rx_ts * 8;
@@ -566,7 +566,7 @@ static int qmc_dai_constraints_noninterleaved(struct snd_pcm_substream *substrea
 	u64 access;
 	int ret;
 
-	frame_bits = (substream->stream == SNDRV_PCM_STREAM_CAPTURE) ?
+	frame_bits = snd_pcm_is_capture(substream) ?
 			qmc_dai->nb_rx_ts * 8 : qmc_dai->nb_tx_ts * 8;
 	ret = snd_pcm_hw_constraint_single(substream->runtime,
 					   SNDRV_PCM_HW_PARAM_FRAME_BITS,
@@ -637,7 +637,7 @@ static int qmc_dai_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		chan_param.mode = QMC_TRANSPARENT;
 		chan_param.transp.max_rx_buf_size = params_period_bytes(params) / nb_chans_used;
 		for (i = 0; i < nb_chans_used; i++) {
@@ -672,7 +672,7 @@ static int qmc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		direction = QMC_CHAN_WRITE;
 		nb_chans_used = qmc_dai->nb_chans_used_tx;
 	} else {
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index d03b0172b8ad2..c0bc992e22b5f 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -525,7 +525,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
 {
 	struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
 	unsigned int ofs = sai->soc_data->reg_offset;
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	unsigned int channels = params_channels(params);
 	struct snd_dmaengine_dai_dma_data *dma_params;
 	struct fsl_sai_dl_cfg *dl_cfg = sai->dl_cfg;
@@ -721,7 +721,7 @@ static int fsl_sai_hw_free(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *cpu_dai)
 {
 	struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	unsigned int ofs = sai->soc_data->reg_offset;
 
 	/* Clear xMR to avoid channel swap with mclk_with_tere enabled case */
@@ -783,7 +783,7 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
 	unsigned int ofs = sai->soc_data->reg_offset;
 
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	int adir = tx ? RX : TX;
 	int dir = tx ? TX : RX;
 	u32 xcsr;
@@ -868,7 +868,7 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *cpu_dai)
 {
 	struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	int ret;
 
 	/*
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index a63121c888e02..d860e54b1f5e6 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -622,7 +622,7 @@ static int fsl_spdif_startup(struct snd_pcm_substream *substream,
 		regmap_update_bits(regmap, REG_SPDIF_SIE, 0xffffff, 0);
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		scr = SCR_TXFIFO_AUTOSYNC | SCR_TXFIFO_CTRL_NORMAL |
 			SCR_TXSEL_NORMAL | SCR_USRC_SEL_CHIP |
 			SCR_TXFIFO_FSEL_IF8;
@@ -650,7 +650,7 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream,
 	struct regmap *regmap = spdif_priv->regmap;
 	u32 scr, mask;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		scr = 0;
 		mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK |
 			SCR_TXSEL_MASK | SCR_USRC_SEL_MASK |
@@ -706,7 +706,7 @@ static int fsl_spdif_hw_params(struct snd_pcm_substream *substream,
 	u32 sample_rate = params_rate(params);
 	int ret = 0;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = spdif_reparent_rootclk(spdif_priv, sample_rate);
 		if (ret) {
 			dev_err(&pdev->dev, "%s: reparent root clk failed: %d\n",
@@ -737,7 +737,7 @@ static int fsl_spdif_trigger(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
 	struct regmap *regmap = spdif_priv->regmap;
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	u32 intr = SIE_INTR_FOR(tx);
 	u32 dmaen = SCR_DMA_xX_EN(tx);
 
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 4ca3a16f7ac0d..ad02a9e0154ac 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -680,7 +680,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
 			    struct snd_soc_dai *dai,
 			    struct snd_pcm_hw_params *hw_params)
 {
-	bool tx2, tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx2, tx = snd_pcm_is_playback(substream);
 	struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(dai);
 	struct regmap *regs = ssi->regs;
 	u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
@@ -805,7 +805,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_pcm_hw_params *hw_params,
 			     struct snd_soc_dai *dai)
 {
-	bool tx2, tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx2, tx = snd_pcm_is_playback(substream);
 	struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(dai);
 	struct fsl_ssi_regvals *vals = ssi->regvals;
 	struct regmap *regs = ssi->regs;
@@ -1109,7 +1109,7 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 {
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index bf9a4e90978ef..f89f778a0d89a 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -437,7 +437,7 @@ static int fsl_xcvr_prepare(struct snd_pcm_substream *substream,
 			    struct snd_soc_dai *dai)
 {
 	struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	u32 m_ctl = 0, v_ctl = 0;
 	u32 r = substream->runtime->rate, ch = substream->runtime->channels;
 	u32 fout = 32 * r * ch * 10;
@@ -562,7 +562,7 @@ static int fsl_xcvr_startup(struct snd_pcm_substream *substream,
 			    struct snd_soc_dai *dai)
 {
 	struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	int ret = 0;
 
 	if (xcvr->streams & BIT(substream->stream)) {
@@ -614,7 +614,7 @@ static void fsl_xcvr_shutdown(struct snd_pcm_substream *substream,
 			      struct snd_soc_dai *dai)
 {
 	struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	u32 mask = 0, val = 0;
 	int ret;
 
@@ -662,7 +662,7 @@ static int fsl_xcvr_trigger(struct snd_pcm_substream *substream, int cmd,
 			    struct snd_soc_dai *dai)
 {
 	struct fsl_xcvr *xcvr = snd_soc_dai_get_drvdata(dai);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	int ret;
 
 	switch (cmd) {
diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index 6fbcf33fd0dea..8e03eadc33888 100644
--- a/sound/soc/fsl/imx-audmix.c
+++ b/sound/soc/fsl/imx-audmix.c
@@ -74,7 +74,7 @@ static int imx_audmix_fe_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct device *dev = rtd->card->dev;
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
 	u32 channels = params_channels(params);
 	int ret, dir;
@@ -113,7 +113,7 @@ static int imx_audmix_be_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct device *dev = rtd->card->dev;
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	unsigned int fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF;
 	int ret;
 
diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
index fe47b439a8183..b6ce395f91bbf 100644
--- a/sound/soc/fsl/imx-hdmi.c
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -34,7 +34,7 @@ static int imx_hdmi_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
 	struct imx_hdmi_data *data = snd_soc_card_get_drvdata(rtd->card);
-	bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
+	bool tx = snd_pcm_is_playback(substream);
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
 	struct snd_soc_card *card = rtd->card;
 	struct device *dev = card->dev;
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 3391430e42532..9005150012c15 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -53,7 +53,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
 
 	get_fiq_regs(&regs);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		iprtd->offset = regs.ARM_r8 & 0xffff;
 	else
 		iprtd->offset = regs.ARM_r9 & 0xffff;
@@ -93,7 +93,7 @@ static int snd_imx_pcm_prepare(struct snd_soc_component *component,
 	struct pt_regs regs;
 
 	get_fiq_regs(&regs);
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		regs.ARM_r8 = (iprtd->period * iprtd->periods - 1) << 16;
 	else
 		regs.ARM_r9 = (iprtd->period * iprtd->periods - 1) << 16;
@@ -115,7 +115,7 @@ static int snd_imx_pcm_trigger(struct snd_soc_component *component,
 	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))
 			atomic_set(&iprtd->playing, 1);
 		else
 			atomic_set(&iprtd->capturing, 1);
@@ -127,7 +127,7 @@ static int snd_imx_pcm_trigger(struct snd_soc_component *component,
 	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))
 			atomic_set(&iprtd->playing, 0);
 		else
 			atomic_set(&iprtd->capturing, 0);
diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c
index b0944a07ab470..3653eed2d5bc9 100644
--- a/sound/soc/fsl/imx-pcm-rpmsg.c
+++ b/sound/soc/fsl/imx-pcm-rpmsg.c
@@ -142,7 +142,7 @@ static int imx_rpmsg_pcm_hw_params(struct snd_soc_component *component,
 	struct rpmsg_info *info = dev_get_drvdata(component->dev);
 	struct rpmsg_msg *msg;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_HW_PARAM];
 		msg->s_msg.header.cmd = TX_HW_PARAM;
 	} else {
@@ -195,7 +195,7 @@ static snd_pcm_uframes_t imx_rpmsg_pcm_pointer(struct snd_soc_component *compone
 	unsigned int pos = 0;
 	int buffer_tail = 0;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM];
 	else
 		msg = &info->msg[RX_PERIOD_DONE + MSG_TYPE_A_NUM];
@@ -214,7 +214,7 @@ static void imx_rpmsg_timer_callback(struct timer_list *t)
 	struct rpmsg_info *info = stream_timer->info;
 	struct rpmsg_msg *msg;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM];
 		msg->s_msg.header.cmd = TX_PERIOD_DONE;
 	} else {
@@ -237,7 +237,7 @@ static int imx_rpmsg_pcm_open(struct snd_soc_component *component,
 	int ret = 0;
 	int cmd;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_OPEN];
 		msg->s_msg.header.cmd = TX_OPEN;
 
@@ -291,7 +291,7 @@ static int imx_rpmsg_pcm_close(struct snd_soc_component *component,
 	/* Flush work in workqueue to make TX_CLOSE is the last message */
 	flush_workqueue(info->rpmsg_wq);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_CLOSE];
 		msg->s_msg.header.cmd = TX_CLOSE;
 	} else {
@@ -353,7 +353,7 @@ static int imx_rpmsg_prepare_and_submit(struct snd_soc_component *component,
 	struct rpmsg_info *info = dev_get_drvdata(component->dev);
 	struct rpmsg_msg *msg;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_BUFFER];
 		msg->s_msg.header.cmd = TX_BUFFER;
 	} else {
@@ -382,7 +382,7 @@ static int imx_rpmsg_async_issue_pending(struct snd_soc_component *component,
 	struct rpmsg_info *info = dev_get_drvdata(component->dev);
 	struct rpmsg_msg *msg;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_START];
 		msg->s_msg.header.cmd = TX_START;
 	} else {
@@ -399,7 +399,7 @@ static int imx_rpmsg_restart(struct snd_soc_component *component,
 	struct rpmsg_info *info = dev_get_drvdata(component->dev);
 	struct rpmsg_msg *msg;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_RESTART];
 		msg->s_msg.header.cmd = TX_RESTART;
 	} else {
@@ -416,7 +416,7 @@ static int imx_rpmsg_pause(struct snd_soc_component *component,
 	struct rpmsg_info *info = dev_get_drvdata(component->dev);
 	struct rpmsg_msg *msg;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_PAUSE];
 		msg->s_msg.header.cmd = TX_PAUSE;
 	} else {
@@ -434,7 +434,7 @@ static int imx_rpmsg_terminate_all(struct snd_soc_component *component,
 	struct rpmsg_msg *msg;
 	int cmd;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_TERMINATE];
 		msg->s_msg.header.cmd = TX_TERMINATE;
 		/* Clear buffer count*/
@@ -530,7 +530,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
 	if (!rpmsg->force_lpa)
 		return 0;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM];
 		msg->s_msg.header.cmd = TX_PERIOD_DONE;
 	} else {
@@ -559,7 +559,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
 		info->notify_updated[substream->stream] = true;
 		spin_unlock_irqrestore(&info->lock[substream->stream], flags);
 
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			avail = snd_pcm_playback_hw_avail(runtime);
 		else
 			avail = snd_pcm_capture_hw_avail(runtime);
diff --git a/sound/soc/fsl/lpc3xxx-i2s.c b/sound/soc/fsl/lpc3xxx-i2s.c
index c65c17dfa1747..536ace6de0088 100644
--- a/sound/soc/fsl/lpc3xxx-i2s.c
+++ b/sound/soc/fsl/lpc3xxx-i2s.c
@@ -75,7 +75,7 @@ static int lpc3xxx_i2s_startup(struct snd_pcm_substream *substream, struct snd_s
 
 	guard(mutex)(&i2s_info_p->lock);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		flag = I2S_PLAYBACK_FLAG;
 	else
 		flag = I2S_CAPTURE_FLAG;
@@ -107,7 +107,7 @@ static void lpc3xxx_i2s_shutdown(struct snd_pcm_substream *substream, struct snd
 
 	guard(mutex)(&i2s_info_p->lock);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		flag = I2S_PLAYBACK_FLAG;
 		regmap_write(regs, LPC3XXX_REG_I2S_TX_RATE, 0);
 		regmap_update_bits(regs, LPC3XXX_REG_I2S_DAO, stop_bits, stop_bits);
@@ -197,7 +197,7 @@ static int lpc3xxx_i2s_hw_params(struct snd_pcm_substream *substream,
 	dev_dbg(dev, "Channels              : %d\n", params_channels(params));
 	dev_dbg(dev, "Data format           : %s\n", "I2S");
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		regmap_write(regs, LPC3XXX_REG_I2S_DMA1,
 			     LPC3XXX_I2S_DMA1_TX_EN | LPC3XXX_I2S_DMA0_TX_DEPTH(4));
 		regmap_write(regs, LPC3XXX_REG_I2S_TX_RATE, (clkx << 8) | clky);
@@ -223,7 +223,7 @@ static int lpc3xxx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			regmap_update_bits(regs, LPC3XXX_REG_I2S_DAO,
 					   LPC3XXX_I2S_STOP, LPC3XXX_I2S_STOP);
 		else
@@ -234,7 +234,7 @@ static int lpc3xxx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 	case SNDRV_PCM_TRIGGER_RESUME:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			regmap_update_bits(regs, LPC3XXX_REG_I2S_DAO,
 					   (LPC3XXX_I2S_RESET | LPC3XXX_I2S_STOP), 0);
 		else
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 345f338251ace..07ddc3cd31890 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -137,7 +137,7 @@ static int psc_dma_trigger(struct snd_soc_component *component,
 		 */
 		spin_lock_irqsave(&psc_dma->lock, flags);
 
-		if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+		if (snd_pcm_is_capture(substream->pstr->stream))
 			bcom_gen_bd_rx_reset(s->bcom_task);
 		else
 			bcom_gen_bd_tx_reset(s->bcom_task);
@@ -160,7 +160,7 @@ static int psc_dma_trigger(struct snd_soc_component *component,
 
 		spin_lock_irqsave(&psc_dma->lock, flags);
 		bcom_disable(s->bcom_task);
-		if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+		if (snd_pcm_is_capture(substream->pstr->stream))
 			bcom_gen_bd_rx_reset(s->bcom_task);
 		else
 			bcom_gen_bd_tx_reset(s->bcom_task);
@@ -219,7 +219,7 @@ static int psc_dma_open(struct snd_soc_component *component,
 
 	dev_dbg(psc_dma->dev, "psc_dma_open(substream=%p)\n", substream);
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream->pstr->stream))
 		s = &psc_dma->capture;
 	else
 		s = &psc_dma->playback;
@@ -246,7 +246,7 @@ static int psc_dma_close(struct snd_soc_component *component,
 
 	dev_dbg(psc_dma->dev, "psc_dma_close(substream=%p)\n", substream);
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream->pstr->stream))
 		s = &psc_dma->capture;
 	else
 		s = &psc_dma->playback;
@@ -271,7 +271,7 @@ psc_dma_pointer(struct snd_soc_component *component,
 	struct psc_dma_stream *s;
 	dma_addr_t count;
 
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream->pstr->stream))
 		s = &psc_dma->capture;
 	else
 		s = &psc_dma->playback;
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index d7ee33b5b9a8d..42460f2b3906d 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -77,7 +77,7 @@ struct psc_dma {
 static inline struct psc_dma_stream *
 to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
 {
-	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(substream->pstr->stream))
 		return &psc_dma->capture;
 	return &psc_dma->playback;
 }
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 0423cf43c7a02..cb96b0ff74396 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -151,7 +151,7 @@ static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream,
 
 	/* Determine the set of enable bits to turn on */
 	s->ac97_slot_bits = (params_channels(params) == 1) ? 0x100 : 0x300;
-	if (substream->pstr->stream != SNDRV_PCM_STREAM_CAPTURE)
+	if (!snd_pcm_is_capture(substream->pstr->stream))
 		s->ac97_slot_bits <<= 16;
 	return 0;
 }
-- 
2.43.0




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux