Skip to contentSkip to conversation

ASoC: Add max98371 codec driver

PATCH In review anish kumar 2 participants 8 messages Apr 13, 2016 – Apr 27, 2016

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

PATCH 1/1 ASoC: Add max98371 codec driver

---
 .../devicetree/bindings/sound/max98371.txt         |  17 +
 sound/soc/codecs/Kconfig                           |   4 +
 sound/soc/codecs/Makefile                          |   1 +
 sound/soc/codecs/max98371.c                        | 419 +++++++++++++++++++++
 sound/soc/codecs/max98371.h                        |  64 ++++
 5 files changed, 505 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98371.txt
 create mode 100644 sound/soc/codecs/max98371.c
 create mode 100644 sound/soc/codecs/max98371.h
Documentation/devicetree/bindings/sound/max98371.txt new file +17 -0
new file mode 100644
index 0000000..6c28523
@@ -0,0 +1,17 @@
+max98371 codec
+
+This device supports I2C mode only.
+
+Required properties:
+
+- compatible : "maxim,max98371"
+- reg : The chip select number on the I2C bus
+
+Example:
+
+&i2c {
+	max98371: max98371@0x31 {
+		compatible = "maxim,max98371";
+		reg = <0x31>;
+	};
+};
sound/soc/codecs/Kconfig +4 -0
index 913c83c..ba6c585 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_MAX98371 if I2C
 	select SND_SOC_MAX9867 if I2C
 	select SND_SOC_MAX98925 if I2C
 	select SND_SOC_MAX98926 if I2C
@@ -491,6 +492,9 @@ config SND_SOC_MAX98095
 config SND_SOC_MAX98357A
        tristate
 
+config SND_SOC_MAX98371
+       tristate
+
 config SND_SOC_MAX9867
 	tristate
 
sound/soc/codecs/Makefile +1 -0
index f39dee7..9f3587b 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-max98371-objs := max98371.o
 snd-soc-max9867-objs := max9867.o
 snd-soc-max98925-objs := max98925.o
 snd-soc-max98926-objs := max98926.o
sound/soc/codecs/max98371.c new file +419 -0

419 lines not on this page · raw message

sound/soc/codecs/max98371.h new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.9.3
maintainer
#1 lore raw

sound/soc/codecs/max98371.c line 29

Quoted 5 lines · anish kumar
sound/soc/codecs/max98371.c new file +5 -0
+static const char *const voltage_level_text[] = {
+	"9.5dB", "10.5dB", "11.5dB", "11.5dB", "12.5dB",
+	"13.5dB", "14.5dB", "15.5dB", "16.5dB", "17.5dB",
+	"18.5dB", "19.5dB", "20.5dB"
+};

As I said last time I would expect this to be a TLV control. As far as I can tell this is basically functioning as a maximum volume. Otherwise this looks good.

#2 lore raw
Quoted 11 lines · Mark Brown

sound/soc/codecs/max98371.c line 29

Quoted 5 lines · anish kumar
sound/soc/codecs/max98371.c new file +5 -0
+static const char *const voltage_level_text[] = {
+     "9.5dB", "10.5dB", "11.5dB", "11.5dB", "12.5dB",
+     "13.5dB", "14.5dB", "15.5dB", "16.5dB", "17.5dB",
+     "18.5dB", "19.5dB", "20.5dB"
+};

As I said last time I would expect this to be a TLV control. As far as I can tell this is basically functioning as a maximum volume. Otherwise this looks good.

I responded to your comment earlier but there was no reply so I thought it is accepted this way. Excuse my understanding. It is not actually a volume but described as such.

It is "Speaker No-Load Output Voltage Maximum". It is described here on page 50.
https://datasheets.maximintegrated.com/en/ds/MAX98371.pdf

maintainer
#3 lore raw
Quoted 9 lines · anish kumar
Quoted 3 lines · Mark Brown

As I said last time I would expect this to be a TLV control. As far as I can tell this is basically functioning as a maximum volume. Otherwise this looks good.

I responded to your comment earlier but there was no reply so I thought it is accepted this way. Excuse my understanding. It is not actually a volume but described as such.

If it's measured in dB I'd still expect a TLV control.

Quoted 3 lines

It is "Speaker No-Load Output Voltage Maximum". It is described here on page 50.
https://datasheets.maximintegrated.com/en/ds/MAX98371.pdf

Hrm, that looks like the driver may be able to set it automatically using the regulator API and just have a switch for the guaranteed.

#4 lore raw
Quoted 11 lines · Mark Brown
Quoted 9 lines · anish kumar
Quoted 3 lines · Mark Brown

As I said last time I would expect this to be a TLV control. As far as I can tell this is basically functioning as a maximum volume. Otherwise this looks good.

I responded to your comment earlier but there was no reply so I thought it is accepted this way. Excuse my understanding. It is not actually a volume but described as such.

Quoted 8 lines

If it's measured in dB I'd still expect a TLV control.

Quoted 3 lines

It is "Speaker No-Load Output Voltage Maximum". It is described here on page 50.
https://datasheets.maximintegrated.com/en/ds/MAX98371.pdf

Hrm, that looks like the driver may be able to set it automatically using the regulator API and just have a switch for the guaranteed.

Should i pass it via device tree then? I didn't get your statement about "switch".

maintainer
#5 lore raw
Quoted 6 lines · anish kumar
Quoted 2 lines · Mark Brown

Hrm, that looks like the driver may be able to set it automatically using the regulator API and just have a switch for the guaranteed.

Should i pass it via device tree then? I didn't get your statement about

I'd expect to look up the value by looking at the supply voltage if we were going to go that way.

Quoted 1 line

"switch".

A switch is an on/off control.

#6 lore raw
Quoted 10 lines · Mark Brown
Quoted 6 lines · anish kumar
Quoted 2 lines · Mark Brown

Hrm, that looks like the driver may be able to set it automatically using the regulator API and just have a switch for the guaranteed.

Should i pass it via device tree then? I didn't get your statement about

I'd expect to look up the value by looking at the supply voltage if we were going to go that way.

Discussion of this with hardware team revealed that dynamic headroom tracking is the feature which will be controlled with this gain.

I am also adding two new controls for this: speaker gain min and DHT rotation point.

I will be adding all of this as TLV as this should be configurable.

Quoted 4 lines
Quoted 2 lines

"switch".

A switch is an on/off control.

maintainer
#7 lore raw
Quoted 7 lines · anish kumar

Discussion of this with hardware team revealed that dynamic headroom tracking is the feature which will be controlled with this gain.

I am also adding two new controls for this: speaker gain min and DHT rotation point.

I will be adding all of this as TLV as this should be configurable.

Sounds good.