[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220113221858.GA18380@nyquist.nev>
Date: Fri, 14 Jan 2022 11:18:58 +1300
From: Daniel Beer <daniel.beer@...rinstitute.com>
To: Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>
Cc: alsa-devel@...a-project.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Andy Liu <andy-liu@...com>, Mark Brown <broonie@...nel.org>,
Derek Simkowiak <derek.simkowiak@...rinstitute.com>
Subject: Re: [PATCH v2 1/2] ASoC: add support for TAS5805M digital amplifier
On Thu, Jan 13, 2022 at 10:18:27AM +0100, Amadeusz Sławiński wrote:
> > +static int tas5805m_vol_put(struct snd_kcontrol *kcontrol,
> > + struct snd_ctl_elem_value *ucontrol)
> > +{
> > + struct snd_soc_component *component =
> > + snd_soc_kcontrol_component(kcontrol);
> > + struct tas5805m_priv *tas5805m =
> > + snd_soc_component_get_drvdata(component);
> > +
> > + if (!(volume_is_valid(ucontrol->value.integer.value[0]) &&
> > + volume_is_valid(ucontrol->value.integer.value[1])))
> > + return -EINVAL;
> > +
> > + mutex_lock(&tas5805m->lock);
> > + tas5805m->vol[0] = ucontrol->value.integer.value[0];
> > + tas5805m->vol[1] = ucontrol->value.integer.value[1];
> > + dev_dbg(component->dev, "set vol=%d/%d (is_powered=%d)\n",
> > + tas5805m->vol[0], tas5805m->vol[1], tas5805m->is_powered);
> > + if (tas5805m->is_powered)
> > + tas5805m_refresh_unlocked(component);
> > + mutex_unlock(&tas5805m->lock);
> > +
> > + return 0;
> > +}
> > +
>
> put method should return '1' if value changed, so ALSA knows to inform
> userspace utilities about change. You can check if userspace is notified of
> changes with "alsactl monitor", you should see something like:
> node hw:2, #3 (2,0,0,ADC0 Capture Volume,0) VALUE
> when value changes.
Thanks, will fix this.
--
Daniel Beer
Firmware Engineer at Igor Institute
daniel.beer@...rinstitute.com or +64-27-420-8101
Offices in Seattle, San Francisco, and Vancouver BC or (206) 494-3312
Powered by blists - more mailing lists