RE: [PATCH] ASoC: rt1320-sdw: kcontrol for brown-out feature switch

Jack Yu
2026-04-02T04:39:00Z

> -----Original Message-----
> From: Mark Brown <broonie@kernel.org>
> Sent: Wednesday, April 1, 2026 9:23 PM
> To: Jack Yu <jack.yu@realtek.com>
> Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org; lars@metafoo.de;
> Flove(HsinFu) <flove@realtek.com>; Oder Chiou <oder_chiou@realtek.com>;
> Shuming [范書銘] <shumingf@realtek.com>; Derek [方德義]
> <derek.fang@realtek.com>
> Subject: Re: [PATCH] ASoC: rt1320-sdw: kcontrol for brown-out feature switch
>
> On Wed, Apr 01, 2026 at 05:31:07PM +0800, jack.yu@realtek.com wrote:
> > From: Jack Yu <jack.yu@realtek.com>
> >
> > Create a kcontrol to enable or disable brown-out dynamically.
>
> > +static const char * const rt1320_brown_out_mode[] = {
> > + "On",
> > + "Off",
> > +};
> > +
> > +static SOC_ENUM_SINGLE_DECL(rt1320_brown_out_enum, 0, 0,
> > + rt1320_brown_out_mode);
> > +
>
> On/off switches should be a Switch control, not an enum.

Maybe the name of kcontrol leads to misunderstand, it's just an effect setting for amplifier.
I'll update this and use another control type but not enum.
>
> > +static int rt1320_brown_out_put(struct snd_kcontrol *kcontrol,
> > + struct snd_ctl_elem_value *ucontrol) {
> > + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
> > + struct rt1320_sdw_priv *rt1320 =
> snd_soc_component_get_drvdata(component);
> > + struct device *dev = &rt1320->sdw_slave->dev;
> > + int ret, tmp;
> > +
> > + ret = pm_runtime_resume(component->dev);
> > + if (ret < 0 && ret != -EACCES)
> > + return ret;
>
> Other controls in this driver ignore writes before hw_init is set, should this
> one?
Will fix it.