Skip to content

Commit 55c4c74

Browse files
committed
ASoC: cs42l84: Report volume updates correctly
cs42l84_put_dac_vol needs to return 1 if the volume was updated. Before this patch, it was only doing that when the MSB changed. Correctly track changes in all the registers. Signed-off-by: Hector Martin <[email protected]>
1 parent 408d516 commit 55c4c74

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

sound/soc/codecs/cs42l84.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int cs42l84_put_dac_vol(struct snd_kcontrol *kctl,
9797
struct snd_soc_component *component = snd_soc_kcontrol_component(kctl);
9898
struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value;
9999
int vola, volb;
100-
int ret, ret2;
100+
int ret, ret2, updated = 0;
101101

102102
vola = val->value.integer.value[0] + mc->min;
103103
volb = val->value.integer.value[1] + mc->min;
@@ -110,23 +110,31 @@ static int cs42l84_put_dac_vol(struct snd_kcontrol *kctl,
110110
CS42L84_FRZ_CTL_ENGAGE);
111111
if (ret < 0)
112112
goto bail;
113+
updated |= ret;
113114

114115
ret = snd_soc_component_update_bits(component, CS42L84_DAC_CHA_VOL_LSB,
115116
0xff, vola & 0xff);
116117
if (ret < 0)
117118
goto bail;
119+
updated |= ret;
120+
118121
ret = snd_soc_component_update_bits(component, CS42L84_DAC_CHA_VOL_MSB,
119122
0xff, (vola >> 8) & 0x01);
120123
if (ret < 0)
121124
goto bail;
125+
updated |= ret;
126+
122127
ret = snd_soc_component_update_bits(component, CS42L84_DAC_CHB_VOL_LSB,
123128
0xff, volb & 0xff);
124129
if (ret < 0)
125130
goto bail;
131+
updated |= ret;
132+
126133
ret = snd_soc_component_update_bits(component, CS42L84_DAC_CHB_VOL_MSB,
127134
0xff, (volb >> 8) & 0x01);
128135
if (ret < 0)
129136
goto bail;
137+
ret |= updated;
130138

131139
bail:
132140
ret2 = snd_soc_component_update_bits(component, CS42L84_FRZ_CTL,

0 commit comments

Comments
 (0)