All of lore.kernel.org
 help / color / mirror / Atom feed
From: yang.a.fang@intel.com
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: alsa-devel@alsa-project.org, rohit.m.ainapure@intel.com,
	james.ausmus@intel.com, vinod.koul@intel.com,
	joe.konno@intel.com, yang.a.fang@intel.com,
	sathyanarayana.nujella@intel.com, jeeja.kp@intel.com,
	vedang.patel@intel.com, yong.zhi@intel.com
Subject: [PATCH 6/8] ASoc: Intel: boards: update constraints for nau88l25_ssm4567 machine
Date: Fri, 11 Dec 2015 11:29:11 -0800	[thread overview]
Message-ID: <1449862153-68738-6-git-send-email-yang.a.fang@intel.com> (raw)
In-Reply-To: <1449862153-68738-1-git-send-email-yang.a.fang@intel.com>

From: Yong Zhi <yong.zhi@intel.com>

We have specific constraints for FE device (48KHz, stereo, 16
bits) and fixups for BE DMIC links (2 or 4 ch), so add those.

Also add one more FE DAIlink for dmiccap

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
---
 sound/soc/intel/boards/skl_nau88l25_ssm4567.c |  136 +++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/sound/soc/intel/boards/skl_nau88l25_ssm4567.c b/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
index 8aa821c..1b54613 100644
--- a/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
+++ b/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
@@ -192,6 +192,65 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
 	return ret;
 }
 
+static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_dapm_context *dapm;
+	struct snd_soc_component *component = rtd->cpu_dai->component;
+
+	dapm = snd_soc_component_get_dapm(component);
+	snd_soc_dapm_ignore_suspend(dapm, "Reference Capture");
+
+	return 0;
+}
+
+static unsigned int rates[] = {
+	48000,
+};
+
+static struct snd_pcm_hw_constraint_list constraints_rates = {
+	.count = ARRAY_SIZE(rates),
+	.list  = rates,
+	.mask = 0,
+};
+
+static unsigned int channels[] = {
+	2,
+};
+
+static struct snd_pcm_hw_constraint_list constraints_channels = {
+	.count = ARRAY_SIZE(channels),
+	.list = channels,
+	.mask = 0,
+};
+
+static int skl_fe_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	/*
+	 * on this platform for PCM device we support,
+	 *	48Khz
+	 *	stereo
+	 *	16 bit audio
+	 */
+
+	runtime->hw.channels_max = 2;
+	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+					   &constraints_channels);
+
+	runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+	snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16);
+
+	snd_pcm_hw_constraint_list(runtime, 0,
+				SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
+
+	return 0;
+}
+
+static const struct snd_soc_ops skylake_nau8825_fe_ops = {
+	.startup = skl_fe_startup,
+};
+
 static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 			struct snd_pcm_hw_params *params)
 {
@@ -211,6 +270,19 @@ static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
+static int skylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *channels = hw_param_interval(params,
+						SNDRV_PCM_HW_PARAM_CHANNELS);
+	if (params_channels(params) == 2)
+		channels->min = channels->max = 2;
+	else
+		channels->min = channels->max = 4;
+
+	return 0;
+}
+
 static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params)
 {
@@ -231,6 +303,52 @@ static struct snd_soc_ops skylake_nau8825_ops = {
 	.hw_params = skylake_nau8825_hw_params,
 };
 
+static unsigned int channels_dmic[] = {
+	2, 4,
+};
+
+static struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
+	.count = ARRAY_SIZE(channels_dmic),
+	.list = channels_dmic,
+	.mask = 0,
+};
+
+static int skylake_dmic_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	runtime->hw.channels_max = 4;
+	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+			&constraints_dmic_channels);
+
+	return snd_pcm_hw_constraint_list(substream->runtime, 0,
+			SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
+}
+
+static struct snd_soc_ops skylake_dmic_ops = {
+	.startup = skylake_dmic_startup,
+};
+
+static unsigned int rates_16000[] = {
+	16000,
+};
+
+static struct snd_pcm_hw_constraint_list constraints_16000 = {
+	.count = ARRAY_SIZE(rates_16000),
+	.list  = rates_16000,
+};
+
+static int skylake_refcap_startup(struct snd_pcm_substream *substream)
+{
+	return snd_pcm_hw_constraint_list(substream->runtime, 0,
+			SNDRV_PCM_HW_PARAM_RATE,
+			&constraints_16000);
+}
+
+static struct snd_soc_ops skylaye_refcap_ops = {
+	.startup = skylake_refcap_startup,
+};
+
 /* skylake digital audio interface glue - connects codec <--> CPU */
 static struct snd_soc_dai_link skylake_dais[] = {
 	/* Front End DAI links */
@@ -243,9 +361,11 @@ static struct snd_soc_dai_link skylake_dais[] = {
 		.codec_name = "snd-soc-dummy",
 		.codec_dai_name = "snd-soc-dummy-dai",
 		.nonatomic = 1,
+		.init = skylake_nau8825_fe_init,
 		.trigger = {
 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
 		.dpcm_playback = 1,
+		.ops = &skylake_nau8825_fe_ops,
 	},
 	{
 		.name = "Skl Audio Capture Port",
@@ -259,6 +379,7 @@ static struct snd_soc_dai_link skylake_dais[] = {
 		.trigger = {
 			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
 		.dpcm_capture = 1,
+		.ops = &skylake_nau8825_fe_ops,
 	},
 	{
 		.name = "Skl Audio Reference cap",
@@ -272,6 +393,20 @@ static struct snd_soc_dai_link skylake_dais[] = {
 		.ignore_suspend = 1,
 		.nonatomic = 1,
 		.dynamic = 1,
+		.ops = &skylaye_refcap_ops,
+	},
+	{
+		.name = "Skl Audio DMIC cap",
+		.stream_name = "dmiccap",
+		.cpu_dai_name = "DMIC Pin",
+		.codec_name = "snd-soc-dummy",
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.platform_name = "0000:00:1f.3",
+		.init = NULL,
+		.dpcm_capture = 1,
+		.nonatomic = 1,
+		.dynamic = 1,
+		.ops = &skylake_dmic_ops,
 	},
 	/* Back End DAI links */
 	{
@@ -317,6 +452,7 @@ static struct snd_soc_dai_link skylake_dais[] = {
 		.codec_dai_name = "dmic-hifi",
 		.platform_name = "0000:00:1f.3",
 		.ignore_suspend = 1,
+		.be_hw_params_fixup = skylake_dmic_fixup,
 		.dpcm_capture = 1,
 		.no_pcm = 1,
 	},
-- 
1.7.9.5

  parent reply	other threads:[~2015-12-11 19:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 19:29 [PATCH 1/8] ASoC: max98357a: Add ACPI ID for Maxim yang.a.fang
2015-12-11 19:29 ` [PATCH 2/8] ASoC: Intel: Add Nuvoton+Maxim machine driver entry yang.a.fang
2015-12-18 12:15   ` Applied "ASoC: Intel: Add Nuvoton+Maxim machine driver entry" to the asoc tree Mark Brown
2015-12-11 19:29 ` [PATCH 3/8] ASoC: Intel: Skylake: Add Nuvoton Maxim machine driver yang.a.fang
2015-12-18 12:15   ` Applied "ASoC: Intel: Skylake: Add Nuvoton Maxim machine driver" to the asoc tree Mark Brown
2015-12-21  1:36   ` [PATCH 3/8] ASoC: Intel: Skylake: Add Nuvoton Maxim machine driver Anatol Pomozov
2015-12-21 18:18     ` Fang, Yang A
2015-12-11 19:29 ` [PATCH 4/8] ASoc: Intel: boards: fix dapm map of nau88l25_ssm4567 machine yang.a.fang
2015-12-18 12:15   ` Applied "ASoc: Intel: boards: fix dapm map of nau88l25_ssm4567 machine" to the asoc tree Mark Brown
2015-12-11 19:29 ` [PATCH 5/8] ASoc: Intel: boards: update ignore suspend for nau88l25_ssm4567 machine yang.a.fang
2015-12-18 12:15   ` Applied "ASoc: Intel: boards: update ignore suspend for nau88l25_ssm4567 machine" to the asoc tree Mark Brown
2015-12-11 19:29 ` yang.a.fang [this message]
2015-12-18 12:15   ` Applied "ASoc: Intel: boards: update constraints " Mark Brown
2015-12-11 19:29 ` [PATCH 7/8] ASoc: Intel: boards: Add WOV as sink for nau88l25_ssm4567 machine yang.a.fang
2015-12-18 12:15   ` Applied "ASoc: Intel: boards: Add WOV as sink for nau88l25_ssm4567 machine" to the asoc tree Mark Brown
2015-12-11 19:29 ` [PATCH 8/8] ASoc: Intel: boards: Add HDMI/DP links for nau88l25_ssm4567 machine yang.a.fang
2015-12-18 12:15   ` Applied "ASoc: Intel: boards: Add HDMI/DP links for nau88l25_ssm4567 machine" to the asoc tree Mark Brown
2015-12-18 12:15 ` Applied "ASoC: max98357a: Add ACPI ID for Maxim" " Mark Brown

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=1449862153-68738-6-git-send-email-yang.a.fang@intel.com \
    --to=yang.a.fang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=james.ausmus@intel.com \
    --cc=jeeja.kp@intel.com \
    --cc=joe.konno@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=rohit.m.ainapure@intel.com \
    --cc=sathyanarayana.nujella@intel.com \
    --cc=vedang.patel@intel.com \
    --cc=vinod.koul@intel.com \
    --cc=yong.zhi@intel.com \
    /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.