Skip to contentSkip to conversation

ASoC: wm8741: Add differential mono mode support

PATCH Applied Sergej Sawazki 3 participants 3 messages May 13, 2015

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

PATCH v3 1/1 ASoC: wm8741: Add differential mono mode support

The WM8741 DAC supports several differential output modes (stereo, stereo reversed, mono left, mono right). Add platform data and DT bindings to configure it.

---

Mark, Charles,
thanks for your comments.

This patch has been tested on a board with two codecs in mono mode (left and right channel).

Changes since v2:
- Add controls for mono codecs with a channel neutral name.
Note: Machine drivers can attach prefixes like left, right or center to this controls using the name_prefix field in struct snd_soc_codec_conf (Suggested by Charles Keepax).

Changes since v1:
- Remove controls for mono codecs.
Note: The machine driver is responsible for controls if the codec is configured in mono mode.

Many thanks in advance for your time and effort,
Sergej

 Documentation/devicetree/bindings/sound/wm8741.txt |  11 ++
 sound/soc/codecs/wm8741.c                          | 129 ++++++++++++++++++---
 sound/soc/codecs/wm8741.h                          |  10 ++
 3 files changed, 137 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/sound/wm8741.txt +11 -0
index 74bda58..a133154 100644
@@ -10,9 +10,20 @@ Required properties:
   - reg : the I2C address of the device for I2C, the chip select
           number for SPI.
 
+Optional properties:
+
+  - diff-mode: Differential output mode configuration. Default value for field
+    DIFF in register R8 (MODE_CONTROL_2). If absent, the default is 0, shall be:
+    0 = stereo
+    1 = mono left
+    2 = stereo reversed
+    3 = mono right
+
 Example:
 
 codec: wm8741@1a {
 	compatible = "wlf,wm8741";
 	reg = <0x1a>;
+
+	diff-mode = <3>;
 };
sound/soc/codecs/wm8741.c +116 -13

189 lines not on this page · raw message

sound/soc/codecs/wm8741.h +10 -0
index 56c1b1d..c8835f6 100644
@@ -194,6 +194,12 @@
 #define WM8741_DITHER_SHIFT                          0  /* DITHER - [1:0] */
 #define WM8741_DITHER_WIDTH                          2  /* DITHER - [1:0] */
 
+/* DIFF field values */
+#define WM8741_DIFF_MODE_STEREO                      0  /* stereo normal */
+#define WM8741_DIFF_MODE_STEREO_REVERSED             2  /* stereo reversed */
+#define WM8741_DIFF_MODE_MONO_LEFT                   1  /* mono left */
+#define WM8741_DIFF_MODE_MONO_RIGHT                  3  /* mono right */
+
 /*
  * R32 (0x20) - ADDITONAL_CONTROL_1
  */
@@ -208,4 +214,8 @@
 
 #define  WM8741_SYSCLK 0
 
+struct wm8741_platform_data {
+	u32 diff_mode;   /* Differential Output Mode */
+};
+
 #endif
Signature · 1 line
1.9.1
maintainer Applied
#2 lore raw
In reply to Sergej Sawazki
Quoted 3 lines · Sergej Sawazki

The WM8741 DAC supports several differential output modes (stereo, stereo reversed, mono left, mono right). Add platform data and DT bindings to configure it.

Applied, thanks.