Re: [PATCH 16/28] ASoC: apple: Add macaudio machine driver
From: Mark Brown
Date: Mon Sep 28 2026 - 07:04:26 EST
On Sat, Sep 26, 2026 at 11:06:02AM +1000, James Calligeros wrote:
> On Tuesday, 22 September 2026 7:38:54 pm Australian Eastern Standard Time Mark Brown wrote:
> > > + 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?
I think so, but I didn't properly check.
> > > +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).
Is that something we actually enforce or is that just a thing a sensible
userspace should do? I can see something racing.
Attachment:
signature.asc
Description: PGP signature