Skip to contentSkip to conversation

ASoC: wm8985: add support for WM8758

PATCH Superseded Petr Kulhavy 2 participants 8 messages May 17, 2016 – May 23, 2016

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: wm8985: add support for WM8758

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch set adds the WM8758 support into the WM8985 driver.

Changes in v2:
* use chip type enum instead of chip structure
* do not copy the complete controls, widget, routes but only the differences and add widgets dynamically using add_widgets()

#1 lore raw

PATCH v2 1/2 ASoC: wm8985: add register definitions for WM8758

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the register definitions for WM8758 specific bit fields to the header file.

---
v1: initial
v2: no change

 sound/soc/codecs/wm8985.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
sound/soc/codecs/wm8985.h +38 -0
index 2e71ff507638..41b1048e3c97 100644
@@ -290,6 +290,9 @@
 #define WM8985_GPIO1GPD_MASK                    0x0040  /* GPIO1GPD */
 #define WM8985_GPIO1GPD_SHIFT                        6  /* GPIO1GPD */
 #define WM8985_GPIO1GPD_WIDTH                        1  /* GPIO1GPD */
+#define WM8758_OPCLKDIV_MASK                    0x0030  /* OPCLKDIV - [1:0] */
+#define WM8758_OPCLKDIV_SHIFT                        4  /* OPCLKDIV - [1:0] */
+#define WM8758_OPCLKDIV_WIDTH                        2  /* OPCLKDIV - [1:0] */
 #define WM8985_GPIO1POL                         0x0008  /* GPIO1POL */
 #define WM8985_GPIO1POL_MASK                    0x0008  /* GPIO1POL */
 #define WM8985_GPIO1POL_SHIFT                        3  /* GPIO1POL */
@@ -301,6 +304,12 @@
 /*
  * R9 (0x09) - Jack Detect Control 1
  */
+#define WM8758_JD_VMID1_MASK                    0x0100  /* JD_VMID1 */
+#define WM8758_JD_VMID1_SHIFT                        8  /* JD_VMID1 */
+#define WM8758_JD_VMID1_WIDTH                        1  /* JD_VMID1 */
+#define WM8758_JD_VMID0_MASK                    0x0080  /* JD_VMID0 */
+#define WM8758_JD_VMID0_SHIFT                        7  /* JD_VMID0 */
+#define WM8758_JD_VMID0_WIDTH                        1  /* JD_VMID0 */
 #define WM8985_JD_EN                            0x0040  /* JD_EN */
 #define WM8985_JD_EN_MASK                       0x0040  /* JD_EN */
 #define WM8985_JD_EN_SHIFT                           6  /* JD_EN */
@@ -649,6 +658,12 @@
 #define WM8985_OUT4_2LNR_MASK                   0x0020  /* OUT4_2LNR */
 #define WM8985_OUT4_2LNR_SHIFT                       5  /* OUT4_2LNR */
 #define WM8985_OUT4_2LNR_WIDTH                       1  /* OUT4_2LNR */
+#define WM8758_VMIDTOG_MASK                     0x0010  /* VMIDTOG */
+#define WM8758_VMIDTOG_SHIFT                         4  /* VMIDTOG */
+#define WM8758_VMIDTOG_WIDTH                         1  /* VMIDTOG */
+#define WM8758_OUT2DEL_MASK                     0x0008  /* OUT2DEL */
+#define WM8758_OUT2DEL_SHIFT                         3  /* OUT2DEL */
+#define WM8758_OUT2DEL_WIDTH                         1  /* OUT2DEL */
 #define WM8985_POBCTRL                          0x0004  /* POBCTRL */
 #define WM8985_POBCTRL_MASK                     0x0004  /* POBCTRL */
 #define WM8985_POBCTRL_SHIFT                         2  /* POBCTRL */
@@ -684,6 +699,9 @@
 #define WM8985_BEEPVOL_MASK                     0x000E  /* BEEPVOL - [3:1] */
 #define WM8985_BEEPVOL_SHIFT                         1  /* BEEPVOL - [3:1] */
 #define WM8985_BEEPVOL_WIDTH                         3  /* BEEPVOL - [3:1] */
+#define WM8758_DELEN2_MASK                      0x0004  /* DELEN2 */
+#define WM8758_DELEN2_SHIFT                          2  /* DELEN2 */
+#define WM8758_DELEN2_WIDTH                          1  /* DELEN2 */
 #define WM8985_BEEPEN                           0x0001  /* BEEPEN */
 #define WM8985_BEEPEN_MASK                      0x0001  /* BEEPEN */
 #define WM8985_BEEPEN_SHIFT                          0  /* BEEPEN */
@@ -790,6 +808,14 @@
 /*
  * R49 (0x31) - Output ctrl
  */
+#define WM8758_HP_COM                           0x0100  /* HP_COM */
+#define WM8758_HP_COM_MASK                      0x0100  /* HP_COM */
+#define WM8758_HP_COM_SHIFT                          8  /* HP_COM */
+#define WM8758_HP_COM_WIDTH                          1  /* HP_COM */
+#define WM8758_LINE_COM                         0x0080  /* LINE_COM */
+#define WM8758_LINE_COM_MASK                    0x0080  /* LINE_COM */
+#define WM8758_LINE_COM_SHIFT                        7  /* LINE_COM */
+#define WM8758_LINE_COM_WIDTH                        1  /* LINE_COM */
 #define WM8985_DACL2RMIX                        0x0040  /* DACL2RMIX */
 #define WM8985_DACL2RMIX_MASK                   0x0040  /* DACL2RMIX */
 #define WM8985_DACL2RMIX_SHIFT                       6  /* DACL2RMIX */
@@ -806,6 +832,14 @@
 #define WM8985_OUT3BOOST_MASK                   0x0008  /* OUT3BOOST */
 #define WM8985_OUT3BOOST_SHIFT                       3  /* OUT3BOOST */
 #define WM8985_OUT3BOOST_WIDTH                       1  /* OUT3BOOST */
+#define WM8758_OUT4ENDEL                        0x0010  /* OUT4ENDEL */
+#define WM8758_OUT4ENDEL_MASK                   0x0010  /* OUT4ENDEL */
+#define WM8758_OUT4ENDEL_SHIFT                       4  /* OUT4ENDEL */
+#define WM8758_OUT4ENDEL_WIDTH                       1  /* OUT4ENDEL */
+#define WM8758_OUT3ENDEL                        0x0008  /* OUT3ENDEL */
+#define WM8758_OUT3ENDEL_MASK                   0x0008  /* OUT3ENDEL */
+#define WM8758_OUT3ENDEL_SHIFT                       3  /* OUT3ENDEL */
+#define WM8758_OUT3ENDEL_WIDTH                       1  /* OUT3ENDEL */
 #define WM8985_TSOPCTRL                         0x0004  /* TSOPCTRL */
 #define WM8985_TSOPCTRL_MASK                    0x0004  /* TSOPCTRL */
 #define WM8985_TSOPCTRL_SHIFT                        2  /* TSOPCTRL */
@@ -1021,6 +1055,10 @@
 #define WM8985_HALFIPBIAS_MASK                  0x0080  /* HALFIPBIAS */
 #define WM8985_HALFIPBIAS_SHIFT                      7  /* HALFIPBIAS */
 #define WM8985_HALFIPBIAS_WIDTH                      1  /* HALFIPBIAS */
+#define WM8758_HALFIPBIAS                       0x0040  /* HALFI_IPGA */
+#define WM8758_HALFI_IPGA_MASK                  0x0040  /* HALFI_IPGA */
+#define WM8758_HALFI_IPGA_SHIFT                      6  /* HALFI_IPGA */
+#define WM8758_HALFI_IPGA_WIDTH                      1  /* HALFI_IPGA */
 #define WM8985_VBBIASTST_MASK                   0x0060  /* VBBIASTST - [6:5] */
 #define WM8985_VBBIASTST_SHIFT                       5  /* VBBIASTST - [6:5] */
 #define WM8985_VBBIASTST_WIDTH                       2  /* VBBIASTST - [6:5] */
Signature · 1 line
1.9.1
Acked-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] ASoC: wm8985: add register definitions for WM8758

Quoted 6 lines · Petr Kulhavy

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the register definitions for WM8758 specific bit fields to the header file.

---

Thanks,
Charles

#3 lore raw

PATCH v2 2/2 ASoC: wm8985: add support for WM8758

In reply to Petr Kulhavy

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the WM8758 support into the WM8985 driver.

The chip selection is done by the I2C name. The SPI probe supports only the WM8985.

---
v1: initial
v2: use chip type enum instead of chip structure
do not copy the complete controls, widget, routes but only the differences and add widgets dynamically using add_widgets()

 sound/soc/codecs/Kconfig  |   2 +-
 sound/soc/codecs/wm8985.c | 191 +++++++++++++++++++++++++++++++++++++---------
 2 files changed, 154 insertions(+), 39 deletions(-)
sound/soc/codecs/Kconfig +1 -1
index 649e92a252ae..5947e0c94d02 100644
@@ -933,7 +933,7 @@ config SND_SOC_WM8983
 	tristate
 
 config SND_SOC_WM8985
-	tristate
+	tristate "Wolfson Microelectronics WM8985 and WM8758 codec driver"
 
 config SND_SOC_WM8988
 	tristate
sound/soc/codecs/wm8985.c +153 -38

347 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw
Quoted 22 lines · Petr Kulhavy

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the WM8758 support into the WM8985 driver.

The chip selection is done by the I2C name. The SPI probe supports only the WM8985.

---

sound/soc/codecs/wm8985.c +13 -0
+
+static int wm8985_add_widgets(struct snd_soc_codec *codec)
+{
+	struct wm8985_priv *wm8985 = snd_soc_codec_get_drvdata(codec);
+	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+
+	snd_soc_dapm_new_controls(dapm, wm8985_common_dapm_widgets,
+		ARRAY_SIZE(wm8985_common_dapm_widgets));
+	snd_soc_dapm_add_routes(dapm, wm8985_common_dapm_routes,
+		ARRAY_SIZE(wm8985_common_dapm_routes));
+
+	switch (wm8985->dev_type) {
+	case WM8758:

sound/soc/codecs/wm8985.c static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { · line 603

Quoted 10 lines
sound/soc/codecs/wm8985.c +10 -0
+		snd_soc_add_codec_controls(codec, wm8985_alc_snd_controls,
+			ARRAY_SIZE(wm8985_alc_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_adc_snd_controls,
+			ARRAY_SIZE(wm8985_adc_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_dac_snd_controls,
+			ARRAY_SIZE(wm8985_dac_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_eq_snd_controls,
+			ARRAY_SIZE(wm8985_eq_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_3d_snd_controls,
+			ARRAY_SIZE(wm8985_3d_snd_controls));

Why not just put all these in a common controls array? They seem to all be used on 8985 as well.

Quoted 11 lines
sound/soc/codecs/wm8985.c +11 -0
+
+		snd_soc_dapm_new_controls(dapm, wm8758_dapm_widgets,
+					  ARRAY_SIZE(wm8758_dapm_widgets));
+		break;
+
+	case WM8985:
+		snd_soc_add_codec_controls(codec, wm8985_alc_snd_controls,
+			ARRAY_SIZE(wm8985_alc_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_adc_snd_controls,
+			ARRAY_SIZE(wm8985_adc_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_dac_snd_controls,

sound/soc/codecs/wm8985.c static const struct snd_soc_dapm_route wm8985_dapm_routes[] = {

Quoted 10 lines
sound/soc/codecs/wm8985.c +9 -0
+			ARRAY_SIZE(wm8985_dac_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_aux_snd_controls,
+			ARRAY_SIZE(wm8985_aux_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_eq_snd_controls,
+			ARRAY_SIZE(wm8985_eq_snd_controls));
+		snd_soc_add_codec_controls(codec, wm8985_3d_snd_controls,
+			ARRAY_SIZE(wm8985_3d_snd_controls));
 
+		snd_soc_add_codec_controls(codec, wm8985_spkr_snd_controls,
+			ARRAY_SIZE(wm8985_spkr_snd_controls));

And why not put aux and spkr in a wm8985 array? Then you only need two arrays.

Quoted 23 lines
sound/soc/codecs/wm8985.c +12 -0
+
+		snd_soc_dapm_new_controls(dapm, wm8985_dapm_widgets,
+			ARRAY_SIZE(wm8985_dapm_widgets));
+		snd_soc_dapm_add_routes(dapm, wm8985_aux_dapm_routes,
+			ARRAY_SIZE(wm8985_aux_dapm_routes));
+		break;
+	}
+
+	return 0;
+}
 
 static int eqmode_get(struct snd_kcontrol *kcontrol,
 		      struct snd_ctl_elem_value *ucontrol)
@@ -1005,6 +1120,8 @@ static int wm8985_probe(struct snd_soc_codec *codec)
 	snd_soc_update_bits(codec, WM8985_BIAS_CTRL, WM8985_BIASCUT,
 			    WM8985_BIASCUT);
 
+	wm8985_add_widgets(codec);
+
 	return 0;
 
 err_reg_enable:

sound/soc/codecs/wm8985.c static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { · line 1056

Quoted 10 lines
sound/soc/codecs/wm8985.c +0 -7
@@ -1047,13 +1164,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = {
 	.probe = wm8985_probe,
 	.set_bias_level = wm8985_set_bias_level,
 	.suspend_bias_off = true,
-
-	.controls = wm8985_snd_controls,
-	.num_controls = ARRAY_SIZE(wm8985_snd_controls),
-	.dapm_widgets = wm8985_dapm_widgets,
-	.num_dapm_widgets = ARRAY_SIZE(wm8985_dapm_widgets),
-	.dapm_routes = wm8985_dapm_routes,
-	.num_dapm_routes = ARRAY_SIZE(wm8985_dapm_routes),

I think you should still be able to use these for the common functionality.

Thanks,
Charles

#5 lore raw
Quoted 28 lines · Charles Keepax
Quoted 27 lines · Petr Kulhavy

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the WM8758 support into the WM8985 driver.

The chip selection is done by the I2C name. The SPI probe supports only the WM8985.

---

sound/soc/codecs/wm8985.c +18 -0
+
+static int wm8985_add_widgets(struct snd_soc_codec *codec)
+{
+     struct wm8985_priv *wm8985 = snd_soc_codec_get_drvdata(codec);
+     struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+
+     snd_soc_dapm_new_controls(dapm, wm8985_common_dapm_widgets,
+             ARRAY_SIZE(wm8985_common_dapm_widgets));
+     snd_soc_dapm_add_routes(dapm, wm8985_common_dapm_routes,
+             ARRAY_SIZE(wm8985_common_dapm_routes));
+
+     switch (wm8985->dev_type) {
+     case WM8758:
+             snd_soc_add_codec_controls(codec, wm8985_alc_snd_controls,
+                     ARRAY_SIZE(wm8985_alc_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_adc_snd_controls,
+                     ARRAY_SIZE(wm8985_adc_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_dac_snd_controls,
Quoted 8 lines

sound/soc/codecs/wm8985.c static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { · line 603

Quoted 5 lines
sound/soc/codecs/wm8985.c +5 -0
+                     ARRAY_SIZE(wm8985_dac_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_eq_snd_controls,
+                     ARRAY_SIZE(wm8985_eq_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_3d_snd_controls,
+                     ARRAY_SIZE(wm8985_3d_snd_controls));

Why not just put all these in a common controls array? They seem to all be used on 8985 as well.

In general I agree with you. But doesn't the order in which snd_soc_add_codec_controls() is called affect the order in which the controls appear in the mixer?
I have split the controls in order to preserve the original order of the controls.

Quoted 7 lines
Quoted 7 lines

err_reg_enable:

sound/soc/codecs/wm8985.c +0 -2
@@ -1047,13 +1164,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = {
      .probe = wm8985_probe,
      .set_bias_level = wm8985_set_bias_level,
      .suspend_bias_off = true,
-
-     .controls = wm8985_snd_controls,
Quoted 8 lines

sound/soc/codecs/wm8985.c static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { · line 1056

Quoted 5 lines
sound/soc/codecs/wm8985.c +0 -5
-     .num_controls = ARRAY_SIZE(wm8985_snd_controls),
-     .dapm_widgets = wm8985_dapm_widgets,
-     .num_dapm_widgets = ARRAY_SIZE(wm8985_dapm_widgets),
-     .dapm_routes = wm8985_dapm_routes,
-     .num_dapm_routes = ARRAY_SIZE(wm8985_dapm_routes),

I think you should still be able to use these for the common functionality.

All these are set by wm8985_add_widgets() now.
Or maybe I didn't quite get what you mean?

Thanks
Petr

#6 lore raw
Quoted 39 lines · Petr Kulhavy
Quoted 28 lines · Charles Keepax
Quoted 27 lines · Petr Kulhavy

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the WM8758 support into the WM8985 driver.

The chip selection is done by the I2C name. The SPI probe supports only the WM8985.

---

sound/soc/codecs/wm8985.c +18 -0
+
+static int wm8985_add_widgets(struct snd_soc_codec *codec)
+{
+     struct wm8985_priv *wm8985 = snd_soc_codec_get_drvdata(codec);
+     struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+
+     snd_soc_dapm_new_controls(dapm, wm8985_common_dapm_widgets,
+             ARRAY_SIZE(wm8985_common_dapm_widgets));
+     snd_soc_dapm_add_routes(dapm, wm8985_common_dapm_routes,
+             ARRAY_SIZE(wm8985_common_dapm_routes));
+
+     switch (wm8985->dev_type) {
+     case WM8758:
+             snd_soc_add_codec_controls(codec, wm8985_alc_snd_controls,
+                     ARRAY_SIZE(wm8985_alc_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_adc_snd_controls,
+                     ARRAY_SIZE(wm8985_adc_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_dac_snd_controls,
Quoted 8 lines

sound/soc/codecs/wm8985.c static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { · line 603

Quoted 5 lines
sound/soc/codecs/wm8985.c +5 -0
+                     ARRAY_SIZE(wm8985_dac_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_eq_snd_controls,
+                     ARRAY_SIZE(wm8985_eq_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_3d_snd_controls,
+                     ARRAY_SIZE(wm8985_3d_snd_controls));

Why not just put all these in a common controls array? They seem to all be used on 8985 as well.

Quoted 5 lines

In general I agree with you. But doesn't the order in which snd_soc_add_codec_controls() is called affect the order in which the controls appear in the mixer?
I have split the controls in order to preserve the original order of the controls.

Personally I would preference keeping the code clean rather than preserving the order of the controls. I don't think the absolute numerical position of the controls is normally considered an important ABI to preserve, aside from anything else it could be affected by things like probe order between cards.

Quoted 17 lines
Quoted 16 lines

sound/soc/codecs/wm8985.c static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { · line 1056

Quoted 13 lines

err_reg_enable:

sound/soc/codecs/wm8985.c +0 -7
@@ -1047,13 +1164,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = {
      .probe = wm8985_probe,
      .set_bias_level = wm8985_set_bias_level,
      .suspend_bias_off = true,
-
-     .controls = wm8985_snd_controls,
-     .num_controls = ARRAY_SIZE(wm8985_snd_controls),
-     .dapm_widgets = wm8985_dapm_widgets,
-     .num_dapm_widgets = ARRAY_SIZE(wm8985_dapm_widgets),
-     .dapm_routes = wm8985_dapm_routes,
-     .num_dapm_routes = ARRAY_SIZE(wm8985_dapm_routes),

I think you should still be able to use these for the common functionality.

Quoted 2 lines

All these are set by wm8985_add_widgets() now.
Or maybe I didn't quite get what you mean?

My point was just that you can still use these helpers for the common stuff and then wm8985_add_widgets needs to only add the codec specific stuff.

Thanks,
Charles

#7 lore raw
Quoted 46 lines · Charles Keepax
Quoted 39 lines · Petr Kulhavy
Quoted 28 lines · Charles Keepax
Quoted 27 lines · Petr Kulhavy

The WM8758 chip is almost identical to WM8985 with the difference that it doesn't feature the AUX input. This patch adds the WM8758 support into the WM8985 driver.

The chip selection is done by the I2C name. The SPI probe supports only the WM8985.

---

sound/soc/codecs/wm8985.c +18 -0
+
+static int wm8985_add_widgets(struct snd_soc_codec *codec)
+{
+     struct wm8985_priv *wm8985 = snd_soc_codec_get_drvdata(codec);
+     struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
+
+     snd_soc_dapm_new_controls(dapm, wm8985_common_dapm_widgets,
+             ARRAY_SIZE(wm8985_common_dapm_widgets));
+     snd_soc_dapm_add_routes(dapm, wm8985_common_dapm_routes,
+             ARRAY_SIZE(wm8985_common_dapm_routes));
+
+     switch (wm8985->dev_type) {
+     case WM8758:
+             snd_soc_add_codec_controls(codec, wm8985_alc_snd_controls,
+                     ARRAY_SIZE(wm8985_alc_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_adc_snd_controls,
+                     ARRAY_SIZE(wm8985_adc_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_dac_snd_controls,
Quoted 8 lines

sound/soc/codecs/wm8985.c static const struct snd_soc_dapm_route wm8985_dapm_routes[] = { · line 603

Quoted 5 lines
sound/soc/codecs/wm8985.c +5 -0
+                     ARRAY_SIZE(wm8985_dac_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_eq_snd_controls,
+                     ARRAY_SIZE(wm8985_eq_snd_controls));
+             snd_soc_add_codec_controls(codec, wm8985_3d_snd_controls,
+                     ARRAY_SIZE(wm8985_3d_snd_controls));

Why not just put all these in a common controls array? They seem to all be used on 8985 as well.

Quoted 5 lines

In general I agree with you. But doesn't the order in which snd_soc_add_codec_controls() is called affect the order in which the controls appear in the mixer?
I have split the controls in order to preserve the original order of the controls.

Quoted 5 lines

Personally I would preference keeping the code clean rather than preserving the order of the controls. I don't think the absolute numerical position of the controls is normally considered an important ABI to preserve, aside from anything else it could be affected by things like probe order between cards.

That makes sense. I will do that.

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

sound/soc/codecs/wm8985.c static struct snd_soc_codec_driver soc_codec_dev_wm8985 = { · line 1056

Quoted 12 lines

err_reg_enable:

sound/soc/codecs/wm8985.c +0 -7
@@ -1047,13 +1164,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8985 = {
      .probe = wm8985_probe,
      .set_bias_level = wm8985_set_bias_level,
      .suspend_bias_off = true,
-
-     .controls = wm8985_snd_controls,
-     .num_controls = ARRAY_SIZE(wm8985_snd_controls),
-     .dapm_widgets = wm8985_dapm_widgets,
-     .num_dapm_widgets = ARRAY_SIZE(wm8985_dapm_widgets),
-     .dapm_routes = wm8985_dapm_routes,
-     .num_dapm_routes = ARRAY_SIZE(wm8985_dapm_routes),

I think you should still be able to use these for the common functionality.

Quoted 6 lines
Quoted 2 lines

All these are set by wm8985_add_widgets() now.
Or maybe I didn't quite get what you mean?

My point was just that you can still use these helpers for the common stuff and then wm8985_add_widgets needs to only add the codec specific stuff.

Ah, now I see what you mean! I didn't know it can be combined like that. Makes absolutely sense, I will change that.

Thanks
Petr