We can use snd_pcm_is_playback/capture(). Let's use it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/rockchip/rockchip_i2s.c | 6 +++--- sound/soc/rockchip/rockchip_i2s_tdm.c | 20 ++++++++++---------- sound/soc/rockchip/rockchip_pdm.c | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index b378f870b3ad2..09e4806071839 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -413,7 +413,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, return -EINVAL; }
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + if (snd_pcm_is_capture(substream)) regmap_update_bits(i2s->regmap, I2S_RXCR, I2S_RXCR_VDW_MASK | I2S_RXCR_CSR_MASK, val); @@ -471,7 +471,7 @@ static int rockchip_i2s_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + if (snd_pcm_is_capture(substream)) ret = rockchip_snd_rxctrl(i2s, 1); else ret = rockchip_snd_txctrl(i2s, 1); @@ -482,7 +482,7 @@ static int rockchip_i2s_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { + if (snd_pcm_is_capture(substream)) { if (!i2s->tx_start) i2s_pinctrl_select_bclk_off(i2s); ret = rockchip_snd_rxctrl(i2s, 0); diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index ee517d7b5b7bb..25d1a516962f6 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -287,7 +287,7 @@ static void rockchip_snd_txrxctrl(struct snd_pcm_substream *substream,
spin_lock_irqsave(&i2s_tdm->lock, flags); if (on) { - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) rockchip_enable_tde(i2s_tdm->regmap); else rockchip_enable_rde(i2s_tdm->regmap); @@ -301,7 +301,7 @@ static void rockchip_snd_txrxctrl(struct snd_pcm_substream *substream, I2S_XFER_RXS_START); } } else { - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) rockchip_disable_tde(i2s_tdm->regmap); else rockchip_disable_rde(i2s_tdm->regmap); @@ -488,7 +488,7 @@ static void rockchip_i2s_tdm_xfer_pause(struct snd_pcm_substream *substream, int stream;
stream = SNDRV_PCM_STREAM_LAST - substream->stream; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(stream)) rockchip_disable_tde(i2s_tdm->regmap); else rockchip_disable_rde(i2s_tdm->regmap); @@ -502,7 +502,7 @@ static void rockchip_i2s_tdm_xfer_resume(struct snd_pcm_substream *substream, int stream;
stream = SNDRV_PCM_STREAM_LAST - substream->stream; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(stream)) rockchip_enable_tde(i2s_tdm->regmap); else rockchip_enable_rde(i2s_tdm->regmap); @@ -557,7 +557,7 @@ static int rockchip_i2s_io_multiplex(struct snd_pcm_substream *substream, return -EINVAL; }
- if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { + if (snd_pcm_is_capture(substream)) { struct snd_pcm_str *playback_str = &substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -629,7 +629,7 @@ static int rockchip_i2s_trcm_mode(struct snd_pcm_substream *substream, I2S_CKR_TSD_MASK | I2S_CKR_RSD_MASK, I2S_CKR_TSD(div_lrck) | I2S_CKR_RSD(div_lrck));
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) regmap_update_bits(i2s_tdm->regmap, I2S_TXCR, I2S_TXCR_VDW_MASK | I2S_TXCR_CSR_MASK, fmt); @@ -661,7 +661,7 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream, mclk = i2s_tdm->mclk_tx; } else if (i2s_tdm->clk_trcm == TRCM_RX) { mclk = i2s_tdm->mclk_rx; - } else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + } else if (snd_pcm_is_playback(substream)) { mclk = i2s_tdm->mclk_tx; } else { mclk = i2s_tdm->mclk_rx; @@ -719,7 +719,7 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
if (i2s_tdm->clk_trcm) { rockchip_i2s_trcm_mode(substream, dai, div_bclk, div_lrck, val); - } else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + } else if (snd_pcm_is_playback(substream)) { regmap_update_bits(i2s_tdm->regmap, I2S_CLKDIV, I2S_CLKDIV_TXM_MASK, I2S_CLKDIV_TXM(div_bclk)); @@ -755,7 +755,7 @@ static int rockchip_i2s_tdm_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (i2s_tdm->clk_trcm) rockchip_snd_txrxctrl(substream, dai, 1); - else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + else if (snd_pcm_is_capture(substream)) rockchip_snd_rxctrl(i2s_tdm, 1); else rockchip_snd_txctrl(i2s_tdm, 1); @@ -765,7 +765,7 @@ static int rockchip_i2s_tdm_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (i2s_tdm->clk_trcm) rockchip_snd_txrxctrl(substream, dai, 0); - else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + else if (snd_pcm_is_capture(substream)) rockchip_snd_rxctrl(i2s_tdm, 0); else rockchip_snd_txctrl(i2s_tdm, 0); diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c index d16a4a67a6a2c..2e97a9e842a89 100644 --- a/sound/soc/rockchip/rockchip_pdm.c +++ b/sound/soc/rockchip/rockchip_pdm.c @@ -204,7 +204,7 @@ static int rockchip_pdm_hw_params(struct snd_pcm_substream *substream, bool change; int ret;
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) return 0;
samplerate = params_rate(params); @@ -351,13 +351,13 @@ static int rockchip_pdm_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_CAPTURE) + if (snd_pcm_is_capture(substream)) rockchip_pdm_rxctrl(pdm, 1); break; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + if (snd_pcm_is_capture(substream)) rockchip_pdm_rxctrl(pdm, 0); break; default: