Skip to contentSkip to conversation

ASoC: Add initial WM8995 driver

PATCH In review Dimitris Papastamos 3 participants 7 messages Dec 21, 2010 – Dec 22, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Add initial WM8995 driver

The WM8995 is a digital audio hub CODEC designed for smartphones. The current driver supports most of the basic functionality of the WM8995.

---
 sound/soc/codecs/Kconfig  |    4 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/wm8995.c | 1812 ++++++++++
 sound/soc/codecs/wm8995.h | 8756 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 10574 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/wm8995.c
 create mode 100644 sound/soc/codecs/wm8995.h
sound/soc/codecs/Kconfig +4 -0
index 0f33db2..054191e 100644
@@ -78,6 +78,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_WM8990 if I2C
 	select SND_SOC_WM8993 if I2C
 	select SND_SOC_WM8994 if MFD_WM8994
+	select SND_SOC_WM8995 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_WM9081 if I2C
 	select SND_SOC_WM9090 if I2C
 	select SND_SOC_WM9705 if SND_SOC_AC97_BUS
@@ -306,6 +307,9 @@ config SND_SOC_WM8993
 config SND_SOC_WM8994
 	tristate
 
+config SND_SOC_WM8995
+	tristate
+
 config SND_SOC_WM9081
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index 10e5e09..6a1e17b 100644
@@ -62,6 +62,7 @@ snd-soc-wm8988-objs := wm8988.o
 snd-soc-wm8990-objs := wm8990.o
 snd-soc-wm8993-objs := wm8993.o
 snd-soc-wm8994-objs := wm8994.o wm8994-tables.o
+snd-soc-wm8995-objs := wm8995.o
 snd-soc-wm9081-objs := wm9081.o
 snd-soc-wm9705-objs := wm9705.o
 snd-soc-wm9712-objs := wm9712.o
@@ -140,6 +141,7 @@ obj-$(CONFIG_SND_SOC_WM8988)	+= snd-soc-wm8988.o
 obj-$(CONFIG_SND_SOC_WM8990)	+= snd-soc-wm8990.o
 obj-$(CONFIG_SND_SOC_WM8993)	+= snd-soc-wm8993.o
 obj-$(CONFIG_SND_SOC_WM8994)	+= snd-soc-wm8994.o
+obj-$(CONFIG_SND_SOC_WM8995)	+= snd-soc-wm8995.o
 obj-$(CONFIG_SND_SOC_WM9081)	+= snd-soc-wm9081.o
 obj-$(CONFIG_SND_SOC_WM9705)	+= snd-soc-wm9705.o
 obj-$(CONFIG_SND_SOC_WM9712)	+= snd-soc-wm9712.o
sound/soc/codecs/wm8995.c new file +1812 -0

1,812 lines not on this page · raw message

sound/soc/codecs/wm8995.h new file +8756 -0

1,158 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.3.4

Part of the diff is not shown here. View the raw message.

#1 lore raw

sound/soc/codecs/wm8995.c line 914

Quoted 13 lines · Dimitris Papastamos

The WM8995 is a digital audio hub CODEC designed for smartphones. The current driver supports most of the basic functionality of the WM8995.

---

sound/soc/codecs/wm8995.c new file +6 -0
+
+static int wm8995_volatile(unsigned int reg)
+{
+	if (reg >= WM8995_MAX_REGISTER + 1)
+		return 1;
+

return -EINVAL here.

Quoted 42 lines
(quoted diff) +41 -0
+	switch (reg) {
+	case WM8995_SOFTWARE_RESET:
+	case WM8995_DC_SERVO_READBACK_0:
+	case WM8995_INTERRUPT_STATUS_1:
+	case WM8995_INTERRUPT_STATUS_2:
+	case WM8995_INTERRUPT_STATUS_1_MASK:
+	case WM8995_INTERRUPT_STATUS_2_MASK:
+	case WM8995_INTERRUPT_CONTROL:
+	case WM8995_ACCESSORY_DETECT_MODE1:
+	case WM8995_ACCESSORY_DETECT_MODE2:
+	case WM8995_HEADPHONE_DETECT1:
+	case WM8995_HEADPHONE_DETECT2:
+		return 1;
+	}
+
+	return 0;
+}
+
 
+
+/*
+ * R1 (0x01) - Power Management (1)
+ */
+#define WM8995_MICB2_ENA                        0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_MASK                   0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_SHIFT                       9	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_WIDTH                       1	/* MICB2_ENA */
+#define WM8995_MICB1_ENA                        0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_MASK                   0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_SHIFT                       8	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_WIDTH                       1	/* MICB1_ENA */
+#define WM8995_HPOUT2L_ENA                      0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_MASK                 0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_SHIFT                     7	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_WIDTH                     1	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2R_ENA                      0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_MASK                 0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_SHIFT                     6	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_WIDTH                     1	/* HPOUT2R_ENA */
+#define WM8995_HPOUT1L_ENA                      0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_MASK                 0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_SHIFT                     5	/* HPOUT1L_ENA */

Review

Quoted 10 lines
(quoted diff) +10 -0
+#define WM8995_HPOUT1L_ENA_WIDTH                     1	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1R_ENA                      0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_MASK                 0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_SHIFT                     4	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_WIDTH                     1	/* HPOUT1R_ENA */
+#define WM8995_BG_ENA                           0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_MASK                      0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_SHIFT                          0	/* BG_ENA */
+#define WM8995_BG_ENA_WIDTH                          1	/* BG_ENA */
+

It looks like all the register bits have macros but some driver functions are still using magic numbers for bits instead of the macros.

Thanks

Liam

#2 lore raw
Quoted 8 lines · Liam Girdwood
Quoted 6 lines · Dimitris Papastamos

The WM8995 is a digital audio hub CODEC designed for smartphones. The current driver supports most of the basic functionality of the WM8995.

---

Quoted 8 lines

sound/soc/codecs/wm8995.c line 914

Quoted 6 lines
sound/soc/codecs/wm8995.c new file +6 -0
+
+static int wm8995_volatile(unsigned int reg)
+{
+	if (reg >= WM8995_MAX_REGISTER + 1)
+		return 1;
+

return -EINVAL here.

The logic behind this is that out of bounds registers are considered volatile. If I change it to -EINVAL, the behaviour will essentially be the same because in the soc-cache code we use snd_soc_codec_volatile_register() and we only test it for being non-zero. We either need clearer semantics for this function or otherwise it should be fine.

Quoted 47 lines
Quoted 47 lines
(quoted diff) +46 -0
+	switch (reg) {
+	case WM8995_SOFTWARE_RESET:
+	case WM8995_DC_SERVO_READBACK_0:
+	case WM8995_INTERRUPT_STATUS_1:
+	case WM8995_INTERRUPT_STATUS_2:
+	case WM8995_INTERRUPT_STATUS_1_MASK:
+	case WM8995_INTERRUPT_STATUS_2_MASK:
+	case WM8995_INTERRUPT_CONTROL:
+	case WM8995_ACCESSORY_DETECT_MODE1:
+	case WM8995_ACCESSORY_DETECT_MODE2:
+	case WM8995_HEADPHONE_DETECT1:
+	case WM8995_HEADPHONE_DETECT2:
+		return 1;
+	}
+
+	return 0;
+}
+
 
+
+/*
+ * R1 (0x01) - Power Management (1)
+ */
+#define WM8995_MICB2_ENA                        0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_MASK                   0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_SHIFT                       9	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_WIDTH                       1	/* MICB2_ENA */
+#define WM8995_MICB1_ENA                        0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_MASK                   0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_SHIFT                       8	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_WIDTH                       1	/* MICB1_ENA */
+#define WM8995_HPOUT2L_ENA                      0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_MASK                 0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_SHIFT                     7	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_WIDTH                     1	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2R_ENA                      0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_MASK                 0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_SHIFT                     6	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_WIDTH                     1	/* HPOUT2R_ENA */
+#define WM8995_HPOUT1L_ENA                      0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_MASK                 0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_SHIFT                     5	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_WIDTH                     1	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1R_ENA                      0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_MASK                 0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_SHIFT                     4	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_WIDTH                     1	/* HPOUT1R_ENA */
Quoted 8 lines

sound/soc/codecs/wm8995.h line 792

Quoted 5 lines
sound/soc/codecs/wm8995.h new file +5 -0
+#define WM8995_BG_ENA                           0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_MASK                      0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_SHIFT                          0	/* BG_ENA */
+#define WM8995_BG_ENA_WIDTH                          1	/* BG_ENA */
+

It looks like all the register bits have macros but some driver functions are still using magic numbers for bits instead of the macros.

I've found one call to dc_servo_cmd() using a magic number. The dapm widgets and the kcontrols don't generally use the macros since the lines become very long.

Thanks,
Dimitris

#3 lore raw
Quoted 18 lines · Dimitris Papastamos
Quoted 8 lines · Liam Girdwood
Quoted 6 lines · Dimitris Papastamos

The WM8995 is a digital audio hub CODEC designed for smartphones. The current driver supports most of the basic functionality of the WM8995.

---

Quoted 8 lines

sound/soc/codecs/wm8995.c line 914

Quoted 6 lines
sound/soc/codecs/wm8995.c new file +6 -0
+
+static int wm8995_volatile(unsigned int reg)
+{
+	if (reg >= WM8995_MAX_REGISTER + 1)
+		return 1;
+

return -EINVAL here.

Quoted 2 lines

The logic behind this is that out of bounds registers are considered volatile.

It does look a little odd since out of bounds generally means invalid.

Quoted 6 lines

If I change it to -EINVAL, the behaviour will essentially be
the same because in the soc-cache code we use snd_soc_codec_volatile_register() and we only test it for being non-zero. We either need clearer semantics for this function or otherwise it should be fine.

Clearer comments are probably better in this case since it does look wrong, however if you have time please feel free to update the function semantics.

Quoted 56 lines
Quoted 47 lines
Quoted 47 lines
(quoted diff) +46 -0
+	switch (reg) {
+	case WM8995_SOFTWARE_RESET:
+	case WM8995_DC_SERVO_READBACK_0:
+	case WM8995_INTERRUPT_STATUS_1:
+	case WM8995_INTERRUPT_STATUS_2:
+	case WM8995_INTERRUPT_STATUS_1_MASK:
+	case WM8995_INTERRUPT_STATUS_2_MASK:
+	case WM8995_INTERRUPT_CONTROL:
+	case WM8995_ACCESSORY_DETECT_MODE1:
+	case WM8995_ACCESSORY_DETECT_MODE2:
+	case WM8995_HEADPHONE_DETECT1:
+	case WM8995_HEADPHONE_DETECT2:
+		return 1;
+	}
+
+	return 0;
+}
+
 
+
+/*
+ * R1 (0x01) - Power Management (1)
+ */
+#define WM8995_MICB2_ENA                        0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_MASK                   0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_SHIFT                       9	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_WIDTH                       1	/* MICB2_ENA */
+#define WM8995_MICB1_ENA                        0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_MASK                   0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_SHIFT                       8	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_WIDTH                       1	/* MICB1_ENA */
+#define WM8995_HPOUT2L_ENA                      0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_MASK                 0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_SHIFT                     7	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_WIDTH                     1	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2R_ENA                      0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_MASK                 0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_SHIFT                     6	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_WIDTH                     1	/* HPOUT2R_ENA */
+#define WM8995_HPOUT1L_ENA                      0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_MASK                 0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_SHIFT                     5	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_WIDTH                     1	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1R_ENA                      0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_MASK                 0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_SHIFT                     4	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_WIDTH                     1	/* HPOUT1R_ENA */
Quoted 8 lines

sound/soc/codecs/wm8995.h line 792

Quoted 5 lines
sound/soc/codecs/wm8995.h new file +5 -0
+#define WM8995_BG_ENA                           0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_MASK                      0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_SHIFT                          0	/* BG_ENA */
+#define WM8995_BG_ENA_WIDTH                          1	/* BG_ENA */
+

It looks like all the register bits have macros but some driver functions are still using magic numbers for bits instead of the macros.

Quoted 4 lines

I've found one call to dc_servo_cmd() using a magic number. The dapm widgets and the kcontrols don't generally use the macros since the lines become very long.

There are also some magic numbers in configure_aif_clock, wm8995_set_dai_fmt, wm8995_hw_params. It's possible there are no macros defined for these numbers though...

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#4 lore raw
Quoted 12 lines · Liam Girdwood
Quoted 10 lines · Dimitris Papastamos
Quoted 9 lines · Liam Girdwood

sound/soc/codecs/wm8995.c line 914

Quoted 5 lines · Dimitris Papastamos
sound/soc/codecs/wm8995.c new file +5 -0
+static int wm8995_volatile(unsigned int reg)
+{
+	if (reg >= WM8995_MAX_REGISTER + 1)
+		return 1;
+

return -EINVAL here.

Quoted 4 lines
Quoted 2 lines

The logic behind this is that out of bounds registers are considered volatile.

It does look a little odd since out of bounds generally means invalid.

Most of the drivers that use this idiom use a constant like MAX_CACHED_REGISTER or similar which makes it clearer that there are more registers beyond the end of the register map. The normal use is to allow access to partially documented diagnostic registers or to support register banks that are partially owned by something else (devices with an embedded DSP being the most obvious example).

Quoted 7 lines
Quoted 3 lines

I've found one call to dc_servo_cmd() using a magic number. The dapm widgets and the kcontrols don't generally use the macros since the lines become very long.

There are also some magic numbers in configure_aif_clock, wm8995_set_dai_fmt, wm8995_hw_params. It's possible there are no macros defined for these numbers though...

Those are all bitfield values IIRC - our register map generation tool is only smart enough to generate register and full field wide constants, it can't manage to generate constants for the values that go in bitfields (yet!).

#5 lore raw
Quoted 16 lines · Mark Brown
Quoted 14 lines · Liam Girdwood
Quoted 13 lines · Dimitris Papastamos
Quoted 9 lines · Liam Girdwood

sound/soc/codecs/wm8995.c line 914

Quoted 5 lines · Dimitris Papastamos
sound/soc/codecs/wm8995.c new file +5 -0
+static int wm8995_volatile(unsigned int reg)
+{
+	if (reg >= WM8995_MAX_REGISTER + 1)
+		return 1;
+

return -EINVAL here.

The logic behind this is that out of bounds registers are considered volatile.

Quoted 8 lines
Quoted 1 line

It does look a little odd since out of bounds generally means invalid.

Most of the drivers that use this idiom use a constant like MAX_CACHED_REGISTER or similar which makes it clearer that there are more registers beyond the end of the register map. The normal use is to allow access to partially documented diagnostic registers or to support register banks that are partially owned by something else (devices with an embedded DSP being the most obvious example).

Yes that makes sense. I've changed the function to use WM8995_MAX_CACHED_REGISTER instead.

Thanks,
Dimitris

#6 lore raw
In reply to Liam Girdwood
Quoted 31 lines · Liam Girdwood
Quoted 18 lines · Dimitris Papastamos
Quoted 8 lines · Liam Girdwood
Quoted 6 lines · Dimitris Papastamos

The WM8995 is a digital audio hub CODEC designed for smartphones. The current driver supports most of the basic functionality of the WM8995.

---

Quoted 8 lines

sound/soc/codecs/wm8995.c line 914

Quoted 6 lines
sound/soc/codecs/wm8995.c new file +6 -0
+
+static int wm8995_volatile(unsigned int reg)
+{
+	if (reg >= WM8995_MAX_REGISTER + 1)
+		return 1;
+

return -EINVAL here.

Quoted 2 lines

The logic behind this is that out of bounds registers are considered volatile.

It does look a little odd since out of bounds generally means invalid.

Quoted 6 lines

If I change it to -EINVAL, the behaviour will essentially be
the same because in the soc-cache code we use snd_soc_codec_volatile_register() and we only test it for being non-zero. We either need clearer semantics for this function or otherwise it should be fine.

Quoted 3 lines

Clearer comments are probably better in this case since it does look wrong, however if you have time please feel free to update the function semantics.

Yes, I've added some comments.

Quoted 56 lines
Quoted 56 lines
Quoted 55 lines
Quoted 42 lines
(quoted diff) +41 -0
+	switch (reg) {
+	case WM8995_SOFTWARE_RESET:
+	case WM8995_DC_SERVO_READBACK_0:
+	case WM8995_INTERRUPT_STATUS_1:
+	case WM8995_INTERRUPT_STATUS_2:
+	case WM8995_INTERRUPT_STATUS_1_MASK:
+	case WM8995_INTERRUPT_STATUS_2_MASK:
+	case WM8995_INTERRUPT_CONTROL:
+	case WM8995_ACCESSORY_DETECT_MODE1:
+	case WM8995_ACCESSORY_DETECT_MODE2:
+	case WM8995_HEADPHONE_DETECT1:
+	case WM8995_HEADPHONE_DETECT2:
+		return 1;
+	}
+
+	return 0;
+}
+
 
+
+/*
+ * R1 (0x01) - Power Management (1)
+ */
+#define WM8995_MICB2_ENA                        0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_MASK                   0x0200	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_SHIFT                       9	/* MICB2_ENA */
+#define WM8995_MICB2_ENA_WIDTH                       1	/* MICB2_ENA */
+#define WM8995_MICB1_ENA                        0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_MASK                   0x0100	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_SHIFT                       8	/* MICB1_ENA */
+#define WM8995_MICB1_ENA_WIDTH                       1	/* MICB1_ENA */
+#define WM8995_HPOUT2L_ENA                      0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_MASK                 0x0080	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_SHIFT                     7	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2L_ENA_WIDTH                     1	/* HPOUT2L_ENA */
+#define WM8995_HPOUT2R_ENA                      0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_MASK                 0x0040	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_SHIFT                     6	/* HPOUT2R_ENA */
+#define WM8995_HPOUT2R_ENA_WIDTH                     1	/* HPOUT2R_ENA */
+#define WM8995_HPOUT1L_ENA                      0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_MASK                 0x0020	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1L_ENA_SHIFT                     5	/* HPOUT1L_ENA */

Review

Quoted 10 lines
(quoted diff) +10 -0
+#define WM8995_HPOUT1L_ENA_WIDTH                     1	/* HPOUT1L_ENA */
+#define WM8995_HPOUT1R_ENA                      0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_MASK                 0x0010	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_SHIFT                     4	/* HPOUT1R_ENA */
+#define WM8995_HPOUT1R_ENA_WIDTH                     1	/* HPOUT1R_ENA */
+#define WM8995_BG_ENA                           0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_MASK                      0x0001	/* BG_ENA */
+#define WM8995_BG_ENA_SHIFT                          0	/* BG_ENA */
+#define WM8995_BG_ENA_WIDTH                          1	/* BG_ENA */
+

It looks like all the register bits have macros but some driver functions are still using magic numbers for bits instead of the macros.

Quoted 8 lines
Quoted 4 lines

I've found one call to dc_servo_cmd() using a magic number. The dapm widgets and the kcontrols don't generally use the macros since the lines become very long.

There are also some magic numbers in configure_aif_clock, wm8995_set_dai_fmt, wm8995_hw_params. It's possible there are no macros defined for these numbers though...

As Mark explained there aren't any defines for these bitfields.

Thanks,
Dimitris