Skip to contentSkip to conversation

ASoC: Add max98371 codec driver

PATCH In review anish kumar 3 participants 12 messages Mar 21, 2016 – Mar 24, 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/max98371.c                        | 428 +++++++++++++++++++++
 sound/soc/codecs/max98371.h                        |  63 +++
 3 files changed, 508 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/max98371.c new file +428 -0

428 lines not on this page · raw message

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

63 lines not on this page · raw message

Signature · 1 line
1.9.3
maintainer
#1 lore raw

On Sun, Mar 20, 2016 at 06:59:02PM -0700, anish kumar wrote:

This looks mostly good, a few small things:

sound/soc/codecs/max98371.c line 29

Quoted 5 lines
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"
+};

Volume controls should be done with TLV data not enums.

sound/soc/codecs/max98371.c line 148

Quoted 4 lines
sound/soc/codecs/max98371.c new file +4 -0
+static const struct snd_kcontrol_new max98371_snd_controls[] = {
+	SOC_SINGLE_TLV("Speaker Gain", MAX98371_GAIN,
+			MAX98371_GAIN_SHIFT, (1<<MAX98371_GAIN_WIDTH)-1, 0,
+			max98371_gain_tlv),

Volume controls should end with Volume.

sound/soc/codecs/max98371.c line 335

Quoted 7 lines
sound/soc/codecs/max98371.c new file +7 -0
+static int max98371_probe(struct snd_soc_codec *codec)
+{
+	struct max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec);
+
+	max98371->codec = codec;
+	return 0;
+}

Do we ever actually use this?

#2 lore raw

Hi Mark,

Could you tell me how do you control this device/codec with Linux ? What is the command ?

Thank you !

Quoted 19 lines · Mark Brown

On Sun, Mar 20, 2016 at 06:59:02PM -0700, anish kumar wrote:

This looks mostly good, a few small things:

sound/soc/codecs/max98371.c line 29

Quoted 5 lines
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"
+};

Volume controls should be done with TLV data not enums.

sound/soc/codecs/max98371.c line 148

Quoted 4 lines
sound/soc/codecs/max98371.c new file +4 -0
+static const struct snd_kcontrol_new max98371_snd_controls[] = {
+     SOC_SINGLE_TLV("Speaker Gain", MAX98371_GAIN,
+                     MAX98371_GAIN_SHIFT, (1<<MAX98371_GAIN_WIDTH)-1, 0,
+                     max98371_gain_tlv),

Volume controls should end with Volume.

Quoted 14 lines

sound/soc/codecs/max98371.c line 335

Quoted 7 lines
sound/soc/codecs/max98371.c new file +7 -0
+static int max98371_probe(struct snd_soc_codec *codec)
+{
+     struct max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec);
+
+     max98371->codec = codec;
+     return 0;
+}

Do we ever actually use this?
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#3 lore raw
Quoted 1 line · Micka

Hi Mark,

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 2 lines

Could you tell me how do you control this device/codec with Linux ? What is the command ?

Using any ALSA userspace applications.

#4 lore raw

*Please don't top post, reply in line with needed context. This allowsreaders to readily follow the flow of conversation and understand whatyou are talking about and also helps ensure that everything in thediscussion is being addressed.*

Sorry ...

*> Could you tell me how do you control this device/codec with Linux ? What is> the command ?*
*Using any ALSA userspace applications.*

But How do you find the device in the amixer application ? That the part don't I don't get it !

Micka,

Quoted 8 lines · Mark Brown
Quoted 1 line · Micka

Hi Mark,

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 6 lines
Quoted 1 line

Could you tell me how do you control this device/codec with Linux ? What

is

Quoted 1 line

the command ?

Using any ALSA userspace applications.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#5 lore raw
Quoted 6 lines · Micka

*> Could you tell me how do you control this device/codec with Linux ? What is> the command ?*
*Using any ALSA userspace applications.*

But How do you find the device in the amixer application ? That the part don't I don't get it !

The machine driver that uses the CODEC will create a card. Probably it's going to be the only card in the system, if not you might need to flip between cards using whatever UI you have. With amixer that's the -c option.

#6 lore raw

Ok,

I 'v a problem with the codec max9768, because I don't see it in the device list.

but in the kernel log, everything looks ok !

[    9.582179] i2C max9768 probe
[    9.582369] ASoC: Registered codec 'max9768.2-0049'
root@beaglebone:/# /sbin/lsmod | grep snd
snd_soc_simple_card     7597  0
*snd_soc_max9768*         4736  0
snd_soc_tlv320aic3x    40053  1
snd_soc_davinci_mcasp    14383  2
snd_soc_edma            1150  1 snd_soc_davinci_mcasp
snd_soc_omap            2581  1 snd_soc_davinci_mcasp
snd_soc_core          155826  6
snd_soc_davinci_mcasp,snd_soc_edma,snd_soc_omap,snd_soc_tlv320aic3x,snd_soc_max9768,snd_soc_simple_card
snd_compress           11589  1 snd_soc_core
snd_pcm_dmaengine       5061  2 snd_soc_core,snd_soc_omap
snd_pcm                76985  5
snd_soc_davinci_mcasp,snd_soc_core,snd_soc_omap,snd_soc_tlv320aic3x,snd_pcm_dmaengine
snd_seq                45177  0
snd_seq_device          4534  1 snd_seq
snd_timer              16867  2 snd_pcm,snd_seq
snd                    56907  7
snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_soc_max9768,snd_seq_device,snd_compress
soundcore               6893  1 snd
Quoted 7 lines · Mark Brown
Quoted 1 line · Micka

*> Could you tell me how do you control this device/codec with Linux ?

What

Quoted 2 lines

is> the command ?*
*Using any ALSA userspace applications.*

Quoted 8 lines
Quoted 2 lines

But How do you find the device in the amixer application ? That the part don't I don't get it !

The machine driver that uses the CODEC will create a card. Probably it's going to be the only card in the system, if not you might need to flip between cards using whatever UI you have. With amixer that's the -c option.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw
Quoted 9 lines · Micka

Ok,

I 'v a problem with the codec max9768, because I don't see it in the device list.

but in the kernel log, everything looks ok !

What does cat /proc/asound/cards say?
Send a mail to me with the dmesg and I can help you.

Quoted 5 lines

[    9.582179] i2C max9768 probe
[    9.582369] ASoC: Registered codec 'max9768.2-0049'
Quoted 32 lines
root@beaglebone:/# /sbin/lsmod | grep snd
snd_soc_simple_card     7597  0
snd_soc_max9768         4736  0
snd_soc_tlv320aic3x    40053  1
snd_soc_davinci_mcasp    14383  2
snd_soc_edma            1150  1 snd_soc_davinci_mcasp
snd_soc_omap            2581  1 snd_soc_davinci_mcasp
snd_soc_core          155826  6 snd_soc_davinci_mcasp,snd_soc_edma,snd_soc_omap,snd_soc_tlv320aic3x,snd_soc_max9768,snd_soc_simple_card
snd_compress           11589  1 snd_soc_core
snd_pcm_dmaengine       5061  2 snd_soc_core,snd_soc_omap
snd_pcm                76985  5 snd_soc_davinci_mcasp,snd_soc_core,snd_soc_omap,snd_soc_tlv320aic3x,snd_pcm_dmaengine
snd_seq                45177  0
snd_seq_device          4534  1 snd_seq
snd_timer              16867  2 snd_pcm,snd_seq
snd                    56907  7 snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_soc_max9768,snd_seq_device,snd_compress
soundcore               6893  1 snd
Quoted 14 lines · Mark Brown
Quoted 6 lines · Micka

*> Could you tell me how do you control this device/codec with Linux ? What is> the command ?*
*Using any ALSA userspace applications.*

But How do you find the device in the amixer application ? That the part don't I don't get it !

The machine driver that uses the CODEC will create a card. Probably it's going to be the only card in the system, if not you might need to flip between cards using whatever UI you have. With amixer that's the -c option.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#8 lore raw
In reply to Mark Brown

Hi Mark,

Where I can find your patch ? Will it work under the kernel 4.1 ? And how do you make it work with the dts file ?

Micka,

Quoted 19 lines · Mark Brown

On Sun, Mar 20, 2016 at 06:59:02PM -0700, anish kumar wrote:

This looks mostly good, a few small things:

sound/soc/codecs/max98371.c line 29

Quoted 5 lines
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"
+};

Volume controls should be done with TLV data not enums.

sound/soc/codecs/max98371.c line 148

Quoted 4 lines
sound/soc/codecs/max98371.c new file +4 -0
+static const struct snd_kcontrol_new max98371_snd_controls[] = {
+     SOC_SINGLE_TLV("Speaker Gain", MAX98371_GAIN,
+                     MAX98371_GAIN_SHIFT, (1<<MAX98371_GAIN_WIDTH)-1, 0,
+                     max98371_gain_tlv),

Volume controls should end with Volume.

Quoted 14 lines

sound/soc/codecs/max98371.c line 335

Quoted 7 lines
sound/soc/codecs/max98371.c new file +7 -0
+static int max98371_probe(struct snd_soc_codec *codec)
+{
+     struct max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec);
+
+     max98371->codec = codec;
+     return 0;
+}

Do we ever actually use this?
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#9 lore raw
Quoted 1 line · Micka

Hi Mark,

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 2 lines

Where I can find your patch ? Will it work under the kernel 4.1 ? And how do you make it work with the dts file ?

I have no idea what you're talking about here, sorry.

#10 lore raw

Mark, the subject of this mail is asoc: add max98371 codex driver.

My questions concerns this patch/codec :

Where I can find your patch ? Will it work under the kernel 4.1 ? And how do you make it work with the dts file ?

Micka,

Quoted 8 lines · Mark Brown
Quoted 1 line · Micka

Hi Mark,

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 5 lines
Quoted 2 lines

Where I can find your patch ? Will it work under the kernel 4.1 ? And how do you make it work with the dts file ?

I have no idea what you're talking about here, sorry.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#11 lore raw
Quoted 6 lines · Micka

Mark, the subject of this mail is asoc: add max98371 codex driver.

Quoted 4 lines

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.