* [PATCH v1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available
@ 2025-02-05 16:48 Stefan Binding
2025-02-05 17:02 ` André Almeida
2025-02-06 14:51 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Binding @ 2025-02-05 16:48 UTC (permalink / raw)
To: Mark Brown
Cc: André Almeida, linux-sound, linux-kernel, patches,
Stefan Binding
For systems which load firmware on the cs35l41 which use ACPI, the
_SUB value is used to differentiate firmware and tuning files for the
individual systems. In the case where a system does not have a _SUB
defined in ACPI node for cs35l41, there needs to be a fallback to
allow the files for that system to be differentiated. Since all
ACPI nodes for cs35l41 should have a HID defined, the HID should be a
safe option.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
sound/soc/codecs/cs35l41.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index 07a5cab35fe1..30b89018b113 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -1150,19 +1150,28 @@ static int cs35l41_dsp_init(struct cs35l41_private *cs35l41)
static int cs35l41_acpi_get_name(struct cs35l41_private *cs35l41)
{
- acpi_handle handle = ACPI_HANDLE(cs35l41->dev);
+ struct acpi_device *adev = ACPI_COMPANION(cs35l41->dev);
+ acpi_handle handle = acpi_device_handle(adev);
+ const char *hid;
const char *sub;
- /* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */
- if (!handle)
+ /* If there is no acpi_device, there is no ACPI for this system, return 0 */
+ if (!adev)
return 0;
sub = acpi_get_subsystem_id(handle);
if (IS_ERR(sub)) {
- /* If bad ACPI, return 0 and fallback to legacy firmware path, otherwise fail */
- if (PTR_ERR(sub) == -ENODATA)
- return 0;
- else
+ /* If no _SUB, fallback to _HID, otherwise fail */
+ if (PTR_ERR(sub) == -ENODATA) {
+ hid = acpi_device_hid(adev);
+ /* If dummy hid, return 0 and fallback to legacy firmware path */
+ if (!strcmp(hid, "device"))
+ return 0;
+ sub = kstrdup(hid, GFP_KERNEL);
+ if (!sub)
+ sub = ERR_PTR(-ENOMEM);
+
+ } else
return PTR_ERR(sub);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available
2025-02-05 16:48 [PATCH v1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available Stefan Binding
@ 2025-02-05 17:02 ` André Almeida
2025-02-06 14:51 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: André Almeida @ 2025-02-05 17:02 UTC (permalink / raw)
To: Stefan Binding; +Cc: linux-sound, linux-kernel, Mark Brown, patches
Hi Stefan,
Em 05/02/2025 13:48, Stefan Binding escreveu:
> For systems which load firmware on the cs35l41 which use ACPI, the
> _SUB value is used to differentiate firmware and tuning files for the
> individual systems. In the case where a system does not have a _SUB
> defined in ACPI node for cs35l41, there needs to be a fallback to
> allow the files for that system to be differentiated. Since all
> ACPI nodes for cs35l41 should have a HID defined, the HID should be a
> safe option.
>
> Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
> ---
> sound/soc/codecs/cs35l41.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
> index 07a5cab35fe1..30b89018b113 100644
> --- a/sound/soc/codecs/cs35l41.c
> +++ b/sound/soc/codecs/cs35l41.c
> @@ -1150,19 +1150,28 @@ static int cs35l41_dsp_init(struct cs35l41_private *cs35l41)
>
> static int cs35l41_acpi_get_name(struct cs35l41_private *cs35l41)
> {
> - acpi_handle handle = ACPI_HANDLE(cs35l41->dev);
> + struct acpi_device *adev = ACPI_COMPANION(cs35l41->dev);
> + acpi_handle handle = acpi_device_handle(adev);
> + const char *hid;
I think *hid and *sub can be in the same line.
Apart from that,
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Tested-by: André Almeida <andrealmeid@igalia.com> (Steam Deck OLED)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available
2025-02-05 16:48 [PATCH v1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available Stefan Binding
2025-02-05 17:02 ` André Almeida
@ 2025-02-06 14:51 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-02-06 14:51 UTC (permalink / raw)
To: Stefan Binding; +Cc: André Almeida, linux-sound, linux-kernel, patches
On Wed, 05 Feb 2025 16:48:04 +0000, Stefan Binding wrote:
> For systems which load firmware on the cs35l41 which use ACPI, the
> _SUB value is used to differentiate firmware and tuning files for the
> individual systems. In the case where a system does not have a _SUB
> defined in ACPI node for cs35l41, there needs to be a fallback to
> allow the files for that system to be differentiated. Since all
> ACPI nodes for cs35l41 should have a HID defined, the HID should be a
> safe option.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available
commit: 1d44a30ae3f9195cb4eb7d81bb9ced2776232094
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] 3+ messages in thread
end of thread, other threads:[~2025-02-06 14:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05 16:48 [PATCH v1] ASoC: cs35l41: Fallback to using HID for system_name if no SUB is available Stefan Binding
2025-02-05 17:02 ` André Almeida
2025-02-06 14:51 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox