From 9f0fc191371843c4fc000a226b0a26b6c059aacd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 19:40:19 +0200 Subject: Merging upstream version 6.7.7. Signed-off-by: Daniel Baumann --- sound/soc/soc-pcm.c | 93 +++++++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 46 deletions(-) (limited to 'sound/soc/soc-pcm.c') diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 511446a30c..f6d1b2e117 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -71,11 +71,11 @@ static inline void snd_soc_dpcm_stream_unlock_irq(struct snd_soc_pcm_runtime *rt static inline const char *soc_cpu_dai_name(struct snd_soc_pcm_runtime *rtd) { - return (rtd)->dai_link->num_cpus == 1 ? asoc_rtd_to_cpu(rtd, 0)->name : "multicpu"; + return (rtd)->dai_link->num_cpus == 1 ? snd_soc_rtd_to_cpu(rtd, 0)->name : "multicpu"; } static inline const char *soc_codec_dai_name(struct snd_soc_pcm_runtime *rtd) { - return (rtd)->dai_link->num_codecs == 1 ? asoc_rtd_to_codec(rtd, 0)->name : "multicodec"; + return (rtd)->dai_link->num_codecs == 1 ? snd_soc_rtd_to_codec(rtd, 0)->name : "multicodec"; } #ifdef CONFIG_DEBUG_FS @@ -184,7 +184,7 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf, snd_soc_dpcm_mutex_lock(fe); for_each_pcm_streams(stream) - if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream)) + if (snd_soc_dai_stream_valid(snd_soc_rtd_to_cpu(fe, 0), stream)) offset += dpcm_show_state(fe, stream, buf + offset, out_count - offset); @@ -386,7 +386,7 @@ static void soc_pcm_set_dai_params(struct snd_soc_dai *dai, static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, struct snd_soc_dai *soc_dai) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); int ret; if (!snd_soc_dai_active(soc_dai)) @@ -419,7 +419,7 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_dai d; struct snd_soc_dai *dai; struct snd_soc_dai *cpu_dai; @@ -452,7 +452,7 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, static void soc_pcm_update_symmetry(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_dai_link *link = rtd->dai_link; struct snd_soc_dai *dai; unsigned int symmetry, i; @@ -473,7 +473,7 @@ static void soc_pcm_update_symmetry(struct snd_pcm_substream *substream) static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); int ret; if (!bits) @@ -487,7 +487,7 @@ static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits) static void soc_pcm_apply_msb(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai; struct snd_soc_dai *codec_dai; int stream = substream->stream; @@ -636,7 +636,7 @@ EXPORT_SYMBOL_GPL(snd_soc_runtime_calc_hw); static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) { struct snd_pcm_hardware *hw = &substream->runtime->hw; - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); u64 formats = hw->formats; /* @@ -652,7 +652,7 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream) static int soc_pcm_components_open(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_component *component; int i, ret = 0; @@ -672,7 +672,7 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream) static int soc_pcm_components_close(struct snd_pcm_substream *substream, int rollback) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_component *component; int i, ret = 0; @@ -700,10 +700,11 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd, snd_soc_runtime_deactivate(rtd, substream->stream); /* Make sure DAI parameters cleared if the DAI becomes inactive */ - for_each_rtd_dais(rtd, i, dai) + for_each_rtd_dais(rtd, i, dai) { if (snd_soc_dai_active(dai) == 0 && (dai->rate || dai->channels || dai->sample_bits)) soc_pcm_set_dai_params(dai, NULL); + } } for_each_rtd_dais(rtd, i, dai) @@ -736,7 +737,7 @@ static int __soc_pcm_close(struct snd_soc_pcm_runtime *rtd, /* PCM close ops for non-DPCM streams */ static int soc_pcm_close(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); snd_soc_dpcm_mutex_lock(rtd); __soc_pcm_close(rtd, substream); @@ -746,7 +747,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) static int soc_hw_sanity_check(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_pcm_hardware *hw = &substream->runtime->hw; const char *name_cpu = soc_cpu_dai_name(rtd); const char *name_codec = soc_codec_dai_name(rtd); @@ -852,7 +853,7 @@ err: /* PCM open ops for non-DPCM streams */ static int soc_pcm_open(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); int ret; snd_soc_dpcm_mutex_lock(rtd); @@ -908,7 +909,7 @@ out: /* PCM prepare ops for non-DPCM streams */ static int soc_pcm_prepare(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); int ret; snd_soc_dpcm_mutex_lock(rtd); @@ -976,7 +977,7 @@ static int __soc_pcm_hw_free(struct snd_soc_pcm_runtime *rtd, /* hw_free PCM ops for non-DPCM streams */ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); int ret; snd_soc_dpcm_mutex_lock(rtd); @@ -1096,7 +1097,7 @@ out: static int soc_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); int ret; snd_soc_dpcm_mutex_lock(rtd); @@ -1121,7 +1122,7 @@ static int (* const trigger[][TRIGGER_MAX])(struct snd_pcm_substream *substream, static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { - struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); struct snd_soc_component *component; int ret = 0, r = 0, i; int rollback = 0; @@ -1408,7 +1409,7 @@ EXPORT_SYMBOL_GPL(dpcm_end_walk_at_be); int dpcm_path_get(struct snd_soc_pcm_runtime *fe, int stream, struct snd_soc_dapm_widget_list **list) { - struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0); + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(fe, 0); int paths; if (fe->dai_link->num_cpus > 1) { @@ -1681,7 +1682,7 @@ unwind: static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_hardware *hw = &runtime->hw; struct snd_soc_dai *dai; @@ -1715,7 +1716,7 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream) static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_hardware *hw = &runtime->hw; struct snd_soc_dpcm *dpcm; @@ -1752,7 +1753,7 @@ static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream) static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_hardware *hw = &runtime->hw; struct snd_soc_dpcm *dpcm; @@ -1791,7 +1792,7 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream) */ if (be->dai_link->num_codecs == 1) { struct snd_soc_pcm_stream *codec_stream = snd_soc_dai_get_pcm_stream( - asoc_rtd_to_codec(be, 0), stream); + snd_soc_rtd_to_codec(be, 0), stream); soc_pcm_hw_update_chan(hw, codec_stream); } @@ -1800,7 +1801,7 @@ static void dpcm_runtime_setup_be_chan(struct snd_pcm_substream *substream) static void dpcm_runtime_setup_be_rate(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_hardware *hw = &runtime->hw; struct snd_soc_dpcm *dpcm; @@ -1839,7 +1840,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream, int stream) { struct snd_soc_dpcm *dpcm; - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(fe_substream); struct snd_soc_dai *fe_cpu_dai; int err = 0; int i; @@ -1866,7 +1867,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream, if (!be_substream) continue; - rtd = asoc_substream_to_rtd(be_substream); + rtd = snd_soc_substream_to_rtd(be_substream); if (rtd->dai_link->be_hw_params_fixup) continue; @@ -1885,7 +1886,7 @@ error: static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(fe_substream); int stream = fe_substream->stream, ret = 0; dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); @@ -1922,7 +1923,7 @@ be_err: static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int stream = substream->stream; snd_soc_dpcm_mutex_assert_held(fe); @@ -1988,7 +1989,7 @@ void dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int stream = substream->stream; snd_soc_dpcm_mutex_lock(fe); @@ -2091,7 +2092,7 @@ unwind: static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int ret, stream = substream->stream; snd_soc_dpcm_mutex_lock(fe); @@ -2294,7 +2295,7 @@ EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream, int cmd, bool fe_first) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int ret; /* call trigger on the frontend before the backend. */ @@ -2325,7 +2326,7 @@ static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream, static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int stream = substream->stream; int ret = 0; enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; @@ -2412,7 +2413,7 @@ out: static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int stream = substream->stream; /* if FE's runtime_update is already set, we're in race; @@ -2466,7 +2467,7 @@ int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(substream); int stream = substream->stream, ret = 0; snd_soc_dpcm_mutex_lock(fe); @@ -2643,7 +2644,7 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) } /* only check active links */ - if (!snd_soc_dai_active(asoc_rtd_to_cpu(fe, 0))) + if (!snd_soc_dai_active(snd_soc_rtd_to_cpu(fe, 0))) return 0; /* DAPM sync will call this to update DSP paths */ @@ -2653,13 +2654,13 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) for_each_pcm_streams(stream) { /* skip if FE doesn't have playback/capture capability */ - if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) || - !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream)) + if (!snd_soc_dai_stream_valid(snd_soc_rtd_to_cpu(fe, 0), stream) || + !snd_soc_dai_stream_valid(snd_soc_rtd_to_codec(fe, 0), stream)) continue; /* skip if FE isn't currently playing/capturing */ - if (!snd_soc_dai_stream_active(asoc_rtd_to_cpu(fe, 0), stream) || - !snd_soc_dai_stream_active(asoc_rtd_to_codec(fe, 0), stream)) + if (!snd_soc_dai_stream_active(snd_soc_rtd_to_cpu(fe, 0), stream) || + !snd_soc_dai_stream_active(snd_soc_rtd_to_codec(fe, 0), stream)) continue; paths = dpcm_path_get(fe, stream, &list); @@ -2717,7 +2718,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dpcm_runtime_update); static void dpcm_fe_dai_cleanup(struct snd_pcm_substream *fe_substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(fe_substream); struct snd_soc_dpcm *dpcm; int stream = fe_substream->stream; @@ -2732,7 +2733,7 @@ static void dpcm_fe_dai_cleanup(struct snd_pcm_substream *fe_substream) static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(fe_substream); int ret; snd_soc_dpcm_mutex_lock(fe); @@ -2746,7 +2747,7 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream) static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) { - struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream); + struct snd_soc_pcm_runtime *fe = snd_soc_substream_to_rtd(fe_substream); struct snd_soc_dapm_widget_list *list; int ret; int stream = fe_substream->stream; @@ -2830,9 +2831,9 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, for_each_rtd_codec_dais(rtd, i, codec_dai) { if (dai_link->num_cpus == 1) { - cpu_dai = asoc_rtd_to_cpu(rtd, 0); + cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); } else if (dai_link->num_cpus == dai_link->num_codecs) { - cpu_dai = asoc_rtd_to_cpu(rtd, i); + cpu_dai = snd_soc_rtd_to_cpu(rtd, i); } else if (rtd->dai_link->num_codecs > rtd->dai_link->num_cpus) { int cpu_id; @@ -2843,7 +2844,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, } cpu_id = rtd->dai_link->codec_ch_maps[i].connected_cpu_id; - cpu_dai = asoc_rtd_to_cpu(rtd, cpu_id); + cpu_dai = snd_soc_rtd_to_cpu(rtd, cpu_id); } else { dev_err(rtd->card->dev, "%s codec number %d < cpu number %d is not supported\n", -- cgit v1.2.3