* [PATCH v2 0/2] ASoC: cs35l56: Support for factory calibration through ALSA controls
@ 2026-03-25 17:08 Richard Fitzgerald
2026-03-25 17:08 ` [PATCH v2 1/2] ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access flags Richard Fitzgerald
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Richard Fitzgerald @ 2026-03-25 17:08 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, linux-kernel, patches
Factory calibration is normally done through debugfs files.
Google have requested that factory calibration can be performed by
repair shops. These repair shops only have access to the standard
"user" kernel, which does not include debugfs.
Patch #1 adds a new control definition macro to create a boolean control
with specified access permissions. (new in V2)
Patch #2 is the implementation in the cs35l56 driver.
Changes in V2:
- Rename "Calibrate" control to "Calibrate Switch" to conform to naming
convention for boolean controls.
- Mark "Calibrate Switch" control volatile.
- Cache the value written to the "CAL_AMBIENT" control so that a read will
return the last set value.
- Return 1 from writing "CAL_AMBIENT" if the value was changed.
- Return 1 from writing the "Calibrate Switch" control to true because
that always causes some activity in the amp.
- Replace use of the confusing in_range() with normal comparisons against
limits and make the limits the same as the control definition.
- Simplify the code in cs35l56_calibrate_ctl_set(). It's a boolean so the
value written to it is either false or true.
Richard Fitzgerald (2):
ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access
flags
ASoC: cs35l56: Allow factory calibration through ALSA controls
include/sound/cs35l56.h | 1 +
include/sound/soc.h | 6 ++
sound/soc/codecs/Kconfig | 13 +++++
sound/soc/codecs/cs35l56-shared.c | 9 +++
sound/soc/codecs/cs35l56.c | 96 +++++++++++++++++++++++++++++++
sound/soc/codecs/cs35l56.h | 2 +
6 files changed, 127 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/2] ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access flags 2026-03-25 17:08 [PATCH v2 0/2] ASoC: cs35l56: Support for factory calibration through ALSA controls Richard Fitzgerald @ 2026-03-25 17:08 ` Richard Fitzgerald 2026-03-25 17:08 ` [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls Richard Fitzgerald 2026-03-26 10:20 ` [PATCH v2 0/2] ASoC: cs35l56: Support for " Mark Brown 2 siblings, 0 replies; 6+ messages in thread From: Richard Fitzgerald @ 2026-03-25 17:08 UTC (permalink / raw) To: broonie; +Cc: linux-sound, linux-kernel, patches Add a macro SOC_SINGLE_BOOL_EXT_ACC() to allow the access permission flags to be set. This is the same as SOC_SINGLE_BOOL_EXT() but with an extra argument for the access flags. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> --- New in V2 include/sound/soc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index a30f95ff7d86..fd6c1c8055d2 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -311,6 +311,12 @@ struct platform_device; .info = snd_soc_info_bool_ext, \ .get = xhandler_get, .put = xhandler_put, \ .private_value = xdata } +#define SOC_SINGLE_BOOL_EXT_ACC(xname, xdata, xhandler_get, xhandler_put, xaccess) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .access = xaccess, \ + .info = snd_soc_info_bool_ext, \ + .get = xhandler_get, .put = xhandler_put, \ + .private_value = xdata } #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_enum_double, \ -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls 2026-03-25 17:08 [PATCH v2 0/2] ASoC: cs35l56: Support for factory calibration through ALSA controls Richard Fitzgerald 2026-03-25 17:08 ` [PATCH v2 1/2] ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access flags Richard Fitzgerald @ 2026-03-25 17:08 ` Richard Fitzgerald 2026-03-25 17:53 ` Mark Brown 2026-03-26 10:20 ` [PATCH v2 0/2] ASoC: cs35l56: Support for " Mark Brown 2 siblings, 1 reply; 6+ messages in thread From: Richard Fitzgerald @ 2026-03-25 17:08 UTC (permalink / raw) To: broonie; +Cc: linux-sound, linux-kernel, patches Add support for using ALSA controls to trigger a factory calibration. This is protected by a new Kconfig option so that it is only available if explicitly enabled in the kernel. By default it is not enabled. Factory calibration is normally done through debugfs files. Google have requested that factory calibration can be performed by repair shops. These repair shops only have access to the standard "user" kernel, which does not include debugfs. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> --- Changes in V2: - Rename "Calibrate" control to "Calibrate Switch" to conform to naming convention for boolean controls. - Mark "Calibrate Switch" control volatile. - Cache the value written to the "CAL_AMBIENT" control so that a read will return the last set value. - Return 1 from writing "CAL_AMBIENT" if the value was changed. - Return 1 from writing the "Calibrate Switch" control to true because that always causes some activity in the amp. - Replace use of the confusing in_range() with normal comparisons against limits and make the limits the same as the control definition. - Simplify the code in cs35l56_calibrate_ctl_set(). It's a boolean so the value written to it is either false or true. include/sound/cs35l56.h | 1 + sound/soc/codecs/Kconfig | 13 +++++ sound/soc/codecs/cs35l56-shared.c | 9 +++ sound/soc/codecs/cs35l56.c | 96 +++++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.h | 2 + 5 files changed, 121 insertions(+) diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h index 7ca25487030a..c3b10587cb4c 100644 --- a/include/sound/cs35l56.h +++ b/include/sound/cs35l56.h @@ -435,6 +435,7 @@ ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base, ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base, const char __user *from, size_t count, loff_t *ppos); +int cs35l56_factory_calibrate(struct cs35l56_base *cs35l56_base); void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base, const struct cs35l56_cal_debugfs_fops *fops); void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base); diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index d6104796db4f..ca3e47db126e 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -921,6 +921,19 @@ config SND_SOC_CS35L56_CAL_SET_CTRL If unsure select "N". +config SND_SOC_CS35L56_CAL_PERFORM_CTRL + bool "CS35L56 ALSA control to perform factory calibration" + default N + select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON + help + Allow performing factory calibration data through an ALSA + control. It is recommended to use the debugfs method instead + because debugfs has restricted access permissions. + + On most platforms this is not needed. + + If unsure select "N". + config SND_SOC_CS35L56_TEST tristate "KUnit test for Cirrus Logic cs35l56 driver" if !KUNIT_ALL_TESTS depends on SND_SOC_CS35L56 && KUNIT diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c index af87ebae98cb..e05d975ba794 100644 --- a/sound/soc/codecs/cs35l56-shared.c +++ b/sound/soc/codecs/cs35l56-shared.c @@ -1185,6 +1185,15 @@ ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base, } EXPORT_SYMBOL_NS_GPL(cs35l56_calibrate_debugfs_write, "SND_SOC_CS35L56_SHARED"); +int cs35l56_factory_calibrate(struct cs35l56_base *cs35l56_base) +{ + if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_PERFORM_CTRL)) + return -ENXIO; + + return cs35l56_perform_calibration(cs35l56_base); +} +EXPORT_SYMBOL_NS_GPL(cs35l56_factory_calibrate, "SND_SOC_CS35L56_SHARED"); + ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base, const char __user *from, size_t count, loff_t *ppos) diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c index 9d35797e000a..378017fcea10 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -1109,6 +1109,88 @@ static int cs35l56_cal_data_ctl_set(struct snd_kcontrol *kcontrol, return 1; } +static int cs35l56_cal_ambient_ctl_get(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); + + ucontrol->value.integer.value[0] = cs35l56->ambient_ctl_value; + + return 0; +} + +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 temperature = ucontrol->value.integer.value[0]; + int ret; + + if (temperature == cs35l56->ambient_ctl_value) + return 0; + + if ((temperature < 0) || (temperature > 40)) + return -EINVAL; + + dapm = cs35l56_power_up_for_cal(cs35l56); + if (IS_ERR(dapm)) + return PTR_ERR(dapm); + + ret = cs_amp_write_ambient_temp(&cs35l56->dsp.cs_dsp, + cs35l56->base.calibration_controls, + temperature); + cs35l56_power_down_after_cal(cs35l56); + + if (ret) + return ret; + + cs35l56->ambient_ctl_value = temperature; + + return 1; +} + +static int cs35l56_calibrate_ctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + /* + * Allow reading because of user-side libraries that assume all + * controls are readable. But always return false to prevent dumb + * save-restore tools like alsactl accidentically triggering a + * factory calibration when they restore. + */ + ucontrol->value.integer.value[0] = 0; + + return 0; +} + +static int cs35l56_calibrate_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 (ucontrol->value.integer.value[0] == 0) + return 0; + + dapm = cs35l56_power_up_for_cal(cs35l56); + if (IS_ERR(dapm)) + return PTR_ERR(dapm); + + snd_soc_dapm_mutex_lock(dapm); + ret = cs35l56_factory_calibrate(&cs35l56->base); + snd_soc_dapm_mutex_unlock(dapm); + cs35l56_power_down_after_cal(cs35l56); + if (ret < 0) + return ret; + + return 1; +} + static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = { SND_SOC_BYTES_E("CAL_DATA", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32), cs35l56_cal_data_ctl_get, cs35l56_cal_data_ctl_set), @@ -1117,6 +1199,14 @@ static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = { SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE), }; +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), + SOC_SINGLE_BOOL_EXT_ACC("Calibrate Switch", 0, + cs35l56_calibrate_ctl_get, cs35l56_calibrate_ctl_set, + SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_VOLATILE), +}; + VISIBLE_IF_KUNIT int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) { unsigned short vendor, device; @@ -1290,6 +1380,12 @@ static int cs35l56_component_probe(struct snd_soc_component *component) ARRAY_SIZE(cs35l56_cal_data_restore_controls)); } + if (!ret && IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_PERFORM_CTRL)) { + ret = snd_soc_add_component_controls(component, + cs35l56_cal_perform_controls, + ARRAY_SIZE(cs35l56_cal_perform_controls)); + } + if (ret) return dev_err_probe(cs35l56->base.dev, ret, "unable to add controls\n"); diff --git a/sound/soc/codecs/cs35l56.h b/sound/soc/codecs/cs35l56.h index 36d239d571cd..cd71b23b2a3a 100644 --- a/sound/soc/codecs/cs35l56.h +++ b/sound/soc/codecs/cs35l56.h @@ -54,6 +54,8 @@ struct cs35l56_private { bool sysclk_set; u8 sdw_link_num; u8 sdw_unique_id; + + u8 ambient_ctl_value; }; static inline struct cs35l56_private *cs35l56_private_from_base(struct cs35l56_base *cs35l56_base) -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls 2026-03-25 17:08 ` [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls Richard Fitzgerald @ 2026-03-25 17:53 ` Mark Brown 2026-03-26 10:16 ` Richard Fitzgerald 0 siblings, 1 reply; 6+ messages in thread From: Mark Brown @ 2026-03-25 17:53 UTC (permalink / raw) To: Richard Fitzgerald; +Cc: linux-sound, linux-kernel, patches [-- Attachment #1: Type: text/plain, Size: 9106 bytes --] On Wed, Mar 25, 2026 at 05:08:41PM +0000, Richard Fitzgerald wrote: > Add support for using ALSA controls to trigger a factory calibration. > This is protected by a new Kconfig option so that it is only available > if explicitly enabled in the kernel. By default it is not enabled. > Factory calibration is normally done through debugfs files. > Google have requested that factory calibration can be performed by > repair shops. These repair shops only have access to the standard > "user" kernel, which does not include debugfs. AFAICT this doesn't have an EFI write command like the debugfs code does (when you write "store_uefi"). I don't mind, just wanted to double check that this is desirable? > > Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> > --- > Changes in V2: > - Rename "Calibrate" control to "Calibrate Switch" to conform to naming > convention for boolean controls. > - Mark "Calibrate Switch" control volatile. > - Cache the value written to the "CAL_AMBIENT" control so that a read will > return the last set value. > - Return 1 from writing "CAL_AMBIENT" if the value was changed. > - Return 1 from writing the "Calibrate Switch" control to true because > that always causes some activity in the amp. > - Replace use of the confusing in_range() with normal comparisons against > limits and make the limits the same as the control definition. > - Simplify the code in cs35l56_calibrate_ctl_set(). It's a boolean so the > value written to it is either false or true. > > include/sound/cs35l56.h | 1 + > sound/soc/codecs/Kconfig | 13 +++++ > sound/soc/codecs/cs35l56-shared.c | 9 +++ > sound/soc/codecs/cs35l56.c | 96 +++++++++++++++++++++++++++++++ > sound/soc/codecs/cs35l56.h | 2 + > 5 files changed, 121 insertions(+) > > diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h > index 7ca25487030a..c3b10587cb4c 100644 > --- a/include/sound/cs35l56.h > +++ b/include/sound/cs35l56.h > @@ -435,6 +435,7 @@ ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base, > ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base, > const char __user *from, size_t count, > loff_t *ppos); > +int cs35l56_factory_calibrate(struct cs35l56_base *cs35l56_base); > void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base, > const struct cs35l56_cal_debugfs_fops *fops); > void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base); > diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig > index d6104796db4f..ca3e47db126e 100644 > --- a/sound/soc/codecs/Kconfig > +++ b/sound/soc/codecs/Kconfig > @@ -921,6 +921,19 @@ config SND_SOC_CS35L56_CAL_SET_CTRL > > If unsure select "N". > > +config SND_SOC_CS35L56_CAL_PERFORM_CTRL > + bool "CS35L56 ALSA control to perform factory calibration" > + default N > + select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON > + help > + Allow performing factory calibration data through an ALSA > + control. It is recommended to use the debugfs method instead > + because debugfs has restricted access permissions. > + > + On most platforms this is not needed. > + > + If unsure select "N". > + > config SND_SOC_CS35L56_TEST > tristate "KUnit test for Cirrus Logic cs35l56 driver" if !KUNIT_ALL_TESTS > depends on SND_SOC_CS35L56 && KUNIT > diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c > index af87ebae98cb..e05d975ba794 100644 > --- a/sound/soc/codecs/cs35l56-shared.c > +++ b/sound/soc/codecs/cs35l56-shared.c > @@ -1185,6 +1185,15 @@ ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base, > } > EXPORT_SYMBOL_NS_GPL(cs35l56_calibrate_debugfs_write, "SND_SOC_CS35L56_SHARED"); > > +int cs35l56_factory_calibrate(struct cs35l56_base *cs35l56_base) > +{ > + if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_PERFORM_CTRL)) > + return -ENXIO; > + > + return cs35l56_perform_calibration(cs35l56_base); > +} > +EXPORT_SYMBOL_NS_GPL(cs35l56_factory_calibrate, "SND_SOC_CS35L56_SHARED"); > + > ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base, > const char __user *from, size_t count, > loff_t *ppos) > diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c > index 9d35797e000a..378017fcea10 100644 > --- a/sound/soc/codecs/cs35l56.c > +++ b/sound/soc/codecs/cs35l56.c > @@ -1109,6 +1109,88 @@ static int cs35l56_cal_data_ctl_set(struct snd_kcontrol *kcontrol, > return 1; > } > > +static int cs35l56_cal_ambient_ctl_get(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); > + > + ucontrol->value.integer.value[0] = cs35l56->ambient_ctl_value; > + > + return 0; > +} > + > +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 temperature = ucontrol->value.integer.value[0]; > + int ret; > + > + if (temperature == cs35l56->ambient_ctl_value) > + return 0; > + > + if ((temperature < 0) || (temperature > 40)) > + return -EINVAL; > + > + dapm = cs35l56_power_up_for_cal(cs35l56); > + if (IS_ERR(dapm)) > + return PTR_ERR(dapm); > + > + ret = cs_amp_write_ambient_temp(&cs35l56->dsp.cs_dsp, > + cs35l56->base.calibration_controls, > + temperature); > + cs35l56_power_down_after_cal(cs35l56); > + > + if (ret) > + return ret; > + > + cs35l56->ambient_ctl_value = temperature; > + > + return 1; > +} > + > +static int cs35l56_calibrate_ctl_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + /* > + * Allow reading because of user-side libraries that assume all > + * controls are readable. But always return false to prevent dumb > + * save-restore tools like alsactl accidentically triggering a > + * factory calibration when they restore. > + */ > + ucontrol->value.integer.value[0] = 0; > + > + return 0; > +} > + > +static int cs35l56_calibrate_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 (ucontrol->value.integer.value[0] == 0) > + return 0; > + > + dapm = cs35l56_power_up_for_cal(cs35l56); > + if (IS_ERR(dapm)) > + return PTR_ERR(dapm); > + > + snd_soc_dapm_mutex_lock(dapm); > + ret = cs35l56_factory_calibrate(&cs35l56->base); > + snd_soc_dapm_mutex_unlock(dapm); > + cs35l56_power_down_after_cal(cs35l56); > + if (ret < 0) > + return ret; > + > + return 1; > +} > + > static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = { > SND_SOC_BYTES_E("CAL_DATA", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32), > cs35l56_cal_data_ctl_get, cs35l56_cal_data_ctl_set), > @@ -1117,6 +1199,14 @@ static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = { > SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE), > }; > > +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), > + SOC_SINGLE_BOOL_EXT_ACC("Calibrate Switch", 0, > + cs35l56_calibrate_ctl_get, cs35l56_calibrate_ctl_set, > + SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_VOLATILE), > +}; > + > VISIBLE_IF_KUNIT int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) > { > unsigned short vendor, device; > @@ -1290,6 +1380,12 @@ static int cs35l56_component_probe(struct snd_soc_component *component) > ARRAY_SIZE(cs35l56_cal_data_restore_controls)); > } > > + if (!ret && IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_PERFORM_CTRL)) { > + ret = snd_soc_add_component_controls(component, > + cs35l56_cal_perform_controls, > + ARRAY_SIZE(cs35l56_cal_perform_controls)); > + } > + > if (ret) > return dev_err_probe(cs35l56->base.dev, ret, "unable to add controls\n"); > > diff --git a/sound/soc/codecs/cs35l56.h b/sound/soc/codecs/cs35l56.h > index 36d239d571cd..cd71b23b2a3a 100644 > --- a/sound/soc/codecs/cs35l56.h > +++ b/sound/soc/codecs/cs35l56.h > @@ -54,6 +54,8 @@ struct cs35l56_private { > bool sysclk_set; > u8 sdw_link_num; > u8 sdw_unique_id; > + > + u8 ambient_ctl_value; > }; > > static inline struct cs35l56_private *cs35l56_private_from_base(struct cs35l56_base *cs35l56_base) > -- > 2.47.3 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls 2026-03-25 17:53 ` Mark Brown @ 2026-03-26 10:16 ` Richard Fitzgerald 0 siblings, 0 replies; 6+ messages in thread From: Richard Fitzgerald @ 2026-03-26 10:16 UTC (permalink / raw) To: Mark Brown; +Cc: linux-sound, linux-kernel, patches On 25/03/2026 5:53 pm, Mark Brown wrote: > On Wed, Mar 25, 2026 at 05:08:41PM +0000, Richard Fitzgerald wrote: >> Add support for using ALSA controls to trigger a factory calibration. >> This is protected by a new Kconfig option so that it is only available >> if explicitly enabled in the kernel. By default it is not enabled. > >> Factory calibration is normally done through debugfs files. >> Google have requested that factory calibration can be performed by >> repair shops. These repair shops only have access to the standard >> "user" kernel, which does not include debugfs. > > AFAICT this doesn't have an EFI write command like the debugfs code does > (when you write "store_uefi"). I don't mind, just wanted to double > check that this is desirable? > That's correct. The Google devices don't have EFI storage, they will use the CAL_DATA_RB control to extract the calibration data to save it in their own persistent storage. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] ASoC: cs35l56: Support for factory calibration through ALSA controls 2026-03-25 17:08 [PATCH v2 0/2] ASoC: cs35l56: Support for factory calibration through ALSA controls Richard Fitzgerald 2026-03-25 17:08 ` [PATCH v2 1/2] ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access flags Richard Fitzgerald 2026-03-25 17:08 ` [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls Richard Fitzgerald @ 2026-03-26 10:20 ` Mark Brown 2 siblings, 0 replies; 6+ messages in thread From: Mark Brown @ 2026-03-26 10:20 UTC (permalink / raw) To: Richard Fitzgerald; +Cc: linux-sound, linux-kernel, patches On Wed, 25 Mar 2026 17:08:39 +0000, Richard Fitzgerald wrote: > ASoC: cs35l56: Support for factory calibration through ALSA controls > > Factory calibration is normally done through debugfs files. > Google have requested that factory calibration can be performed by > repair shops. These repair shops only have access to the standard > "user" kernel, which does not include debugfs. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1 Thanks! [1/2] ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access flags https://git.kernel.org/broonie/sound/c/37c277f050e8 [2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls https://git.kernel.org/broonie/sound/c/ee7d655dbaf5 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-26 16:21 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-25 17:08 [PATCH v2 0/2] ASoC: cs35l56: Support for factory calibration through ALSA controls Richard Fitzgerald 2026-03-25 17:08 ` [PATCH v2 1/2] ASoC: soc.h: Add SOC_SINGLE_BOOL_EXT_ACC() to allow setting access flags Richard Fitzgerald 2026-03-25 17:08 ` [PATCH v2 2/2] ASoC: cs35l56: Allow factory calibration through ALSA controls Richard Fitzgerald 2026-03-25 17:53 ` Mark Brown 2026-03-26 10:16 ` Richard Fitzgerald 2026-03-26 10:20 ` [PATCH v2 0/2] ASoC: cs35l56: Support for " Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox