lkml.org 
[lkml]   [2022]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.15 30/42] ASoC: wm5102: Fix event generation for output compensation
    Date
    From: Charles Keepax <ckeepax@opensource.cirrus.com>

    [ Upstream commit 71b5ab96ffe6589abe7a2e302b83f7a426ebe099 ]

    The output compensation controls always returns zero regardless of if
    the control value was updated. This results in missing notifications
    to user-space of the control change. Update the handling to return 1
    when the value is changed.

    Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
    Link: https://lore.kernel.org/r/20220628153409.3266932-1-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    sound/soc/codecs/wm5102.c | 21 +++++++++++++++++----
    1 file changed, 17 insertions(+), 4 deletions(-)

    diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
    index 621598608bf0..fc3d4e1a9c55 100644
    --- a/sound/soc/codecs/wm5102.c
    +++ b/sound/soc/codecs/wm5102.c
    @@ -680,12 +680,17 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
    {
    struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
    struct arizona *arizona = dev_get_drvdata(component->dev->parent);
    + uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
    + int ret = 0;

    mutex_lock(&arizona->dac_comp_lock);
    - arizona->dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data);
    + if (arizona->dac_comp_coeff != dac_comp_coeff) {
    + arizona->dac_comp_coeff = dac_comp_coeff;
    + ret = 1;
    + }
    mutex_unlock(&arizona->dac_comp_lock);

    - return 0;
    + return ret;
    }

    static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
    @@ -706,12 +711,20 @@ static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol,
    {
    struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
    struct arizona *arizona = dev_get_drvdata(component->dev->parent);
    + struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
    + int ret = 0;
    +
    + if (ucontrol->value.integer.value[0] > mc->max)
    + return -EINVAL;

    mutex_lock(&arizona->dac_comp_lock);
    - arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
    + if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) {
    + arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
    + ret = 1;
    + }
    mutex_unlock(&arizona->dac_comp_lock);

    - return 0;
    + return ret;
    }

    static const char * const wm5102_osr_text[] = {
    --
    2.35.1
    \
     
     \ /
      Last update: 2022-07-20 03:21    [W:4.136 / U:0.924 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site