* [PATCH] ASoC: cs35l56: Add module parameter to allow factory calibration
@ 2026-12-02 11:43 Richard Fitzgerald
2026-12-02 13:05 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2026-12-02 11:43 UTC (permalink / raw)
To: broonie, tiwai; +Cc: linux-sound, linux-kernel, patches
Always build the calibration debugfs support into the driver, but only
create the debugfs files if the new module parameter 'allow_factory_cal'
is true, or the existing CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS Kconfig is
enabled. This allows manufacturers to perform factory calibration on the
production line without the need to build and install a custom kernel.
If the kernel has been built with CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS,
the module parameter can be forced to 0 to disable calibration.
A small change is needed to the Kconfig for the HDA driver to delete the
select of SND_SOC_CS35L56_CAL_DEBUGFS_COMMON, as that Kconfig symbol is
now removed.
The CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS Kconfig is retained to prevent
changing the behaviour of existing downstream products that depend on it
enabling the debugfs.
Factory calibration is disabled by default to prevent accidental use of
this feature in non-factory conditions, which could result in the speakers
being under-protected.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
Takashi/Mark: There is a trivial change to the Kconfig for the HDA driver.
We don't have any other changes planned to that Kconfig so should be safe
to take this patch through the ASoC tree.
sound/hda/codecs/side-codecs/Kconfig | 1 -
sound/soc/codecs/Kconfig | 6 ------
sound/soc/codecs/cs35l56-shared.c | 15 ---------------
sound/soc/codecs/cs35l56.c | 6 +++++-
4 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/sound/hda/codecs/side-codecs/Kconfig b/sound/hda/codecs/side-codecs/Kconfig
index b7e2a6fa4258..3c36c82fe0a7 100644
--- a/sound/hda/codecs/side-codecs/Kconfig
+++ b/sound/hda/codecs/side-codecs/Kconfig
@@ -116,7 +116,6 @@ menu "CS35L56 driver options"
config SND_HDA_SCODEC_CS35L56_CAL_DEBUGFS
bool "CS35L56 create debugfs for factory calibration"
depends on DEBUG_FS
- select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
help
Create debugfs entries used during factory-line manufacture
for factory calibration.
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index c353c54465d3..169427d43898 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -911,16 +911,12 @@ config SND_SOC_CS35L56_SDW
help
Enable support for Cirrus Logic CS35L56 boosted amplifier with SoundWire control
-config SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
- bool
-
menu "CS35L56 driver options"
depends on SND_SOC_CS35L56
config SND_SOC_CS35L56_CAL_DEBUGFS
bool "CS35L56 create debugfs for factory calibration"
depends on DEBUG_FS
- select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
help
Create debugfs entries used during factory-line manufacture
for factory calibration.
@@ -929,7 +925,6 @@ config SND_SOC_CS35L56_CAL_DEBUGFS
config SND_SOC_CS35L56_CAL_SET_CTRL
bool "CS35L56 ALSA control to restore factory calibration"
- select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON
help
Allow restoring factory calibration data through an ALSA
control. This is only needed on platforms without UEFI or
@@ -942,7 +937,6 @@ config SND_SOC_CS35L56_CAL_SET_CTRL
config SND_SOC_CS35L56_CAL_PERFORM_CTRL
bool "CS35L56 ALSA control to perform factory calibration"
- 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
diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 329351de32b1..f7374afb7097 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -1084,9 +1084,6 @@ ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base,
char buf[11] = { 0 };
int num_amps, ret;
- if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
- return -ENXIO;
-
if (*ppos)
return -EINVAL;
@@ -1139,9 +1136,6 @@ ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base,
unsigned long val;
int ret;
- if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
- return -ENXIO;
-
if (*ppos)
return -EINVAL;
@@ -1170,9 +1164,6 @@ ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base,
char __user *to, size_t count,
loff_t *ppos)
{
- if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
- return -ENXIO;
-
if (!cs35l56_base->cal_data_valid)
return 0;
@@ -1188,9 +1179,6 @@ ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base,
struct cirrus_amp_cal_data cal_data;
int ret;
- if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
- return -ENXIO;
-
/* Only allow a full blob to be written */
if (*ppos || (count != sizeof(cal_data)))
return -EMSGSIZE;
@@ -1210,9 +1198,6 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_cal_data_debugfs_write, "SND_SOC_CS35L56_SHARED");
void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base,
const struct cs35l56_cal_debugfs_fops *fops)
{
- if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON))
- return;
-
cs35l56_base->debugfs = cs_amp_create_debugfs(cs35l56_base->dev);
debugfs_create_file("calibrate",
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 0ea8c69d93fc..34588245a8f3 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -43,6 +43,10 @@
#include "wm_adsp.h"
#include "cs35l56.h"
+static bool cs35l56_allow_factory_cal = IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS);
+module_param_named(allow_factory_cal, cs35l56_allow_factory_cal, bool, 0444);
+MODULE_PARM_DESC(allow_factory_cal, "Enable support for factory calibration");
+
/*
* snd_soc_register_component() can call component_probe() on all instances
* in a card, so deferred registration must be protected across all instances.
@@ -1532,7 +1536,7 @@ static int _cs35l56_component_probe(struct snd_soc_component *component)
if (ret)
return ret;
- if (IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS))
+ if (cs35l56_allow_factory_cal)
cs35l56_create_cal_debugfs(&cs35l56->base, &cs35l56_cal_debugfs_fops);
queue_work(cs35l56->dsp_wq, &cs35l56->dsp_work);
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: cs35l56: Add module parameter to allow factory calibration
2026-12-02 11:43 [PATCH] ASoC: cs35l56: Add module parameter to allow factory calibration Richard Fitzgerald
@ 2026-12-02 13:05 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-12-02 13:05 UTC (permalink / raw)
To: tiwai, Richard Fitzgerald; +Cc: linux-sound, linux-kernel, patches
On Wed, 02 Dec 2026 11:43:33 +0000, Richard Fitzgerald wrote:
> ASoC: cs35l56: Add module parameter to allow factory calibration
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5
Thanks!
[1/1] ASoC: cs35l56: Add module parameter to allow factory calibration
https://git.kernel.org/broonie/sound/c/d8d4f9e00b06
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] 2+ messages in thread
end of thread, other threads:[~2026-12-02 16:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 11:43 [PATCH] ASoC: cs35l56: Add module parameter to allow factory calibration Richard Fitzgerald
2026-12-02 13:05 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®