All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Jeeja KP <jeeja.kp@intel.com>
Cc: tiwai@suse.de, patches.audio@intel.com,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	liam.r.girdwood@intel.com
Subject: Applied "ASoC: Intel: Skylake: Add helper function to setup host/link dma" to the asoc tree
Date: Thu, 15 Dec 2016 12:20:44 +0000	[thread overview]
Message-ID: <E1cHV1g-0000Vr-DI@debutante> (raw)
In-Reply-To: <1481118275-30715-3-git-send-email-jeeja.kp@intel.com>

The patch

   ASoC: Intel: Skylake: Add helper function to setup host/link dma

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From ad036bdee57ab2287535fe53864bb5154e101991 Mon Sep 17 00:00:00 2001
From: Jeeja KP <jeeja.kp@intel.com>
Date: Thu, 8 Dec 2016 13:41:13 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Add helper function to setup host/link
 dma

This patch adds helper function to configure the host/link DMA when
the DMA is in decoupled mode.
Next patch adds the usage of this helper routines for configuring
DMA in Mixer event handler.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c      | 74 ++++++++++++++++++++++++++++++++++
 sound/soc/intel/skylake/skl-topology.h |  4 ++
 2 files changed, 78 insertions(+)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index aebae234152c..1abff8e1a298 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -137,6 +137,80 @@ static void skl_set_suspend_active(struct snd_pcm_substream *substream,
 		skl->supend_active--;
 }
 
+int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
+{
+	struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
+	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	unsigned int format_val;
+	struct hdac_stream *hstream;
+	struct hdac_ext_stream *stream;
+	int err;
+
+	hstream = snd_hdac_get_stream(bus, params->stream,
+					params->host_dma_id + 1);
+	if (!hstream)
+		return -EINVAL;
+
+	stream = stream_to_hdac_ext_stream(hstream);
+	snd_hdac_ext_stream_decouple(ebus, stream, true);
+
+	format_val = snd_hdac_calc_stream_format(params->s_freq,
+				params->ch, params->format, 32, 0);
+
+	dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
+		format_val, params->s_freq, params->ch, params->format);
+
+	snd_hdac_stream_reset(hdac_stream(stream));
+	err = snd_hdac_stream_set_params(hdac_stream(stream), format_val);
+	if (err < 0)
+		return err;
+
+	err = snd_hdac_stream_setup(hdac_stream(stream));
+	if (err < 0)
+		return err;
+
+	hdac_stream(stream)->prepared = 1;
+
+	return 0;
+}
+
+int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
+{
+	struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
+	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	unsigned int format_val;
+	struct hdac_stream *hstream;
+	struct hdac_ext_stream *stream;
+	struct hdac_ext_link *link;
+
+	hstream = snd_hdac_get_stream(bus, params->stream,
+					params->link_dma_id + 1);
+	if (!hstream)
+		return -EINVAL;
+
+	stream = stream_to_hdac_ext_stream(hstream);
+	snd_hdac_ext_stream_decouple(ebus, stream, true);
+	format_val = snd_hdac_calc_stream_format(params->s_freq,
+				params->ch, params->format, 24, 0);
+
+	dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
+		format_val, params->s_freq, params->ch, params->format);
+
+	snd_hdac_ext_link_stream_reset(stream);
+
+	snd_hdac_ext_link_stream_setup(stream, format_val);
+
+	list_for_each_entry(link, &ebus->hlink_list, list) {
+		if (link->index == params->link_index)
+			snd_hdac_ext_link_set_stream_id(link,
+					hstream->stream_tag);
+	}
+
+	stream->link_prepared = 1;
+
+	return 0;
+}
+
 static int skl_pcm_open(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index 405765f3a6b5..a0d3158196f0 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -385,4 +385,8 @@ int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size,
 struct skl_module_cfg *skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai,
 								int stream);
 enum skl_bitdepth skl_get_bit_depth(int params);
+int skl_pcm_host_dma_prepare(struct device *dev,
+			struct skl_pipe_params *params);
+int skl_pcm_link_dma_prepare(struct device *dev,
+			struct skl_pipe_params *params);
 #endif
-- 
2.11.0

  reply	other threads:[~2016-12-15 12:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 13:44 [PATCH v2 00/13] ASoC: Intel: Skylake: Driver updates jeeja.kp
2016-12-07 13:44 ` [PATCH v2 01/13] ASoC: Intel: Skylake: Update link_index and format in pipe params jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Update link_index and format in pipe params" to the asoc tree Mark Brown
2016-12-07 13:44 ` [PATCH v2 02/13] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
2016-12-15 12:20   ` Mark Brown [this message]
2016-12-07 13:44 ` [PATCH v2 03/13] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
2016-12-07 13:44 ` [PATCH v2 04/13] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
2016-12-07 13:44 ` [PATCH v2 05/13] ALSA: hda: check stream decoupled register state jeeja.kp
2016-12-07 13:41   ` Takashi Iwai
2016-12-08  6:31     ` Jeeja KP
2016-12-07 13:44 ` [PATCH v2 06/13] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK jeeja.kp
2016-12-07 13:44 ` [PATCH v2 07/13] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops jeeja.kp
2016-12-07 13:44 ` [PATCH v2 08/13] ASoC: Intel: Skylake: Add supply widget as non DSP widget jeeja.kp
2016-12-07 13:44 ` [PATCH v2 09/13] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine jeeja.kp
2016-12-07 13:44 ` [PATCH v2 10/13] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine jeeja.kp
2016-12-07 13:44 ` [PATCH v2 11/13] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
2016-12-07 13:44 ` [PATCH v2 12/13] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
2016-12-07 13:44 ` [PATCH v2 13/13] ASoC: hdac_hdmi: Enable pin and converter in prepare jeeja.kp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1cHV1g-0000Vr-DI@debutante \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.