Re: [PATCH 16/28] ASoC: apple: Add macaudio machine driver

From: James Calligeros

Date: Fri Sep 25 2026 - 21:06:23 EST


Hi Mark,

On Tuesday, 22 September 2026 7:38:54 pm Australian Eastern Standard Time Mark Brown wrote:
> > +static void macaudio_vlimit_update(struct macaudio_snd_data *ma)
> > +{
> >
> > +
> > + /* Check that *every* limited control is locked by the same owner */
> > + list_for_each_entry(kctl, &ma->card.snd_card->controls, list) {
> > + if (!snd_soc_control_matches(kctl, volume_control_names[ma->cfg->amp]))
> > + continue;
>
> This is used from the volume limit timeout work which doesn't hold the
> controls_rwsem, userspace can add or remove user controls which would
> change the list so the work needs to lock the controls list.
>

Would it be sufficient to scoped_guard the controls_rwsem wherever we
use this pattern?

> > +static int macaudio_dpcm_hw_params(struct snd_pcm_substream *substream,
> > + struct snd_pcm_hw_params *params)
> > +{
> > + struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
> > + struct macaudio_snd_data *ma = snd_soc_card_get_drvdata(rtd->card);
> > + struct macaudio_link_props *props = &ma->link_props[rtd->dai_link->id];
> > + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
> > + struct snd_interval *rate = hw_param_interval(params,
> > + SNDRV_PCM_HW_PARAM_RATE);
> > + int bclk_ratio = macaudio_get_runtime_bclk_ratio(substream);
> > + int i;
> > +
> > + if (props->is_sense) {
> > + rate->min = rate->max = cpu_dai->symmetric_rate;
> > + return 0;
> > + }
>
> It feels like this DAI ought to have separate ops... Also, for the
> sense link will we definitely already have a rate set up?

AIUI, the cpu rate should always be set up by the time we hit
this path as it is only taken when setting up the VISENSE FE (after the
playback stuff is already set up).