Skip to contentSkip to conversation

ASoc: tas2770: Fix build error without GPIOLIB

PATCH Superseded YueHaibing 4 participants 9 messages Oct 6, 2019 – Oct 8, 2019

Subsystems (3)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 ASoc: tas2770: Fix build error without GPIOLIB

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
^~~~~~~~~~~~~~~~~~~~~~~~
gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,

                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
---
 sound/soc/codecs/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/Kconfig +1 -0
index bcac957..d639f17 100644
@@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
 config SND_SOC_TAS2770
 	tristate "Texas Instruments TAS2770 speaker amplifier"
 	depends on I2C
+	select GPIOLIB
 
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
Signature · 1 line
2.7.4
#1 lore raw

Dear YueHaibing,

Quoted 29 lines · YueHaibing

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]

   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
---
 sound/soc/codecs/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/Kconfig +0 -0
index bcac957..d639f17 100644

sound/soc/codecs/Kconfig config SND_SOC_TAS2552 · line 1111

Quoted 4 lines
sound/soc/codecs/Kconfig +1 -0
@@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
 config SND_SOC_TAS2770
 	tristate "Texas Instruments TAS2770 speaker amplifier"
 	depends on I2C
+	select GPIOLIB

GPIOLIB API is working perfectly fine even if GPIOLIB is not selected and gpiod_* functions will merely return -ENOSYS in this case. Please see <linux/gpio/consumer.h> and fix your patch accordingly.

Quoted 10 lines
sound/soc/codecs/Kconfig +0 -0
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
Signature · 7 lines
2.7.4


_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author
#2 lore raw
Quoted 27 lines · Ladislav Michl

Dear YueHaibing,

Quoted 24 lines · YueHaibing

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]

   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
---
 sound/soc/codecs/Kconfig | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

sound/soc/codecs/Kconfig config SND_SOC_TAS2552 · line 1111

Quoted 9 lines
sound/soc/codecs/Kconfig +1 -0
index bcac957..d639f17 100644
@@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
 config SND_SOC_TAS2770
 	tristate "Texas Instruments TAS2770 speaker amplifier"
 	depends on I2C
+	select GPIOLIB

GPIOLIB API is working perfectly fine even if GPIOLIB is not selected and gpiod_* functions will merely return -ENOSYS in this case. Please see <linux/gpio/consumer.h> and fix your patch accordingly.

Thanks, will send v2 as your suggestion.

Quoted 14 lines
Quoted 11 lines
sound/soc/codecs/Kconfig +0 -0
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
Signature · 7 lines
2.7.4


_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

.

author
#3 lore raw

PATCH v2 1/1 ASoc: tas2770: Fix build error without GPIOLIB

In reply to YueHaibing

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
^~~~~~~~~~~~~~~~~~~~~~~~
gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,

                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")

---
v2: Add missing include file

---
 sound/soc/codecs/tas2770.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2770.c +1 -0
index 9da88cc..a36d0d7 100644
@@ -15,6 +15,7 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <linux/firmware.h>
Signature · 1 line
2.7.4
#4 lore raw
Quoted 32 lines · YueHaibing

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]

   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")

---
v2: Add missing include file

---
 sound/soc/codecs/tas2770.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2770.c +0 -0
index 9da88cc..a36d0d7 100644

sound/soc/codecs/tas2770.c line 21

Quoted 7 lines
sound/soc/codecs/tas2770.c +1 -0
@@ -15,6 +15,7 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <linux/firmware.h>

The Kconfig part is missing - is this intended? If I guess correctly, the driver won't work without GPIOLIB, so it should either 'select GPIOLIB' or 'depends on GPIOLIB || COMPILE_TEST' or even 'select GPIOLIB if !COMPILE_TEST'.

Best Regards,
Michał Mirosław

#5 lore raw

Hi Michał,

Quoted 37 lines · On Sun, Oct 06, 2019 at 05:31:58PM +0200, [email protected] wrote:
Quoted 36 lines · YueHaibing

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]

   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")

---
v2: Add missing include file

---
 sound/soc/codecs/tas2770.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2770.c +1 -0
index 9da88cc..a36d0d7 100644
@@ -15,6 +15,7 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
Quoted 8 lines

sound/soc/codecs/tas2770.c line 21

Quoted 3 lines
sound/soc/codecs/tas2770.c +0 -0
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <linux/firmware.h>

The Kconfig part is missing - is this intended? If I guess correctly, the driver won't work without GPIOLIB, so it should either 'select GPIOLIB' or 'depends on GPIOLIB || COMPILE_TEST' or even 'select GPIOLIB if !COMPILE_TEST'.

while the first one is actually preferable I won't do this in this patch, but rather generally. The same you can say about regulator, regmap and other interfaces, so perhaps leaving that to patchset focusing on this kind of problem seem to be better.

Btw, I guess linux/gpio/consumer.h is enough for this driver and including linux/gpio.h should be dropped.

ladis

maintainer
#6 lore raw

Applied "ASoc: tas2770: Fix build error without GPIOLIB" to the asoc tree

In reply to YueHaibing

The patch

ASoc: tas2770: Fix build error without GPIOLIB

has been applied to the asoc tree at

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

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 03fe492e8346d3da59b6eb7ea306d46ebf22e9d5 Mon Sep 17 00:00:00 2001
From: YueHaibing <[email protected]>
Date: Sun, 6 Oct 2019 18:46:31 +0800
Subject: [PATCH] ASoc: tas2770: Fix build error without GPIOLIB

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
^~~~~~~~~~~~~~~~~~~~~~~~
gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,

                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
---
 sound/soc/codecs/tas2770.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2770.c +1 -0
index dbbb21fe0548..15f6fcc6d87e 100644
@@ -15,6 +15,7 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <linux/firmware.h>
Signature · 1 line
2.20.1
#7 lore raw

Re: [alsa-devel] Applied "ASoc: tas2770: Fix build error without GPIOLIB" to the asoc tree

Hi YueHaibing & Mark,

Quoted 7 lines · Mark Brown

The patch

ASoc: tas2770: Fix build error without GPIOLIB

has been applied to the asoc tree at

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

Hmm, too late it seems...
Patch should actually remove <linux/gpio.h> as this is legacy one (see comment on the top and also Documentation/driver-api/gpio/consumer.rst)

And that brings a question. Given this is -next only is it actually possible to squash fixes into 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") just to make bisect a bit more happy?

	l.
Quoted 70 lines

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

Quoted 1 line

From 03fe492e8346d3da59b6eb7ea306d46ebf22e9d5 Mon Sep 17 00:00:00 2001

From: YueHaibing <[email protected]>
Date: Sun, 6 Oct 2019 18:46:31 +0800
Subject: [PATCH] ASoc: tas2770: Fix build error without GPIOLIB

If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]

   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH
Fixes 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
---
 sound/soc/codecs/tas2770.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/tas2770.c +1 -0
index dbbb21fe0548..15f6fcc6d87e 100644
@@ -15,6 +15,7 @@
 #include <linux/pm.h>
 #include <linux/i2c.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <linux/firmware.h>
Signature · 6 lines
2.20.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer
#8 lore raw

Re: [alsa-devel] Applied "ASoc: tas2770: Fix build error without GPIOLIB" to the asoc tree

Quoted 3 lines · Ladislav Michl

Hmm, too late it seems...
Patch should actually remove <linux/gpio.h> as this is legacy one (see comment on the top and also Documentation/driver-api/gpio/consumer.rst)

Yes, leaving that is an oversight.

Quoted 3 lines

And that brings a question. Given this is -next only is it actually possible to squash fixes into 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver") just to make bisect a bit more happy?

No:

Quoted 3 lines
Quoted 3 lines

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.

Apart from anything else I've merged up the fixes branch IIRC which causes trouble.