* [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4
@ 2025-07-10 12:40 Peng Fan
2025-07-10 12:40 ` [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage Peng Fan
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Peng Fan @ 2025-07-10 12:40 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, Linus Walleij, Bartosz Golaszewski,
Alexander Stein
Cc: linux-sound, linux-kernel, linux-gpio, Peng Fan, Markus Niebel
This patchset is a pick up of patch 1,2 from [1]. And I also collect
Linus's R-b for patch 2. After this patchset, there is only one user of
of_gpio.h left in sound driver(pxa2xx-ac97).
of_gpio.h is deprecated, update the driver to use GPIO descriptors.
Patch 1 is to drop legacy platform data which in-tree no users are using it
Patch 2 is to convert to GPIO descriptors
Checking the DTS that use the device, all are using GPIOD_ACTIVE_LOW
polarity for reset-gpios, so all should work as expected with this patch.
[1] https://lore.kernel.org/all/20250408-asoc-gpio-v1-0-c0db9d3fd6e9@nxp.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in v2:
- Add T-b from Alexander Stein
- Add patch 2 to sort header files per Alexander Stein
- Set rstn_gpio to NULL to align with devm_get_gpio_optional per Alexander Stein
- Link to v1: https://lore.kernel.org/r/20250706-asoc-gpio-1-v1-0-f0912095e923@nxp.com
---
Peng Fan (3):
ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage
ASoC: codec: tlv320aic32x4: Sort headers alphabetically
ASoC: codec: tlv320aic32x4: Convert to GPIO descriptors
include/sound/tlv320aic32x4.h | 9 -------
sound/soc/codecs/tlv320aic32x4.c | 53 +++++++++++++++++-----------------------
2 files changed, 23 insertions(+), 39 deletions(-)
---
base-commit: a4c01042cd9f2ad96f3289b5b28c4b64da9e0000
change-id: 20250706-asoc-gpio-1-bd0762d29351
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage
2025-07-10 12:40 [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Peng Fan
@ 2025-07-10 12:40 ` Peng Fan
2025-07-11 18:38 ` Linus Walleij
2025-07-10 12:40 ` [PATCH v2 2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically Peng Fan
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Peng Fan @ 2025-07-10 12:40 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, Linus Walleij, Bartosz Golaszewski,
Alexander Stein
Cc: linux-sound, linux-kernel, linux-gpio, Peng Fan, Markus Niebel
There is no machine is using aic32x4_pdata as platform_data, so
remove the dead code.
Cc: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
include/sound/tlv320aic32x4.h | 9 ---------
sound/soc/codecs/tlv320aic32x4.c | 9 +--------
2 files changed, 1 insertion(+), 17 deletions(-)
diff --git a/include/sound/tlv320aic32x4.h b/include/sound/tlv320aic32x4.h
index 0abf74d7edbd69484c45ad6a1c39b3f67d61bd63..b779d671a99576deadc6e647edff9b1b3a5d33c2 100644
--- a/include/sound/tlv320aic32x4.h
+++ b/include/sound/tlv320aic32x4.h
@@ -40,13 +40,4 @@
struct aic32x4_setup_data {
unsigned int gpio_func[5];
};
-
-struct aic32x4_pdata {
- struct aic32x4_setup_data *setup;
- u32 power_cfg;
- u32 micpga_routing;
- bool swapdacs;
- int rstn_gpio;
-};
-
#endif
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 54ea4bc58c276d9ab39a15d312287dfb300dbab9..7dbcf7f7130b04a27f58f20beb83eb3676c79c3d 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -1346,7 +1346,6 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap,
enum aic32x4_type type)
{
struct aic32x4_priv *aic32x4;
- struct aic32x4_pdata *pdata = dev->platform_data;
struct device_node *np = dev->of_node;
int ret;
@@ -1363,13 +1362,7 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap,
dev_set_drvdata(dev, aic32x4);
- if (pdata) {
- aic32x4->power_cfg = pdata->power_cfg;
- aic32x4->swapdacs = pdata->swapdacs;
- aic32x4->micpga_routing = pdata->micpga_routing;
- aic32x4->rstn_gpio = pdata->rstn_gpio;
- aic32x4->mclk_name = "mclk";
- } else if (np) {
+ if (np) {
ret = aic32x4_parse_dt(aic32x4, np);
if (ret) {
dev_err(dev, "Failed to parse DT node\n");
--
2.37.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically
2025-07-10 12:40 [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Peng Fan
2025-07-10 12:40 ` [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage Peng Fan
@ 2025-07-10 12:40 ` Peng Fan
2025-07-10 13:41 ` Alexander Stein
2025-07-10 12:40 ` [PATCH v2 3/3] ASoC: codec: tlv320aic32x4: Convert to GPIO descriptors Peng Fan
2025-07-14 13:42 ` [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Mark Brown
3 siblings, 1 reply; 7+ messages in thread
From: Peng Fan @ 2025-07-10 12:40 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, Linus Walleij, Bartosz Golaszewski,
Alexander Stein
Cc: linux-sound, linux-kernel, linux-gpio, Peng Fan
Sort headers alphabetically to easily insert new ones
and drop unused ones.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
sound/soc/codecs/tlv320aic32x4.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 7dbcf7f7130b04a27f58f20beb83eb3676c79c3d..2f4147387c4f802bdac983c81b104c000b1fd6ed 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -9,27 +9,27 @@
* Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
*/
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/pm.h>
-#include <linux/gpio.h>
-#include <linux/of_gpio.h>
#include <linux/cdev.h>
-#include <linux/slab.h>
#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/of_clk.h>
+#include <linux/of_gpio.h>
+#include <linux/pm.h>
#include <linux/regulator/consumer.h>
+#include <linux/slab.h>
-#include <sound/tlv320aic32x4.h>
#include <sound/core.h>
+#include <sound/initval.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
-#include <sound/initval.h>
#include <sound/tlv.h>
+#include <sound/tlv320aic32x4.h>
#include "tlv320aic32x4.h"
--
2.37.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] ASoC: codec: tlv320aic32x4: Convert to GPIO descriptors
2025-07-10 12:40 [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Peng Fan
2025-07-10 12:40 ` [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage Peng Fan
2025-07-10 12:40 ` [PATCH v2 2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically Peng Fan
@ 2025-07-10 12:40 ` Peng Fan
2025-07-14 13:42 ` [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Peng Fan @ 2025-07-10 12:40 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, Linus Walleij, Bartosz Golaszewski,
Alexander Stein
Cc: linux-sound, linux-kernel, linux-gpio, Peng Fan, Markus Niebel
of_gpio.h is deprecated, update the driver to use GPIO descriptors.
- Use devm_gpiod_get_optional to get GPIO descriptor, and set consumer
name.
- Use gpiod_set_value to configure output value.
While at here, reorder the included headers.
Checking the DTS that use the device, all are using GPIOD_ACTIVE_LOW
polarity for reset-gpios, so all should work as expected with this patch.
Cc: Markus Niebel <Markus.Niebel@ew.tq-group.com>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
sound/soc/codecs/tlv320aic32x4.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 2f4147387c4f802bdac983c81b104c000b1fd6ed..3b89980e9bcf2fe93826b5af385d0dca517091a1 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -12,12 +12,11 @@
#include <linux/cdev.h>
#include <linux/clk.h>
#include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/of_clk.h>
-#include <linux/of_gpio.h>
#include <linux/pm.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
@@ -38,7 +37,7 @@ struct aic32x4_priv {
u32 power_cfg;
u32 micpga_routing;
bool swapdacs;
- int rstn_gpio;
+ struct gpio_desc *rstn_gpio;
const char *mclk_name;
struct regulator *supply_ldo;
@@ -1236,7 +1235,14 @@ static int aic32x4_parse_dt(struct aic32x4_priv *aic32x4,
aic32x4->swapdacs = false;
aic32x4->micpga_routing = 0;
- aic32x4->rstn_gpio = of_get_named_gpio(np, "reset-gpios", 0);
+ /* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
+ aic32x4->rstn_gpio = devm_gpiod_get_optional(aic32x4->dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(aic32x4->rstn_gpio)) {
+ return dev_err_probe(aic32x4->dev, PTR_ERR(aic32x4->rstn_gpio),
+ "Failed to get reset gpio\n");
+ } else {
+ gpiod_set_consumer_name(aic32x4->rstn_gpio, "tlv320aic32x4_rstn");
+ }
if (of_property_read_u32_array(np, "aic32x4-gpio-func",
aic32x4_setup->gpio_func, 5) >= 0)
@@ -1372,26 +1378,20 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap,
aic32x4->power_cfg = 0;
aic32x4->swapdacs = false;
aic32x4->micpga_routing = 0;
- aic32x4->rstn_gpio = -1;
+ aic32x4->rstn_gpio = NULL;
aic32x4->mclk_name = "mclk";
}
- if (gpio_is_valid(aic32x4->rstn_gpio)) {
- ret = devm_gpio_request_one(dev, aic32x4->rstn_gpio,
- GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn");
- if (ret != 0)
- return ret;
- }
-
ret = aic32x4_setup_regulators(dev, aic32x4);
if (ret) {
dev_err(dev, "Failed to setup regulators\n");
return ret;
}
- if (gpio_is_valid(aic32x4->rstn_gpio)) {
+ if (!aic32x4->rstn_gpio) {
ndelay(10);
- gpio_set_value_cansleep(aic32x4->rstn_gpio, 1);
+ /* deassert reset */
+ gpiod_set_value_cansleep(aic32x4->rstn_gpio, 0);
mdelay(1);
}
--
2.37.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically
2025-07-10 12:40 ` [PATCH v2 2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically Peng Fan
@ 2025-07-10 13:41 ` Alexander Stein
0 siblings, 0 replies; 7+ messages in thread
From: Alexander Stein @ 2025-07-10 13:41 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, Linus Walleij, Bartosz Golaszewski,
Peng Fan
Cc: linux-sound, linux-kernel, linux-gpio, Peng Fan
Hi,
thanks for the update.
Am Donnerstag, 10. Juli 2025, 14:40:02 CEST schrieb Peng Fan:
> Sort headers alphabetically to easily insert new ones
> and drop unused ones.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> sound/soc/codecs/tlv320aic32x4.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
> index 7dbcf7f7130b04a27f58f20beb83eb3676c79c3d..2f4147387c4f802bdac983c81b104c000b1fd6ed 100644
> --- a/sound/soc/codecs/tlv320aic32x4.c
> +++ b/sound/soc/codecs/tlv320aic32x4.c
> @@ -9,27 +9,27 @@
> * Based on sound/soc/codecs/wm8974 and TI driver for kernel 2.6.27.
> */
>
> -#include <linux/module.h>
> -#include <linux/moduleparam.h>
> -#include <linux/init.h>
> -#include <linux/delay.h>
> -#include <linux/pm.h>
> -#include <linux/gpio.h>
> -#include <linux/of_gpio.h>
> #include <linux/cdev.h>
> -#include <linux/slab.h>
> #include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/gpio.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/moduleparam.h>
> #include <linux/of_clk.h>
> +#include <linux/of_gpio.h>
> +#include <linux/pm.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/slab.h>
>
> -#include <sound/tlv320aic32x4.h>
> #include <sound/core.h>
> +#include <sound/initval.h>
> #include <sound/pcm.h>
> #include <sound/pcm_params.h>
> #include <sound/soc.h>
> #include <sound/soc-dapm.h>
> -#include <sound/initval.h>
> #include <sound/tlv.h>
> +#include <sound/tlv320aic32x4.h>
>
> #include "tlv320aic32x4.h"
>
>
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage
2025-07-10 12:40 ` [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage Peng Fan
@ 2025-07-11 18:38 ` Linus Walleij
0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2025-07-11 18:38 UTC (permalink / raw)
To: Peng Fan
Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Mark Brown, Bartosz Golaszewski, Alexander Stein,
linux-sound, linux-kernel, linux-gpio, Markus Niebel
On Thu, Jul 10, 2025 at 2:42 PM Peng Fan <peng.fan@nxp.com> wrote:
> There is no machine is using aic32x4_pdata as platform_data, so
> remove the dead code.
>
> Cc: Markus Niebel <Markus.Niebel@ew.tq-group.com>
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4
2025-07-10 12:40 [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Peng Fan
` (2 preceding siblings ...)
2025-07-10 12:40 ` [PATCH v2 3/3] ASoC: codec: tlv320aic32x4: Convert to GPIO descriptors Peng Fan
@ 2025-07-14 13:42 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2025-07-14 13:42 UTC (permalink / raw)
To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
Liam Girdwood, Linus Walleij, Bartosz Golaszewski,
Alexander Stein, Peng Fan
Cc: linux-sound, linux-kernel, linux-gpio, Markus Niebel
On Thu, 10 Jul 2025 20:40:00 +0800, Peng Fan wrote:
> This patchset is a pick up of patch 1,2 from [1]. And I also collect
> Linus's R-b for patch 2. After this patchset, there is only one user of
> of_gpio.h left in sound driver(pxa2xx-ac97).
>
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
>
> Patch 1 is to drop legacy platform data which in-tree no users are using it
> Patch 2 is to convert to GPIO descriptors
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage
commit: 69d5b62c4bded309332add0fac6760239ff47a68
[2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically
commit: b709c1aef5e15db3aff5749fc7ed9c61b8d0a322
[3/3] ASoC: codec: tlv320aic32x4: Convert to GPIO descriptors
commit: 790d5f8ee6f2a27686d042abbce16b4e03ac1608
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] 7+ messages in thread
end of thread, other threads:[~2025-07-14 13:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 12:40 [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Peng Fan
2025-07-10 12:40 ` [PATCH v2 1/3] ASoC: codec: tlv320aic32x4: Drop aic32x4_pdata usage Peng Fan
2025-07-11 18:38 ` Linus Walleij
2025-07-10 12:40 ` [PATCH v2 2/3] ASoC: codec: tlv320aic32x4: Sort headers alphabetically Peng Fan
2025-07-10 13:41 ` Alexander Stein
2025-07-10 12:40 ` [PATCH v2 3/3] ASoC: codec: tlv320aic32x4: Convert to GPIO descriptors Peng Fan
2025-07-14 13:42 ` [PATCH v2 0/3] ASoC: codec: Convert to GPIO descriptors for tlv320aic32x4 Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).