Skip to contentSkip to conversation

ASoC: Intel: Add Merrifield machine driver

PATCH In review Vinod Koul 2 participants 5 messages Oct 31, 2014 – Nov 3, 2014

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH 1/1 ASoC: Intel: Add Merrifield machine driver

This patch adds machine driver support for Merrifield platform. Patch has dependency on Merrifield DSP driver.

---
this is standalone patch with no depends on other code posted

 sound/soc/intel/Kconfig            |   15 ++
 sound/soc/intel/Makefile           |    2 +
 sound/soc/intel/merr_dpcm_wm8958.c |  430 ++++++++++++++++++++++++++++++++++++
 3 files changed, 447 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/intel/merr_dpcm_wm8958.c
sound/soc/intel/Kconfig +15 -0
index 2a3af88..16d1801 100644
@@ -76,3 +76,18 @@ config SND_SOC_INTEL_BROADWELL_MACH
 	  Ultrabook platforms.
 	  Say Y if you have such a device
 	  If unsure select "N".
+
+config SND_SOC_INTEL_MRFLD_WM8958_MACH
+	tristate "SOC Machine Audio driver for Intel Merrifield MID platform"
+	depends on X86
+	select SND_SOC_WM8994
+	select MFD_CORE
+	select MFD_WM8994
+	select REGULATOR_WM8994
+	select SND_SST_MFLD_PLATFORM
+	select SND_SST_IPC
+	help
+	  This adds support for ASoC machine driver for Intel(R) MID Merrifield platform
+          used as alsa device in audio substem in Intel(R) MID devices
+          Say Y if you have such a device
+          If unsure select "N".
sound/soc/intel/Makefile +2 -0
index 9ab43be..9d4b3d4 100644
@@ -26,6 +26,7 @@ snd-soc-sst-haswell-objs := haswell.o
 snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
 snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
 snd-soc-sst-broadwell-objs := broadwell.o
+snd-merr-dpcm-wm8958-objs := merr_dpcm_wm8958.o
 
 obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
@@ -34,3 +35,4 @@ obj-$(CONFIG_SND_SOC_INTEL_BROADWELL_MACH) += snd-soc-sst-broadwell.o
 
 # DSP driver
 obj-$(CONFIG_SND_SST_IPC) += sst/
+obj-$(CONFIG_SND_SOC_INTEL_MRFLD_WM8958_MACH) += snd-merr-dpcm-wm8958.o
sound/soc/intel/merr_dpcm_wm8958.c new file +430 -0

430 lines not on this page · raw message

Signature · 1 line
1.7.0.4
maintainer
#1 lore raw

sound/soc/intel/Makefile snd-soc-sst-haswell-objs := haswell.o · line 29

Quoted 5 lines · Vinod Koul
sound/soc/intel/Makefile +1 -0
@@ -26,6 +26,7 @@ snd-soc-sst-haswell-objs := haswell.o
 snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
 snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
 snd-soc-sst-broadwell-objs := broadwell.o
+snd-merr-dpcm-wm8958-objs := merr_dpcm_wm8958.o

Notice the difference in naming style for the module here...

sound/soc/intel/merr_dpcm_wm8958.c line 209

Quoted 6 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +6 -0
+	switch (level) {
+	case SND_SOC_BIAS_STANDBY:
+		/*
+		 * We are in standby down so */
+		/* Switch to 32KHz MCLK2 input clock for codec
+		 */

Interesting coding style!

sound/soc/intel/merr_dpcm_wm8958.c line 260

Quoted 6 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +6 -0
+static const struct wm8958_micd_rate micdet_rates[] = {
+	{ 32768,       true,  1, 4 },
+	{ 32768,       false, 1, 1 },
+	{ 44100 * 256, true,  7, 10 },
+	{ 44100 * 256, false, 7, 10 },
+};

This isn't referenced anywhere.

Quoted 13 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +13 -0
+static int mrfld_8958_init(struct snd_soc_pcm_runtime *runtime)
+{
+	int ret;
+	struct snd_soc_card *card = runtime->card;
+	struct mrfld_8958_mc_private *ctx = snd_soc_card_get_drvdata(card);
+	struct snd_soc_dai *aif1_dai = card->rtd[CODEC_BE].codec_dai;
+	struct snd_soc_codec *codec = aif1_dai->codec;
+
+	if (!aif1_dai)
+		return -ENODEV;
+
+	ret = snd_soc_dai_set_tdm_slot(aif1_dai, 0xf0, 0xf0, 4, 24);
+	if (ret < 0) {

sound/soc/intel/merr_dpcm_wm8958.c line 284

Quoted 10 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +10 -0
+		dev_err(card->dev, "can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	card->dapm.idle_bias_off = true;
+
+	if (!codec) {
+		dev_err(card->dev, "%s: we didnt find the codec pointer!\n", __func__);
+		return 0;
+	}

This should be an error if it's even worth checking for (which it shouldn't be).

sound/soc/intel/merr_dpcm_wm8958.c line 297

Quoted 2 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +2 -0
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_1, KEY_MEDIA);
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_0, KEY_MEDIA);

Two buttons both reporting the same key? Might be worth a comment.

sound/soc/intel/merr_dpcm_wm8958.c line 394

Quoted 1 line
sound/soc/intel/merr_dpcm_wm8958.c new file +1 -0
+	ret_val = snd_soc_register_card(&snd_soc_card_mrfld);

devm_snd_soc_register_card() and you can loose the remove function.

author
#2 lore raw
Quoted 9 lines · Mark Brown

sound/soc/intel/Makefile snd-soc-sst-haswell-objs := haswell.o · line 29

Quoted 5 lines · Vinod Koul
sound/soc/intel/Makefile +1 -0
@@ -26,6 +26,7 @@ snd-soc-sst-haswell-objs := haswell.o
 snd-soc-sst-byt-rt5640-mach-objs := byt-rt5640.o
 snd-soc-sst-byt-max98090-mach-objs := byt-max98090.o
 snd-soc-sst-broadwell-objs := broadwell.o
+snd-merr-dpcm-wm8958-objs := merr_dpcm_wm8958.o

Notice the difference in naming style for the module here...

shouldnt be, will amke it consistent

Quoted 9 lines

sound/soc/intel/merr_dpcm_wm8958.c line 209

Quoted 7 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +6 -0
+	switch (level) {
+	case SND_SOC_BIAS_STANDBY:
+		/*
+		 * We are in standby down so */
+		/* Switch to 32KHz MCLK2 input clock for codec
+		 */

Interesting coding style!

mea culpa, looks like fixing this cause issue :(

Quoted 9 lines

sound/soc/intel/merr_dpcm_wm8958.c line 260

Quoted 7 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +6 -0
+static const struct wm8958_micd_rate micdet_rates[] = {
+	{ 32768,       true,  1, 4 },
+	{ 32768,       false, 1, 1 },
+	{ 44100 * 256, true,  7, 10 },
+	{ 44100 * 256, false, 7, 10 },
+};

This isn't referenced anywhere.

Yup, this should come in subsequent jack detect patch not here

Quoted 19 lines
Quoted 19 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +18 -0
+static int mrfld_8958_init(struct snd_soc_pcm_runtime *runtime)
+{
+	int ret;
+	struct snd_soc_card *card = runtime->card;
+	struct mrfld_8958_mc_private *ctx = snd_soc_card_get_drvdata(card);
+	struct snd_soc_dai *aif1_dai = card->rtd[CODEC_BE].codec_dai;
+	struct snd_soc_codec *codec = aif1_dai->codec;
+
+	if (!aif1_dai)
+		return -ENODEV;
+
+	ret = snd_soc_dai_set_tdm_slot(aif1_dai, 0xf0, 0xf0, 4, 24);
+	if (ret < 0) {
+		dev_err(card->dev, "can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	card->dapm.idle_bias_off = true;
Quoted 8 lines

sound/soc/intel/merr_dpcm_wm8958.c line 284

Quoted 5 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +5 -0
+
+	if (!codec) {
+		dev_err(card->dev, "%s: we didnt find the codec pointer!\n", __func__);
+		return 0;
+	}

This should be an error if it's even worth checking for (which it shouldn't be).

yes..

Quoted 5 lines

sound/soc/intel/merr_dpcm_wm8958.c line 297

Quoted 3 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +2 -0
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_1, KEY_MEDIA);
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_0, KEY_MEDIA);

Two buttons both reporting the same key? Might be worth a comment.

Okay loooking back I am not sure why we added two here, let me check and clean this up.

Quoted 4 lines

sound/soc/intel/merr_dpcm_wm8958.c line 394

Quoted 2 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +1 -0
+	ret_val = snd_soc_register_card(&snd_soc_card_mrfld);

devm_snd_soc_register_card() and you can loose the remove function.

Sure

Signature · 1 line
~Vinod
maintainer
#3 lore raw
Quoted 9 lines · Vinod Koul
Quoted 4 lines · Mark Brown

sound/soc/intel/merr_dpcm_wm8958.c line 297

Quoted 2 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +2 -0
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_1, KEY_MEDIA);
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_0, KEY_MEDIA);

Two buttons both reporting the same key? Might be worth a comment.

Okay loooking back I am not sure why we added two here, let me check and clean this up.

I was assuming it was because the tolerance desired on the button was wider than a single detection range on the device so this was ensuring that the button was reliably detected.

author
#4 lore raw
Quoted 8 lines · Mark Brown
Quoted 6 lines · Vinod Koul
Quoted 4 lines · Mark Brown

sound/soc/intel/merr_dpcm_wm8958.c line 297

Quoted 2 lines
sound/soc/intel/merr_dpcm_wm8958.c new file +2 -0
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_1, KEY_MEDIA);
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_0, KEY_MEDIA);

Two buttons both reporting the same key? Might be worth a comment.

Quoted 6 lines
Quoted 2 lines

Okay loooking back I am not sure why we added two here, let me check and clean this up.

I was assuming it was because the tolerance desired on the button was wider than a single detection range on the device so this was ensuring that the button was reliably detected.

and thats is the changelog i found from our old kernel tree. So will add this coment here...

Signature · 1 line
~Vinod