[alsa-devel] [PATCH] ASoC: pcm512x: Implement the digital_mute interface

Dimitris Papavasiliou dpapavas at gmail.com
Mon Nov 26 20:23:28 CET 2018


On Mon, Nov 26, 2018 at 4:02 PM Mark Brown <broonie at kernel.org> wrote:

> On Sat, Nov 24, 2018 at 10:05:42PM +0200, Dimitris Papavasiliou wrote:
>
> > +static int pcm512x_digital_playback_switch_get(struct snd_kcontrol
> *kcontrol,
> > +                                            struct snd_ctl_elem_value
> *ucontrol)
> > +{
> > +     struct snd_soc_component *component =
> snd_soc_kcontrol_component(kcontrol);
> > +     struct pcm512x_priv *pcm512x =
> snd_soc_component_get_drvdata(component);
> > +
> > +     mutex_lock(&pcm512x->mutex);
> > +     ucontrol->value.integer.value[0] = !(pcm512x->mute & 0x4);
> > +     ucontrol->value.integer.value[1] = !(pcm512x->mute & 0x2);
> > +     mutex_unlock(&pcm512x->mutex);
> > +
> > +     return 0;
> > +}
>
> Just remove the control, no need to jump through these hoops.
>

 Sorry, I probably misunderstand.  Do you propose removing
the "Digital Playback Switch" control entirely?  It would
certainly simplify things, as far as implementing the
.digital_mute callback is concerned, but it would remove the only
way of manually muting the DAC.  The "Digital Playback Volume"
control is the main (and basically sole, apart from a switchable
-6dB analog gain control) volume control of the DAC and removing
the Switch component would make it unmutable.

The current implementation uses the control to keep track of the
user's desired mute state and allows the .digital_mute callback to
override it, in a way that is transparent to the user.


More information about the Alsa-devel mailing list