* [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients
@ 2024-07-30 14:37 Stefan Binding
2024-07-30 14:55 ` Jaroslav Kysela
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Binding @ 2024-07-30 14:37 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai
Cc: alsa-devel, linux-sound, linux-kernel, patches, Stefan Binding
Add a kernel parameter to allow coefficients to be exposed as ALSA controls.
When the CS35L41 loads its firmware, it has a number of controls to
affect its behaviour. Currently, these controls are exposed as ALSA
Controls by default.
However, nothing in userspace currently uses them, and is unlikely to
do so in the future, therefore we don't need to create ASLA controls
for them.
These controls can be useful for debug, so we can add a kernel
parameter to re-enable them if necessary.
Disabling these controls would prevent userspace from trying to read
these controls when the CS35L41 is hibernating, which ordinarily
would result in an error message.
Also change the formatting of the other module parameter in
cs35l41_hda.c to match the new parameter.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
sound/pci/hda/cs35l41_hda.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index 4b411ed8c3fe..43d49a69ca14 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -76,8 +76,13 @@ static const struct cirrus_amp_cal_controls cs35l41_calibration_controls = {
static bool firmware_autostart = 1;
module_param(firmware_autostart, bool, 0444);
-MODULE_PARM_DESC(firmware_autostart, "Allow automatic firmware download on boot"
- "(0=Disable, 1=Enable) (default=1); ");
+MODULE_PARM_DESC(firmware_autostart,
+ "Allow automatic firmware download on boot, (0=Disable, 1=Enable) (default=1)");
+
+static bool expose_dsp_controls;
+module_param(expose_dsp_controls, bool, 0444);
+MODULE_PARM_DESC(expose_dsp_controls,
+ "Expose DSP controls as ALSA controls on boot, (0=Disable, 1=Enable) (default=0)");
static const struct reg_sequence cs35l41_hda_config[] = {
{ CS35L41_PLL_CLK_CTRL, 0x00000430 }, // 3072000Hz, BCLK Input, PLL_REFCLK_EN = 1
@@ -603,7 +608,8 @@ static int cs35l41_init_dsp(struct cs35l41_hda *cs35l41)
if (ret)
goto err;
- cs35l41_add_controls(cs35l41);
+ if (expose_dsp_controls)
+ cs35l41_add_controls(cs35l41);
cs35l41_hda_apply_calibration(cs35l41);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients
2024-07-30 14:37 [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients Stefan Binding
@ 2024-07-30 14:55 ` Jaroslav Kysela
2024-07-31 10:30 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Jaroslav Kysela @ 2024-07-30 14:55 UTC (permalink / raw)
To: Stefan Binding, Takashi Iwai
Cc: alsa-devel, linux-sound, linux-kernel, patches
On 30. 07. 24 16:37, Stefan Binding wrote:
> Add a kernel parameter to allow coefficients to be exposed as ALSA controls.
>
> When the CS35L41 loads its firmware, it has a number of controls to
> affect its behaviour. Currently, these controls are exposed as ALSA
> Controls by default.
>
> However, nothing in userspace currently uses them, and is unlikely to
> do so in the future, therefore we don't need to create ASLA controls
> for them.
>
> These controls can be useful for debug, so we can add a kernel
> parameter to re-enable them if necessary.
>
> Disabling these controls would prevent userspace from trying to read
> these controls when the CS35L41 is hibernating, which ordinarily
> would result in an error message.
This is probably not a right argument to add this code. The codec should be
powered up when those controls are accessed or those controls should be cached
by the driver.
Although the controls have not been used yet, exposing them in this way is not
ideal.
Could you fix the driver (no I/O errors)?
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients
2024-07-30 14:55 ` Jaroslav Kysela
@ 2024-07-31 10:30 ` Takashi Iwai
2024-07-31 10:36 ` Jaroslav Kysela
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2024-07-31 10:30 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: Stefan Binding, Takashi Iwai, alsa-devel, linux-sound,
linux-kernel, patches
On Tue, 30 Jul 2024 16:55:19 +0200,
Jaroslav Kysela wrote:
>
> On 30. 07. 24 16:37, Stefan Binding wrote:
> > Add a kernel parameter to allow coefficients to be exposed as ALSA controls.
> >
> > When the CS35L41 loads its firmware, it has a number of controls to
> > affect its behaviour. Currently, these controls are exposed as ALSA
> > Controls by default.
> >
> > However, nothing in userspace currently uses them, and is unlikely to
> > do so in the future, therefore we don't need to create ASLA controls
> > for them.
> >
> > These controls can be useful for debug, so we can add a kernel
> > parameter to re-enable them if necessary.
> >
> > Disabling these controls would prevent userspace from trying to read
> > these controls when the CS35L41 is hibernating, which ordinarily
> > would result in an error message.
>
> This is probably not a right argument to add this code. The codec
> should be powered up when those controls are accessed or those
> controls should be cached by the driver.
>
> Although the controls have not been used yet, exposing them in this
> way is not ideal.
>
> Could you fix the driver (no I/O errors)?
While we should fix the potential errors at hibernation, it's not bad
to hide those controls, IMO. For the normal use cases, it's nothing
but a cause of troubles, after all.
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients
2024-07-31 10:30 ` Takashi Iwai
@ 2024-07-31 10:36 ` Jaroslav Kysela
2024-07-31 10:44 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Jaroslav Kysela @ 2024-07-31 10:36 UTC (permalink / raw)
To: Takashi Iwai
Cc: Stefan Binding, Takashi Iwai, alsa-devel, linux-sound,
linux-kernel, patches
On 31. 07. 24 12:30, Takashi Iwai wrote:
> On Tue, 30 Jul 2024 16:55:19 +0200,
> Jaroslav Kysela wrote:
>>
>> On 30. 07. 24 16:37, Stefan Binding wrote:
>>> Add a kernel parameter to allow coefficients to be exposed as ALSA controls.
>>>
>>> When the CS35L41 loads its firmware, it has a number of controls to
>>> affect its behaviour. Currently, these controls are exposed as ALSA
>>> Controls by default.
>>>
>>> However, nothing in userspace currently uses them, and is unlikely to
>>> do so in the future, therefore we don't need to create ASLA controls
>>> for them.
>>>
>>> These controls can be useful for debug, so we can add a kernel
>>> parameter to re-enable them if necessary.
>>>
>>> Disabling these controls would prevent userspace from trying to read
>>> these controls when the CS35L41 is hibernating, which ordinarily
>>> would result in an error message.
>>
>> This is probably not a right argument to add this code. The codec
>> should be powered up when those controls are accessed or those
>> controls should be cached by the driver.
>>
>> Although the controls have not been used yet, exposing them in this
>> way is not ideal.
>>
>> Could you fix the driver (no I/O errors)?
>
> While we should fix the potential errors at hibernation, it's not bad
> to hide those controls, IMO. For the normal use cases, it's nothing
> but a cause of troubles, after all.
I do not think that the situation is so obvious. Different coefficients can be
used in various UCM profiles for example.
But for debugging we have debugfs when the developer thinks that the feature
is not useful for users. The module parameter solution is not good in my eyes.
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients
2024-07-31 10:36 ` Jaroslav Kysela
@ 2024-07-31 10:44 ` Takashi Iwai
2024-07-31 15:12 ` Stefan Binding
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2024-07-31 10:44 UTC (permalink / raw)
To: Jaroslav Kysela
Cc: Stefan Binding, Takashi Iwai, alsa-devel, linux-sound,
linux-kernel, patches
On Wed, 31 Jul 2024 12:36:19 +0200,
Jaroslav Kysela wrote:
>
> On 31. 07. 24 12:30, Takashi Iwai wrote:
> > On Tue, 30 Jul 2024 16:55:19 +0200,
> > Jaroslav Kysela wrote:
> >>
> >> On 30. 07. 24 16:37, Stefan Binding wrote:
> >>> Add a kernel parameter to allow coefficients to be exposed as ALSA controls.
> >>>
> >>> When the CS35L41 loads its firmware, it has a number of controls to
> >>> affect its behaviour. Currently, these controls are exposed as ALSA
> >>> Controls by default.
> >>>
> >>> However, nothing in userspace currently uses them, and is unlikely to
> >>> do so in the future, therefore we don't need to create ASLA controls
> >>> for them.
> >>>
> >>> These controls can be useful for debug, so we can add a kernel
> >>> parameter to re-enable them if necessary.
> >>>
> >>> Disabling these controls would prevent userspace from trying to read
> >>> these controls when the CS35L41 is hibernating, which ordinarily
> >>> would result in an error message.
> >>
> >> This is probably not a right argument to add this code. The codec
> >> should be powered up when those controls are accessed or those
> >> controls should be cached by the driver.
> >>
> >> Although the controls have not been used yet, exposing them in this
> >> way is not ideal.
> >>
> >> Could you fix the driver (no I/O errors)?
> >
> > While we should fix the potential errors at hibernation, it's not bad
> > to hide those controls, IMO. For the normal use cases, it's nothing
> > but a cause of troubles, after all.
>
> I do not think that the situation is so obvious. Different
> coefficients can be used in various UCM profiles for example.
If that's the supposed use-case, yes.
I doubt it, though, but this needs clarification from Cirrus people.
> But for debugging we have debugfs when the developer thinks that the
> feature is not useful for users. The module parameter solution is not
> good in my eyes.
Yeah, I believe we should disable it unconditionally, and provide a
different way like debugfs in the firmware driver side, too -- again,
if the exposure is only for debugging.
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients
2024-07-31 10:44 ` Takashi Iwai
@ 2024-07-31 15:12 ` Stefan Binding
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Binding @ 2024-07-31 15:12 UTC (permalink / raw)
To: Takashi Iwai, Jaroslav Kysela
Cc: Takashi Iwai, alsa-devel, linux-sound, linux-kernel, patches
On 31/07/2024 11:44, Takashi Iwai wrote:
> On Wed, 31 Jul 2024 12:36:19 +0200,
> Jaroslav Kysela wrote:
>> On 31. 07. 24 12:30, Takashi Iwai wrote:
>>> On Tue, 30 Jul 2024 16:55:19 +0200,
>>> Jaroslav Kysela wrote:
>>>> On 30. 07. 24 16:37, Stefan Binding wrote:
>>>>> Add a kernel parameter to allow coefficients to be exposed as ALSA controls.
>>>>>
>>>>> When the CS35L41 loads its firmware, it has a number of controls to
>>>>> affect its behaviour. Currently, these controls are exposed as ALSA
>>>>> Controls by default.
>>>>>
>>>>> However, nothing in userspace currently uses them, and is unlikely to
>>>>> do so in the future, therefore we don't need to create ASLA controls
>>>>> for them.
>>>>>
>>>>> These controls can be useful for debug, so we can add a kernel
>>>>> parameter to re-enable them if necessary.
>>>>>
>>>>> Disabling these controls would prevent userspace from trying to read
>>>>> these controls when the CS35L41 is hibernating, which ordinarily
>>>>> would result in an error message.
>>>> This is probably not a right argument to add this code. The codec
>>>> should be powered up when those controls are accessed or those
>>>> controls should be cached by the driver.
>>>>
>>>> Although the controls have not been used yet, exposing them in this
>>>> way is not ideal.
>>>>
>>>> Could you fix the driver (no I/O errors)?
>>> While we should fix the potential errors at hibernation, it's not bad
>>> to hide those controls, IMO. For the normal use cases, it's nothing
>>> but a cause of troubles, after all.
>> I do not think that the situation is so obvious. Different
>> coefficients can be used in various UCM profiles for example.
> If that's the supposed use-case, yes.
> I doubt it, though, but this needs clarification from Cirrus people.
>
>> But for debugging we have debugfs when the developer thinks that the
>> feature is not useful for users. The module parameter solution is not
>> good in my eyes.
> Yeah, I believe we should disable it unconditionally, and provide a
> different way like debugfs in the firmware driver side, too -- again,
> if the exposure is only for debugging.
I'll update the patch to completely remove the creation of these controls.
The tuning files, which are specific for each laptop, that are loaded in conjunction with the firmware files already provide us with the all the control we need over the firmware coefficients, so the ALSA Controls are not needed for anything.
These controls were never intended to be exposed to users, anyway, but the firmware doesn't mark them as hidden, so its best for the driver to just ignore them.
We think there's very little value in providing an different way (i.e. debugfs) to accessing these controls for debug purposes, so we think we should just remove them.
Thanks,
Stefan
>
>
> Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-31 15:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 14:37 [PATCH v1] ALSA: hda: cs35l41: Stop creating ALSA Controls for firmware coefficients Stefan Binding
2024-07-30 14:55 ` Jaroslav Kysela
2024-07-31 10:30 ` Takashi Iwai
2024-07-31 10:36 ` Jaroslav Kysela
2024-07-31 10:44 ` Takashi Iwai
2024-07-31 15:12 ` Stefan Binding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox