2023-12-19 16:23:56

by Stefan Binding

[permalink] [raw]
Subject: [PATCH v1 2/2] ALSA: hda: cs35l41: Only add SPI CS GPIO if SPI is enabled in kernel

If CONFIG_SPI is not set in the kernel, there is no point in trying
to set the chip selects. We can selectively compile it.

Fixes: 8c4c216db8fb ("ALSA: hda: cs35l41: Add config table to support many laptops without _DSD")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Signed-off-by: Stefan Binding <[email protected]>
---
sound/pci/hda/cs35l41_hda_property.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index 73b304e6c83c..194e1179a253 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -210,6 +210,8 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde

if (cfg->bus == SPI) {
cs35l41->index = id;
+
+#if IS_ENABLED(CONFIG_SPI)
/*
* Manually set the Chip Select for the second amp <cs_gpio_index> in the node.
* This is only supported for systems with 2 amps, since we cannot expand the
@@ -249,6 +251,7 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde
spi_setup(spi);
}
}
+#endif
} else {
if (cfg->num_amps > 2)
/*
--
2.34.1



2023-12-20 08:10:54

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ALSA: hda: cs35l41: Only add SPI CS GPIO if SPI is enabled in kernel

On Tue, 19 Dec 2023 17:22:32 +0100,
Stefan Binding wrote:
>
> If CONFIG_SPI is not set in the kernel, there is no point in trying
> to set the chip selects. We can selectively compile it.

I guess it should with IS_REACHABLE() instead of IS_ENABLED()?
It can be still CONFIG_SPI=m while CONFIG_SND_HDA_*=y.


thanks,

Takashi


>
> Fixes: 8c4c216db8fb ("ALSA: hda: cs35l41: Add config table to support many laptops without _DSD")
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> Signed-off-by: Stefan Binding <[email protected]>
> ---
> sound/pci/hda/cs35l41_hda_property.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
> index 73b304e6c83c..194e1179a253 100644
> --- a/sound/pci/hda/cs35l41_hda_property.c
> +++ b/sound/pci/hda/cs35l41_hda_property.c
> @@ -210,6 +210,8 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde
>
> if (cfg->bus == SPI) {
> cs35l41->index = id;
> +
> +#if IS_ENABLED(CONFIG_SPI)
> /*
> * Manually set the Chip Select for the second amp <cs_gpio_index> in the node.
> * This is only supported for systems with 2 amps, since we cannot expand the
> @@ -249,6 +251,7 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde
> spi_setup(spi);
> }
> }
> +#endif
> } else {
> if (cfg->num_amps > 2)
> /*
> --
> 2.34.1
>

2023-12-21 08:27:49

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] ALSA: hda: cs35l41: Only add SPI CS GPIO if SPI is enabled in kernel

On Wed, 20 Dec 2023 09:10:37 +0100,
Takashi Iwai wrote:
>
> On Tue, 19 Dec 2023 17:22:32 +0100,
> Stefan Binding wrote:
> >
> > If CONFIG_SPI is not set in the kernel, there is no point in trying
> > to set the chip selects. We can selectively compile it.
>
> I guess it should with IS_REACHABLE() instead of IS_ENABLED()?
> It can be still CONFIG_SPI=m while CONFIG_SND_HDA_*=y.

In anyway, I applied the patches as is for now, as it should work in most cases.
Let's see whether the use of IS_REACHABLE() is required.


thanks,

Takashi