On Wed, Jun 29, 2022 at 10:06:43AM +0100, Srinivas Kandagatla wrote: > +static int wsa_dev_mode_put(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); > + struct wsa883x_priv *wsa883x = snd_soc_component_get_drvdata(component); > + > + if (wsa883x->dev_mode == ucontrol->value.enumerated.item[0]) > + return 0; > + > + wsa883x->dev_mode = ucontrol->value.enumerated.item[0]; > + > + return 0; > +} This isn't returning 1 when the value changes so will miss generating events, please test the driver with mixer-test. > + switch (event) { > + case SND_SOC_DAPM_POST_PMU: > + if (wsa883x->dev_mode == RECEIVER) { > + snd_soc_component_write_field(component, WSA883X_CDC_PATH_MODE, > + WSA883X_RXD_MODE_MASK, > + WSA883X_RXD_MODE_HIFI); > + snd_soc_component_write_field(component, WSA883X_SPKR_PWM_CLK_CTL, > + WSA883X_SPKR_PWM_FREQ_SEL_MASK, > + WSA883X_SPKR_PWM_FREQ_F600KHZ); > + snd_soc_component_write_field(component, WSA883X_DRE_CTL_0, > + WSA883X_DRE_PROG_DELAY_MASK, 0x0); > + } else if (wsa883x->dev_mode == SPEAKER) { This looks like it'd be better written as a switch statement. > +static const struct snd_kcontrol_new wsa883x_snd_controls[] = { > + SOC_SINGLE_RANGE_TLV("PA Gain", WSA883X_DRE_CTL_1, 1, > + 0x0, 0x1f, 1, pa_gain), Volume controls should end in Volume, mixer-test should also have caught this.
Attachment:
signature.asc
Description: PGP signature