RE: [PATCH v2 2/2] ASoC: codecs: Add driver for Iron Device MA5311
From: Hyun-Uk Son
Date: Wed Nov 11 2026 - 19:44:41 EST
Dear Mark,
> > > > + ma5311->adc4_pga_left = 0x10;
> > > > + ma5311->adc4_pga_right = 0x10;
>
> > > Like I said on v1 we usually leave the device with the hardware
> > > defaults to avoid having to decide on a specific use case in the
> > > kernel - presumably the defaults in the hardware were chosen for a
> reason.
>
> > I added a register initialization function because the factory-default
> > register settings are not suitable for practical use.
>
> They rarely are, but they tend to be safe and what is suitable for
> practical use will vary depending on the system. A gain that makes sense
> for a line output will be unsuitable for headphones, and vice versa.
> There are a few things, like zero cross for example, which are pretty much
> universally sensible and we do change those but for things that are likely
> to vary with use case we just go with what's in the hardware since that
> gives us consistency without us making decisions that might favour some
> users over others.
I'd like to provide some additional context regarding the rationale behind
the initialization values defined in reg_defaults.
The purpose of this initialization is to configure the data path and output
format for practical use, rather than to change sensitive parameters such as
speaker volume, ADC gain, or PGA gain.
The values of these parameters in reg_defaults match the hardware factory defaults.
Best Regards,
Hyunuk Son
The information in this email and any attachment is confidential and may be legally protected. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure or actions taken
as a result of the information in this email is prohibited and may be unlawful. If you are not the intended recipient, please notify us immediately and then delete this e-mail and any attachment. Thank you.
> -----Original Message-----
> From: Mark Brown <broonie@xxxxxxxxxx>
> Sent: Tuesday, November 10, 2026 10:51 PM
> To: Hyun-Uk Son <hyunuk.son@xxxxxxxxxxxxxx>
> Cc: Liam Girdwood <lgirdwood@xxxxxxxxx>; Ki-Seok Jo
> <kiseok.jo@xxxxxxxxxxxxxx>; Rob Herring <robh@xxxxxxxxxx>; Krzysztof
> Kozlowski <krzk+dt@xxxxxxxxxx>; Conor Dooley <conor+dt@xxxxxxxxxx>;
> Jaroslav Kysela <perex@xxxxxxxx>; Takashi Iwai <tiwai@xxxxxxxx>; linux-
> sound@xxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 2/2] ASoC: codecs: Add driver for Iron Device
> MA5311
>
> On Tue, Nov 10, 2026 at 08:41:57AM +0000, Hyun-Uk Son wrote:
>
> > > > + ma5311->adc4_pga_left = 0x10;
> > > > + ma5311->adc4_pga_right = 0x10;
>
> > > Like I said on v1 we usually leave the device with the hardware
> > > defaults to avoid having to decide on a specific use case in the
> > > kernel - presumably the defaults in the hardware were chosen for a
> reason.
>
> > I added a register initialization function because the factory-default
> > register settings are not suitable for practical use.
>
> They rarely are, but they tend to be safe and what is suitable for
> practical use will vary depending on the system. A gain that makes sense
> for a line output will be unsuitable for headphones, and vice versa.
> There are a few things, like zero cross for example, which are pretty much
> universally sensible and we do change those but for things that are likely
> to vary with use case we just go with what's in the hardware since that
> gives us consistency without us making decisions that might favour some
> users over others.
>
> > static int ma5311_rx_tdm_slot_put(struct snd_kcontrol *kcontrol,
> > struct snd_ctl_elem_value *ucontrol) {
>
> ...
>
> > Also, this control is essential because it allows the speaker output
> > channels to be dynamically assigned to different playback channels
> > during PCM playback.
>
> This would be better represented with DAPM routes directing playback from
> the audio interface rather than a custom control.
>
> > > > +static int ma5311_reset_control_put(struct snd_kcontrol *kcontrol,
> > > > + struct snd_ctl_elem_value *ucontrol)
> {
> > >
> > > > + ret = ma5311_reset(component);
>
> > > This might break the machine driver if it's relying on setting the
> > > DAI up during probe()...
>
> > With internal verification, I figured out that synchronizing private
> > data to reset hardware register setting is enough, because The driver
> > does not rely on probe() for any essential configuration and dai_ops
> > callback functions always set the essential settings including PLL,
> > TDM slot, etc..
>
> The issue is that machine drivers often only reconfigure things during
> probe() (including the generic ones) so the dai_ops might not get called
> again after a reset.
>
> > On our target platform, the required DAI settings, including PLL and
> > TDM slot configuration, are reapplied when the PCM streams are
> > reconfigured after a reset.
>
> Sure, it'll work for some systems but not in general.
>
> > > > + default:
> > > > + dev_err(component->dev, "%s: unsupported PCM
> format: %d\n",
> > > > + __func__, params_format(params));
> > > > + return -EINVAL;
> > > > + }
>
> > > Don't we need to configure anything in the hardware for clock
> > > provider mode here?
>
> > Since the frame size is already calculated in
> > ma5311_dai_set_tdm_slot(), I don't think we need to configure the clock
> provider mode here.
>
> You shouldn't rely on set_tdm_slot() having been called, generally things
> should work by default. Usually the result is the equivalent of a
> set_tdm_slot() based on the hw_params channels and widths.
>
> > Lastly, do I need to address all feedback from the Sashiko bot, or are
> > only the "High Priority" and "Medium Priority" comments mandatory,
> > with the remaining comments serving as recommendations?
>
> If it's pointing out something valid/useful then of course update for that
> but there's no requirement to update for everything. Your other
> suggestions look OK from reviewing them here, though I might spot
> something in context - in general it's a lot easier to just send the new
> version, especially if it's just implementing the requested changes.