Skip to contentSkip to conversation

ASoC: wm8731: Overhaul of the driver

PATCH In review Mark Brown 4 participants 19 messages Mar 25, 2022 – Apr 5, 2022

Subsystems (8)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

cover ASoC: wm8731: Overhaul of the driver

This series contains a bunch of fairly minor changes which overhaul and modernise the WM8731 driver, there should be no impact on the driver's functionality.

Mark Brown (7):
ASoC: wm8731: Update to modern DAI terminology
ASoC: wm8731: Factor component init out of bus code
ASoC: wm8731: Move regulator request into wm8731_init()
ASoC: wm8731: Factor our MCLK and mutex initialisation
ASoC: wm8731: Factor out the I2C and SPI bus code into separate
modules
ASoC: wm8731: Convert DT bindings to YAML format
ARM: configs: Update multi_v5_defconfig for WM8731 bus refactoring

 .../devicetree/bindings/sound/wlf,wm8731.yaml |  97 +++++++
 .../devicetree/bindings/sound/wm8731.txt      |  27 --
 arch/arm/configs/multi_v5_defconfig           |   3 +-
 sound/soc/atmel/Kconfig                       |   4 +-
 sound/soc/au1x/Kconfig                        |   2 +-
 sound/soc/codecs/Kconfig                      |  18 +-
 sound/soc/codecs/Makefile                     |   4 +
 sound/soc/codecs/wm8731-i2c.c                 |  69 +++++
 sound/soc/codecs/wm8731-spi.c                 |  59 ++++
 sound/soc/codecs/wm8731.c                     | 266 +++---------------
 sound/soc/codecs/wm8731.h                     |  27 ++
 sound/soc/pxa/Kconfig                         |   4 +-
 12 files changed, 323 insertions(+), 257 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wlf,wm8731.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/wm8731.txt
 create mode 100644 sound/soc/codecs/wm8731-i2c.c
 create mode 100644 sound/soc/codecs/wm8731-spi.c

base-commit: 0b88a659002151e354272a13ae29d8b795ef1b46

Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/7 ASoC: wm8731: Update to modern DAI terminology

As part of retiring the old defines used to specify DAI formats update the wm8731 driver to use the modern names.

---
 sound/soc/codecs/wm8731.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8731.c +3 -4
index 5d4949c2ec9b..5b399c631faf 100644
@@ -429,12 +429,11 @@ static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	struct snd_soc_component *component = codec_dai->component;
 	u16 iface = 0;
 
-	/* set master/slave audio interface */
-	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
-	case SND_SOC_DAIFMT_CBM_CFM:
+	switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
+	case SND_SOC_DAIFMT_CBP_CFP:
 		iface |= 0x0040;
 		break;
-	case SND_SOC_DAIFMT_CBS_CFS:
+	case SND_SOC_DAIFMT_CBC_CFC:
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH 2/7 ASoC: wm8731: Factor component init out of bus code

In reply to Mark Brown

Both the I2C and SPI bus code register the component immediately after they call wm8731_hw_init(), factor the code out into the the common function and rename it to just be plain wm8731_init() while we're at it since it's not just for hardware init any more. This refactoring means we need to move the function after the declaration of the component driver.

---
 sound/soc/codecs/wm8731.c | 67 ++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 40 deletions(-)
sound/soc/codecs/wm8731.c +27 -40
index 5b399c631faf..b2ec03b1afed 100644
@@ -594,7 +594,22 @@ static int wm8731_request_supplies(struct device *dev,
 	return 0;
 }
 
-static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
+static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
+	.set_bias_level		= wm8731_set_bias_level,
+	.controls		= wm8731_snd_controls,
+	.num_controls		= ARRAY_SIZE(wm8731_snd_controls),
+	.dapm_widgets		= wm8731_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(wm8731_dapm_widgets),
+	.dapm_routes		= wm8731_intercon,
+	.num_dapm_routes	= ARRAY_SIZE(wm8731_intercon),
+	.suspend_bias_off	= 1,
+	.idle_bias_on		= 1,
+	.use_pmdown_time	= 1,
+	.endianness		= 1,
+	.non_legacy_dai_naming	= 1,
+};
+
+static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
 {
 	int ret = 0;
 
@@ -618,6 +633,15 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
 
 	regcache_mark_dirty(wm8731->regmap);
 
+	ret = devm_snd_soc_register_component(dev,
+			&soc_component_dev_wm8731, &wm8731_dai, 1);
+	if (ret != 0) {
+		dev_err(dev, "Failed to register CODEC: %d\n", ret);
+		goto err_regulator_enable;
+	}
+
+	return 0;
+
 err_regulator_enable:
 	/* Regulators will be enabled by bias management */
 	regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
@@ -625,21 +649,6 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
 	return ret;
 }
 
-static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
-	.set_bias_level		= wm8731_set_bias_level,
-	.controls		= wm8731_snd_controls,
-	.num_controls		= ARRAY_SIZE(wm8731_snd_controls),
-	.dapm_widgets		= wm8731_dapm_widgets,
-	.num_dapm_widgets	= ARRAY_SIZE(wm8731_dapm_widgets),
-	.dapm_routes		= wm8731_intercon,
-	.num_dapm_routes	= ARRAY_SIZE(wm8731_intercon),
-	.suspend_bias_off	= 1,
-	.idle_bias_on		= 1,
-	.use_pmdown_time	= 1,
-	.endianness		= 1,
-	.non_legacy_dai_naming	= 1,
-};
-
 static const struct of_device_id wm8731_of_match[] = {
 	{ .compatible = "wlf,wm8731", },
 	{ }
@@ -698,18 +707,7 @@ static int wm8731_spi_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	ret = wm8731_hw_init(&spi->dev, wm8731);
-	if (ret != 0)
-		return ret;
-
-	ret = devm_snd_soc_register_component(&spi->dev,
-			&soc_component_dev_wm8731, &wm8731_dai, 1);
-	if (ret != 0) {
-		dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
+	return wm8731_init(&spi->dev, wm8731);
 }
 
 static struct spi_driver wm8731_spi_driver = {
@@ -762,18 +760,7 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	ret = wm8731_hw_init(&i2c->dev, wm8731);
-	if (ret != 0)
-		return ret;
-
-	ret = devm_snd_soc_register_component(&i2c->dev,
-			&soc_component_dev_wm8731, &wm8731_dai, 1);
-	if (ret != 0) {
-		dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
+	return wm8731_init(&i2c->dev, wm8731);
 }
 
 static const struct i2c_device_id wm8731_i2c_id[] = {
Signature · 1 line
2.30.2
Acked-by on v1 2/7
#4 lore raw

Re: [PATCH v1 2/7] ASoC: wm8731: Factor component init out of bus code

Quoted 8 lines · Mark Brown

Both the I2C and SPI bus code register the component immediately after they call wm8731_hw_init(), factor the code out into the the common function and rename it to just be plain wm8731_init() while we're at it since it's not just for hardware init any more. This refactoring means we need to move the function after the declaration of the component driver.

---

Thanks,
Charles

author maintainer
#5 lore raw

PATCH 3/7 ASoC: wm8731: Move regulator request into wm8731_init()

In reply to Mark Brown

The supplies used by the wm8731 do not depend on the bus and there is no need to do anything with the supplies prior to instantiating the regmap so move the request into wm8731_init().

---
 sound/soc/codecs/wm8731.c | 48 +++++++++++++--------------------------
 1 file changed, 16 insertions(+), 32 deletions(-)
sound/soc/codecs/wm8731.c +16 -32
index b2ec03b1afed..334332bb5f22 100644
@@ -569,8 +569,22 @@ static struct snd_soc_dai_driver wm8731_dai = {
 	.symmetric_rate = 1,
 };
 
-static int wm8731_request_supplies(struct device *dev,
-		struct wm8731_priv *wm8731)
+static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
+	.set_bias_level		= wm8731_set_bias_level,
+	.controls		= wm8731_snd_controls,
+	.num_controls		= ARRAY_SIZE(wm8731_snd_controls),
+	.dapm_widgets		= wm8731_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(wm8731_dapm_widgets),
+	.dapm_routes		= wm8731_intercon,
+	.num_dapm_routes	= ARRAY_SIZE(wm8731_intercon),
+	.suspend_bias_off	= 1,
+	.idle_bias_on		= 1,
+	.use_pmdown_time	= 1,
+	.endianness		= 1,
+	.non_legacy_dai_naming	= 1,
+};
+
+static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
 {
 	int ret = 0, i;
 
@@ -591,28 +605,6 @@ static int wm8731_request_supplies(struct device *dev,
 		return ret;
 	}
 
-	return 0;
-}
-
-static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
-	.set_bias_level		= wm8731_set_bias_level,
-	.controls		= wm8731_snd_controls,
-	.num_controls		= ARRAY_SIZE(wm8731_snd_controls),
-	.dapm_widgets		= wm8731_dapm_widgets,
-	.num_dapm_widgets	= ARRAY_SIZE(wm8731_dapm_widgets),
-	.dapm_routes		= wm8731_intercon,
-	.num_dapm_routes	= ARRAY_SIZE(wm8731_intercon),
-	.suspend_bias_off	= 1,
-	.idle_bias_on		= 1,
-	.use_pmdown_time	= 1,
-	.endianness		= 1,
-	.non_legacy_dai_naming	= 1,
-};
-
-static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
-{
-	int ret = 0;
-
 	ret = wm8731_reset(wm8731->regmap);
 	if (ret < 0) {
 		dev_err(dev, "Failed to issue reset: %d\n", ret);
@@ -695,10 +687,6 @@ static int wm8731_spi_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, wm8731);
 
-	ret = wm8731_request_supplies(&spi->dev, wm8731);
-	if (ret != 0)
-		return ret;
-
 	wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
 	if (IS_ERR(wm8731->regmap)) {
 		ret = PTR_ERR(wm8731->regmap);
@@ -748,10 +736,6 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
 
 	i2c_set_clientdata(i2c, wm8731);
 
-	ret = wm8731_request_supplies(&i2c->dev, wm8731);
-	if (ret != 0)
-		return ret;
-
 	wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
 	if (IS_ERR(wm8731->regmap)) {
 		ret = PTR_ERR(wm8731->regmap);
Signature · 1 line
2.30.2
Acked-by on v1 3/7
#6 lore raw

Re: [PATCH v1 3/7] ASoC: wm8731: Move regulator request into wm8731_init()

Quoted 6 lines · Mark Brown

The supplies used by the wm8731 do not depend on the bus and there is no need to do anything with the supplies prior to instantiating the regmap so move the request into wm8731_init().

---

Thanks,
Charles

author maintainer
#7 lore raw

PATCH 4/7 ASoC: wm8731: Factor our MCLK and mutex initialisation

In reply to Mark Brown

The code for initialising the MCLK and mutex is identical in the I2C and SPI probe functions so just move this out into wm8731_init().

---
 sound/soc/codecs/wm8731.c | 44 +++++++++++++--------------------------
 1 file changed, 14 insertions(+), 30 deletions(-)
sound/soc/codecs/wm8731.c +14 -30
index 334332bb5f22..43730aba11fe 100644
@@ -588,6 +588,20 @@ static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
 {
 	int ret = 0, i;
 
+	wm8731->mclk = devm_clk_get(dev, "mclk");
+	if (IS_ERR(wm8731->mclk)) {
+		ret = PTR_ERR(wm8731->mclk);
+		if (ret == -ENOENT) {
+			wm8731->mclk = NULL;
+			dev_warn(dev, "Assuming static MCLK\n");
+		} else {
+			dev_err(dev, "Failed to get MCLK: %d\n", ret);
+			return ret;
+		}
+	}
+
+	mutex_init(&wm8731->lock);
+
 	for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
 		wm8731->supplies[i].supply = wm8731_supply_names[i];
 
@@ -670,21 +684,6 @@ static int wm8731_spi_probe(struct spi_device *spi)
 	if (wm8731 == NULL)
 		return -ENOMEM;
 
-	wm8731->mclk = devm_clk_get(&spi->dev, "mclk");
-	if (IS_ERR(wm8731->mclk)) {
-		ret = PTR_ERR(wm8731->mclk);
-		if (ret == -ENOENT) {
-			wm8731->mclk = NULL;
-			dev_warn(&spi->dev, "Assuming static MCLK\n");
-		} else {
-			dev_err(&spi->dev, "Failed to get MCLK: %d\n",
-				ret);
-			return ret;
-		}
-	}
-
-	mutex_init(&wm8731->lock);
-
 	spi_set_drvdata(spi, wm8731);
 
 	wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
@@ -719,21 +718,6 @@ static int wm8731_i2c_probe(struct i2c_client *i2c,
 	if (wm8731 == NULL)
 		return -ENOMEM;
 
-	wm8731->mclk = devm_clk_get(&i2c->dev, "mclk");
-	if (IS_ERR(wm8731->mclk)) {
-		ret = PTR_ERR(wm8731->mclk);
-		if (ret == -ENOENT) {
-			wm8731->mclk = NULL;
-			dev_warn(&i2c->dev, "Assuming static MCLK\n");
-		} else {
-			dev_err(&i2c->dev, "Failed to get MCLK: %d\n",
-				ret);
-			return ret;
-		}
-	}
-
-	mutex_init(&wm8731->lock);
-
 	i2c_set_clientdata(i2c, wm8731);
 
 	wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
Signature · 1 line
2.30.2
author maintainer
#9 lore raw

PATCH 5/7 ASoC: wm8731: Factor out the I2C and SPI bus code into separate modules

In reply to Mark Brown

Placing both the I2C and SPI code in the same module causes problems with mixes of modular and non-modular builds of the buses so it's generally bad practice. As with other drivers split the bus code out of the WM8731 driver into separate modules.

---
 sound/soc/atmel/Kconfig       |   4 +-
 sound/soc/au1x/Kconfig        |   2 +-
 sound/soc/codecs/Kconfig      |  18 ++++-
 sound/soc/codecs/Makefile     |   4 +
 sound/soc/codecs/wm8731-i2c.c |  69 +++++++++++++++++
 sound/soc/codecs/wm8731-spi.c |  59 +++++++++++++++
 sound/soc/codecs/wm8731.c     | 138 +---------------------------------
 sound/soc/codecs/wm8731.h     |  27 +++++++
 sound/soc/pxa/Kconfig         |   4 +-
 9 files changed, 183 insertions(+), 142 deletions(-)
 create mode 100644 sound/soc/codecs/wm8731-i2c.c
 create mode 100644 sound/soc/codecs/wm8731-spi.c
sound/soc/atmel/Kconfig +2 -2
index 8617793ed955..2a3ade9e56ec 100644
@@ -42,9 +42,9 @@ config SND_ATMEL_SOC_SSC_DMA
 config SND_AT91_SOC_SAM9G20_WM8731
 	tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
 	depends on ARCH_AT91 || COMPILE_TEST
-	depends on ATMEL_SSC && SND_SOC_I2C_AND_SPI
+	depends on ATMEL_SSC && I2C
 	select SND_ATMEL_SOC_SSC_PDC
-	select SND_SOC_WM8731
+	select SND_SOC_WM8731_I2C
 	help
 	  Say Y if you want to add support for SoC audio on WM8731-based
 	  AT91sam9g20 evaluation board.
sound/soc/au1x/Kconfig +1 -1
index 38de7c0efbc7..8a78809e8754 100644
@@ -58,7 +58,7 @@ config SND_SOC_DB1200
 	select SND_SOC_AC97_CODEC
 	select SND_SOC_WM9712
 	select SND_SOC_AU1XPSC_I2S
-	select SND_SOC_WM8731
+	select SND_SOC_WM8731_I2C
 	help
 	  Select this option to enable audio (AC97 and I2S) on the
 	  Alchemy/AMD/RMI/NetLogic Db1200, Db1550 and Db1300 evaluation boards.
sound/soc/codecs/Kconfig +15 -3
index c2627f7489a4..ab4e5b5e827a 100644
@@ -263,7 +263,8 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_WM8711
 	imply SND_SOC_WM8727
 	imply SND_SOC_WM8728
-	imply SND_SOC_WM8731
+	imply SND_SOC_WM8731_I2C
+	imply SND_SOC_WM8731_SPI
 	imply SND_SOC_WM8737
 	imply SND_SOC_WM8741
 	imply SND_SOC_WM8750
@@ -1742,8 +1743,19 @@ config SND_SOC_WM8728
 	depends on SND_SOC_I2C_AND_SPI
 
 config SND_SOC_WM8731
-	tristate "Wolfson Microelectronics WM8731 CODEC"
-	depends on SND_SOC_I2C_AND_SPI
+	tristate
+
+config SND_SOC_WM8731_I2C
+	tristate "Wolfson Microelectronics WM8731 CODEC with I2C"
+	depends on I2C
+	select REGMAP
+	select SND_SOC_WM8731
+
+config SND_SOC_WM8731_SPI
+	tristate "Wolfson Microelectronics WM8731 CODEC with SPI"
+	depends on SPI
+	select REGMAP
+	select SND_SOC_WM8731
 
 config SND_SOC_WM8737
 	tristate "Wolfson Microelectronics WM8737 ADC"
sound/soc/codecs/Makefile +4 -0
index b4e11c3e4a08..d98a22c54a4e 100644
@@ -288,6 +288,8 @@ snd-soc-wm8711-objs := wm8711.o
 snd-soc-wm8727-objs := wm8727.o
 snd-soc-wm8728-objs := wm8728.o
 snd-soc-wm8731-objs := wm8731.o
+snd-soc-wm8731-i2c-objs := wm8731-i2c.o
+snd-soc-wm8731-spi-objs := wm8731-spi.o
 snd-soc-wm8737-objs := wm8737.o
 snd-soc-wm8741-objs := wm8741.o
 snd-soc-wm8750-objs := wm8750.o
@@ -629,6 +631,8 @@ obj-$(CONFIG_SND_SOC_WM8711)	+= snd-soc-wm8711.o
 obj-$(CONFIG_SND_SOC_WM8727)	+= snd-soc-wm8727.o
 obj-$(CONFIG_SND_SOC_WM8728)	+= snd-soc-wm8728.o
 obj-$(CONFIG_SND_SOC_WM8731)	+= snd-soc-wm8731.o
+obj-$(CONFIG_SND_SOC_WM8731_I2C)	+= snd-soc-wm8731-i2c.o
+obj-$(CONFIG_SND_SOC_WM8731_SPI)	+= snd-soc-wm8731-spi.o
 obj-$(CONFIG_SND_SOC_WM8737)	+= snd-soc-wm8737.o
 obj-$(CONFIG_SND_SOC_WM8741)	+= snd-soc-wm8741.o
 obj-$(CONFIG_SND_SOC_WM8750)	+= snd-soc-wm8750.o
sound/soc/codecs/wm8731-i2c.c new file +69 -0

69 lines not on this page · raw message

sound/soc/codecs/wm8731-spi.c new file +59 -0

59 lines not on this page · raw message

sound/soc/codecs/wm8731.c +4 -134

178 lines not on this page · raw message

sound/soc/codecs/wm8731.h +27 -0
index 4fcf1226d7c2..8d5a7a9ca6b2 100644
@@ -12,6 +12,13 @@
 #ifndef _WM8731_H
 #define _WM8731_H
 
+#include <linux/mutex.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+
+struct clk;
+struct snd_pcm_hw_constraint_list;
+
 /* WM8731 register space */
 
 #define WM8731_LINVOL   0x00
@@ -33,4 +40,24 @@
 
 #define WM8731_DAI		0
 
+#define WM8731_NUM_SUPPLIES 4
+
+/* codec private data */
+struct wm8731_priv {
+	struct regmap *regmap;
+	struct clk *mclk;
+	struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
+	const struct snd_pcm_hw_constraint_list *constraints;
+	unsigned int sysclk;
+	int sysclk_type;
+	int playback_fs;
+	bool deemph;
+
+	struct mutex lock;
+};
+
+extern const struct regmap_config wm8731_regmap;
+
+int wm8731_init(struct device *dev, struct wm8731_priv *wm8731);
+
 #endif
sound/soc/pxa/Kconfig +2 -2
index 9d40e8a206d1..c51e1961ca20 100644
@@ -45,7 +45,7 @@ config SND_PXA2XX_SOC_CORGI
 	tristate "SoC Audio support for Sharp Zaurus SL-C7x0"
 	depends on SND_PXA2XX_SOC && PXA_SHARP_C7xx && I2C
 	select SND_PXA2XX_SOC_I2S
-	select SND_SOC_WM8731
+	select SND_SOC_WM8731_I2C
 	help
 	  Say Y if you want to add support for SoC audio on Sharp
 	  Zaurus SL-C7x0 models (Corgi, Shepherd, Husky).
@@ -71,7 +71,7 @@ config SND_PXA2XX_SOC_POODLE
 	tristate "SoC Audio support for Poodle"
 	depends on SND_PXA2XX_SOC && MACH_POODLE && I2C
 	select SND_PXA2XX_SOC_I2S
-	select SND_SOC_WM8731
+	select SND_SOC_WM8731_I2C
 	help
 	  Say Y if you want to add support for SoC audio on Sharp
 	  Zaurus SL-5600 model (Poodle).
Signature · 1 line
2.30.2
Acked-by on v1 5/7
#10 lore raw

Re: [PATCH v1 5/7] ASoC: wm8731: Factor out the I2C and SPI bus code into separate modules

Quoted 7 lines · Mark Brown

Placing both the I2C and SPI code in the same module causes problems with mixes of modular and non-modular builds of the buses so it's generally bad practice. As with other drivers split the bus code out of the WM8731 driver into separate modules.

---

Thanks,
Charles

Acked-by on v1 5/7
#11 lore raw

Re: [PATCH v1 5/7] ASoC: wm8731: Factor out the I2C and SPI bus code into separate modules

In reply to Mark Brown
Quoted 7 lines · Mark Brown

Placing both the I2C and SPI code in the same module causes problems with mixes of modular and non-modular builds of the buses so it's generally bad practice. As with other drivers split the bus code out of the WM8731 driver into separate modules.

---

Thanks,
Charles

author maintainer
#12 lore raw

PATCH 6/7 ASoC: wm8731: Convert DT bindings to YAML format

In reply to Mark Brown

Convert the WM8731 DT bindings to YAML format, including addition of documentation for the regulator and clock bindings which the driver has had for some time but which were not covered in the bindings document.

---
 .../devicetree/bindings/sound/wlf,wm8731.yaml | 97 +++++++++++++++++++
 .../devicetree/bindings/sound/wm8731.txt      | 27 ------
 2 files changed, 97 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wlf,wm8731.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/wm8731.txt
Documentation/devicetree/bindings/sound/wlf,wm8731.yaml new file +97 -0
new file mode 100644
index 000000000000..e7220e8b49f0
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/wlf,wm8731.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Wolfson Microelectromics WM8731 audio CODEC
+
+maintainers:
+  - [email protected]
+
+description: |
+  Wolfson Microelectronics WM8731 audio CODEC
+
+  Pins on the device (for linking into audio routes):
+    * LOUT: Left Channel Line Output
+    * ROUT: Right Channel Line Output
+    * LHPOUT: Left Channel Headphone Output
+    * RHPOUT: Right Channel Headphone Output
+    * LLINEIN: Left Channel Line Input
+    * RLINEIN: Right Channel Line Input
+    * MICIN: Microphone Input
+
+properties:
+  compatible:
+    enum:
+      - wlf,wm8731
+
+  reg:
+    maxItems: 1
+
+  "#sound-dai-cells":
+    const: 0
+
+  clocks:
+    description: Clock provider for MCLK pin.
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: mclk
+
+  AVDD-supply:
+    description: Analog power supply regulator on the AVDD pin.
+
+  HPVDD-supply:
+    description: Headphone power supply regulator on the HPVDD pin.
+
+  DBVDD-supply:
+    description: Digital buffer supply regulator for the DBVDD pin.
+
+  DCVDD-supply:
+    description: Digital core supply regulator for the DCVDD pin.
+
+  spi-max-frequency: true
+
+additionalProperties: false
+
+required:
+  - reg
+  - compatible
+  - AVDD-supply
+  - HPVDD-supply
+  - DBVDD-supply
+  - DCVDD-supply
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        wm8731_i2c: codec@0 {
+            compatible = "wlf,wm8731";
+            reg = <0>;
+            spi-max-frequency = <12500000>;
+
+            AVDD-supply = <&avdd_reg>;
+            HPVDD-supply = <&hpvdd_reg>;
+            DCVDD-supply = <&dcvdd_reg>;
+            DBVDD-supply = <&dbvdd_reg>;
+        };
+    };
+  - |
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        wm8731_spi: codec@1b {
+            compatible = "wlf,wm8731";
+            reg = <0x1b>;
+
+            AVDD-supply = <&avdd_reg>;
+            HPVDD-supply = <&hpvdd_reg>;
+            DCVDD-supply = <&dcvdd_reg>;
+            DBVDD-supply = <&dbvdd_reg>;
+        };
+    };
Documentation/devicetree/bindings/sound/wm8731.txt deleted +0 -27
deleted file mode 100644
index f660d9bb0e69..000000000000
@@ -1,27 +0,0 @@
-WM8731 audio CODEC
-
-This device supports both I2C and SPI (configured with pin strapping
-on the board).
-
-Required properties:
-
-  - compatible : "wlf,wm8731"
-
-  - reg : the I2C address of the device for I2C, the chip select
-          number for SPI.
-
-Example:
-
-wm8731: codec@1a {
-	compatible = "wlf,wm8731";
-	reg = <0x1a>;
-};
-
-Available audio endpoints for an audio-routing table:
- * LOUT: Left Channel Line Output
- * ROUT: Right Channel Line Output
- * LHPOUT: Left Channel Headphone Output
- * RHPOUT: Right Channel Headphone Output
- * LLINEIN: Left Channel Line Input
- * RLINEIN: Right Channel Line Input
- * MICIN: Microphone Input
Signature · 1 line
2.30.2
Acked-by on v1 6/7
#13 lore raw

Re: [PATCH v1 6/7] ASoC: wm8731: Convert DT bindings to YAML format

Quoted 8 lines · Mark Brown

Convert the WM8731 DT bindings to YAML format, including addition of documentation for the regulator and clock bindings which the driver has had for some time but which were not covered in the bindings document.

---

Thanks,
Charles

maintainer Reviewed-by on v1 6/7
#14 lore raw

Re: [PATCH v1 6/7] ASoC: wm8731: Convert DT bindings to YAML format

In reply to Mark Brown
Quoted 7 lines · Mark Brown

Convert the WM8731 DT bindings to YAML format, including addition of documentation for the regulator and clock bindings which the driver has had for some time but which were not covered in the bindings document.

Quoted 7 lines
---
 .../devicetree/bindings/sound/wlf,wm8731.yaml | 97 +++++++++++++++++++
 .../devicetree/bindings/sound/wm8731.txt      | 27 ------
 2 files changed, 97 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wlf,wm8731.yaml
 delete mode 100644 Documentation/devicetree/bindings/sound/wm8731.txt
author maintainer
#15 lore raw

PATCH 7/7 ARM: configs: Update multi_v5_defconfig for WM8731 bus refactoring

In reply to Mark Brown

The WM8731 driver has been refactored so the I2C and SPI bus code is separate modules. Refresh multi_v5_defconfig to reflect this.

---
 arch/arm/configs/multi_v5_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/configs/multi_v5_defconfig +2 -1
index fe8d760256a4..38a939d91a32 100644
@@ -208,7 +208,8 @@ CONFIG_SND_ATMEL_SOC_WM8904=m
 CONFIG_SND_AT91_SOC_SAM9X5_WM8731=m
 CONFIG_SND_KIRKWOOD_SOC=y
 CONFIG_SND_SOC_ALC5623=y
-CONFIG_SND_SOC_WM8731=y
+CONFIG_SND_SOC_WM8731_I2C=y
+CONFIG_SND_SOC_WM8731_SPI=y
 CONFIG_SND_SIMPLE_CARD=y
 CONFIG_HID_DRAGONRISE=y
 CONFIG_HID_GYRATION=y
Signature · 1 line
2.30.2
Acked-by on v1 7/7
#17 lore raw

Re: [PATCH v1 7/7] ARM: configs: Update multi_v5_defconfig for WM8731 bus refactoring

In reply to Mark Brown
Quoted 7 lines · Mark Brown

The WM8731 driver has been refactored so the I2C and SPI bus code is separate modules. Refresh multi_v5_defconfig to reflect this.

---

If you prefer to keep it together with the driver patches, please merge through your tree.

Arnd

author maintainer
#18 lore raw
In reply to Mark Brown
Quoted 14 lines · Mark Brown

This series contains a bunch of fairly minor changes which overhaul and modernise the WM8731 driver, there should be no impact on the driver's functionality.

Mark Brown (7):
ASoC: wm8731: Update to modern DAI terminology
ASoC: wm8731: Factor component init out of bus code
ASoC: wm8731: Move regulator request into wm8731_init()
ASoC: wm8731: Factor our MCLK and mutex initialisation
ASoC: wm8731: Factor out the I2C and SPI bus code into separate
modules
ASoC: wm8731: Convert DT bindings to YAML format
ARM: configs: Update multi_v5_defconfig for WM8731 bus refactoring

Quoted 1 line

[...]

Applied to

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

Thanks!

[1/7] ASoC: wm8731: Update to modern DAI terminology

      commit: 00b87e18f3c0a98e2e22a95eb205c2ae03862a23
[2/7] ASoC: wm8731: Factor component init out of bus code
      commit: 3f4fb905510911f6149593a7321ae1825259b242
[3/7] ASoC: wm8731: Move regulator request into wm8731_init()
      commit: 5f1b9d1e424b91a8ae04211cbe4d354463c83583
[4/7] ASoC: wm8731: Factor our MCLK and mutex initialisation
      commit: 8875d104af6c237bfedb47309afd938984a3c05b
[5/7] ASoC: wm8731: Factor out the I2C and SPI bus code into separate modules
      commit: 9dc15f81baf273b5aaaa3302ee8faacd78f361fd
[6/7] ASoC: wm8731: Convert DT bindings to YAML format
      commit: 0e336eeaf467cdd86d827d696e24081b638ef61c
[7/7] ARM: configs: Update multi_v5_defconfig for WM8731 bus refactoring
      commit: 64a1a4e04e4450a89940adc8f339a85e2c01d905

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