Skip to contentSkip to conversation

ASoC: rt5682: fix Kconfig/compilation issues when I2C is not selected

PATCH In review Pierre-Louis Bossart 2 participants 8 messages Mar 10, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: rt5682: fix Kconfig/compilation issues when I2C is not selected

RT5682 can work in I2C or SoundWire mode, but the code will not compile if I2C is not selected.

Pierre-Louis Bossart (3):
ASoC: rt5682: fix unmet dependencies
ASoC: rt5682: fix compilation issues without I2C
ASoC: rt5682-sdw: fix 'defined but not used' pm functions

 sound/soc/codecs/Kconfig      |  2 +-
 sound/soc/codecs/rt5682-sdw.c |  4 ++--
 sound/soc/codecs/rt5682.c     | 10 ++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 ASoC: rt5682: fix unmet dependencies

The rt5682 code can be used in I2C or SoundWire mode. When I2C is not selected, we have the following issue:

WARNING: unmet direct dependencies detected for SND_SOC_RT5682
Depends on [n]: SOUND [=m] && !UML && SND [=m] && SND_SOC [=m] && I2C [=n]
Selected by [m]:
- SND_SOC_RT5682_SDW [=m] && SOUND [=m] && !UML && SND [=m] &&

    SND_SOC [=m] && SOUNDWIRE [=m]

Fix by adding SOUNDWIRE as a dependency.

Fixes 03f6fc6de9192f ('ASoC: rt5682: Add the soundwire support')
Cc Oder Chiou <[email protected]>
---
 sound/soc/codecs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/Kconfig +1 -1
index 6aee70ed43df..78be69e9b618 100644
@@ -1135,7 +1135,7 @@ config SND_SOC_RT5677_SPI
 
 config SND_SOC_RT5682
 	tristate
-	depends on I2C
+	depends on I2C || SOUNDWIRE
 
 config SND_SOC_RT5682_SDW
 	tristate "Realtek RT5682 Codec - SDW"
Signature · 1 line
2.20.1
maintainer
#2 lore raw

Applied "ASoC: rt5682: fix unmet dependencies" to the asoc tree

The patch

ASoC: rt5682: fix unmet dependencies

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

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

From 5549ea64799784308cc03313a86dea3de56d48ce Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 10 Mar 2020 11:35:07 -0500
Subject: [PATCH] ASoC: rt5682: fix unmet dependencies

The rt5682 code can be used in I2C or SoundWire mode. When I2C is not selected, we have the following issue:

WARNING: unmet direct dependencies detected for SND_SOC_RT5682
Depends on [n]: SOUND [=m] && !UML && SND [=m] && SND_SOC [=m] && I2C [=n]
Selected by [m]:
- SND_SOC_RT5682_SDW [=m] && SOUND [=m] && !UML && SND [=m] &&

    SND_SOC [=m] && SOUNDWIRE [=m]

Fix by adding SOUNDWIRE as a dependency.

Fixes 03f6fc6de9192f ('ASoC: rt5682: Add the soundwire support')
Cc Oder Chiou <[email protected]>
---
 sound/soc/codecs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/Kconfig +1 -1
index 6aee70ed43df..78be69e9b618 100644
@@ -1135,7 +1135,7 @@ config SND_SOC_RT5677_SPI
 
 config SND_SOC_RT5682
 	tristate
-	depends on I2C
+	depends on I2C || SOUNDWIRE
 
 config SND_SOC_RT5682_SDW
 	tristate "Realtek RT5682 Codec - SDW"
Signature · 1 line
2.20.1
#3 lore raw

PATCH 2/3 ASoC: rt5682: fix compilation issues without I2C

In reply to Pierre-Louis Bossart

Exclude all I2C-related code from compilation to avoid compilation errors and defined but not used warnings.

sound/soc/codecs/rt5682.c:3688:26: warning: 'rt5682_i2c_driver' defined but not used [-Wunused-variable]

    static struct i2c_driver rt5682_i2c_driver = {
                             ^~~~~~~~~~~~~~~~~
Fixes 03f6fc6de9192f ('ASoC: rt5682: Add the soundwire support')
Cc Oder Chiou <[email protected]>
---
 sound/soc/codecs/rt5682.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
sound/soc/codecs/rt5682.c +10 -0
index e1df2d076533..8828ed5db58d 100644
@@ -33,6 +33,7 @@
 #include "rt5682.h"
 #include "rt5682-sdw.h"
 
+#if IS_ENABLED(CONFIG_I2C)
 static const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
 	"AVDD",
 	"MICVDD",
@@ -47,6 +48,7 @@ static const struct rt5682_platform_data i2s_default_platform_data = {
 	.dai_clk_names[RT5682_DAI_WCLK_IDX] = "rt5682-dai-wclk",
 	.dai_clk_names[RT5682_DAI_BCLK_IDX] = "rt5682-dai-bclk",
 };
+#endif
 
 static const struct reg_sequence patch_list[] = {
 	{RT5682_HP_IMP_SENS_CTRL_19, 0x1000},
@@ -974,6 +976,7 @@ static int rt5682_headset_detect(struct snd_soc_component *component,
 	return rt5682->jack_type;
 }
 
+#if IS_ENABLED(CONFIG_I2C)
 static irqreturn_t rt5682_irq(int irq, void *data)
 {
 	struct rt5682_priv *rt5682 = data;
@@ -1002,6 +1005,7 @@ static void rt5682_jd_check_handler(struct work_struct *work)
 		schedule_delayed_work(&rt5682->jd_check_work, 500);
 	}
 }
+#endif
 
 static int rt5682_set_jack_detect(struct snd_soc_component *component,
 	struct snd_soc_jack *hs_jack, void *data)
@@ -3214,6 +3218,7 @@ static const struct regmap_config rt5682_regmap = {
 	.use_single_write = true,
 };
 
+#if IS_ENABLED(CONFIG_I2C)
 static const struct i2c_device_id rt5682_i2c_id[] = {
 	{"rt5682", 0},
 	{}
@@ -3244,6 +3249,7 @@ static int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
 
 	return 0;
 }
+#endif
 
 static void rt5682_calibrate(struct rt5682_priv *rt5682)
 {
@@ -3510,6 +3516,7 @@ int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
 EXPORT_SYMBOL_GPL(rt5682_io_init);
 #endif
 
+#if IS_ENABLED(CONFIG_I2C)
 static int rt5682_i2c_probe(struct i2c_client *i2c,
 		    const struct i2c_device_id *id)
 {
@@ -3668,6 +3675,7 @@ static void rt5682_i2c_shutdown(struct i2c_client *client)
 
 	rt5682_reset(rt5682);
 }
+#endif
 
 #ifdef CONFIG_OF
 static const struct of_device_id rt5682_of_match[] = {
@@ -3685,6 +3693,7 @@ static const struct acpi_device_id rt5682_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, rt5682_acpi_match);
 #endif
 
+#if IS_ENABLED(CONFIG_I2C)
 static struct i2c_driver rt5682_i2c_driver = {
 	.driver = {
 		.name = "rt5682",
@@ -3696,6 +3705,7 @@ static struct i2c_driver rt5682_i2c_driver = {
 	.id_table = rt5682_i2c_id,
 };
 module_i2c_driver(rt5682_i2c_driver);
+#endif
 
 MODULE_DESCRIPTION("ASoC RT5682 driver");
 MODULE_AUTHOR("Bard Liao <[email protected]>");
Signature · 1 line
2.20.1
maintainer
#4 lore raw

Re: [PATCH 2/3] ASoC: rt5682: fix compilation issues without I2C

Quoted 2 lines · Pierre-Louis Bossart

Exclude all I2C-related code from compilation to avoid compilation errors and defined but not used warnings.

I think it would be better to do this by factoring the bus code out into a separate file like we've done with I2C and SPI, it's neater than ifdefs and easier to get right going forwards.

#5 lore raw

Re: [PATCH 2/3] ASoC: rt5682: fix compilation issues without I2C

Quoted 7 lines · Mark Brown
Quoted 2 lines · Pierre-Louis Bossart

Exclude all I2C-related code from compilation to avoid compilation errors and defined but not used warnings.

I think it would be better to do this by factoring the bus code out into a separate file like we've done with I2C and SPI, it's neater than ifdefs and easier to get right going forwards.

Agree, this was just a quick fix to solve compilation issues.

#6 lore raw

PATCH 3/3 ASoC: rt5682-sdw: fix 'defined but not used' pm functions

In reply to Pierre-Louis Bossart

Gcc reports the following warnings:

sound/soc/codecs/rt5682-sdw.c:286:12: warning: 'rt5682_dev_resume' defined but not used [-Wunused-function]
static int rt5682_dev_resume(struct device *dev)

            ^~~~~~~~~~~~~~~~~

sound/soc/codecs/rt5682-sdw.c:273:12: warning: 'rt5682_dev_suspend' defined but not used [-Wunused-function]
static int rt5682_dev_suspend(struct device *dev)

            ^~~~~~~~~~~~~~~~~~

Fix by adding maybe_unused as done for other SoundWire codecs

Fixes 03f6fc6de9192f ('ASoC: rt5682: Add the soundwire support')
Cc Oder Chiou <[email protected]>
---
 sound/soc/codecs/rt5682-sdw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5682-sdw.c +2 -2
index fc31d04b5203..e456bdd15207 100644
@@ -270,7 +270,7 @@ static const struct sdw_device_id rt5682_id[] = {
 };
 MODULE_DEVICE_TABLE(sdw, rt5682_id);
 
-static int rt5682_dev_suspend(struct device *dev)
+static int __maybe_unused rt5682_dev_suspend(struct device *dev)
 {
 	struct rt5682_priv *rt5682 = dev_get_drvdata(dev);
 
@@ -283,7 +283,7 @@ static int rt5682_dev_suspend(struct device *dev)
 	return 0;
 }
 
-static int rt5682_dev_resume(struct device *dev)
+static int __maybe_unused rt5682_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt5682_priv *rt5682 = dev_get_drvdata(dev);
Signature · 1 line
2.20.1
maintainer
#7 lore raw

Applied "ASoC: rt5682-sdw: fix 'defined but not used' pm functions" to the asoc tree

The patch

ASoC: rt5682-sdw: fix 'defined but not used' pm functions

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

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

From 724cc62f7a71e3a04112126806c62d9c639ab92c Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 10 Mar 2020 11:35:09 -0500
Subject: [PATCH] ASoC: rt5682-sdw: fix 'defined but not used' pm functions

Gcc reports the following warnings:

sound/soc/codecs/rt5682-sdw.c:286:12: warning: 'rt5682_dev_resume' defined but not used [-Wunused-function]
static int rt5682_dev_resume(struct device *dev)

            ^~~~~~~~~~~~~~~~~

sound/soc/codecs/rt5682-sdw.c:273:12: warning: 'rt5682_dev_suspend' defined but not used [-Wunused-function]
static int rt5682_dev_suspend(struct device *dev)

            ^~~~~~~~~~~~~~~~~~

Fix by adding maybe_unused as done for other SoundWire codecs

Fixes 03f6fc6de9192f ('ASoC: rt5682: Add the soundwire support')
Cc Oder Chiou <[email protected]>
---
 sound/soc/codecs/rt5682-sdw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5682-sdw.c +2 -2
index 1d6963dd6403..a2d1d3ae1e31 100644
@@ -270,7 +270,7 @@ static const struct sdw_device_id rt5682_id[] = {
 };
 MODULE_DEVICE_TABLE(sdw, rt5682_id);
 
-static int rt5682_dev_suspend(struct device *dev)
+static int __maybe_unused rt5682_dev_suspend(struct device *dev)
 {
 	struct rt5682_priv *rt5682 = dev_get_drvdata(dev);
 
@@ -283,7 +283,7 @@ static int rt5682_dev_suspend(struct device *dev)
 	return 0;
 }
 
-static int rt5682_dev_resume(struct device *dev)
+static int __maybe_unused rt5682_dev_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct rt5682_priv *rt5682 = dev_get_drvdata(dev);
Signature · 1 line
2.20.1