lkml.org 
[lkml]   [2022]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v2 1/2] ASoC: add support for TAS5805M digital amplifier
    From
    On 1/11/2022 12:53 AM, Daniel Beer wrote:
    > The Texas Instruments TAS5805M is a class D audio amplifier with an
    > integrated DSP. DSP configuration is expected to be supplied via a
    > device-tree attribute containing a sequence of register writes.
    >
    > These register writes set up application-specific DSP settings and are
    > expected to be generated using TI's PPC3 tool.
    >
    > Signed-off-by: Daniel Beer <daniel.beer@igorinstitute.com>
    > ---

    ...

    > +
    > +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.

    \
     
     \ /
      Last update: 2022-01-13 10:19    [W:3.036 / U:0.352 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site