Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Naveen Manohar <naveen.m@intel.com>
To: alsa-devel@alsa-project.org
Cc: vinod.koul@intel.com, liam.r.girdwood@linux.intel.com,
	tiwai@suse.de, broonie@kernel.org, naveen.m@intel.com,
	pierre-louis.bossart@intel.com
Subject: [PATCH 2/2] ASoC: Intel: kbl: update dmic fixup params
Date: Thu,  9 Nov 2017 19:34:36 +0530	[thread overview]
Message-ID: <1510236276-3416-3-git-send-email-naveen.m@intel.com> (raw)
In-Reply-To: <1510236276-3416-1-git-send-email-naveen.m@intel.com>

Update dmic fixup params to always expose QUAD channel capture
device, enabling User-space to control channel count.
Assign min and max channel only based on input hw_params.

Signed-off-by: Naveen Manohar <naveen.m@intel.com>
---
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c
index 661f164..27c8cf3 100644
--- a/sound/soc/intel/boards/kbl_rt5663_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c
@@ -33,9 +33,9 @@
 #define DMIC_CH(p) p->list[p->count-1]
 #define MAXIM_DEV0_NAME "i2c-MX98927:00"
 #define MAXIM_DEV1_NAME "i2c-MX98927:01"
+#define QUAD_CHANNEL 4
 
 static struct snd_soc_card *kabylake_audio_card;
-static const struct snd_pcm_hw_constraint_list *dmic_constraints;
 static struct snd_soc_jack skylake_hdmi[3];
 
 struct kbl_hdmi_pcm {
@@ -305,6 +305,16 @@ static int kabylake_5663_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
 	.mask = 0,
 };
 
+static const unsigned int channels_quad[] = {
+	QUAD_CHANNEL,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_channels_quad = {
+	.count = ARRAY_SIZE(channels_quad),
+	.list = channels_quad,
+	.mask = 0,
+};
+
 static int kbl_fe_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
@@ -382,7 +392,7 @@ static int kabylake_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
 	struct snd_interval *channels = hw_param_interval(params,
 				SNDRV_PCM_HW_PARAM_CHANNELS);
 
-	if (params_channels(params) == 2 || DMIC_CH(dmic_constraints) == 2)
+	if (params_channels(params) == 2)
 		channels->min = channels->max = 2;
 	else
 		channels->min = channels->max = 4;
@@ -394,9 +404,9 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 
-	runtime->hw.channels_max = DMIC_CH(dmic_constraints);
+	runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
-			dmic_constraints);
+			&constraints_channels_quad);
 
 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
 			SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
-- 
1.9.1

  parent reply	other threads:[~2017-11-09 14:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 14:04 [PATCH 0/2] ASoC: Intel: kbl: update dmic fixup params Naveen Manohar
2017-11-09 14:04 ` [PATCH 1/2] ASoC: Intel: kbl: Remove option of choosing CH count based on pdata Naveen Manohar
2017-11-16 11:48   ` Mark Brown
2017-11-09 14:04 ` Naveen Manohar [this message]
2017-11-15  4:55 ` [PATCH 0/2] ASoC: Intel: kbl: update dmic fixup params Vinod Koul
  -- strict thread matches above, loose matches on Subject: below --
2021-02-18 12:31 [PATCH 0/2] dmic fix to allow userspace to choose ch count vamshi.krishna.gopal
2021-02-18 12:31 ` [PATCH 2/2] ASoC: Intel: kbl: update dmic fixup params vamshi.krishna.gopal

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=1510236276-3416-3-git-send-email-naveen.m@intel.com \
    --to=naveen.m@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox