@@ -345,7 +345,7 @@ static int sof_ipc4_chain_dma_trigger(struct snd_sof_dev *sdev,
msg.extension |= pipeline->msg.extension;
}
- if (direction == SNDRV_PCM_STREAM_CAPTURE) {
+ if (snd_pcm_is_capture(direction)) {
/*
* For ChainDMA the DMA ids are unique with the following mapping:
* playback: 0 - (num_playback_streams - 1)
@@ -681,7 +681,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
if (pipeline->use_chain_dma)
return 0;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
if (sof_ipc4_copier_is_single_bitdepth(sdev,
available_fmt->output_pin_fmts,
available_fmt->num_output_formats)) {
@@ -1044,7 +1044,7 @@ static int sof_ipc4_pcm_pointer(struct snd_soc_component *component,
/* Wrap the dai counter at the boundary where the host counter wraps */
div64_u64_rem(dai_cnt, time_info->boundary, &dai_cnt);
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(substream)) {
head_cnt = host_cnt;
tail_cnt = dai_cnt;
} else {
@@ -511,7 +511,7 @@ static int sof_ipc4_widget_setup_pcm(struct snd_sof_widget *swidget)
if (ret)
goto free_available_fmt;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
struct snd_sof_pcm_stream *sps = &spcm->stream[dir];
sof_update_ipc_object(scomp, &sps->dsp_max_burst_size_in_ms,
@@ -1668,7 +1668,7 @@ sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
* of the RATE, CHANNELS, bit depth is static among the formats then
* narrow the params to only allow that specific parameter value.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
pin_fmts = available_fmt->output_pin_fmts;
num_pin_fmts = available_fmt->num_output_formats;
} else {
@@ -1783,7 +1783,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
* Use the input_pin_fmts to match pcm params for playback and the output_pin_fmts
* for capture.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
ref_params = *fe_params;
else
ref_params = *pipeline_params;
@@ -1828,7 +1828,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
* For playback the pipeline_params needs to be used to find the
* input configuration of the copier.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
ref_params = *pipeline_params;
break;
@@ -2225,7 +2225,7 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget,
* For playback, the SRC sink rate will be configured based on the requested output
* format, which is restricted to only deal with DAI's with a single format for now.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK && available_fmt->num_output_formats > 1) {
+ if (snd_pcm_is_playback(dir) && available_fmt->num_output_formats > 1) {
dev_err(sdev->dev, "Invalid number of output formats: %d for SRC %s\n",
available_fmt->num_output_formats, swidget->widget->name);
return -EINVAL;
@@ -308,7 +308,7 @@ static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev,
* purpose of connecting a pipeline from a host to a DAI in order to receive the DAPM
* events. But they are not handled by the firmware. So ignore them.
*/
- if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (snd_pcm_is_playback(dir)) {
for_each_dapm_widgets(list, i, widget) {
if (!widget->dobj.private)
continue;
@@ -623,11 +623,11 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
continue;
/* starting widget for playback is AIF type */
- if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in)
+ if (snd_pcm_is_playback(dir) && widget->id != snd_soc_dapm_aif_in)
continue;
/* starting widget for capture is DAI type */
- if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out)
+ if (snd_pcm_is_capture(dir) && widget->id != snd_soc_dapm_dai_out)
continue;
switch (op) {
@@ -950,7 +950,7 @@ snd_sof_find_swidget_sname(struct snd_soc_component *scomp,
struct snd_sof_widget *swidget;
enum snd_soc_dapm_type type;
- if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+ if (snd_pcm_is_playback(dir))
type = snd_soc_dapm_aif_in;
else
type = snd_soc_dapm_aif_out;
We can use snd_pcm_is_playback/capture(). Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> --- sound/soc/sof/ipc4-pcm.c | 6 +++--- sound/soc/sof/ipc4-topology.c | 10 +++++----- sound/soc/sof/sof-audio.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-)