[alsa-devel] [PATCH 1/2] ASoC: wm8580: Fix build error
Re-organize the code a bit to fix the following build errors and warnings:
sound/soc/codecs/wm8580.c:932:21: error: variable ‘wm8580_regmap’ has initializer but incomplete type static const struct regmap_config wm8580_regmap = {
sound/soc/codecs/wm8580.c:233:20: warning: ‘wm8580_supply_names’ defined but not used [-Wunused-variable] sound/soc/codecs/wm8580.c:840:34: warning: ‘wm8580_dai’ defined but not used [-Wunused-variable] sound/soc/codecs/wm8580.c:914:36: warning: ‘soc_codec_dev_wm8580’ defined but not used [-Wunused-variable]
Signed-off-by: Sachin Kamat sachin.kamat@linaro.org --- sound/soc/codecs/wm8580.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 318989acbbe5..7a9d6fa9f3b3 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -214,28 +214,12 @@ static const struct reg_default wm8580_reg_defaults[] = { { 52, 0x0000 }, };
-static bool wm8580_volatile(struct device *dev, unsigned int reg) -{ - switch (reg) { - case WM8580_RESET: - return true; - default: - return false; - } -} - struct pll_state { unsigned int in; unsigned int out; };
#define WM8580_NUM_SUPPLIES 3 -static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = { - "AVDD", - "DVDD", - "PVDD", -}; - /* codec private data */ struct wm8580_priv { struct regmap *regmap; @@ -837,6 +821,7 @@ static const struct snd_soc_dai_ops wm8580_dai_ops_capture = { .set_pll = wm8580_set_dai_pll, };
+#if IS_ENABLED(CONFIG_I2C) static struct snd_soc_dai_driver wm8580_dai[] = { { .name = "wm8580-hifi-playback", @@ -863,6 +848,7 @@ static struct snd_soc_dai_driver wm8580_dai[] = { .ops = &wm8580_dai_ops_capture, }, }; +#endif
static int wm8580_probe(struct snd_soc_codec *codec) { @@ -911,7 +897,7 @@ static int wm8580_remove(struct snd_soc_codec *codec) return 0; }
-static struct snd_soc_codec_driver soc_codec_dev_wm8580 = { +static struct snd_soc_codec_driver soc_codec_dev_wm8580 __maybe_unused = { .probe = wm8580_probe, .remove = wm8580_remove, .set_bias_level = wm8580_set_bias_level, @@ -929,6 +915,23 @@ static const struct of_device_id wm8580_of_match[] = { { }, };
+#if IS_ENABLED(CONFIG_I2C) +static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = { + "AVDD", + "DVDD", + "PVDD", +}; + +static bool wm8580_volatile(struct device *dev, unsigned int reg) +{ + switch (reg) { + case WM8580_RESET: + return true; + default: + return false; + } +} + static const struct regmap_config wm8580_regmap = { .reg_bits = 7, .val_bits = 9, @@ -941,7 +944,6 @@ static const struct regmap_config wm8580_regmap = { .volatile_reg = wm8580_volatile, };
-#if IS_ENABLED(CONFIG_I2C) static int wm8580_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) {
Depend on MFD_ARIZONA to avoid the following build errors:
sound/soc/codecs/arizona.c:218: undefined reference to `arizona_request_irq' sound/soc/codecs/arizona.c:226: undefined reference to `arizona_request_irq' sound/soc/codecs/arizona.c:1719: undefined reference to `arizona_request_irq'
Signed-off-by: Sachin Kamat sachin.kamat@linaro.org --- sound/soc/samsung/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index e8fbf4e5732f..454f41cfc828 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -210,7 +210,7 @@ config SND_SOC_TOBERMORY
config SND_SOC_BELLS tristate "Audio support for Wolfson Bells" - depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 + depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 && MFD_ARIZONA select SND_SAMSUNG_I2S select SND_SOC_WM5102 select SND_SOC_WM5110
On Fri, Jan 24, 2014 at 02:09:25PM +0530, Sachin Kamat wrote:
Depend on MFD_ARIZONA to avoid the following build errors:
sound/soc/codecs/arizona.c:218: undefined reference to `arizona_request_irq' sound/soc/codecs/arizona.c:226: undefined reference to `arizona_request_irq' sound/soc/codecs/arizona.c:1719: undefined reference to `arizona_request_irq'
Applied, thanks.
On Fri, Jan 24, 2014 at 02:09:24PM +0530, Sachin Kamat wrote:
+#if IS_ENABLED(CONFIG_I2C) +static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = {
- "AVDD",
- "DVDD",
- "PVDD",
+};
This is obviously not sensible - the device doesn't suddenly stop needing power if it is using SPI.
On 24 January 2014 16:40, Mark Brown broonie@kernel.org wrote:
On Fri, Jan 24, 2014 at 02:09:24PM +0530, Sachin Kamat wrote:
+#if IS_ENABLED(CONFIG_I2C) +static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = {
"AVDD",
"DVDD",
"PVDD",
+};
This is obviously not sensible - the device doesn't suddenly stop needing power if it is using SPI.
This structure is being used only in wm8580_i2c_probe which is guarded by IS_ENABLED(CONFIG_I2C). Do you mean the existing implementation is wrong or we just need to move it out of the #if?
On Fri, Jan 24, 2014 at 05:22:35PM +0530, Sachin Kamat wrote:
On 24 January 2014 16:40, Mark Brown broonie@kernel.org wrote:
On Fri, Jan 24, 2014 at 02:09:24PM +0530, Sachin Kamat wrote:
+#if IS_ENABLED(CONFIG_I2C) +static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = {
"AVDD",
"DVDD",
"PVDD",
+};
This is obviously not sensible - the device doesn't suddenly stop needing power if it is using SPI.
This structure is being used only in wm8580_i2c_probe which is guarded by IS_ENABLED(CONFIG_I2C). Do you mean the existing implementation is wrong or we just need to move it out of the #if?
Think about what the code is doing - obviously there is a problem with the existing code here but this is not a good fix for it. Like I say it's not very likely that the device only requires power when used with I2C, it would be better to fix the fact that the driver is only using regulators for I2C.
participants (2)
-
Mark Brown
-
Sachin Kamat