Skip to contentSkip to conversation

ASoC: Add max9867 codec driver

PATCH In review anish kumar 2 participants 2 messages Feb 11, 2016 – Feb 15, 2016

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

PATCH 1/1 ASoC: Add max9867 codec driver

---
 .../devicetree/bindings/sound/max9867.txt          |  17 +
 sound/soc/codecs/Kconfig                           |   4 +
 sound/soc/codecs/Makefile                          |   1 +
 sound/soc/codecs/max9867.c                         | 528 +++++++++++++++++++++
 sound/soc/codecs/max9867.h                         |  83 ++++
 5 files changed, 633 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max9867.txt
 create mode 100755 sound/soc/codecs/max9867.c
 create mode 100755 sound/soc/codecs/max9867.h
Documentation/devicetree/bindings/sound/max9867.txt new file +17 -0
new file mode 100644
index 0000000..394cd4e
@@ -0,0 +1,17 @@
+max9867 codec
+
+This device supports I2C mode only.
+
+Required properties:
+
+- compatible : "maxim,max9867"
+- reg : The chip select number on the I2C bus
+
+Example:
+
+&i2c {
+	max9867: max9867@0x18 {
+		compatible = "maxim,max9867";
+		reg = <0x18>;
+	};
+};
sound/soc/codecs/Kconfig +4 -0
index c3178e3..913c83c 100644
@@ -75,6 +75,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_MAX98090 if I2C
 	select SND_SOC_MAX98095 if I2C
 	select SND_SOC_MAX98357A if GPIOLIB
+	select SND_SOC_MAX9867 if I2C
 	select SND_SOC_MAX98925 if I2C
 	select SND_SOC_MAX98926 if I2C
 	select SND_SOC_MAX9850 if I2C
@@ -490,6 +491,9 @@ config SND_SOC_MAX98095
 config SND_SOC_MAX98357A
        tristate
 
+config SND_SOC_MAX9867
+	tristate
+
 config SND_SOC_MAX98925
        tristate
 
sound/soc/codecs/Makefile +1 -0
index 84843f3..f39dee7 100644
@@ -70,6 +70,7 @@ snd-soc-max98088-objs := max98088.o
 snd-soc-max98090-objs := max98090.o
 snd-soc-max98095-objs := max98095.o
 snd-soc-max98357a-objs := max98357a.o
+snd-soc-max9867-objs := max9867.o
 snd-soc-max98925-objs := max98925.o
 snd-soc-max98926-objs := max98926.o
 snd-soc-max9850-objs := max9850.o
sound/soc/codecs/max9867.c new file +528 -0

528 lines not on this page · raw message

sound/soc/codecs/max9867.h new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
1.9.3
maintainer
#1 lore raw

On Thu, Feb 11, 2016 at 10:32:19AM -0800, anish kumar wrote:

A few small issues but otherwise this looks good:

sound/soc/codecs/max9867.c line 52

Quoted 3 lines
sound/soc/codecs/max9867.c new file +3 -0
+	SOC_SINGLE("DAC Attenuation", MAX9867_DACLEVEL, 0, 15, 1),
+	SOC_DOUBLE("ADC Left Gain", MAX9867_ADCLEVEL, 4, 0, 15, 1),
+	SOC_DOUBLE("ADC Right Gain", MAX9867_ADCLEVEL, 0, 0, 15, 1),

All volume controls should be called "... Volume" regardless of physical implementation as per ControlNames.txt in order to help userspace figure out how to handle them. Please also try to provide a mapping to dB via TLV.

sound/soc/codecs/max9867.c line 54

Quoted 1 line
sound/soc/codecs/max9867.c new file +1 -0
+	SOC_SINGLE("Volume Smoothing", MAX9867_MODECONFIG, 6, 1, 0),

On/off switches should have names ending "...Switch" again for similar reasons to the ones behind Volume.

sound/soc/codecs/max9867.c line 388

Quoted 8 lines
sound/soc/codecs/max9867.c new file +8 -0
+static int max9867_resume(struct device *dev)
+{
+	struct max9867_priv *max9867 = dev_get_drvdata(dev);
+
+	msleep(20);
+	regmap_update_bits(max9867->regmap, MAX9867_PWRMAN,
+		MAX9867_SHTDOWN_MASK, MAX9867_SHTDOWN_MASK);
+	return 0;

This is very strange - we have a sleep before we ever interact with the device. A sleep in a register write sequence would make sense but this doesn't seem like it should.

sound/soc/codecs/max9867.c line 399

Quoted 8 lines
sound/soc/codecs/max9867.c new file +8 -0
+static int max9867_probe(struct snd_soc_codec *codec)
+{
+	struct max9867_priv *max9867 = snd_soc_codec_get_drvdata(codec);
+
+	max9867->codec = codec;
+	codec->control_data = max9867->regmap;
+	return 0;
+}

The core will figure this out, you don't need to explicitly do it.