Re: [PATCH] ASoC: cs35l56: Allow factory calibration through ALSA controls

From: Richard Fitzgerald

Date: Tue Mar 24 2026 - 10:28:09 EST


On 24/03/2026 2:02 pm, Mark Brown wrote:
On Tue, Mar 24, 2026 at 11:03:02AM +0000, Richard Fitzgerald wrote:

+static int cs35l56_cal_ambient_ctl_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
+ struct snd_soc_dapm_context *dapm;
+ int ret;
+
+ if (!in_range(ucontrol->value.integer.value[0], 5, 35))
+ return -EINVAL;

The values range from 5..35...


The second argument to in_range() isn't a max.
But if I'm sending a new version to make them volatile I can also change
it to not use the in_range() macro.

+static const struct snd_kcontrol_new cs35l56_cal_perform_controls[] = {
+ SOC_SINGLE_EXT("CAL_AMBIENT", SND_SOC_NOPM, 0, 40, 0,
+ cs35l56_cal_ambient_ctl_get, cs35l56_cal_ambient_ctl_set),

...but the range is from 0..40? I'd expect mixer-test to complain about
both these controls too, they're not flagged as volatile.