* [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls
@ 2024-08-05 10:27 Simon Trimmer
2024-08-05 10:27 ` [PATCH 1/2] ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add() Simon Trimmer
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Simon Trimmer @ 2024-08-05 10:27 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, alsa-devel, linux-kernel, patches, Simon Trimmer
This pair of patches extend wm_adsp to add a callback that can be used
to control whether ALSA controls are added and then tweak cs35l56 to use
it to suppress controls made from firmware coefficients.
Simon Trimmer (2):
ASoC: wm_adsp: Add control_add callback and export
wm_adsp_control_add()
ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients
sound/soc/codecs/cs35l56.c | 11 +++++++++++
sound/soc/codecs/wm_adsp.c | 17 ++++++++++++++---
sound/soc/codecs/wm_adsp.h | 3 +++
3 files changed, 28 insertions(+), 3 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add()
2024-08-05 10:27 [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Simon Trimmer
@ 2024-08-05 10:27 ` Simon Trimmer
2024-08-05 10:27 ` [PATCH 2/2] ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients Simon Trimmer
2024-08-06 18:44 ` [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Simon Trimmer @ 2024-08-05 10:27 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, alsa-devel, linux-kernel, patches, Simon Trimmer
The callback allows codec drivers to affect how firmware coefficients
are added as controls.
For example a codec driver may selectively add controls by choosing to
call wm_adsp_control_add() based on some filter logic.
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
---
sound/soc/codecs/wm_adsp.c | 17 ++++++++++++++---
sound/soc/codecs/wm_adsp.h | 3 +++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 9f8549b34e30..e69283195f36 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -583,7 +583,7 @@ static void wm_adsp_ctl_work(struct work_struct *work)
kfree(kcontrol);
}
-static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
+int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
{
struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp);
struct cs_dsp *cs_dsp = &dsp->cs_dsp;
@@ -658,6 +658,17 @@ static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
return ret;
}
+EXPORT_SYMBOL_GPL(wm_adsp_control_add);
+
+static int wm_adsp_control_add_cb(struct cs_dsp_coeff_ctl *cs_ctl)
+{
+ struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp);
+
+ if (dsp->control_add)
+ return (dsp->control_add)(dsp, cs_ctl);
+ else
+ return wm_adsp_control_add(cs_ctl);
+}
static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl)
{
@@ -2072,12 +2083,12 @@ irqreturn_t wm_halo_wdt_expire(int irq, void *data)
EXPORT_SYMBOL_GPL(wm_halo_wdt_expire);
static const struct cs_dsp_client_ops wm_adsp1_client_ops = {
- .control_add = wm_adsp_control_add,
+ .control_add = wm_adsp_control_add_cb,
.control_remove = wm_adsp_control_remove,
};
static const struct cs_dsp_client_ops wm_adsp2_client_ops = {
- .control_add = wm_adsp_control_add,
+ .control_add = wm_adsp_control_add_cb,
.control_remove = wm_adsp_control_remove,
.pre_run = wm_adsp_pre_run,
.post_run = wm_adsp_event_post_run,
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index e53dfcf1f78f..edc5b02ae765 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -37,6 +37,7 @@ struct wm_adsp {
bool wmfw_optional;
struct work_struct boot_work;
+ int (*control_add)(struct wm_adsp *dsp, struct cs_dsp_coeff_ctl *cs_ctl);
int (*pre_run)(struct wm_adsp *dsp);
bool preloaded;
@@ -132,6 +133,8 @@ int wm_adsp_compr_pointer(struct snd_soc_component *component,
int wm_adsp_compr_copy(struct snd_soc_component *component,
struct snd_compr_stream *stream,
char __user *buf, size_t count);
+
+int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl);
int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,
unsigned int alg, void *buf, size_t len);
int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type,
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients
2024-08-05 10:27 [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Simon Trimmer
2024-08-05 10:27 ` [PATCH 1/2] ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add() Simon Trimmer
@ 2024-08-05 10:27 ` Simon Trimmer
2024-08-06 18:44 ` [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Simon Trimmer @ 2024-08-05 10:27 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, alsa-devel, linux-kernel, patches, Simon Trimmer
A number of laptops have gone to market with old firmware versions that
export controls that have since been hidden, but we can't just install a
newer firmware because the firmware for each product is customized and
qualified by the OEM. The issue is that alsactl save and restore has no
idea what controls are good to persist which can lead to
misconfiguration.
There is no reason that the UCM or user should need to interact with any
of the ALSA controls for the firmware coefficients so they can be
removed entirely.
Fixes: e49611252900 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
---
sound/soc/codecs/cs35l56.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 84c34f5b1a51..757ade6373ed 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -1095,6 +1095,11 @@ int cs35l56_system_resume(struct device *dev)
}
EXPORT_SYMBOL_GPL(cs35l56_system_resume);
+static int cs35l56_control_add_nop(struct wm_adsp *dsp, struct cs_dsp_coeff_ctl *cs_ctl)
+{
+ return 0;
+}
+
static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
{
struct wm_adsp *dsp;
@@ -1117,6 +1122,12 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
dsp->fw = 12;
dsp->wmfw_optional = true;
+ /*
+ * None of the firmware controls need to be exported so add a no-op
+ * callback that suppresses creating an ALSA control.
+ */
+ dsp->control_add = &cs35l56_control_add_nop;
+
dev_dbg(cs35l56->base.dev, "DSP system name: '%s'\n", dsp->system_name);
ret = wm_halo_init(dsp);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls
2024-08-05 10:27 [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Simon Trimmer
2024-08-05 10:27 ` [PATCH 1/2] ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add() Simon Trimmer
2024-08-05 10:27 ` [PATCH 2/2] ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients Simon Trimmer
@ 2024-08-06 18:44 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2024-08-06 18:44 UTC (permalink / raw)
To: Simon Trimmer; +Cc: linux-sound, alsa-devel, linux-kernel, patches
On Mon, 05 Aug 2024 10:27:19 +0000, Simon Trimmer wrote:
> This pair of patches extend wm_adsp to add a callback that can be used
> to control whether ALSA controls are added and then tweak cs35l56 to use
> it to suppress controls made from firmware coefficients.
>
> Simon Trimmer (2):
> ASoC: wm_adsp: Add control_add callback and export
> wm_adsp_control_add()
> ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add()
commit: 45b4acab4cac79503663f0a4be9eb3752db04d4b
[2/2] ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients
commit: 2c3640b82213cf2beb7c1cc3cfce2ecf5349b0de
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] 4+ messages in thread
end of thread, other threads:[~2024-08-06 18:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 10:27 [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Simon Trimmer
2024-08-05 10:27 ` [PATCH 1/2] ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add() Simon Trimmer
2024-08-05 10:27 ` [PATCH 2/2] ASoC: cs35l56: Stop creating ALSA controls for firmware coefficients Simon Trimmer
2024-08-06 18:44 ` [PATCH 0/2] ASoC: Extend wm_adsp so cs35l56 can suppress controls Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox