linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors
@ 2025-05-06  7:29 Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 1/9] ASoC: codec: cs42l56: Sort headers alphabetically Peng Fan (OSS)
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

This patchset is separate from [1], and not merging changes in one
patch. So separate changes into three patches for each chip.
- sort headers
- Drop legacy platform support
- Convert to GPIO descriptors

of_gpio.h is deprecated, update the driver to use GPIO descriptors.
 - Use devm_gpiod_get_optional to get GPIO descriptor with default
   polarity GPIOD_OUT_LOW, set consumer name.
 - Use gpiod_set_value_cansleep to configure output value.

I not have platforms to test, just do the patches with my best efforts,
and make build pass.

[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 v3:
- Fix build break in patch 2 when using allmodconfig
- Link to v2: https://lore.kernel.org/r/20250428-csl42x-v2-0-e8056313968f@nxp.com

---
Peng Fan (9):
      ASoC: codec: cs42l56: Sort headers alphabetically
      ASoC: codec: cs42l56: Drop cs42l56.h
      ASoC: codec: cs42l56: Convert to GPIO descriptors
      ASoC: codec: cs42l73: Sort headers alphabetically
      ASoC: codec: cs42l73: Drop cs42l73.h
      ASoC: codec: cs42l73: Convert to GPIO descriptors
      ASoC: codec: cs42l52: Sort headers alphabetically
      ASoC: codec: cs42l52: Drop cs42l52.h
      ASoC: codec: cs42l52: Convert to GPIO descriptors

 include/sound/cs42l52.h    |  29 ------------
 include/sound/cs42l56.h    |  45 ------------------
 include/sound/cs42l73.h    |  19 --------
 sound/soc/codecs/cs42l52.c | 112 ++++++++++++++++++++++++---------------------
 sound/soc/codecs/cs42l56.c |  90 ++++++++++++++++++++++--------------
 sound/soc/codecs/cs42l73.c |  70 +++++++++++++---------------
 6 files changed, 150 insertions(+), 215 deletions(-)
---
base-commit: d9889ee34d3ea05284d5df6182692c12595b671d
change-id: 20250427-csl42x-0151784a1230

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3 1/9] ASoC: codec: cs42l56: Sort headers alphabetically
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 2/9] ASoC: codec: cs42l56: Drop cs42l56.h Peng Fan (OSS)
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

Sort headers alphabetically to easily insert new ones
and drop unused ones.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 sound/soc/codecs/cs42l56.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
index aaf90c8b7339dc7d9fa469048a56f38dca1797cd..0201206518cd9ea8ecfb823a96fb59cae37c36f4 100644
--- a/sound/soc/codecs/cs42l56.c
+++ b/sound/soc/codecs/cs42l56.c
@@ -7,29 +7,29 @@
  * Author: Brian Austin <brian.austin@cirrus.com>
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/delay.h>
-#include <linux/pm.h>
 #include <linux/i2c.h>
+#include <linux/init.h>
 #include <linux/input.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/consumer.h>
-#include <linux/of.h>
-#include <linux/of_gpio.h>
 #include <sound/core.h>
+#include <sound/cs42l56.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/cs42l56.h>
 #include "cs42l56.h"
 
 #define CS42L56_NUM_SUPPLIES 3

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 2/9] ASoC: codec: cs42l56: Drop cs42l56.h
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 1/9] ASoC: codec: cs42l56: Sort headers alphabetically Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is no in-tree user of "include/sound/cs42l56.h", so move
'struct cs42l56_platform_data' to cs42l56.c and remove the header file.
And platform data is mostly for platforms that create
devices non using device tree. CS42L56 is a discontinued product,
there is less possibility that new users will use legacy method
to create devices. So drop cs42l56.h to prepare using GPIOD API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 include/sound/cs42l56.h    | 45 ------------------------------------------
 sound/soc/codecs/cs42l56.c | 49 ++++++++++++++++++++++++++++++++++------------
 2 files changed, 37 insertions(+), 57 deletions(-)

diff --git a/include/sound/cs42l56.h b/include/sound/cs42l56.h
deleted file mode 100644
index 62e9f7a3b414f6d1bcb651b22f7f8bd1f29b0eb3..0000000000000000000000000000000000000000
--- a/include/sound/cs42l56.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * linux/sound/cs42l56.h -- Platform data for CS42L56
- *
- * Copyright (c) 2014 Cirrus Logic Inc.
- */
-
-#ifndef __CS42L56_H
-#define __CS42L56_H
-
-struct cs42l56_platform_data {
-
-	/* GPIO for Reset */
-	unsigned int gpio_nreset;
-
-	/* MICBIAS Level. Check datasheet Pg48 */
-	unsigned int micbias_lvl;
-
-	/* Analog Input 1A Reference 0=Single 1=Pseudo-Differential */
-	unsigned int ain1a_ref_cfg;
-
-	/* Analog Input 2A Reference 0=Single 1=Pseudo-Differential */
-	unsigned int ain2a_ref_cfg;
-
-	/* Analog Input 1B Reference 0=Single 1=Pseudo-Differential */
-	unsigned int ain1b_ref_cfg;
-
-	/* Analog Input 2B Reference 0=Single 1=Pseudo-Differential */
-	unsigned int ain2b_ref_cfg;
-
-	/* Charge Pump Freq. Check datasheet Pg62 */
-	unsigned int chgfreq;
-
-	/* HighPass Filter Right Channel Corner Frequency */
-	unsigned int hpfb_freq;
-
-	/* HighPass Filter Left Channel Corner Frequency */
-	unsigned int hpfa_freq;
-
-	/* Adaptive Power Control for LO/HP */
-	unsigned int adaptive_pwr;
-
-};
-
-#endif /* __CS42L56_H */
diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
index 0201206518cd9ea8ecfb823a96fb59cae37c36f4..9c58d4f08692871c5baf2702c73367287735cf24 100644
--- a/sound/soc/codecs/cs42l56.c
+++ b/sound/soc/codecs/cs42l56.c
@@ -23,7 +23,6 @@
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <sound/core.h>
-#include <sound/cs42l56.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -33,6 +32,39 @@
 #include "cs42l56.h"
 
 #define CS42L56_NUM_SUPPLIES 3
+
+struct cs42l56_platform_data {
+	/* GPIO for Reset */
+	unsigned int gpio_nreset;
+
+	/* MICBIAS Level. Check datasheet Pg48 */
+	unsigned int micbias_lvl;
+
+	/* Analog Input 1A Reference 0=Single 1=Pseudo-Differential */
+	unsigned int ain1a_ref_cfg;
+
+	/* Analog Input 2A Reference 0=Single 1=Pseudo-Differential */
+	unsigned int ain2a_ref_cfg;
+
+	/* Analog Input 1B Reference 0=Single 1=Pseudo-Differential */
+	unsigned int ain1b_ref_cfg;
+
+	/* Analog Input 2B Reference 0=Single 1=Pseudo-Differential */
+	unsigned int ain2b_ref_cfg;
+
+	/* Charge Pump Freq. Check datasheet Pg62 */
+	unsigned int chgfreq;
+
+	/* HighPass Filter Right Channel Corner Frequency */
+	unsigned int hpfb_freq;
+
+	/* HighPass Filter Left Channel Corner Frequency */
+	unsigned int hpfa_freq;
+
+	/* Adaptive Power Control for LO/HP */
+	unsigned int adaptive_pwr;
+};
+
 static const char *const cs42l56_supply_names[CS42L56_NUM_SUPPLIES] = {
 	"VA",
 	"VCP",
@@ -1169,8 +1201,6 @@ static int cs42l56_handle_of_data(struct i2c_client *i2c_client,
 static int cs42l56_i2c_probe(struct i2c_client *i2c_client)
 {
 	struct cs42l56_private *cs42l56;
-	struct cs42l56_platform_data *pdata =
-		dev_get_platdata(&i2c_client->dev);
 	int ret, i;
 	unsigned int devid;
 	unsigned int alpha_rev, metal_rev;
@@ -1188,15 +1218,10 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client)
 		return ret;
 	}
 
-	if (pdata) {
-		cs42l56->pdata = *pdata;
-	} else {
-		if (i2c_client->dev.of_node) {
-			ret = cs42l56_handle_of_data(i2c_client,
-						     &cs42l56->pdata);
-			if (ret != 0)
-				return ret;
-		}
+	if (i2c_client->dev.of_node) {
+		ret = cs42l56_handle_of_data(i2c_client, &cs42l56->pdata);
+		if (ret != 0)
+			return ret;
 	}
 
 	if (cs42l56->pdata.gpio_nreset) {

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 1/9] ASoC: codec: cs42l56: Sort headers alphabetically Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 2/9] ASoC: codec: cs42l56: Drop cs42l56.h Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-13 12:54   ` Linus Walleij
  2025-05-13 12:54   ` Linus Walleij
  2025-05-06  7:29 ` [PATCH v3 4/9] ASoC: codec: cs42l73: Sort headers alphabetically Peng Fan (OSS)
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

of_gpio.h is deprecated, update the driver to use GPIO descriptors.
 - Use devm_gpiod_get_optional to get GPIO descriptor with default
   polarity GPIOD_OUT_LOW, set consumer name.
 - Use gpiod_set_value_cansleep to configure output value.

Checking the current driver using legacy GPIO API, the
nreset value is first output HIGH, then LOW, then HIGH.

Checking the datasheet, nreset is should be held low after power
on, when nreset is high, it starts to work.

Since the driver has been here for quite long time and no complain on
the nreset flow, still follow original flow when using GPIOD
descriptors.

Commit 944004eb56dc ("gpiolib: of: add a quirk for reset line for Cirrus
CS42L56 codec") added quirks, so the gpio request API will work as before.

Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong. There is
no in-tree DTS has the device, so all should be fine.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 sound/soc/codecs/cs42l56.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
index 9c58d4f08692871c5baf2702c73367287735cf24..98fa812bc07b87fae717d601561d4ab3b9ee6bdd 100644
--- a/sound/soc/codecs/cs42l56.c
+++ b/sound/soc/codecs/cs42l56.c
@@ -8,6 +8,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -15,7 +16,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/of.h>
-#include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/regmap.h>
@@ -35,7 +35,7 @@
 
 struct cs42l56_platform_data {
 	/* GPIO for Reset */
-	unsigned int gpio_nreset;
+	struct gpio_desc *gpio_nreset;
 
 	/* MICBIAS Level. Check datasheet Pg48 */
 	unsigned int micbias_lvl;
@@ -1193,7 +1193,13 @@ static int cs42l56_handle_of_data(struct i2c_client *i2c_client,
 	if (of_property_read_u32(np, "cirrus,hpf-left-freq", &val32) >= 0)
 		pdata->hpfb_freq = val32;
 
-	pdata->gpio_nreset = of_get_named_gpio(np, "cirrus,gpio-nreset", 0);
+	pdata->gpio_nreset = devm_gpiod_get_optional(&i2c_client->dev, "cirrus,gpio-nreset",
+						     GPIOD_OUT_LOW);
+
+	if (IS_ERR(pdata->gpio_nreset))
+		return PTR_ERR(pdata->gpio_nreset);
+
+	gpiod_set_consumer_name(pdata->gpio_nreset, "CS42L56 /RST");
 
 	return 0;
 }
@@ -1225,19 +1231,10 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client)
 	}
 
 	if (cs42l56->pdata.gpio_nreset) {
-		ret = gpio_request_one(cs42l56->pdata.gpio_nreset,
-				       GPIOF_OUT_INIT_HIGH, "CS42L56 /RST");
-		if (ret < 0) {
-			dev_err(&i2c_client->dev,
-				"Failed to request /RST %d: %d\n",
-				cs42l56->pdata.gpio_nreset, ret);
-			return ret;
-		}
-		gpio_set_value_cansleep(cs42l56->pdata.gpio_nreset, 0);
-		gpio_set_value_cansleep(cs42l56->pdata.gpio_nreset, 1);
+		gpiod_set_value_cansleep(cs42l56->pdata.gpio_nreset, 1);
+		gpiod_set_value_cansleep(cs42l56->pdata.gpio_nreset, 0);
 	}
 
-
 	i2c_set_clientdata(i2c_client, cs42l56);
 
 	for (i = 0; i < ARRAY_SIZE(cs42l56->supplies); i++)

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 4/9] ASoC: codec: cs42l73: Sort headers alphabetically
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (2 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 5/9] ASoC: codec: cs42l73: Drop cs42l73.h Peng Fan (OSS)
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

Sort headers alphabetically to easily insert new ones
and drop unused ones.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 sound/soc/codecs/cs42l73.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index ddf36001100eef29f74f4d99420511f620f1948d..556270befa941a69e17b47a15677e1c4f912b14f 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -8,26 +8,26 @@
  *	    Brian Austin, Cirrus Logic Inc, <brian.austin@cirrus.com>
  */
 
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/delay.h>
 #include <linux/of_gpio.h>
 #include <linux/pm.h>
-#include <linux/i2c.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <sound/core.h>
+#include <sound/cs42l73.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/cs42l73.h>
-#include "cs42l73.h"
 #include "cirrus_legacy.h"
+#include "cs42l73.h"
 
 struct sp_config {
 	u8 spc, mmcc, spfs;

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 5/9] ASoC: codec: cs42l73: Drop cs42l73.h
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (3 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 4/9] ASoC: codec: cs42l73: Sort headers alphabetically Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is no in-tree user of "include/sound/cs42l56.h", so move
'struct cs42l73_platform_data ' to cs42l73.c and remove the header file.
And platform data is mostly for legacy platforms that create devices
non using device tree. So drop cs42l73.h to prepare using GPIOD API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 include/sound/cs42l73.h    | 19 -------------------
 sound/soc/codecs/cs42l73.c | 36 ++++++++++++++++++------------------
 2 files changed, 18 insertions(+), 37 deletions(-)

diff --git a/include/sound/cs42l73.h b/include/sound/cs42l73.h
deleted file mode 100644
index 5a93393b6124f746bfb7bf5076e4bd1f458019d2..0000000000000000000000000000000000000000
--- a/include/sound/cs42l73.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * linux/sound/cs42l73.h -- Platform data for CS42L73
- *
- * Copyright (c) 2012 Cirrus Logic Inc.
- */
-
-#ifndef __CS42L73_H
-#define __CS42L73_H
-
-struct cs42l73_platform_data {
-	/* RST GPIO */
-	unsigned int reset_gpio;
-	unsigned int chgfreq;
-	int jack_detection;
-	unsigned int mclk_freq;
-};
-
-#endif /* __CS42L73_H */
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 556270befa941a69e17b47a15677e1c4f912b14f..c09c23487d2e73340b8947ed0e1ffadb24414e7c 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -19,7 +19,6 @@
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <sound/core.h>
-#include <sound/cs42l73.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -29,6 +28,14 @@
 #include "cirrus_legacy.h"
 #include "cs42l73.h"
 
+struct cs42l73_platform_data {
+	/* RST GPIO */
+	unsigned int reset_gpio;
+	unsigned int chgfreq;
+	int jack_detection;
+	unsigned int mclk_freq;
+};
+
 struct sp_config {
 	u8 spc, mmcc, spfs;
 	u32 srate;
@@ -1276,7 +1283,7 @@ static const struct regmap_config cs42l73_regmap = {
 static int cs42l73_i2c_probe(struct i2c_client *i2c_client)
 {
 	struct cs42l73_private *cs42l73;
-	struct cs42l73_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
+	struct cs42l73_platform_data *pdata;
 	int ret, devid;
 	unsigned int reg;
 	u32 val32;
@@ -1292,23 +1299,16 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client)
 		return ret;
 	}
 
-	if (pdata) {
-		cs42l73->pdata = *pdata;
-	} else {
-		pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
-				     GFP_KERNEL);
-		if (!pdata)
-			return -ENOMEM;
-
-		if (i2c_client->dev.of_node) {
-			if (of_property_read_u32(i2c_client->dev.of_node,
-				"chgfreq", &val32) >= 0)
-				pdata->chgfreq = val32;
-		}
-		pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node,
-						"reset-gpio", 0);
-		cs42l73->pdata = *pdata;
+	pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	if (i2c_client->dev.of_node) {
+		if (of_property_read_u32(i2c_client->dev.of_node, "chgfreq", &val32) >= 0)
+			pdata->chgfreq = val32;
 	}
+	pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, "reset-gpio", 0);
+	cs42l73->pdata = *pdata;
 
 	i2c_set_clientdata(i2c_client, cs42l73);
 

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (4 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 5/9] ASoC: codec: cs42l73: Drop cs42l73.h Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-13 12:55   ` Linus Walleij
  2025-05-06  7:29 ` [PATCH v3 7/9] ASoC: codec: cs42l52: Sort headers alphabetically Peng Fan (OSS)
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

of_gpio.h is deprecated, update the driver to use GPIO descriptors.
 - Use devm_gpiod_get_optional to get GPIO descriptor with default
   polarity GPIOD_OUT_LOW, set consumer name.
 - Use gpiod_set_value_cansleep to configure output value.

Checking the current driver using legacy GPIO API, the
reset value is first output HIGH, then LOW, then HIGH.

Checking the datasheet, Hold RESET LOW (active) until all the power
supply rails have risen to greater than or equal to the minimum
recommended operating voltages.

Since the driver has been here for quite long time and no complain on
the reset flow, still follow original flow when using GPIOD
descriptors.

Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong. There is
no in-tree DTS has the device, so all should be fine.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 sound/soc/codecs/cs42l73.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index c09c23487d2e73340b8947ed0e1ffadb24414e7c..535a867f9f2a6d32986190c4302dfeb1e9f06913 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -9,12 +9,12 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/of_gpio.h>
 #include <linux/pm.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
@@ -30,7 +30,7 @@
 
 struct cs42l73_platform_data {
 	/* RST GPIO */
-	unsigned int reset_gpio;
+	struct gpio_desc *reset_gpio;
 	unsigned int chgfreq;
 	int jack_detection;
 	unsigned int mclk_freq;
@@ -1307,23 +1307,19 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client)
 		if (of_property_read_u32(i2c_client->dev.of_node, "chgfreq", &val32) >= 0)
 			pdata->chgfreq = val32;
 	}
-	pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, "reset-gpio", 0);
+	pdata->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev, "reset", GPIOD_OUT_LOW);
+
+	if (IS_ERR(pdata->reset_gpio))
+		return PTR_ERR(pdata->reset_gpio);
+
+	gpiod_set_consumer_name(pdata->reset_gpio, "CS42L73 /RST");
 	cs42l73->pdata = *pdata;
 
 	i2c_set_clientdata(i2c_client, cs42l73);
 
 	if (cs42l73->pdata.reset_gpio) {
-		ret = devm_gpio_request_one(&i2c_client->dev,
-					    cs42l73->pdata.reset_gpio,
-					    GPIOF_OUT_INIT_HIGH,
-					    "CS42L73 /RST");
-		if (ret < 0) {
-			dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n",
-				cs42l73->pdata.reset_gpio, ret);
-			return ret;
-		}
-		gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 0);
-		gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 1);
+		gpiod_set_value_cansleep(cs42l73->pdata.reset_gpio, 1);
+		gpiod_set_value_cansleep(cs42l73->pdata.reset_gpio, 0);
 	}
 
 	/* initialize codec */
@@ -1360,7 +1356,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client)
 	return 0;
 
 err_reset:
-	gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 0);
+	gpiod_set_value_cansleep(cs42l73->pdata.reset_gpio, 1);
 
 	return ret;
 }

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 7/9] ASoC: codec: cs42l52: Sort headers alphabetically
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (5 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 8/9] ASoC: codec: cs42l52: Drop cs42l52.h Peng Fan (OSS)
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

Sort headers alphabetically to easily insert new ones
and drop unused ones.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 sound/soc/codecs/cs42l52.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index cd3f92c19045ad32f1f0f0f1764390640d68eb10..ba2ccc818ba6cc1b5fbcfb38e07e9bc8f68c4a6e 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -8,27 +8,27 @@
  * Author: Brian Austin <brian.austin@cirrus.com>
  */
 
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/delay.h>
 #include <linux/of_gpio.h>
 #include <linux/pm.h>
-#include <linux/i2c.h>
-#include <linux/input.h>
+#include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
-#include <linux/platform_device.h>
 #include <sound/core.h>
+#include <sound/cs42l52.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/cs42l52.h>
 #include "cs42l52.h"
 
 struct sp_config {

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 8/9] ASoC: codec: cs42l52: Drop cs42l52.h
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (6 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 7/9] ASoC: codec: cs42l52: Sort headers alphabetically Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-06  7:29 ` [PATCH v3 9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors Peng Fan (OSS)
  2025-05-07 11:13 ` [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: " Mark Brown
  9 siblings, 0 replies; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

There is no in-tree user of "include/sound/cs42l52.h", so move
'struct cs42l52_platform_data ' to cs42l52.c and remove the header file.
And platform data is mostly for legacy platforms that create devices
non using device tree. So drop cs42l52.h to prepare using GPIOD API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 include/sound/cs42l52.h    | 29 -----------------
 sound/soc/codecs/cs42l52.c | 78 +++++++++++++++++++++++++++-------------------
 2 files changed, 46 insertions(+), 61 deletions(-)

diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h
deleted file mode 100644
index c20649666abe5dcbbf628f6c2d1692d3e7190eeb..0000000000000000000000000000000000000000
--- a/include/sound/cs42l52.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * linux/sound/cs42l52.h -- Platform data for CS42L52
- *
- * Copyright (c) 2012 Cirrus Logic Inc.
- */
-
-#ifndef __CS42L52_H
-#define __CS42L52_H
-
-struct cs42l52_platform_data {
-
-	/* MICBIAS Level. Check datasheet Pg48 */
-	unsigned int micbias_lvl;
-
-	/* MICA mode selection Differential or Single-ended */
-	bool mica_diff_cfg;
-
-	/* MICB mode selection Differential or Single-ended */
-	bool micb_diff_cfg;
-
-	/* Charge Pump Freq. Check datasheet Pg73 */
-	unsigned int chgfreq;
-
-	/* Reset GPIO */
-	unsigned int reset_gpio;
-};
-
-#endif /* __CS42L52_H */
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index ba2ccc818ba6cc1b5fbcfb38e07e9bc8f68c4a6e..aa8c001cce099e3c1dfc979678fe8000caed097f 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -22,7 +22,6 @@
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <sound/core.h>
-#include <sound/cs42l52.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -36,6 +35,24 @@ struct sp_config {
 	u32 srate;
 };
 
+struct cs42l52_platform_data {
+
+	/* MICBIAS Level. Check datasheet Pg48 */
+	unsigned int micbias_lvl;
+
+	/* MICA mode selection Differential or Single-ended */
+	bool mica_diff_cfg;
+
+	/* MICB mode selection Differential or Single-ended */
+	bool micb_diff_cfg;
+
+	/* Charge Pump Freq. Check datasheet Pg73 */
+	unsigned int chgfreq;
+
+	/* Reset GPIO */
+	unsigned int reset_gpio;
+};
+
 struct  cs42l52_private {
 	struct regmap *regmap;
 	struct snd_soc_component *component;
@@ -1090,7 +1107,7 @@ static const struct regmap_config cs42l52_regmap = {
 static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
 {
 	struct cs42l52_private *cs42l52;
-	struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
+	struct cs42l52_platform_data *pdata;
 	int ret;
 	unsigned int devid;
 	unsigned int reg;
@@ -1107,38 +1124,35 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
 		dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
 		return ret;
 	}
-	if (pdata) {
-		cs42l52->pdata = *pdata;
-	} else {
-		pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
-				     GFP_KERNEL);
-		if (!pdata)
-			return -ENOMEM;
-
-		if (i2c_client->dev.of_node) {
-			if (of_property_read_bool(i2c_client->dev.of_node,
-				"cirrus,mica-differential-cfg"))
-				pdata->mica_diff_cfg = true;
-
-			if (of_property_read_bool(i2c_client->dev.of_node,
-				"cirrus,micb-differential-cfg"))
-				pdata->micb_diff_cfg = true;
-
-			if (of_property_read_u32(i2c_client->dev.of_node,
-				"cirrus,micbias-lvl", &val32) >= 0)
-				pdata->micbias_lvl = val32;
-
-			if (of_property_read_u32(i2c_client->dev.of_node,
-				"cirrus,chgfreq-divisor", &val32) >= 0)
-				pdata->chgfreq = val32;
-
-			pdata->reset_gpio =
-				of_get_named_gpio(i2c_client->dev.of_node,
-						"cirrus,reset-gpio", 0);
-		}
-		cs42l52->pdata = *pdata;
+
+	pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	if (i2c_client->dev.of_node) {
+		if (of_property_read_bool(i2c_client->dev.of_node,
+			"cirrus,mica-differential-cfg"))
+			pdata->mica_diff_cfg = true;
+
+		if (of_property_read_bool(i2c_client->dev.of_node,
+			"cirrus,micb-differential-cfg"))
+			pdata->micb_diff_cfg = true;
+
+		if (of_property_read_u32(i2c_client->dev.of_node,
+			"cirrus,micbias-lvl", &val32) >= 0)
+			pdata->micbias_lvl = val32;
+
+		if (of_property_read_u32(i2c_client->dev.of_node,
+			"cirrus,chgfreq-divisor", &val32) >= 0)
+			pdata->chgfreq = val32;
+
+		pdata->reset_gpio =
+			of_get_named_gpio(i2c_client->dev.of_node,
+					"cirrus,reset-gpio", 0);
 	}
 
+	cs42l52->pdata = *pdata;
+
 	if (cs42l52->pdata.reset_gpio) {
 		ret = devm_gpio_request_one(&i2c_client->dev,
 					    cs42l52->pdata.reset_gpio,

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (7 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 8/9] ASoC: codec: cs42l52: Drop cs42l52.h Peng Fan (OSS)
@ 2025-05-06  7:29 ` Peng Fan (OSS)
  2025-05-13 12:55   ` Linus Walleij
  2025-05-07 11:13 ` [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: " Mark Brown
  9 siblings, 1 reply; 15+ messages in thread
From: Peng Fan (OSS) @ 2025-05-06  7:29 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Linus Walleij, Bartosz Golaszewski,
	Charles Keepax
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

of_gpio.h is deprecated, update the driver to use GPIO descriptors.
 - Use devm_gpiod_get_optional to get GPIO descriptor with default
   polarity GPIOD_OUT_LOW, set consumer name.
 - Use gpiod_set_value_cansleep to configure output value.

Checking the current driver using legacy GPIO API, the
reset value is first output HIGH, then LOW, then HIGH.

Checking the datasheet, the device remains in Power-down state until
RESET pin is brought high.

Since the driver has been here for quite long time and no complain on
the reset flow, still follow original flow when using GPIOD
descriptors.

Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong.
And the binding use reset-gpio as example, not same as driver using
"cirrus,reset-gpio", and there is no in-tree DTS has the device,
so all should be fine with this patch.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 sound/soc/codecs/cs42l52.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index aa8c001cce099e3c1dfc979678fe8000caed097f..a9ffba62aaf88c55a715d83609382d6fc5cfaa8d 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -9,13 +9,13 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/of_gpio.h>
 #include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
@@ -50,7 +50,7 @@ struct cs42l52_platform_data {
 	unsigned int chgfreq;
 
 	/* Reset GPIO */
-	unsigned int reset_gpio;
+	struct gpio_desc *reset_gpio;
 };
 
 struct  cs42l52_private {
@@ -1146,25 +1146,21 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client)
 			"cirrus,chgfreq-divisor", &val32) >= 0)
 			pdata->chgfreq = val32;
 
-		pdata->reset_gpio =
-			of_get_named_gpio(i2c_client->dev.of_node,
-					"cirrus,reset-gpio", 0);
+		pdata->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
+							    "cirrus,reset",
+							    GPIOD_OUT_LOW);
+
+		if (IS_ERR(pdata->reset_gpio))
+			return PTR_ERR(pdata->reset_gpio);
+
+		gpiod_set_consumer_name(pdata->reset_gpio, "CS42L52 /RST");
 	}
 
 	cs42l52->pdata = *pdata;
 
 	if (cs42l52->pdata.reset_gpio) {
-		ret = devm_gpio_request_one(&i2c_client->dev,
-					    cs42l52->pdata.reset_gpio,
-					    GPIOF_OUT_INIT_HIGH,
-					    "CS42L52 /RST");
-		if (ret < 0) {
-			dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n",
-				cs42l52->pdata.reset_gpio, ret);
-			return ret;
-		}
-		gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 0);
-		gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 1);
+		gpiod_set_value_cansleep(cs42l52->pdata.reset_gpio, 1);
+		gpiod_set_value_cansleep(cs42l52->pdata.reset_gpio, 0);
 	}
 
 	i2c_set_clientdata(i2c_client, cs42l52);

-- 
2.37.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors
  2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
                   ` (8 preceding siblings ...)
  2025-05-06  7:29 ` [PATCH v3 9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-07 11:13 ` Mark Brown
  9 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2025-05-07 11:13 UTC (permalink / raw)
  To: David Rhodes, Richard Fitzgerald, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Linus Walleij, Bartosz Golaszewski, Charles Keepax,
	Peng Fan (OSS)
  Cc: linux-sound, patches, linux-kernel, linux-gpio, Peng Fan

On Tue, 06 May 2025 15:29:30 +0800, Peng Fan (OSS) wrote:
> This patchset is separate from [1], and not merging changes in one
> patch. So separate changes into three patches for each chip.
> - sort headers
> - Drop legacy platform support
> - Convert to GPIO descriptors
> 
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
>  - Use devm_gpiod_get_optional to get GPIO descriptor with default
>    polarity GPIOD_OUT_LOW, set consumer name.
>  - Use gpiod_set_value_cansleep to configure output value.
> 
> [...]

Applied to

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

Thanks!

[1/9] ASoC: codec: cs42l56: Sort headers alphabetically
      commit: 4060ebdd5063eed98a8f81f78f1e67ffc4ff0942
[2/9] ASoC: codec: cs42l56: Drop cs42l56.h
      commit: 86f6e4791c40c33891299d95c055e5d06d396284
[3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors
      commit: 0bb92e4736a9dd43e3215b378db5ac63075a3cc1
[4/9] ASoC: codec: cs42l73: Sort headers alphabetically
      commit: f3e7298848f0e6c09e4da5fd80bca7cd0c58ccc1
[5/9] ASoC: codec: cs42l73: Drop cs42l73.h
      commit: 43ef0dccbc2528924c4b03a902fa39502faabb16
[6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors
      commit: b6118100382c9e4c8ca623b3a8e8bf1a09c42aa5
[7/9] ASoC: codec: cs42l52: Sort headers alphabetically
      commit: 2d703321b856acdb6589d74906e19aa5cb328d4e
[8/9] ASoC: codec: cs42l52: Drop cs42l52.h
      commit: 772c036befb875c904731fb309fb9d2e065ba3f8
[9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors
      commit: 5bf5bdfd007e07f2ec5b3e07aa02616f4eebef67

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] 15+ messages in thread

* Re: [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors
  2025-05-06  7:29 ` [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-13 12:54   ` Linus Walleij
  2025-05-13 12:54   ` Linus Walleij
  1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2025-05-13 12:54 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Bartosz Golaszewski,
	Charles Keepax, linux-sound, patches, linux-kernel, linux-gpio,
	Peng Fan

On Tue, May 6, 2025 at 9:31 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

> From: Peng Fan <peng.fan@nxp.com>
>
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
>  - Use devm_gpiod_get_optional to get GPIO descriptor with default
>    polarity GPIOD_OUT_LOW, set consumer name.
>  - Use gpiod_set_value_cansleep to configure output value.
>
> Checking the current driver using legacy GPIO API, the
> nreset value is first output HIGH, then LOW, then HIGH.
>
> Checking the datasheet, nreset is should be held low after power
> on, when nreset is high, it starts to work.
>
> Since the driver has been here for quite long time and no complain on
> the nreset flow, still follow original flow when using GPIOD
> descriptors.
>
> Commit 944004eb56dc ("gpiolib: of: add a quirk for reset line for Cirrus
> CS42L56 codec") added quirks, so the gpio request API will work as before.
>
> Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
> example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong. There is
> no in-tree DTS has the device, so all should be fine.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors
  2025-05-06  7:29 ` [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors Peng Fan (OSS)
  2025-05-13 12:54   ` Linus Walleij
@ 2025-05-13 12:54   ` Linus Walleij
  1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2025-05-13 12:54 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Bartosz Golaszewski,
	Charles Keepax, linux-sound, patches, linux-kernel, linux-gpio,
	Peng Fan

On Tue, May 6, 2025 at 9:31 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

> From: Peng Fan <peng.fan@nxp.com>
>
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
>  - Use devm_gpiod_get_optional to get GPIO descriptor with default
>    polarity GPIOD_OUT_LOW, set consumer name.
>  - Use gpiod_set_value_cansleep to configure output value.
>
> Checking the current driver using legacy GPIO API, the
> nreset value is first output HIGH, then LOW, then HIGH.
>
> Checking the datasheet, nreset is should be held low after power
> on, when nreset is high, it starts to work.
>
> Since the driver has been here for quite long time and no complain on
> the nreset flow, still follow original flow when using GPIOD
> descriptors.
>
> Commit 944004eb56dc ("gpiolib: of: add a quirk for reset line for Cirrus
> CS42L56 codec") added quirks, so the gpio request API will work as before.
>
> Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
> example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong. There is
> no in-tree DTS has the device, so all should be fine.
>
> 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] 15+ messages in thread

* Re: [PATCH v3 6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors
  2025-05-06  7:29 ` [PATCH v3 6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-13 12:55   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2025-05-13 12:55 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Bartosz Golaszewski,
	Charles Keepax, linux-sound, patches, linux-kernel, linux-gpio,
	Peng Fan

On Tue, May 6, 2025 at 9:31 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

> From: Peng Fan <peng.fan@nxp.com>
>
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
>  - Use devm_gpiod_get_optional to get GPIO descriptor with default
>    polarity GPIOD_OUT_LOW, set consumer name.
>  - Use gpiod_set_value_cansleep to configure output value.
>
> Checking the current driver using legacy GPIO API, the
> reset value is first output HIGH, then LOW, then HIGH.
>
> Checking the datasheet, Hold RESET LOW (active) until all the power
> supply rails have risen to greater than or equal to the minimum
> recommended operating voltages.
>
> Since the driver has been here for quite long time and no complain on
> the reset flow, still follow original flow when using GPIOD
> descriptors.
>
> Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
> example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong. There is
> no in-tree DTS has the device, so all should be fine.
>
> 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] 15+ messages in thread

* Re: [PATCH v3 9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors
  2025-05-06  7:29 ` [PATCH v3 9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors Peng Fan (OSS)
@ 2025-05-13 12:55   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2025-05-13 12:55 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: David Rhodes, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, Bartosz Golaszewski,
	Charles Keepax, linux-sound, patches, linux-kernel, linux-gpio,
	Peng Fan

On Tue, May 6, 2025 at 9:31 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

> From: Peng Fan <peng.fan@nxp.com>
>
> of_gpio.h is deprecated, update the driver to use GPIO descriptors.
>  - Use devm_gpiod_get_optional to get GPIO descriptor with default
>    polarity GPIOD_OUT_LOW, set consumer name.
>  - Use gpiod_set_value_cansleep to configure output value.
>
> Checking the current driver using legacy GPIO API, the
> reset value is first output HIGH, then LOW, then HIGH.
>
> Checking the datasheet, the device remains in Power-down state until
> RESET pin is brought high.
>
> Since the driver has been here for quite long time and no complain on
> the reset flow, still follow original flow when using GPIOD
> descriptors.
>
> Per datasheet, the DTS polarity should be GPIOD_ACTIVE_LOW. The binding
> example use value 0(GPIOD_ACTIVE_HIGH) which seems wrong.
> And the binding use reset-gpio as example, not same as driver using
> "cirrus,reset-gpio", and there is no in-tree DTS has the device,
> so all should be fine with this patch.
>
> 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] 15+ messages in thread

end of thread, other threads:[~2025-05-13 12:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06  7:29 [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: Convert to GPIO descriptors Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 1/9] ASoC: codec: cs42l56: Sort headers alphabetically Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 2/9] ASoC: codec: cs42l56: Drop cs42l56.h Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 3/9] ASoC: codec: cs42l56: Convert to GPIO descriptors Peng Fan (OSS)
2025-05-13 12:54   ` Linus Walleij
2025-05-13 12:54   ` Linus Walleij
2025-05-06  7:29 ` [PATCH v3 4/9] ASoC: codec: cs42l73: Sort headers alphabetically Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 5/9] ASoC: codec: cs42l73: Drop cs42l73.h Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 6/9] ASoC: codec: cs42l73: Convert to GPIO descriptors Peng Fan (OSS)
2025-05-13 12:55   ` Linus Walleij
2025-05-06  7:29 ` [PATCH v3 7/9] ASoC: codec: cs42l52: Sort headers alphabetically Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 8/9] ASoC: codec: cs42l52: Drop cs42l52.h Peng Fan (OSS)
2025-05-06  7:29 ` [PATCH v3 9/9] ASoC: codec: cs42l52: Convert to GPIO descriptors Peng Fan (OSS)
2025-05-13 12:55   ` Linus Walleij
2025-05-07 11:13 ` [PATCH v3 0/9] ASoC: codec: cs42l[56,73,52]: " 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).