Skip to contentSkip to conversation

Add support for merrfield audio

RFC In review Vinod Koul 4 participants 18 messages May 5, 2014 – May 7, 2014

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

cover Add support for merrfield audio

This RFC patch series is dependent upon the "ASoC: Intel: rework the mfld platform driver" series

This add support for Merrfield machine based on WM8958 codec and Intels Merrfield SoC. The SoC implementation is based on DPCM.

At last the SST DSP driver has been added which provides the low level IPC functionality and power management.

Vinod Koul (4):
ASoC: Intel: add SSP BE DAIs
ASoC: Intel: Add merrifield machine driver
ASoC: Intel: add the low level dsp driver for mrfld
ASoC: Intel: add support for mrfld DPCM platform

 sound/soc/intel/Kconfig                          |   20 +
 sound/soc/intel/board/Makefile                   |    4 +
 sound/soc/intel/board/merr_dpcm_wm8958.c         |  619 ++++++++++
 sound/soc/intel/platform-libs/controls_v2.h      |  754 +++++++++++++
 sound/soc/intel/platform-libs/controls_v2_dpcm.c | 1315 ++++++++++++++++++++++
 sound/soc/intel/platform-libs/sst_widgets.h      |  378 +++++++
 sound/soc/intel/platform_ipc_v2.h                |  694 ++++++++++++
 sound/soc/intel/sst-mfld-platform-compress.c     |    8 +-
 sound/soc/intel/sst-mfld-platform-pcm.c          |  490 +++++++--
 sound/soc/intel/sst-mfld-platform.h              |    2 +
 sound/soc/intel/sst/Makefile                     |    5 +
 sound/soc/intel/sst/sst.c                        |  631 +++++++++++
 sound/soc/intel/sst/sst.h                        |  686 +++++++++++
 sound/soc/intel/sst/sst_drv_interface.c          |  812 +++++++++++++
 sound/soc/intel/sst/sst_ipc.c                    |  388 +++++++
 sound/soc/intel/sst/sst_loader.c                 |  947 ++++++++++++++++
 sound/soc/intel/sst/sst_pvt.c                    |  203 ++++
 sound/soc/intel/sst/sst_stream.c                 |  529 +++++++++
 18 files changed, 8401 insertions(+), 84 deletions(-)
 create mode 100644 sound/soc/intel/board/Makefile
 create mode 100644 sound/soc/intel/board/merr_dpcm_wm8958.c
 create mode 100644 sound/soc/intel/platform-libs/controls_v2.h
 create mode 100644 sound/soc/intel/platform-libs/controls_v2_dpcm.c
 create mode 100644 sound/soc/intel/platform-libs/sst_widgets.h
 create mode 100644 sound/soc/intel/platform_ipc_v2.h
 create mode 100644 sound/soc/intel/sst/Makefile
 create mode 100644 sound/soc/intel/sst/sst.c
 create mode 100644 sound/soc/intel/sst/sst.h
 create mode 100644 sound/soc/intel/sst/sst_drv_interface.c
 create mode 100644 sound/soc/intel/sst/sst_ipc.c
 create mode 100644 sound/soc/intel/sst/sst_loader.c
 create mode 100644 sound/soc/intel/sst/sst_pvt.c
 create mode 100644 sound/soc/intel/sst/sst_stream.c
author
#1 lore raw

RFC 1/4 ASoC: Intel: add SSP BE DAIs

---
 sound/soc/intel/sst-mfld-platform-pcm.c |  112 +++++++++++++++++++++++--------
 1 files changed, 83 insertions(+), 29 deletions(-)
sound/soc/intel/sst-mfld-platform-pcm.c +83 -29
index 7c790f5..f4b85e5 100644
@@ -92,35 +92,6 @@ static struct snd_pcm_hardware sst_platform_pcm_hw = {
 	.fifo_size = SST_FIFO_SIZE,
 };
 
-/* MFLD - MSIC */
-static struct snd_soc_dai_driver sst_platform_dai[] = {
-{
-	.name = "Headset-cpu-dai",
-	.id = 0,
-	.playback = {
-		.channels_min = SST_STEREO,
-		.channels_max = SST_STEREO,
-		.rates = SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S24_LE,
-	},
-	.capture = {
-		.channels_min = 1,
-		.channels_max = 5,
-		.rates = SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S24_LE,
-	},
-},
-{
-	.name = "Compress-cpu-dai",
-	.compress_dai = 1,
-	.playback = {
-		.channels_min = SST_STEREO,
-		.channels_max = SST_STEREO,
-		.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE,
-	},
-},
-};
 
 /* helper functions */
 void sst_set_stream_status(struct sst_runtime_stream *stream,
@@ -316,6 +287,89 @@ static int sst_platform_pcm_prepare(struct snd_pcm_substream *substream)
 	return ret_val;
 }
 
+static struct snd_soc_dai_driver sst_platform_dai[] = {
+{
+	.name = "media-cpu-dai",
+	.playback = {
+		.stream_name = "Media Playback",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "Media Capture",
+		.channels_min = 1,
+		.channels_max = 2,
+		.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+{
+	.name = "compress-cpu-dai",
+	.compress_dai = 1,
+	.playback = {
+		.stream_name = "Compress Playback",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+/*BE CPU  Dais */
+{
+	.name = "ssp0-port",
+	.playback = {
+		.stream_name = "ssp0 Tx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "ssp0 Rx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+{
+	.name = "ssp1-port",
+	.playback = {
+		.stream_name = "ssp1 Tx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "ssp1 Rx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+{
+	.name = "ssp2-port",
+	.playback = {
+		.stream_name = "ssp2 Tx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "ssp2 Rx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+};
+
 static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
 					int cmd)
 {
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [RFC 1/4] ASoC: Intel: add SSP BE DAIs

Quoted 1 line · Vinod Koul

Probably best to have a short description on each patch ;)

Quoted 124 lines
---
 sound/soc/intel/sst-mfld-platform-pcm.c |  112 +++++++++++++++++++++++--------
 1 files changed, 83 insertions(+), 29 deletions(-)
sound/soc/intel/sst-mfld-platform-pcm.c +76 -29
index 7c790f5..f4b85e5 100644
@@ -92,35 +92,6 @@ static struct snd_pcm_hardware sst_platform_pcm_hw = {
 	.fifo_size = SST_FIFO_SIZE,
 };
 
-/* MFLD - MSIC */
-static struct snd_soc_dai_driver sst_platform_dai[] = {
-{
-	.name = "Headset-cpu-dai",
-	.id = 0,
-	.playback = {
-		.channels_min = SST_STEREO,
-		.channels_max = SST_STEREO,
-		.rates = SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S24_LE,
-	},
-	.capture = {
-		.channels_min = 1,
-		.channels_max = 5,
-		.rates = SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S24_LE,
-	},
-},
-{
-	.name = "Compress-cpu-dai",
-	.compress_dai = 1,
-	.playback = {
-		.channels_min = SST_STEREO,
-		.channels_max = SST_STEREO,
-		.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE,
-	},
-},
-};
 
 /* helper functions */
 void sst_set_stream_status(struct sst_runtime_stream *stream,
@@ -316,6 +287,89 @@ static int sst_platform_pcm_prepare(struct snd_pcm_substream *substream)
 	return ret_val;
 }
 
+static struct snd_soc_dai_driver sst_platform_dai[] = {
+{
+	.name = "media-cpu-dai",
+	.playback = {
+		.stream_name = "Media Playback",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "Media Capture",
+		.channels_min = 1,
+		.channels_max = 2,
+		.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+{
+	.name = "compress-cpu-dai",
+	.compress_dai = 1,
+	.playback = {
+		.stream_name = "Compress Playback",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+/*BE CPU  Dais */
+{
+	.name = "ssp0-port",
+	.playback = {
+		.stream_name = "ssp0 Tx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "ssp0 Rx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+{
+	.name = "ssp1-port",
+	.playback = {
+		.stream_name = "ssp1 Tx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "ssp1 Rx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+{
+	.name = "ssp2-port",
+	.playback = {
+		.stream_name = "ssp2 Tx",
+		.channels_min = SST_STEREO,
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.capture = {
+		.stream_name = "ssp2 Rx",
+		.channels_min = SST_STEREO,

sound/soc/intel/sst-mfld-platform-pcm.c static int sst_platform_pcm_prepare(struct snd_pcm_substream *substream) · line 375

Quoted 10 lines
sound/soc/intel/sst-mfld-platform-pcm.c +7 -0
+		.channels_max = SST_STEREO,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+},
+};
+
 static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
 					int cmd)
 {

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

author
#3 lore raw

RFC 2/4 ASoC: Intel: Add merrifield machine driver

In reply to Vinod Koul
---
 sound/soc/intel/Kconfig                  |   17 +
 sound/soc/intel/board/Makefile           |    4 +
 sound/soc/intel/board/merr_dpcm_wm8958.c |  619 ++++++++++++++++++++++++++++++
 3 files changed, 640 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/intel/board/Makefile
 create mode 100644 sound/soc/intel/board/merr_dpcm_wm8958.c
sound/soc/intel/Kconfig +17 -0
index 3c81b38..422c32d 100644
@@ -49,3 +49,20 @@ config SND_SOC_INTEL_BYT_RT5640_MACH
 	help
 	  This adds audio driver for Intel Baytrail platform based boards
 	  with the RT5640 audio codec.
+
+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_MACHINE
+	select SND_INTEL_SST
+	default n
+	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/board/Makefile new file +4 -0
new file mode 100644
index 0000000..fdfbecf
@@ -0,0 +1,4 @@
+# Merrifield board
+snd-merr-dpcm-wm8958-objs := merr_dpcm_wm8958.o
+
+obj-$(CONFIG_SND_SOC_INTEL_MRFLD_WM8958_MACH) += snd-merr-dpcm-wm8958.o
sound/soc/intel/board/merr_dpcm_wm8958.c new file +619 -0

619 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#4 lore raw

Re: [RFC 2/4] ASoC: Intel: Add merrifield machine driver

Quoted 131 lines · Vinod Koul
---
 sound/soc/intel/Kconfig                  |   17 +
 sound/soc/intel/board/Makefile           |    4 +
 sound/soc/intel/board/merr_dpcm_wm8958.c |  619 ++++++++++++++++++++++++++++++
 3 files changed, 640 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/intel/board/Makefile
 create mode 100644 sound/soc/intel/board/merr_dpcm_wm8958.c
sound/soc/intel/Kconfig +17 -0
index 3c81b38..422c32d 100644
@@ -49,3 +49,20 @@ config SND_SOC_INTEL_BYT_RT5640_MACH
 	help
 	  This adds audio driver for Intel Baytrail platform based boards
 	  with the RT5640 audio codec.
+
+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_MACHINE
+	select SND_INTEL_SST
+	default n
+	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/board/Makefile new file +4 -0
new file mode 100644
index 0000000..fdfbecf
@@ -0,0 +1,4 @@
+# Merrifield board
+snd-merr-dpcm-wm8958-objs := merr_dpcm_wm8958.o
+
+obj-$(CONFIG_SND_SOC_INTEL_MRFLD_WM8958_MACH) += snd-merr-dpcm-wm8958.o
sound/soc/intel/board/merr_dpcm_wm8958.c new file +81 -0
new file mode 100644
index 0000000..4c17746
@@ -0,0 +1,619 @@
+/*
+ *  merr_dpcm_wm8958.c - ASoc DPCM Machine driver for Intel Merrfield MID platform
+ *
+ *  Copyright (C) 2013-14 Intel Corp
+ *  Author: Vinod Koul <[email protected]>
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/async.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+#include <linux/input.h>
+
+#include <linux/mfd/wm8994/core.h>
+#include <linux/mfd/wm8994/registers.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include "../../codecs/wm8994.h"
+#include "../platform-libs/controls_v2.h"
+
+/* Codec PLL output clk rate */
+#define CODEC_SYSCLK_RATE			24576000
+/* Input clock to codec at MCLK1 PIN */
+#define CODEC_IN_MCLK1_RATE			19200000
+/* Input clock to codec at MCLK2 PIN */
+#define CODEC_IN_MCLK2_RATE			32768
+/*  define to select between MCLK1 and MCLK2 input to codec as its clock */
+#define CODEC_IN_MCLK1				1
+#define CODEC_IN_MCLK2				2
+
+struct mrfld_8958_mc_private {
+	struct snd_soc_jack jack;
+	int jack_retry;
+};
+
+
+static inline struct snd_soc_codec *mrfld_8958_get_codec(struct snd_soc_card *card)
+{
+	bool found = false;
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strstr(codec->name, "wm8994-codec")) {
+			pr_debug("codec was %s", codec->name);
+			continue;
+		} else {
+			found = true;
+			break;
+		}
+	}
+	if (found == false) {
+		pr_warn("%s: cant find codec", __func__);
+		return NULL;
+	}
+	return codec;
+}
+
+/* TODO: find better way of doing this */
+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
+{
+	int i;

sound/soc/intel/board/merr_dpcm_wm8958.c line 91

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+	for (i = 0; i < card->num_rtd; i++) {
+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
+			return card->rtd[i].codec_dai;
+	}
+	pr_err("%s: unable to find codec dai\n", __func__);
+	/* this should never occur */
+	WARN_ON(1);
+	return NULL;
+}
+

It would be good if we could eventually make the above 2 calls generic in core. Seem to be quite useful functions.

Quoted 92 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +92 -0
+/* Function to switch the input clock for codec,  When audio is in
+ * progress input clock to codec will be through MCLK1 which is 19.2MHz
+ * while in off state input clock to codec will be through 32KHz through
+ * MCLK2
+ * card	: Sound card structure
+ * src	: Input clock source to codec
+ */
+static int mrfld_8958_set_codec_clk(struct snd_soc_card *card, int src)
+{
+	struct snd_soc_dai *aif1_dai = find_codec_dai(card, "wm8994-aif1");
+	int ret;
+
+	if (!aif1_dai)
+		return -ENODEV;
+
+	switch (src) {
+	case CODEC_IN_MCLK1:
+		/* Turn ON the PLL to generate required sysclk rate
+		 * from MCLK1 */
+		ret = snd_soc_dai_set_pll(aif1_dai,
+			WM8994_FLL1, WM8994_FLL_SRC_MCLK1,
+			CODEC_IN_MCLK1_RATE, CODEC_SYSCLK_RATE);
+		if (ret < 0) {
+			pr_err("Failed to start FLL: %d\n", ret);
+			return ret;
+		}
+		/* Switch to MCLK1 input */
+		ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_FLL1,
+				CODEC_SYSCLK_RATE, SND_SOC_CLOCK_IN);
+		if (ret < 0) {
+			pr_err("Failed to set codec sysclk configuration %d\n",
+				 ret);
+			return ret;
+		}
+		break;
+	case CODEC_IN_MCLK2:
+		/* Switch to MCLK2 */
+		ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2,
+				32768, SND_SOC_CLOCK_IN);
+		if (ret < 0) {
+			pr_err("Failed to switch to MCLK2: %d", ret);
+			return ret;
+		}
+		/* Turn off PLL for MCLK1 */
+		ret = snd_soc_dai_set_pll(aif1_dai, WM8994_FLL1, 0, 0, 0);
+		if (ret < 0) {
+			pr_err("Failed to stop the FLL: %d", ret);
+			return ret;
+		}
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static int mrfld_wm8958_set_clk_fmt(struct snd_soc_dai *codec_dai)
+{
+	unsigned int fmt;
+	int ret = 0;
+	struct snd_soc_card *card = codec_dai->card;
+
+	pr_err("setting snd_soc_dai_set_tdm_slot\n");
+	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 4, SNDRV_PCM_FORMAT_S24_LE);
+	if (ret < 0) {
+		pr_err("can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	/* WM8958 slave Mode */
+	fmt =   SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
+		| SND_SOC_DAIFMT_CBS_CFS;
+	ret = snd_soc_dai_set_fmt(codec_dai, fmt);
+	if (ret < 0) {
+		pr_err("can't set codec DAI configuration %d\n", ret);
+		return ret;
+	}
+
+	/* FIXME: move this to SYS_CLOCK event handler when codec driver
+	 * dependency is clean.
+	 */
+	/* Switch to 19.2MHz MCLK1 input clock for codec */
+	ret = mrfld_8958_set_codec_clk(card, CODEC_IN_MCLK1);
+
+	return ret;
+}
+
+static int mrfld_8958_hw_params(struct snd_pcm_substream *substream,
+			   struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;

sound/soc/intel/board/merr_dpcm_wm8958.c line 193

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+
+	if (!strcmp(codec_dai->name, "wm8994-aif1"))
+		return mrfld_wm8958_set_clk_fmt(codec_dai);
+	return 0;
+}
+
+static int mrfld_wm8958_compr_set_params(struct snd_compr_stream *cstream)
+{
+	return 0;
+}

Do we need to implement this if it's not used ?

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

author
#5 lore raw

Re: [RFC 2/4] ASoC: Intel: Add merrifield machine driver

Quoted 11 lines · Liam Girdwood
Quoted 9 lines · Vinod Koul
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+/* TODO: find better way of doing this */
+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
+{
+	int i;
+	for (i = 0; i < card->num_rtd; i++) {
+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
+			return card->rtd[i].codec_dai;
+	}
+	pr_err("%s: unable to find codec dai\n", __func__);
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 91

Quoted 5 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +5 -0
+	/* this should never occur */
+	WARN_ON(1);
+	return NULL;
+}
+

It would be good if we could eventually make the above 2 calls generic in core. Seem to be quite useful functions.

Yes I didnt do that as I wanted to check if we have a better method or not. With multi-codec systems we dont have single codec for the card so finding this would need lookup or else... Somehow I think we should have simpler solution, Mark??

Quoted 6 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 193

Quoted 4 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +4 -0
+static int mrfld_wm8958_compr_set_params(struct snd_compr_stream *cstream)
+{
+	return 0;
+}

Do we need to implement this if it's not used ?

My bad, this was supposed to be removed but... :)

Signature · 1 line
~Vinod
#6 lore raw

Re: [RFC 2/4] ASoC: Intel: Add merrifield machine driver

In reply to Vinod Koul

On 05/05/2014 08:01 PM, Vinod Koul wrote:
[...]

Quoted 11 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +11 -0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/async.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <sound/pcm.h>

sound/soc/intel/board/merr_dpcm_wm8958.c line 39

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+#include <linux/input.h>
+
+#include <linux/mfd/wm8994/core.h>
+#include <linux/mfd/wm8994/registers.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include "../../codecs/wm8994.h"
+#include "../platform-libs/controls_v2.h"

I don't think that include exists in upstream.

Quoted 29 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +29 -0
+
+/* Codec PLL output clk rate */
+#define CODEC_SYSCLK_RATE			24576000
+/* Input clock to codec at MCLK1 PIN */
+#define CODEC_IN_MCLK1_RATE			19200000
+/* Input clock to codec at MCLK2 PIN */
+#define CODEC_IN_MCLK2_RATE			32768
+/*  define to select between MCLK1 and MCLK2 input to codec as its clock */
+#define CODEC_IN_MCLK1				1
+#define CODEC_IN_MCLK2				2
+
+struct mrfld_8958_mc_private {
+	struct snd_soc_jack jack;
+	int jack_retry;
+};
+
+
+static inline struct snd_soc_codec *mrfld_8958_get_codec(struct snd_soc_card *card)
+{
+	bool found = false;
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strstr(codec->name, "wm8994-codec")) {
+			pr_debug("codec was %s", codec->name);
+			continue;
+		} else {
+			found = true;
+			break;

sound/soc/intel/board/merr_dpcm_wm8958.c line 78

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+		}
+	}
+	if (found == false) {
+		pr_warn("%s: cant find codec", __func__);
+		return NULL;
+	}
+	return codec;
+}
+
+/* TODO: find better way of doing this */

Yes!

sound/soc/intel/board/merr_dpcm_wm8958.c line 90

Quoted 12 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +12 -0
+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
+{
+	int i;
+	for (i = 0; i < card->num_rtd; i++) {
+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
+			return card->rtd[i].codec_dai;
+	}
+	pr_err("%s: unable to find codec dai\n", __func__);
+	/* this should never occur */
+	WARN_ON(1);
+	return NULL;
+}

The proper way to do this is to implement the init callback for the dai link. There you get a pointer to the codec and the dai and everything else. If you need one for later store them in the private struct of the card driver.

sound/soc/intel/board/merr_dpcm_wm8958.c line 97

Quoted 7 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +7 -0
+
+/* Function to switch the input clock for codec,  When audio is in
+ * progress input clock to codec will be through MCLK1 which is 19.2MHz
+ * while in off state input clock to codec will be through 32KHz through
+ * MCLK2
+ * card	: Sound card structure
+ * src	: Input clock source to codec

That's not proper kerneldoc

Quoted 1 line

+ */

[...]

sound/soc/intel/board/merr_dpcm_wm8958.c line 155

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+
+static int mrfld_wm8958_set_clk_fmt(struct snd_soc_dai *codec_dai)
+{
+	unsigned int fmt;
+	int ret = 0;
+	struct snd_soc_card *card = codec_dai->card;
+
+	pr_err("setting snd_soc_dai_set_tdm_slot\n");
+	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 4, SNDRV_PCM_FORMAT_S24_LE);

the slot width should be in number of bit clock cycles.

sound/soc/intel/board/merr_dpcm_wm8958.c line 164

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+	if (ret < 0) {
+		pr_err("can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	/* WM8958 slave Mode */
+	fmt =   SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
+		| SND_SOC_DAIFMT_CBS_CFS;
+	ret = snd_soc_dai_set_fmt(codec_dai, fmt);

Use the dai_fmt field of the dai_link to set this up.

Quoted 13 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +13 -0
+	if (ret < 0) {
+		pr_err("can't set codec DAI configuration %d\n", ret);
+		return ret;
+	}
+
+	/* FIXME: move this to SYS_CLOCK event handler when codec driver
+	 * dependency is clean.
+	 */
+	/* Switch to 19.2MHz MCLK1 input clock for codec */
+	ret = mrfld_8958_set_codec_clk(card, CODEC_IN_MCLK1);
+
+	return ret;
+}

[...]

Quoted 14 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +14 -0
+static int mrfld_8958_init(struct snd_soc_pcm_runtime *runtime)
+{
+	int ret;
+	unsigned int fmt;
+	struct snd_soc_codec *codec;
+	struct snd_soc_card *card = runtime->card;
+	struct snd_soc_dai *aif1_dai = find_codec_dai(card, "wm8994-aif1");
+	struct mrfld_8958_mc_private *ctx = snd_soc_card_get_drvdata(card);
+
+	if (!aif1_dai)
+		return -ENODEV;
+
+	pr_debug("Entry %s\n", __func__);
+

sound/soc/intel/board/merr_dpcm_wm8958.c line 344

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+	ret = snd_soc_dai_set_tdm_slot(aif1_dai, 0, 0, 4, SNDRV_PCM_FORMAT_S24_LE);
+	if (ret < 0) {
+		pr_err("can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	/* WM8958 slave Mode */
+	fmt =   SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
+		| SND_SOC_DAIFMT_CBS_CFS;
+	ret = snd_soc_dai_set_fmt(aif1_dai, fmt);

Same commens as above.

Quoted 11 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +11 -0
+	if (ret < 0) {
+		pr_err("can't set codec DAI configuration %d\n", ret);
+		return ret;
+	}
+
+	mrfld_8958_set_bias_level(card, &card->dapm, SND_SOC_BIAS_OFF);
+	card->dapm.idle_bias_off = true;
+
+	/* these pins are not used in SB config so mark as nc
+	 *
+	 * LINEOUT1, 2

sound/soc/intel/board/merr_dpcm_wm8958.c line 365

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+	 * IN1R
+	 * DMICDAT2
+	 */
+	snd_soc_dapm_nc_pin(&card->dapm, "DMIC2DAT");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT1P");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT1N");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT2P");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT2N");
+	snd_soc_dapm_nc_pin(&card->dapm, "IN1RN");
+	snd_soc_dapm_nc_pin(&card->dapm, "IN1RP");

Set the fully_routed flag on the card and this will happen automatically.

Quoted 18 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +18 -0
+
+	/* Force enable VMID to avoid cold latency constraints */
+	snd_soc_dapm_force_enable_pin(&card->dapm, "VMID");
+	snd_soc_dapm_sync(&card->dapm);
+
+	codec = mrfld_8958_get_codec(card);
+	if (!codec) {
+		pr_err("%s: we didnt find the codec pointer!\n", __func__);
+		return 0;
+	}
+
+	ctx->jack_retry = 0;
+	ret = snd_soc_jack_new(codec, "Intel MID Audio Jack",
+			       SND_JACK_HEADSET | SND_JACK_HEADPHONE |
+				SND_JACK_BTN_0 | SND_JACK_BTN_1,
+				&ctx->jack);
+	if (ret) {
+		pr_err("jack creation failed\n");

sound/soc/intel/board/merr_dpcm_wm8958.c line 393

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+		return ret;
+	}
+
+	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);
+
+	wm8958_mic_detect(codec, &ctx->jack, NULL, NULL, NULL, NULL);
+
+	snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_1, WM8994_AIF1DAC1_MUTE, 0);
+	snd_soc_update_bits(codec, WM8994_AIF1_DAC2_FILTERS_1, WM8994_AIF1DAC2_MUTE, 0);

The card driver should not be poking in the codec registers.

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+
+	/* Micbias1 is always off, so for pm optimizations make sure the micbias1
+	 * discharge bit is set to floating to avoid discharge in disable state
+	 */
+	snd_soc_update_bits(codec, WM8958_MICBIAS1, WM8958_MICB1_DISCH, 0);
+
+	return 0;
+}
+

[...]

sound/soc/intel/board/merr_dpcm_wm8958.c line 550

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+
+static int snd_mrfld_8958_mc_probe(struct platform_device *pdev)
+{
+	int ret_val = 0;
+	struct mrfld_8958_mc_private *drv;
+
+	pr_debug("Entry %s\n", __func__);
+
+	drv = kzalloc(sizeof(*drv), GFP_ATOMIC);

GFP_KERNEL and maybe devm_kzalloc

Quoted 21 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +21 -0
+	if (!drv) {
+		pr_err("allocation failed\n");
+		return -ENOMEM;
+	}
+
+	/* register the soc card */
+	snd_soc_card_mrfld.dev = &pdev->dev;
+	snd_soc_card_set_drvdata(&snd_soc_card_mrfld, drv);
+	ret_val = snd_soc_register_card(&snd_soc_card_mrfld);
+	if (ret_val) {
+		pr_err("snd_soc_register_card failed %d\n", ret_val);
+		goto unalloc;
+	}
+	platform_set_drvdata(pdev, &snd_soc_card_mrfld);
+	pr_info("%s successful\n", __func__);
+	return ret_val;
+
+unalloc:
+	kfree(drv);
+	return ret_val;
+}

[...]

sound/soc/intel/board/merr_dpcm_wm8958.c line 604

Quoted 4 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +4 -0
+
+static int snd_mrfld_8958_driver_init(void)
+{
+	pr_info("Merrifield Machine Driver mrfld_wm8958 registerd\n");

That's just noise.

sound/soc/intel/board/merr_dpcm_wm8958.c line 614

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+	return platform_driver_register(&snd_mrfld_8958_mc_driver);
+}
+
+static void snd_mrfld_8958_driver_exit(void)
+{
+	pr_debug("In %s\n", __func__);
+	platform_driver_unregister(&snd_mrfld_8958_mc_driver);
+}
+late_initcall(snd_mrfld_8958_driver_init);
+module_exit(snd_mrfld_8958_driver_exit);

module_platform_driver().

author
#7 lore raw

Re: [RFC 2/4] ASoC: Intel: Add merrifield machine driver

Quoted 17 lines · Lars-Peter Clausen

On 05/05/2014 08:01 PM, Vinod Koul wrote:
[...]

Quoted 15 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +15 -0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/async.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+#include <linux/input.h>
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 39

Quoted 6 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +6 -0
+
+#include <linux/mfd/wm8994/core.h>
+#include <linux/mfd/wm8994/registers.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include "../../codecs/wm8994.h"
+#include "../platform-libs/controls_v2.h"

I don't think that include exists in upstream.

which one ../platform-libs/controls_v2.h is part of this patch.

Quoted 34 lines
Quoted 34 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +33 -0
+
+/* Codec PLL output clk rate */
+#define CODEC_SYSCLK_RATE			24576000
+/* Input clock to codec at MCLK1 PIN */
+#define CODEC_IN_MCLK1_RATE			19200000
+/* Input clock to codec at MCLK2 PIN */
+#define CODEC_IN_MCLK2_RATE			32768
+/*  define to select between MCLK1 and MCLK2 input to codec as its clock */
+#define CODEC_IN_MCLK1				1
+#define CODEC_IN_MCLK2				2
+
+struct mrfld_8958_mc_private {
+	struct snd_soc_jack jack;
+	int jack_retry;
+};
+
+
+static inline struct snd_soc_codec *mrfld_8958_get_codec(struct snd_soc_card *card)
+{
+	bool found = false;
+	struct snd_soc_codec *codec;
+
+	list_for_each_entry(codec, &card->codec_dev_list, card_list) {
+		if (!strstr(codec->name, "wm8994-codec")) {
+			pr_debug("codec was %s", codec->name);
+			continue;
+		} else {
+			found = true;
+			break;
+		}
+	}
+	if (found == false) {
+		pr_warn("%s: cant find codec", __func__);
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 78

Quoted 6 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +6 -0
+		return NULL;
+	}
+	return codec;
+}
+
+/* TODO: find better way of doing this */

Yes!

Am all ears :)

Quoted 10 lines
Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
+{
+	int i;
+	for (i = 0; i < card->num_rtd; i++) {
+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
+			return card->rtd[i].codec_dai;
+	}
+	pr_err("%s: unable to find codec dai\n", __func__);
+	/* this should never occur */
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 90

Quoted 3 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +3 -0
+	WARN_ON(1);
+	return NULL;
+}

The proper way to do this is to implement the init callback for the dai link. There you get a pointer to the codec and the dai and everything else. If you need one for later store them in the private struct of the card driver.

again the driver would need to store the pointers to cards (we multi codec systems) and multi dais. Somehow I dont feel this might be worth thr trouble. Earlier we always had card->codec pointing to _one_ codec but with multi-codec systems that is not the case, so we need ot lookup, but yes am not sure if above is best way or something else..

Quoted 11 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 97

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +7 -0
+
+/* Function to switch the input clock for codec,  When audio is in
+ * progress input clock to codec will be through MCLK1 which is 19.2MHz
+ * while in off state input clock to codec will be through 32KHz through
+ * MCLK2
+ * card	: Sound card structure
+ * src	: Input clock source to codec

That's not proper kerneldoc

Ah that shouldnt have slipped, will fix.

Quoted 14 lines
Quoted 2 lines

+ */

[...]

sound/soc/intel/board/merr_dpcm_wm8958.c line 155

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+
+static int mrfld_wm8958_set_clk_fmt(struct snd_soc_dai *codec_dai)
+{
+	unsigned int fmt;
+	int ret = 0;
+	struct snd_soc_card *card = codec_dai->card;
+
+	pr_err("setting snd_soc_dai_set_tdm_slot\n");
+	ret = snd_soc_dai_set_tdm_slot(codec_dai, 0, 0, 4, SNDRV_PCM_FORMAT_S24_LE);

the slot width should be in number of bit clock cycles.

ok

Quoted 12 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 164

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+	if (ret < 0) {
+		pr_err("can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	/* WM8958 slave Mode */
+	fmt =   SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
+		| SND_SOC_DAIFMT_CBS_CFS;
+	ret = snd_soc_dai_set_fmt(codec_dai, fmt);

Use the dai_fmt field of the dai_link to set this up.

ok

Quoted 57 lines
Quoted 14 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +13 -0
+	if (ret < 0) {
+		pr_err("can't set codec DAI configuration %d\n", ret);
+		return ret;
+	}
+
+	/* FIXME: move this to SYS_CLOCK event handler when codec driver
+	 * dependency is clean.
+	 */
+	/* Switch to 19.2MHz MCLK1 input clock for codec */
+	ret = mrfld_8958_set_codec_clk(card, CODEC_IN_MCLK1);
+
+	return ret;
+}

[...]

Quoted 14 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +14 -0
+static int mrfld_8958_init(struct snd_soc_pcm_runtime *runtime)
+{
+	int ret;
+	unsigned int fmt;
+	struct snd_soc_codec *codec;
+	struct snd_soc_card *card = runtime->card;
+	struct snd_soc_dai *aif1_dai = find_codec_dai(card, "wm8994-aif1");
+	struct mrfld_8958_mc_private *ctx = snd_soc_card_get_drvdata(card);
+
+	if (!aif1_dai)
+		return -ENODEV;
+
+	pr_debug("Entry %s\n", __func__);
+

sound/soc/intel/board/merr_dpcm_wm8958.c line 344

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+	ret = snd_soc_dai_set_tdm_slot(aif1_dai, 0, 0, 4, SNDRV_PCM_FORMAT_S24_LE);
+	if (ret < 0) {
+		pr_err("can't set codec pcm format %d\n", ret);
+		return ret;
+	}
+
+	/* WM8958 slave Mode */
+	fmt =   SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF
+		| SND_SOC_DAIFMT_CBS_CFS;
+	ret = snd_soc_dai_set_fmt(aif1_dai, fmt);

Same commens as above.

Quoted 15 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +15 -0
+	if (ret < 0) {
+		pr_err("can't set codec DAI configuration %d\n", ret);
+		return ret;
+	}
+
+	mrfld_8958_set_bias_level(card, &card->dapm, SND_SOC_BIAS_OFF);
+	card->dapm.idle_bias_off = true;
+
+	/* these pins are not used in SB config so mark as nc
+	 *
+	 * LINEOUT1, 2
+	 * IN1R
+	 * DMICDAT2
+	 */
+	snd_soc_dapm_nc_pin(&card->dapm, "DMIC2DAT");
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 365

Quoted 6 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +6 -0
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT1P");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT1N");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT2P");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT2N");
+	snd_soc_dapm_nc_pin(&card->dapm, "IN1RN");
+	snd_soc_dapm_nc_pin(&card->dapm, "IN1RP");

Set the fully_routed flag on the card and this will happen automatically.

I havent looked thos changes up, will this mark as nc asll the unrouted pins?

Quoted 23 lines
Quoted 23 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +22 -0
+
+	/* Force enable VMID to avoid cold latency constraints */
+	snd_soc_dapm_force_enable_pin(&card->dapm, "VMID");
+	snd_soc_dapm_sync(&card->dapm);
+
+	codec = mrfld_8958_get_codec(card);
+	if (!codec) {
+		pr_err("%s: we didnt find the codec pointer!\n", __func__);
+		return 0;
+	}
+
+	ctx->jack_retry = 0;
+	ret = snd_soc_jack_new(codec, "Intel MID Audio Jack",
+			       SND_JACK_HEADSET | SND_JACK_HEADPHONE |
+				SND_JACK_BTN_0 | SND_JACK_BTN_1,
+				&ctx->jack);
+	if (ret) {
+		pr_err("jack creation failed\n");
+		return ret;
+	}
+
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_1, KEY_MEDIA);
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 393

Quoted 6 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +6 -0
+	snd_jack_set_key(ctx->jack.jack, SND_JACK_BTN_0, KEY_MEDIA);
+
+	wm8958_mic_detect(codec, &ctx->jack, NULL, NULL, NULL, NULL);
+
+	snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_1, WM8994_AIF1DAC1_MUTE, 0);
+	snd_soc_update_bits(codec, WM8994_AIF1_DAC2_FILTERS_1, WM8994_AIF1DAC2_MUTE, 0);

The card driver should not be poking in the codec registers.

ah yes with DPCM we dont need this

Quoted 11 lines
Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+
+	/* Micbias1 is always off, so for pm optimizations make sure the micbias1
+	 * discharge bit is set to floating to avoid discharge in disable state
+	 */
+	snd_soc_update_bits(codec, WM8958_MICBIAS1, WM8958_MICB1_DISCH, 0);
+
+	return 0;
+}
+

[...]

Quoted 11 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 550

Quoted 9 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+
+static int snd_mrfld_8958_mc_probe(struct platform_device *pdev)
+{
+	int ret_val = 0;
+	struct mrfld_8958_mc_private *drv;
+
+	pr_debug("Entry %s\n", __func__);
+
+	drv = kzalloc(sizeof(*drv), GFP_ATOMIC);

GFP_KERNEL and maybe devm_kzalloc

devm_ yes

Quoted 30 lines
Quoted 22 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +21 -0
+	if (!drv) {
+		pr_err("allocation failed\n");
+		return -ENOMEM;
+	}
+
+	/* register the soc card */
+	snd_soc_card_mrfld.dev = &pdev->dev;
+	snd_soc_card_set_drvdata(&snd_soc_card_mrfld, drv);
+	ret_val = snd_soc_register_card(&snd_soc_card_mrfld);
+	if (ret_val) {
+		pr_err("snd_soc_register_card failed %d\n", ret_val);
+		goto unalloc;
+	}
+	platform_set_drvdata(pdev, &snd_soc_card_mrfld);
+	pr_info("%s successful\n", __func__);
+	return ret_val;
+
+unalloc:
+	kfree(drv);
+	return ret_val;
+}

[...]

sound/soc/intel/board/merr_dpcm_wm8958.c line 604

Quoted 4 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +4 -0
+
+static int snd_mrfld_8958_driver_init(void)
+{
+	pr_info("Merrifield Machine Driver mrfld_wm8958 registerd\n");

That's just noise.

Quoted 12 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 614

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+	return platform_driver_register(&snd_mrfld_8958_mc_driver);
+}
+
+static void snd_mrfld_8958_driver_exit(void)
+{
+	pr_debug("In %s\n", __func__);
+	platform_driver_unregister(&snd_mrfld_8958_mc_driver);
+}
+late_initcall(snd_mrfld_8958_driver_init);
+module_exit(snd_mrfld_8958_driver_exit);

module_platform_driver().

yes!

Signature · 1 line
~Vinod
#8 lore raw

Re: [RFC 2/4] ASoC: Intel: Add merrifield machine driver

Quoted 26 lines · Vinod Koul
Quoted 17 lines · Lars-Peter Clausen

On 05/05/2014 08:01 PM, Vinod Koul wrote:
[...]

Quoted 15 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +15 -0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/async.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+#include <linux/input.h>
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 39

Quoted 6 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +6 -0
+
+#include <linux/mfd/wm8994/core.h>
+#include <linux/mfd/wm8994/registers.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include "../../codecs/wm8994.h"
+#include "../platform-libs/controls_v2.h"

I don't think that include exists in upstream.

Quoted 1 line

which one ../platform-libs/controls_v2.h is part of this patch.

I just saw it's part of patch 4 of this series. But still, it should added before the user is added.

[..]

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
+{
+	int i;
+	for (i = 0; i < card->num_rtd; i++) {
+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
+			return card->rtd[i].codec_dai;
+	}
+	pr_err("%s: unable to find codec dai\n", __func__);
+	/* this should never occur */
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 90

Quoted 3 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +3 -0
+	WARN_ON(1);
+	return NULL;
+}

The proper way to do this is to implement the init callback for the dai link. There you get a pointer to the codec and the dai and everything else. If you need one for later store them in the private struct of the card driver.

Quoted 5 lines

again the driver would need to store the pointers to cards (we multi codec systems) and multi dais. Somehow I dont feel this might be worth thr trouble. Earlier we always had card->codec pointing to _one_ codec but with multi-codec systems that is not the case, so we need ot lookup, but yes am not sure if above is best way or something else..

Another thing you could do is just use card->rtd[X].codec_dai. The rtds are in the same order as the DAI links so you know which rtd is for which DAI.

[...]

Quoted 10 lines
Quoted 9 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 365

Quoted 7 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +7 -0
+	snd_soc_dapm_nc_pin(&card->dapm, "DMIC2DAT");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT1P");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT1N");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT2P");
+	snd_soc_dapm_nc_pin(&card->dapm, "LINEOUT2N");
+	snd_soc_dapm_nc_pin(&card->dapm, "IN1RN");
+	snd_soc_dapm_nc_pin(&card->dapm, "IN1RP");

Set the fully_routed flag on the card and this will happen automatically.

I havent looked thos changes up, will this mark as nc asll the unrouted pins?

It will mark any input, output and micbias pin that has no external connection as not connected. Which is typically what you want.

- Lars

author
#9 lore raw

Re: [RFC 2/4] ASoC: Intel: Add merrifield machine driver

Quoted 27 lines · Lars-Peter Clausen
Quoted 26 lines · Vinod Koul
Quoted 25 lines · Lars-Peter Clausen

On 05/05/2014 08:01 PM, Vinod Koul wrote:
[...]

Quoted 11 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +11 -0
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/async.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <sound/pcm.h>

sound/soc/intel/board/merr_dpcm_wm8958.c line 39

Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +10 -0
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+#include <linux/input.h>
+
+#include <linux/mfd/wm8994/core.h>
+#include <linux/mfd/wm8994/registers.h>
+#include <linux/mfd/wm8994/pdata.h>
+#include "../../codecs/wm8994.h"
+#include "../platform-libs/controls_v2.h"

I don't think that include exists in upstream.

Quoted 4 lines
Quoted 1 line

which one ../platform-libs/controls_v2.h is part of this patch.

I just saw it's part of patch 4 of this series. But still, it should added before the user is added.

Yes :)

And i dont use in below code so would remove for now...
Later additions to thsi would use these defines so would amke sense to add then.

Quoted 26 lines

[..]

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +9 -0
+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
+{
+	int i;
+	for (i = 0; i < card->num_rtd; i++) {
+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
+			return card->rtd[i].codec_dai;
+	}
+	pr_err("%s: unable to find codec dai\n", __func__);
+	/* this should never occur */
Quoted 8 lines

sound/soc/intel/board/merr_dpcm_wm8958.c line 90

Quoted 3 lines
sound/soc/intel/board/merr_dpcm_wm8958.c new file +3 -0
+	WARN_ON(1);
+	return NULL;
+}

The proper way to do this is to implement the init callback for the dai link. There you get a pointer to the codec and the dai and everything else. If you need one for later store them in the private struct of the card driver.

Quoted 5 lines

again the driver would need to store the pointers to cards (we multi codec systems) and multi dais. Somehow I dont feel this might be worth thr trouble. Earlier we always had card->codec pointing to _one_ codec but with multi-codec systems that is not the case, so we need ot lookup, but yes am not sure if above is best way or something else..

Quoted 3 lines

Another thing you could do is just use card->rtd[X].codec_dai. The rtds are in the same order as the DAI links so you know which rtd is for which DAI.

that should work too..
Mark, Any comments on these approaches before I modify the code?

Signature · 1 line
~Vinod
author
#10 lore raw

RFC 3/4 ASoC: Intel: add the low level dsp driver for mrfld

In reply to Vinod Koul

This driver provides low level functions like sending and receiving IPCs, managing power for DSP etc

---
 sound/soc/intel/sst/Makefile            |    5 +
 sound/soc/intel/sst/sst.c               |  631 ++++++++++++++++++++
 sound/soc/intel/sst/sst.h               |  686 ++++++++++++++++++++++
 sound/soc/intel/sst/sst_drv_interface.c |  812 ++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_ipc.c           |  388 +++++++++++++
 sound/soc/intel/sst/sst_loader.c        |  947 +++++++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_pvt.c           |  203 +++++++
 sound/soc/intel/sst/sst_stream.c        |  529 +++++++++++++++++
 8 files changed, 4201 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/intel/sst/Makefile
 create mode 100644 sound/soc/intel/sst/sst.c
 create mode 100644 sound/soc/intel/sst/sst.h
 create mode 100644 sound/soc/intel/sst/sst_drv_interface.c
 create mode 100644 sound/soc/intel/sst/sst_ipc.c
 create mode 100644 sound/soc/intel/sst/sst_loader.c
 create mode 100644 sound/soc/intel/sst/sst_pvt.c
 create mode 100644 sound/soc/intel/sst/sst_stream.c
sound/soc/intel/sst/Makefile new file +5 -0
new file mode 100644
index 0000000..d5bf4e8
@@ -0,0 +1,5 @@
+snd-intel-sst-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o
+
+obj-$(CONFIG_SND_INTEL_SST) += snd-intel-sst.o
+
+CFLAGS_snd-intel-sst.o = -I$(src)
sound/soc/intel/sst/sst.c new file +631 -0

631 lines not on this page · raw message

sound/soc/intel/sst/sst.h new file +686 -0

686 lines not on this page · raw message

sound/soc/intel/sst/sst_drv_interface.c new file +812 -0

812 lines not on this page · raw message

sound/soc/intel/sst/sst_ipc.c new file +388 -0

388 lines not on this page · raw message

sound/soc/intel/sst/sst_loader.c new file +947 -0

478 lines not on this page · raw message

sound/soc/intel/sst/sst_pvt.c new file +203 -0

203 lines not on this page · raw message

sound/soc/intel/sst/sst_stream.c new file +529 -0

529 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#11 lore raw

Re: [RFC 3/4] ASoC: Intel: add the low level dsp driver for mrfld

Quoted 4 lines · Vinod Koul

This driver provides low level functions like sending and receiving IPCs, managing power for DSP etc

Quoted 9 lines
---
 sound/soc/intel/sst/Makefile            |    5 +
 sound/soc/intel/sst/sst.c               |  631 ++++++++++++++++++++
 sound/soc/intel/sst/sst.h               |  686 ++++++++++++++++++++++
 sound/soc/intel/sst/sst_drv_interface.c |  812 ++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_ipc.c           |  388 +++++++++++++
 sound/soc/intel/sst/sst_loader.c        |  947 +++++++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_pvt.c           |  203 +++++++
 sound/soc/intel/sst/sst_stream.c        |  529 +++++++++++++++++

We should rename the sst directory to avoid confusion with other sst drivers.

Quoted 66 lines
 8 files changed, 4201 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/intel/sst/Makefile
 create mode 100644 sound/soc/intel/sst/sst.c
 create mode 100644 sound/soc/intel/sst/sst.h
 create mode 100644 sound/soc/intel/sst/sst_drv_interface.c
 create mode 100644 sound/soc/intel/sst/sst_ipc.c
 create mode 100644 sound/soc/intel/sst/sst_loader.c
 create mode 100644 sound/soc/intel/sst/sst_pvt.c
 create mode 100644 sound/soc/intel/sst/sst_stream.c
sound/soc/intel/sst/Makefile new file +5 -0
new file mode 100644
index 0000000..d5bf4e8
@@ -0,0 +1,5 @@
+snd-intel-sst-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_loader.o sst_pvt.o
+
+obj-$(CONFIG_SND_INTEL_SST) += snd-intel-sst.o
+
+CFLAGS_snd-intel-sst.o = -I$(src)
sound/soc/intel/sst/sst.c new file +39 -0
new file mode 100644
index 0000000..116522b
@@ -0,0 +1,631 @@
+/*
+ *  sst.c - Intel SST Driver for audio engine
+ *
+ *  Copyright (C) 2008-14	Intel Corp
+ *  Authors:	Vinod Koul <[email protected]>
+ *		Harsha Priya <[email protected]>
+ *		Dharageswari R <[email protected]>
+ *		KP Jeeja <[email protected]>
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/fs.h>
+#include <linux/interrupt.h>
+#include <linux/firmware.h>
+#include <linux/miscdevice.h>
+#include <linux/pm_runtime.h>
+#include <linux/pm_qos.h>
+#include <linux/async.h>
+#include <linux/delay.h>
+#include <linux/acpi.h>
+#include <asm/intel-mid.h>
+#include <asm/platform_sst_audio.h>
+#include <asm/platform_sst.h>
+#include "../sst_platform.h"

sound/soc/intel/sst/sst.c line 49

Quoted 10 lines
sound/soc/intel/sst/sst.c new file +10 -0
+#include "../platform_ipc_v2.h"
+#include "sst.h"
+
+MODULE_AUTHOR("Vinod Koul <[email protected]>");
+MODULE_AUTHOR("Harsha Priya <[email protected]>");
+MODULE_DESCRIPTION("Intel (R) SST(R) Audio Engine Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_VERSION(SST_DRIVER_VERSION);
+
+struct intel_sst_drv *sst_drv_ctx;

static ?

sound/soc/intel/sst/sst.c line 143

Quoted 6 lines
sound/soc/intel/sst/sst.c new file +4 -0
+static struct mutex drv_ctx_lock;
+
 
 
+
+static int sst_save_dsp_context_v2(struct intel_sst_drv *sst)

Is there a V1 somewhere ?

sound/soc/intel/sst/sst.c line 552

Quoted 3 lines
sound/soc/intel/sst/sst.c new file +3 -0
+static int intel_sst_suspend(struct device *dev)
+{
+

extra line ? Spotted this in a few places too.

Probably best to split this into several patches to make review easier.

Liam

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

author
#12 lore raw

Re: [RFC 3/4] ASoC: Intel: add the low level dsp driver for mrfld

Quoted 15 lines · Liam Girdwood
Quoted 4 lines · Vinod Koul

This driver provides low level functions like sending and receiving IPCs, managing power for DSP etc

Quoted 9 lines
---
 sound/soc/intel/sst/Makefile            |    5 +
 sound/soc/intel/sst/sst.c               |  631 ++++++++++++++++++++
 sound/soc/intel/sst/sst.h               |  686 ++++++++++++++++++++++
 sound/soc/intel/sst/sst_drv_interface.c |  812 ++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_ipc.c           |  388 +++++++++++++
 sound/soc/intel/sst/sst_loader.c        |  947 +++++++++++++++++++++++++++++++
 sound/soc/intel/sst/sst_pvt.c           |  203 +++++++
 sound/soc/intel/sst/sst_stream.c        |  529 +++++++++++++++++
Quoted 2 lines

We should rename the sst directory to avoid confusion with other sst drivers.

Sure, any suggestion :D

Quoted 3 lines
Quoted 1 line

+struct intel_sst_drv *sst_drv_ctx;

static ?

yup!

Quoted 9 lines

sound/soc/intel/sst/sst.c line 143

Quoted 7 lines
sound/soc/intel/sst/sst.c new file +4 -0
+static struct mutex drv_ctx_lock;
+
 
 
+
+static int sst_save_dsp_context_v2(struct intel_sst_drv *sst)

Is there a V1 somewhere ?

Yes that was used in mfld driver. I dont think we will get around to push those bits

Quoted 9 lines

sound/soc/intel/sst/sst.c line 552

Quoted 5 lines
sound/soc/intel/sst/sst.c new file +3 -0
+static int intel_sst_suspend(struct device *dev)
+{
+

extra line ? Spotted this in a few places too.

Probably best to split this into several patches to make review easier.

Okay will do that

Signature · 1 line
~Vinod
Quoted 3 lines

Liam

#13 lore raw

Re: [RFC 3/4] ASoC: Intel: add the low level dsp driver for mrfld

In reply to Vinod Koul
Quoted 1 line · Vinod Koul

+++ b/sound/soc/intel/sst/sst.h

...

Quoted 9 lines
sound/soc/intel/sst/sst.h new file +9 -0
+
+/* SST register map */
+#define SST_CSR			0x00
+#define SST_PISR		0x08
+#define SST_PIMR		0x10
+#define SST_ISRX		0x18
+#define SST_ISRD		0x20
+#define SST_IMRX		0x28
+#define SST_IMRD		0x30

sound/soc/intel/sst/sst.h line 82

Quoted 10 lines
sound/soc/intel/sst/sst.h new file +10 -0
+#define SST_IPCX		0x38 /* IPC IA-SST */
+#define SST_IPCD		0x40 /* IPC SST-IA */
+#define SST_ISRSC		0x48
+#define SST_ISRLPESC		0x50
+#define SST_IMRSC		0x58
+#define SST_IMRLPESC		0x60
+#define SST_IPCSC		0x68
+#define SST_IPCLPESC		0x70
+#define SST_CLKCTL		0x78
+#define SST_CSR2		0x80

Please re-use register definitions in sound/soc/intel/sst-dsp.h since they are the same.

Signature · 1 line
Jarkko
author
#14 lore raw

Re: [RFC 3/4] ASoC: Intel: add the low level dsp driver for mrfld

Quoted 16 lines · Jarkko Nikula
Quoted 1 line · Vinod Koul

+++ b/sound/soc/intel/sst/sst.h

...

Quoted 13 lines
sound/soc/intel/sst/sst.h new file +13 -0
+
+/* SST register map */
+#define SST_CSR			0x00
+#define SST_PISR		0x08
+#define SST_PIMR		0x10
+#define SST_ISRX		0x18
+#define SST_ISRD		0x20
+#define SST_IMRX		0x28
+#define SST_IMRD		0x30
+#define SST_IPCX		0x38 /* IPC IA-SST */
+#define SST_IPCD		0x40 /* IPC SST-IA */
+#define SST_ISRSC		0x48
+#define SST_ISRLPESC		0x50
Quoted 8 lines

sound/soc/intel/sst/sst.h line 82

Quoted 6 lines
sound/soc/intel/sst/sst.h new file +6 -0
+#define SST_IMRSC		0x58
+#define SST_IMRLPESC		0x60
+#define SST_IPCSC		0x68
+#define SST_IPCLPESC		0x70
+#define SST_CLKCTL		0x78
+#define SST_CSR2		0x80

Please re-use register definitions in sound/soc/intel/sst-dsp.h since they are the same.

Sure will add reuse that one..

Signature · 1 line
~Vinod
author
#15 lore raw

RFC 4/4 ASoC: Intel: add support for mrfld DPCM platform

In reply to Vinod Koul

This patch adds DPCM based supprt for managing mrfld platform

---
 sound/soc/intel/Kconfig                          |    3 +
 sound/soc/intel/platform-libs/controls_v2.h      |  754 +++++++++++++
 sound/soc/intel/platform-libs/controls_v2_dpcm.c | 1315 ++++++++++++++++++++++
 sound/soc/intel/platform-libs/sst_widgets.h      |  378 +++++++
 sound/soc/intel/platform_ipc_v2.h                |  694 ++++++++++++
 sound/soc/intel/sst-mfld-platform-compress.c     |    8 +-
 sound/soc/intel/sst-mfld-platform-pcm.c          |  384 ++++++-
 sound/soc/intel/sst-mfld-platform.h              |    2 +
 8 files changed, 3480 insertions(+), 58 deletions(-)
 create mode 100644 sound/soc/intel/platform-libs/controls_v2.h
 create mode 100644 sound/soc/intel/platform-libs/controls_v2_dpcm.c
 create mode 100644 sound/soc/intel/platform-libs/sst_widgets.h
 create mode 100644 sound/soc/intel/platform_ipc_v2.h
sound/soc/intel/Kconfig +3 -0
index 422c32d..1254eb8 100644
@@ -66,3 +66,6 @@ config SND_SOC_INTEL_MRFLD_WM8958_MACH
           used as alsa device in audio substem in Intel(R) MID devices
           Say Y if you have such a device
           If unsure select "N".
+
+config SND_INTEL_SST
+       tristate
sound/soc/intel/platform-libs/controls_v2.h new file +754 -0

754 lines not on this page · raw message

sound/soc/intel/platform-libs/controls_v2_dpcm.c new file +1315 -0

1,315 lines not on this page · raw message

sound/soc/intel/platform-libs/sst_widgets.h new file +378 -0

378 lines not on this page · raw message

sound/soc/intel/platform_ipc_v2.h new file +694 -0

547 lines not on this page · raw message

sound/soc/intel/sst-mfld-platform-compress.c +5 -3
index 02abd19..ca58f4c 100644

Lines of this file are not shown. View the raw message.

sound/soc/intel/sst-mfld-platform-pcm.c +329 -55

384 lines not on this page · raw message

sound/soc/intel/sst-mfld-platform.h +2 -0
index 6c5e7dc..67b375b 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#16 lore raw

Re: [RFC 4/4] ASoC: Intel: add support for mrfld DPCM platform

Quoted 53 lines · Vinod Koul

This patch adds DPCM based supprt for managing mrfld platform

---
 sound/soc/intel/Kconfig                          |    3 +
 sound/soc/intel/platform-libs/controls_v2.h      |  754 +++++++++++++
 sound/soc/intel/platform-libs/controls_v2_dpcm.c | 1315 ++++++++++++++++++++++
 sound/soc/intel/platform-libs/sst_widgets.h      |  378 +++++++
 sound/soc/intel/platform_ipc_v2.h                |  694 ++++++++++++
 sound/soc/intel/sst-mfld-platform-compress.c     |    8 +-
 sound/soc/intel/sst-mfld-platform-pcm.c          |  384 ++++++-
 sound/soc/intel/sst-mfld-platform.h              |    2 +
 8 files changed, 3480 insertions(+), 58 deletions(-)
 create mode 100644 sound/soc/intel/platform-libs/controls_v2.h
 create mode 100644 sound/soc/intel/platform-libs/controls_v2_dpcm.c
 create mode 100644 sound/soc/intel/platform-libs/sst_widgets.h
 create mode 100644 sound/soc/intel/platform_ipc_v2.h
sound/soc/intel/Kconfig +3 -0
index 422c32d..1254eb8 100644
@@ -66,3 +66,6 @@ config SND_SOC_INTEL_MRFLD_WM8958_MACH
           used as alsa device in audio substem in Intel(R) MID devices
           Say Y if you have such a device
           If unsure select "N".
+
+config SND_INTEL_SST
+       tristate
sound/soc/intel/platform-libs/controls_v2.h new file +18 -0
new file mode 100644
index 0000000..7988d81
@@ -0,0 +1,754 @@
+/*
+ *  controls_v2.h - Intel MID Platform driver header file
+ *
+ *  Copyright (C) 2013-14 Intel Corp
+ *  Author: Ramesh Babu <[email protected]>
+ *  	Omair M Abdullah <[email protected]>
+ *  	Samreen Nilofer <[email protected]>
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *

sound/soc/intel/platform-libs/controls_v2.h line 28

Quoted 10 lines
sound/soc/intel/platform-libs/controls_v2.h new file +10 -0
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ */
+
+#ifndef __SST_CONTROLS_V2_H__
+#define __SST_CONTROLS_V2_H__
+
+enum {
+	MERR_DPCM_AUDIO = 0,
+	MERR_DPCM_COMPR,

SST_ prefix

Quoted 42 lines
sound/soc/intel/platform-libs/controls_v2.h new file +42 -0
+enum sst_cmd {
+	SBA_IDLE		= 14,
+	SBA_VB_SET_SPEECH_PATH	= 26,
+	MMX_SET_GAIN		= 33,
+	SBA_VB_SET_GAIN		= 33,
+	FBA_VB_RX_CNI		= 35,
+	MMX_SET_GAIN_TIMECONST	= 36,
+	SBA_VB_SET_TIMECONST	= 36,
+	FBA_VB_ANA		= 37,
+	FBA_VB_SET_FIR		= 38,
+	FBA_VB_SET_IIR		= 39,
+	SBA_VB_START_TONE	= 41,
+	SBA_VB_STOP_TONE	= 42,
+	FBA_VB_AEC		= 47,
+	FBA_VB_NR_UL		= 48,
+	FBA_VB_AGC		= 49,
+	FBA_VB_WNR		= 52,
+	FBA_VB_SLV		= 53,
+	FBA_VB_NR_DL		= 55,
+	SBA_PROBE		= 66,
+	MMX_PROBE		= 66,
+	FBA_VB_SET_BIQUAD_D_C	= 69,
+	FBA_VB_DUAL_BAND_COMP	= 70,
+	FBA_VB_SNS		= 72,
+	FBA_VB_SER		= 78,
+	FBA_VB_TX_CNI		= 80,
+	SBA_VB_START		= 85,
+	FBA_VB_SET_REF_LINE	= 94,
+	FBA_VB_SET_DELAY_LINE	= 95,
+	FBA_VB_BWX		= 104,
+	FBA_VB_GMM		= 105,
+	FBA_VB_GLC		= 107,
+	FBA_VB_BMF		= 111,
+	FBA_VB_DNR		= 113,
+	MMX_SET_SWM		= 114,
+	SBA_SET_SWM		= 114,
+	SBA_SET_MDRP            = 116,
+	SBA_HW_SET_SSP		= 117,
+	SBA_SET_MEDIA_LOOP_MAP	= 118,
+	SBA_SET_MEDIA_PATH	= 119,
+	MMX_SET_MEDIA_PATH	= 119,
+	FBA_VB_TNR_UL		= 119,

sound/soc/intel/platform-libs/controls_v2.h line 478

Quoted 10 lines
sound/soc/intel/platform-libs/controls_v2.h new file +10 -0
+	FBA_VB_TNR_DL		= 121,
+	FBA_VB_NLF		= 125,
+	SBA_VB_LPRO		= 126,
+	FBA_VB_MDRP		= 127,
+	SBA_VB_SET_FIR          = 128,
+	SBA_VB_SET_IIR          = 129,
+	SBA_SET_SSP_SLOT_MAP	= 130,
+	AWARE_ENV_CLASS_PARAMS	= 130,
+	VAD_ENV_CLASS_PARAMS	= 2049,
+};

ditto

Quoted 6 lines
sound/soc/intel/platform-libs/controls_v2.h new file +6 -0
+
+#define MAX_DBG_RW_BYTES 80
+#define MAX_NUM_SCATTER_BUFFERS 8
+#define MAX_LOOP_BACK_DWORDS 8
+/* IPC base address and mailbox, timestamp offsets */
+#define SST_MAILBOX_SIZE 0x0400

sound/soc/intel/platform-libs/controls_v2.h line 96

Quoted 10 lines
sound/soc/intel/platform-libs/controls_v2.h new file +10 -0
+#define SST_MAILBOX_SEND 0x0000
+#define SST_TIME_STAMP 0x1800
+#define SST_TIME_STAMP_MRFLD 0x680
+#define SST_TIME_STAMP_BYT 0x800
+#define SST_RESERVED_OFFSET 0x1A00
+#define SST_SCU_LPE_MAILBOX 0x1000
+#define SST_LPE_SCU_MAILBOX 0x1400
+#define SST_SCU_LPE_LOG_BUF (SST_SCU_LPE_MAILBOX+16)
+#define PROCESS_MSG 0x80
+

ditto (for some of the above)

This could probably benefit from being split into smaller patches too.

Thanks !

Liam

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

author
#17 lore raw

Re: [RFC 4/4] ASoC: Intel: add support for mrfld DPCM platform

Quoted 58 lines · Liam Girdwood
Quoted 57 lines · Vinod Koul

This patch adds DPCM based supprt for managing mrfld platform

---
 sound/soc/intel/Kconfig                          |    3 +
 sound/soc/intel/platform-libs/controls_v2.h      |  754 +++++++++++++
 sound/soc/intel/platform-libs/controls_v2_dpcm.c | 1315 ++++++++++++++++++++++
 sound/soc/intel/platform-libs/sst_widgets.h      |  378 +++++++
 sound/soc/intel/platform_ipc_v2.h                |  694 ++++++++++++
 sound/soc/intel/sst-mfld-platform-compress.c     |    8 +-
 sound/soc/intel/sst-mfld-platform-pcm.c          |  384 ++++++-
 sound/soc/intel/sst-mfld-platform.h              |    2 +
 8 files changed, 3480 insertions(+), 58 deletions(-)
 create mode 100644 sound/soc/intel/platform-libs/controls_v2.h
 create mode 100644 sound/soc/intel/platform-libs/controls_v2_dpcm.c
 create mode 100644 sound/soc/intel/platform-libs/sst_widgets.h
 create mode 100644 sound/soc/intel/platform_ipc_v2.h
sound/soc/intel/Kconfig +3 -0
index 422c32d..1254eb8 100644
@@ -66,3 +66,6 @@ config SND_SOC_INTEL_MRFLD_WM8958_MACH
           used as alsa device in audio substem in Intel(R) MID devices
           Say Y if you have such a device
           If unsure select "N".
+
+config SND_INTEL_SST
+       tristate
sound/soc/intel/platform-libs/controls_v2.h new file +22 -0
new file mode 100644
index 0000000..7988d81
@@ -0,0 +1,754 @@
+/*
+ *  controls_v2.h - Intel MID Platform driver header file
+ *
+ *  Copyright (C) 2013-14 Intel Corp
+ *  Author: Ramesh Babu <[email protected]>
+ *  	Omair M Abdullah <[email protected]>
+ *  	Samreen Nilofer <[email protected]>
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; version 2 of the License.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ */
+
Quoted 8 lines

sound/soc/intel/platform-libs/controls_v2.h line 28

Quoted 6 lines
sound/soc/intel/platform-libs/controls_v2.h new file +6 -0
+#ifndef __SST_CONTROLS_V2_H__
+#define __SST_CONTROLS_V2_H__
+
+enum {
+	MERR_DPCM_AUDIO = 0,
+	MERR_DPCM_COMPR,

SST_ prefix

yes definately thats required...

Quoted 48 lines
Quoted 48 lines
sound/soc/intel/platform-libs/controls_v2.h new file +46 -0
+enum sst_cmd {
+	SBA_IDLE		= 14,
+	SBA_VB_SET_SPEECH_PATH	= 26,
+	MMX_SET_GAIN		= 33,
+	SBA_VB_SET_GAIN		= 33,
+	FBA_VB_RX_CNI		= 35,
+	MMX_SET_GAIN_TIMECONST	= 36,
+	SBA_VB_SET_TIMECONST	= 36,
+	FBA_VB_ANA		= 37,
+	FBA_VB_SET_FIR		= 38,
+	FBA_VB_SET_IIR		= 39,
+	SBA_VB_START_TONE	= 41,
+	SBA_VB_STOP_TONE	= 42,
+	FBA_VB_AEC		= 47,
+	FBA_VB_NR_UL		= 48,
+	FBA_VB_AGC		= 49,
+	FBA_VB_WNR		= 52,
+	FBA_VB_SLV		= 53,
+	FBA_VB_NR_DL		= 55,
+	SBA_PROBE		= 66,
+	MMX_PROBE		= 66,
+	FBA_VB_SET_BIQUAD_D_C	= 69,
+	FBA_VB_DUAL_BAND_COMP	= 70,
+	FBA_VB_SNS		= 72,
+	FBA_VB_SER		= 78,
+	FBA_VB_TX_CNI		= 80,
+	SBA_VB_START		= 85,
+	FBA_VB_SET_REF_LINE	= 94,
+	FBA_VB_SET_DELAY_LINE	= 95,
+	FBA_VB_BWX		= 104,
+	FBA_VB_GMM		= 105,
+	FBA_VB_GLC		= 107,
+	FBA_VB_BMF		= 111,
+	FBA_VB_DNR		= 113,
+	MMX_SET_SWM		= 114,
+	SBA_SET_SWM		= 114,
+	SBA_SET_MDRP            = 116,
+	SBA_HW_SET_SSP		= 117,
+	SBA_SET_MEDIA_LOOP_MAP	= 118,
+	SBA_SET_MEDIA_PATH	= 119,
+	MMX_SET_MEDIA_PATH	= 119,
+	FBA_VB_TNR_UL		= 119,
+	FBA_VB_TNR_DL		= 121,
+	FBA_VB_NLF		= 125,
+	SBA_VB_LPRO		= 126,
+	FBA_VB_MDRP		= 127,
Quoted 8 lines

sound/soc/intel/platform-libs/controls_v2.h line 478

Quoted 6 lines
sound/soc/intel/platform-libs/controls_v2.h new file +6 -0
+	SBA_VB_SET_FIR          = 128,
+	SBA_VB_SET_IIR          = 129,
+	SBA_SET_SSP_SLOT_MAP	= 130,
+	AWARE_ENV_CLASS_PARAMS	= 130,
+	VAD_ENV_CLASS_PARAMS	= 2049,
+};

ditto

yes will fix namespace everwhere else too...

Quoted 21 lines
Quoted 8 lines
sound/soc/intel/platform-libs/controls_v2.h new file +6 -0
+
+#define MAX_DBG_RW_BYTES 80
+#define MAX_NUM_SCATTER_BUFFERS 8
+#define MAX_LOOP_BACK_DWORDS 8
+/* IPC base address and mailbox, timestamp offsets */
+#define SST_MAILBOX_SIZE 0x0400

sound/soc/intel/platform-libs/controls_v2.h line 96

Quoted 10 lines
sound/soc/intel/platform-libs/controls_v2.h new file +10 -0
+#define SST_MAILBOX_SEND 0x0000
+#define SST_TIME_STAMP 0x1800
+#define SST_TIME_STAMP_MRFLD 0x680
+#define SST_TIME_STAMP_BYT 0x800
+#define SST_RESERVED_OFFSET 0x1A00
+#define SST_SCU_LPE_MAILBOX 0x1000
+#define SST_LPE_SCU_MAILBOX 0x1400
+#define SST_SCU_LPE_LOG_BUF (SST_SCU_LPE_MAILBOX+16)
+#define PROCESS_MSG 0x80
+

ditto (for some of the above)

Quoted 1 line

This could probably benefit from being split into smaller patches too.

Yes will try to split to more logical bits. Already did with one patch series which Mark applied. It would help review and getting applied quicker too

Signature · 1 line
~Vinod