[PATCH 048/113] ASoC: dwc: 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/dwc/dwc-i2s.c | 20 ++++++++++----------
 sound/soc/dwc/dwc-pcm.c |  6 +++---
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index c04466f5492e9..874d5bf2985e6 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -42,7 +42,7 @@ static inline void i2s_disable_channels(struct dw_i2s_dev *dev, u32 stream)
 {
 	u32 i = 0;
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		for (i = 0; i < 4; i++)
 			i2s_write_reg(dev->i2s_base, TER(i), 0);
 	} else {
@@ -55,7 +55,7 @@ static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream)
 {
 	u32 i = 0;
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		for (i = 0; i < 4; i++)
 			i2s_read_reg(dev->i2s_base, TOR(i));
 	} else {
@@ -69,7 +69,7 @@ static inline void i2s_disable_irqs(struct dw_i2s_dev *dev, u32 stream,
 {
 	u32 i, irq;
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		for (i = 0; i < (chan_nr / 2); i++) {
 			irq = i2s_read_reg(dev->i2s_base, IMR(i));
 			i2s_write_reg(dev->i2s_base, IMR(i), irq | 0x30);
@@ -87,7 +87,7 @@ static inline void i2s_enable_irqs(struct dw_i2s_dev *dev, u32 stream,
 {
 	u32 i, irq;
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		for (i = 0; i < (chan_nr / 2); i++) {
 			irq = i2s_read_reg(dev->i2s_base, IMR(i));
 			i2s_write_reg(dev->i2s_base, IMR(i), irq & ~0x30);
@@ -156,7 +156,7 @@ static void i2s_enable_dma(struct dw_i2s_dev *dev, u32 stream)
 	u32 dma_reg = i2s_read_reg(dev->i2s_base, I2S_DMACR);
 
 	/* Enable DMA handshake for stream */
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(stream))
 		dma_reg |= I2S_DMAEN_TXBLOCK;
 	else
 		dma_reg |= I2S_DMAEN_RXBLOCK;
@@ -169,7 +169,7 @@ static void i2s_disable_dma(struct dw_i2s_dev *dev, u32 stream)
 	u32 dma_reg = i2s_read_reg(dev->i2s_base, I2S_DMACR);
 
 	/* Disable DMA handshake for stream */
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(stream)) {
 		dma_reg &= ~I2S_DMAEN_TXBLOCK;
 		i2s_write_reg(dev->i2s_base, I2S_RTXDMA, 1);
 	} else {
@@ -194,7 +194,7 @@ static void i2s_start(struct dw_i2s_dev *dev,
 
 	i2s_write_reg(dev->i2s_base, IER, reg);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		i2s_write_reg(dev->i2s_base, ITER, 1);
 	else
 		i2s_write_reg(dev->i2s_base, IRER, 1);
@@ -213,7 +213,7 @@ static void i2s_stop(struct dw_i2s_dev *dev,
 {
 
 	i2s_clear_irqs(dev, substream->stream);
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		i2s_write_reg(dev->i2s_base, ITER, 0);
 	else
 		i2s_write_reg(dev->i2s_base, IRER, 0);
@@ -253,7 +253,7 @@ static void dw_i2s_config(struct dw_i2s_dev *dev, int stream)
 	i2s_disable_channels(dev, stream);
 
 	for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) {
-		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(stream)) {
 			i2s_write_reg(dev->i2s_base, TCR(ch_reg),
 				      dev->xfer_resolution);
 			i2s_write_reg(dev->i2s_base, TFCR(ch_reg),
@@ -352,7 +352,7 @@ static int dw_i2s_prepare(struct snd_pcm_substream *substream,
 {
 	struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		i2s_write_reg(dev->i2s_base, TXFFR, 1);
 	else
 		i2s_write_reg(dev->i2s_base, RXFFR, 1);
diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c
index a418265c030a5..673218e010607 100644
--- a/sound/soc/dwc/dwc-pcm.c
+++ b/sound/soc/dwc/dwc-pcm.c
@@ -200,7 +200,7 @@ static int dw_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)) {
 			WRITE_ONCE(dev->tx_ptr, 0);
 			rcu_assign_pointer(dev->tx_substream, substream);
 		} else {
@@ -211,7 +211,7 @@ static int dw_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))
 			rcu_assign_pointer(dev->tx_substream, NULL);
 		else
 			rcu_assign_pointer(dev->rx_substream, NULL);
@@ -231,7 +231,7 @@ static snd_pcm_uframes_t dw_pcm_pointer(struct snd_soc_component *component,
 	struct dw_i2s_dev *dev = runtime->private_data;
 	snd_pcm_uframes_t pos;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		pos = READ_ONCE(dev->tx_ptr);
 	else
 		pos = READ_ONCE(dev->rx_ptr);
-- 
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