diff mbox series

[056/113] ASoC: qcom: use snd_pcm_is_playback/capture()

Message ID 87v80fyf8t.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series 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/qcom/apq8096.c                |  2 +-
 sound/soc/qcom/lpass-apq8016.c          |  2 +-
 sound/soc/qcom/lpass-cpu.c              | 12 ++++++------
 sound/soc/qcom/lpass-ipq806x.c          |  2 +-
 sound/soc/qcom/lpass-platform.c         |  8 ++++----
 sound/soc/qcom/lpass-sc7180.c           |  4 ++--
 sound/soc/qcom/lpass-sc7280.c           |  2 +-
 sound/soc/qcom/qdsp6/audioreach.c       |  2 +-
 sound/soc/qcom/qdsp6/q6apm-dai.c        | 10 +++++-----
 sound/soc/qcom/qdsp6/q6apm-lpass-dais.c |  6 +++---
 sound/soc/qcom/qdsp6/q6apm.c            | 12 ++++++------
 sound/soc/qcom/qdsp6/q6asm-dai.c        | 16 ++++++++--------
 sound/soc/qcom/qdsp6/q6routing.c        |  2 +-
 sound/soc/qcom/sdm845.c                 |  4 ++--
 14 files changed, 42 insertions(+), 42 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c
index 4f6594cc723ce..a5305f33c32c5 100644
--- a/sound/soc/qcom/apq8096.c
+++ b/sound/soc/qcom/apq8096.c
@@ -46,7 +46,7 @@  static int msm_snd_hw_params(struct snd_pcm_substream *substream,
 		return 0;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
 						  rx_ch_cnt, rx_ch);
 	else
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 9005c85f8c547..5dfcd547cfcd5 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -126,7 +126,7 @@  static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 	const struct lpass_variant *v = drvdata->variant;
 	int chan = 0;
 
-	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(direction)) {
 		chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
 					v->rdma_channels);
 
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 5a47f661e0c6f..81036c49bce1b 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -113,7 +113,7 @@  static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream,
 	 * Will not impact if disabled in lpass_cpu_daiops_trigger()
 	 * suspend.
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_DISABLE);
 	else
 		regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_DISABLE);
@@ -185,7 +185,7 @@  static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		mode = drvdata->mi2s_playback_sd_mode[id];
 	else
 		mode = drvdata->mi2s_capture_sd_mode[id];
@@ -249,7 +249,7 @@  static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = regmap_fields_write(i2sctl->spkmode, id,
 					 LPAIF_I2SCTL_SPKMODE(mode));
 		if (ret) {
@@ -320,7 +320,7 @@  static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
 		 *     turn off the shared BCLK while other devices are using
 		 *     it.
 		 */
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			ret = regmap_fields_write(i2sctl->spken, id,
 						 LPAIF_I2SCTL_SPKEN_ENABLE);
 		} else  {
@@ -345,7 +345,7 @@  static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
 		 * To ensure lpass BCLK/LRCLK is disabled during
 		 * device suspend.
 		 */
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			ret = regmap_fields_write(i2sctl->spken, id,
 						 LPAIF_I2SCTL_SPKEN_DISABLE);
 		} else  {
@@ -378,7 +378,7 @@  static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
 	 * the data flow.
 	 * (ex: to drop start up pop noise before capture starts).
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		ret = regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_ENABLE);
 	else
 		ret = regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_ENABLE);
diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 5c874139f39d4..dbaaed1f3d8e3 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -97,7 +97,7 @@  static int ipq806x_lpass_exit(struct platform_device *pdev)
 
 static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir, unsigned int dai_id)
 {
-	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(dir))
 		return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
 	else	/* Capture currently not implemented */
 		return -EINVAL;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index addd2c4bdd3e8..f8e223e73fa02 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -329,7 +329,7 @@  static struct lpaif_dmactl *__lpass_get_dmactl_handle(const struct snd_pcm_subst
 
 	switch (cpu_dai->driver->id) {
 	case MI2S_PRIMARY ... MI2S_QUINARY:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			dmactl = drvdata->rd_dmactl;
 		else
 			dmactl = drvdata->wr_dmactl;
@@ -364,7 +364,7 @@  static int __lpass_get_id(const struct snd_pcm_substream *substream,
 
 	switch (cpu_dai->driver->id) {
 	case MI2S_PRIMARY ... MI2S_QUINARY:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			id = pcm_data->dma_ch;
 		else
 			id = pcm_data->dma_ch - v->wrdma_channel_start;
@@ -1230,14 +1230,14 @@  static int lpass_platform_copy(struct snd_soc_component *component,
 	void __iomem *dma_buf = (void __iomem *) (rt->dma_area + pos +
 				channel * (rt->dma_bytes / rt->channels));
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		if (is_cdc_dma_port(dai_id)) {
 			ret = copy_from_iter_toio(dma_buf, buf, bytes);
 		} else {
 			if (copy_from_iter((void __force *)dma_buf, bytes, buf) != bytes)
 				ret = -EFAULT;
 		}
-	} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	} else if (snd_pcm_is_capture(substream)) {
 		if (is_cdc_dma_port(dai_id)) {
 			ret = copy_to_iter_fromio(buf, dma_buf, bytes);
 		} else {
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index e6bcdf6ed7965..6898e9254a78d 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -80,7 +80,7 @@  static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 	int chan = 0;
 
 	if (dai_id == LPASS_DP_RX) {
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(direction)) {
 			chan = find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
 						v->hdmi_rdma_channels);
 
@@ -89,7 +89,7 @@  static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 		}
 		set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
 	} else {
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(direction)) {
 			chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
 						v->rdma_channels);
 
diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c
index 47c622327a8d3..d5a1c27652e48 100644
--- a/sound/soc/qcom/lpass-sc7280.c
+++ b/sound/soc/qcom/lpass-sc7280.c
@@ -115,7 +115,7 @@  static int sc7280_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 
 	switch (dai_id) {
 	case MI2S_PRIMARY ... MI2S_QUINARY:
-		if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(direction)) {
 			chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
 						   v->rdma_channels);
 
diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index 4ebaaf736fb98..cd7d99f9b8b40 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -1309,7 +1309,7 @@  int audioreach_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, s
 	void *p;
 	int rc, i;
 
-	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(dir))
 		data = &graph->rx_data;
 	else
 		data = &graph->tx_data;
diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
index c9404b5934c7e..26c6051a53a0a 100644
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -280,7 +280,7 @@  static int q6apm_dai_prepare(struct snd_soc_component *component,
 		return ret;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		int i;
 		/* Queue the buffers for Capture ONLY after graph is started */
 		for (i = 0; i < runtime->periods; i++)
@@ -306,7 +306,7 @@  static int q6apm_dai_trigger(struct snd_soc_component *component,
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		 /* start writing buffers for playback only as we already queued capture buffers */
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			ret = q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
@@ -356,9 +356,9 @@  static int q6apm_dai_open(struct snd_soc_component *component,
 		goto err;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		runtime->hw = q6apm_dai_hardware_playback;
-	else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	else if (snd_pcm_is_capture(substream))
 		runtime->hw = q6apm_dai_hardware_capture;
 
 	/* Ensure that buffer size is a multiple of period size */
@@ -368,7 +368,7 @@  static int q6apm_dai_open(struct snd_soc_component *component,
 		goto err;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
 						   BUFFER_BYTES_MIN, BUFFER_BYTES_MAX);
 		if (ret < 0) {
diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
index 9c98a35ad0994..3189a10b2f28a 100644
--- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
+++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
@@ -171,7 +171,7 @@  static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s
 		q6apm_graph_stop(dai_data->graph[dai->id]);
 		dai_data->is_port_started[dai->id] = false;
 
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (snd_pcm_is_playback(substream)) {
 			q6apm_graph_close(dai_data->graph[dai->id]);
 			dai_data->graph[dai->id] = NULL;
 		}
@@ -181,7 +181,7 @@  static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s
 	 * It is recommend to load DSP with source graph first and then sink
 	 * graph, so sequence for playback and capture will be different
 	 */
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
 		if (IS_ERR(graph)) {
 			dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id);
@@ -224,7 +224,7 @@  static int q6apm_lpass_dai_startup(struct snd_pcm_substream *substream, struct s
 	struct q6apm_graph *graph;
 	int graph_id = dai->id;
 
-	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	if (snd_pcm_is_capture(substream)) {
 		graph = q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id);
 		if (IS_ERR(graph)) {
 			dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id);
diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
index 2a2a5bd98110b..38d8aaab876d2 100644
--- a/sound/soc/qcom/qdsp6/q6apm.c
+++ b/sound/soc/qcom/qdsp6/q6apm.c
@@ -195,7 +195,7 @@  int q6apm_graph_media_format_shmem(struct q6apm_graph *graph,
 {
 	struct audioreach_module *module;
 
-	if (cfg->direction == SNDRV_PCM_STREAM_CAPTURE)
+	if (snd_pcm_is_capture(cfg->direction))
 		module = q6apm_find_module_by_mid(graph, MODULE_ID_RD_SHARED_MEM_EP);
 	else
 		module = q6apm_find_module_by_mid(graph, MODULE_ID_WR_SHARED_MEM_EP);
@@ -218,7 +218,7 @@  int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_a
 	int cnt;
 	int rc;
 
-	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(dir))
 		data = &graph->rx_data;
 	else
 		data = &graph->tx_data;
@@ -236,7 +236,7 @@  int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, phys_a
 		return -ENOMEM;
 	}
 
-	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(dir))
 		data = &graph->rx_data;
 	else
 		data = &graph->tx_data;
@@ -273,7 +273,7 @@  int q6apm_unmap_memory_regions(struct q6apm_graph *graph, unsigned int dir)
 	struct gpr_pkt *pkt;
 	int rc;
 
-	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(dir))
 		data = &graph->rx_data;
 	else
 		data = &graph->tx_data;
@@ -538,7 +538,7 @@  static int graph_callback(struct gpr_resp_pkt *data, void *priv, int op)
 		graph->result.status = 0;
 		rsp = data->payload;
 
-		if (hdr->token == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(hdr->token))
 			graph->rx_data.mem_map_handle = rsp->mem_map_handle;
 		else
 			graph->tx_data.mem_map_handle = rsp->mem_map_handle;
@@ -575,7 +575,7 @@  static int graph_callback(struct gpr_resp_pkt *data, void *priv, int op)
 		case APM_CMD_SHARED_MEM_UNMAP_REGIONS:
 			graph->result.opcode = result->opcode;
 			graph->result.status = 0;
-			if (hdr->token == SNDRV_PCM_STREAM_PLAYBACK)
+			if (snd_pcm_is_playback(hdr->token))
 				graph->rx_data.mem_map_handle = 0;
 			else
 				graph->tx_data.mem_map_handle = 0;
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index 3913706ccdc5f..3e3d2847f992b 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -187,7 +187,7 @@  static void event_handler(uint32_t opcode, uint32_t token,
 
 	switch (opcode) {
 	case ASM_CLIENT_EVENT_CMD_RUN_DONE:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			q6asm_write_async(prtd->audio_client, prtd->stream_id,
 				   prtd->pcm_count, 0, 0, 0);
 		break;
@@ -258,11 +258,11 @@  static int q6asm_dai_prepare(struct snd_soc_component *component,
 		return -ENOMEM;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
 				       FORMAT_LINEAR_PCM,
 				       0, prtd->bits_per_sample, false);
-	} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	} else if (snd_pcm_is_capture(substream)) {
 		ret = q6asm_open_read(prtd->audio_client, prtd->stream_id,
 				      FORMAT_LINEAR_PCM,
 				      prtd->bits_per_sample);
@@ -281,12 +281,12 @@  static int q6asm_dai_prepare(struct snd_soc_component *component,
 		goto routing_err;
 	}
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = q6asm_media_format_block_multi_ch_pcm(
 				prtd->audio_client, prtd->stream_id,
 				runtime->rate, runtime->channels, NULL,
 				prtd->bits_per_sample);
-	} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+	} else if (snd_pcm_is_capture(substream)) {
 		ret = q6asm_enc_cfg_blk_pcm_format_support(prtd->audio_client,
 							   prtd->stream_id,
 							   runtime->rate,
@@ -385,9 +385,9 @@  static int q6asm_dai_open(struct snd_soc_component *component,
 	/* DSP expects stream id from 1 */
 	prtd->stream_id = 1;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		runtime->hw = q6asm_dai_hardware_playback;
-	else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+	else if (snd_pcm_is_capture(substream))
 		runtime->hw = q6asm_dai_hardware_capture;
 
 	ret = snd_pcm_hw_constraint_list(runtime, 0,
@@ -401,7 +401,7 @@  static int q6asm_dai_open(struct snd_soc_component *component,
 	if (ret < 0)
 		dev_info(dev, "snd_pcm_hw_constraint_integer failed\n");
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = snd_pcm_hw_constraint_minmax(runtime,
 			SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
 			PLAYBACK_MIN_NUM_PERIODS * PLAYBACK_MIN_PERIOD_SIZE,
diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c
index 81fde0681f952..7e7ad072700d2 100644
--- a/sound/soc/qcom/qdsp6/q6routing.c
+++ b/sound/soc/qcom/qdsp6/q6routing.c
@@ -1055,7 +1055,7 @@  static int routing_hw_params(struct snd_soc_component *component,
 	struct session_data *session;
 	int path_type;
 
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	if (snd_pcm_is_playback(substream))
 		path_type = ADM_PATH_PLAYBACK;
 	else
 		path_type = ADM_PATH_LIVE_REC;
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index 75701546b6ea8..daa38d07a50f2 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -84,7 +84,7 @@  static int sdm845_slim_snd_hw_params(struct snd_pcm_substream *substream,
 			continue;
 		}
 
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (snd_pcm_is_playback(substream))
 			ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL,
 							  rx_ch_cnt, rx_ch);
 		else
@@ -115,7 +115,7 @@  static int sdm845_tdm_snd_hw_params(struct snd_pcm_substream *substream,
 	}
 
 	channels = params_channels(params);
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+	if (snd_pcm_is_playback(substream)) {
 		ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, 0x3,
 				8, slot_width);
 		if (ret < 0) {