Skip to contentSkip to conversation

ASoC: Add max98926 codec driver

PATCH In review anish kumar 2 participants 2 messages Jan 4, 2016 – Jan 10, 2016

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

PATCH 1/1 ASoC: Add max98926 codec driver

---
Changes since v1:
Made some widgets as supply widgets
Changed the names a bit
Moved some registers to volatile struct
Some coding style changes
added the print for diagnostics

Changes in this version:
Arranged kconfig and make file entries.
Renamed kcontrols
Moved probing of the device before registration of codec

 .../devicetree/bindings/sound/max98926.txt         |  32 +
 sound/soc/codecs/Kconfig                           |   4 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/max98926.c                        | 604 +++++++++++++++
 sound/soc/codecs/max98926.h                        | 848 +++++++++++++++++++++
 5 files changed, 1490 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98926.txt
 create mode 100644 sound/soc/codecs/max98926.c
 create mode 100644 sound/soc/codecs/max98926.h
Documentation/devicetree/bindings/sound/max98926.txt new file +32 -0
new file mode 100644
index 0000000..0b7f4e4
@@ -0,0 +1,32 @@
+max98926 audio CODEC
+
+This device supports I2C.
+
+Required properties:
+
+  - compatible : "maxim,max98926"
+
+  - vmon-slot-no : slot number used to send voltage information
+                   or in inteleave mode this will be used as
+                   interleave slot.
+
+  - imon-slot-no : slot number used to send current information
+
+  - interleave-mode : When using two MAX98926 in a system it is
+                      possible to create ADC data that that will
+                      overflow the frame size. Digital Audio Interleave
+                      mode provides a means to output VMON and IMON data
+                      from two devices on a single DOUT line when running
+                      smaller frames sizes such as 32 BCLKS per LRCLK or
+                      48 BCLKS per LRCLK.
+
+  - reg : the I2C address of the device for I2C
+
+Example:
+
+codec: max98926@1a {
+   compatible = "maxim,max98926";
+   vmon-slot-no = <0>;
+   imon-slot-no = <2>;
+   reg = <0x1a>;
+};
sound/soc/codecs/Kconfig +4 -0
index cfdafc4..c3178e3 100644
@@ -76,6 +76,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_MAX98095 if I2C
 	select SND_SOC_MAX98357A if GPIOLIB
 	select SND_SOC_MAX98925 if I2C
+	select SND_SOC_MAX98926 if I2C
 	select SND_SOC_MAX9850 if I2C
 	select SND_SOC_MAX9768 if I2C
 	select SND_SOC_MAX9877 if I2C
@@ -492,6 +493,9 @@ config SND_SOC_MAX98357A
 config SND_SOC_MAX98925
        tristate
 
+config SND_SOC_MAX98926
+	tristate
+
 config SND_SOC_MAX9850
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index f632fc4..84843f3 100644
@@ -71,6 +71,7 @@ snd-soc-max98090-objs := max98090.o
 snd-soc-max98095-objs := max98095.o
 snd-soc-max98357a-objs := max98357a.o
 snd-soc-max98925-objs := max98925.o
+snd-soc-max98926-objs := max98926.o
 snd-soc-max9850-objs := max9850.o
 snd-soc-mc13783-objs := mc13783.o
 snd-soc-ml26124-objs := ml26124.o
@@ -266,6 +267,7 @@ obj-$(CONFIG_SND_SOC_MAX98090)	+= snd-soc-max98090.o
 obj-$(CONFIG_SND_SOC_MAX98095)	+= snd-soc-max98095.o
 obj-$(CONFIG_SND_SOC_MAX98357A)	+= snd-soc-max98357a.o
 obj-$(CONFIG_SND_SOC_MAX98925)	+= snd-soc-max98925.o
+obj-$(CONFIG_SND_SOC_MAX98926)	+= snd-soc-max98926.o
 obj-$(CONFIG_SND_SOC_MAX9850)	+= snd-soc-max9850.o
 obj-$(CONFIG_SND_SOC_MC13783)	+= snd-soc-mc13783.o
 obj-$(CONFIG_SND_SOC_ML26124)	+= snd-soc-ml26124.o
sound/soc/codecs/max98926.c new file +604 -0

604 lines not on this page · raw message

sound/soc/codecs/max98926.h new file +848 -0

848 lines not on this page · raw message

Signature · 1 line
1.9.3
maintainer
#1 lore raw
Quoted 1 line · anish kumar

This looks mostly good, a couple of small things.

sound/soc/codecs/max98926.c line 116

Quoted 5 lines
sound/soc/codecs/max98926.c new file +5 -0
+static const struct snd_kcontrol_new max98926_mixer_controls[] = {
+	SOC_DAPM_SINGLE("PCM Single", MAX98926_SPK_AMP,
+		MAX98926_INSELECT_MODE_SHIFT, 0, 0),
+	SOC_DAPM_SINGLE("PDM Single", MAX98926_SPK_AMP,
+		MAX98926_INSELECT_MODE_SHIFT, 1, 0),

Most of these mixer controls look like they're on/off switches (I'd expect them to be as mixer controls) so should have names ending in " Switch" as per ControlNames.txt so userspace can understand them.

sound/soc/codecs/max98926.c line 585

Quoted 2 lines
sound/soc/codecs/max98926.c new file +2 -0
+static const struct of_device_id max98926_of_match[] = {
+	{ .compatible = "maxim, max98926", },

There shouldn't be a space in the compatible string.