From patchwork Thu Nov 9 14:04:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen M X-Patchwork-Id: 10051009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 565F460381 for ; Thu, 9 Nov 2017 14:05:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 498E02A9E7 for ; Thu, 9 Nov 2017 14:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DD4D2AACE; Thu, 9 Nov 2017 14:05:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1D622AAC7 for ; Thu, 9 Nov 2017 14:05:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 54A9C2677E8; Thu, 9 Nov 2017 15:05:18 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C0B3A266F89; Thu, 9 Nov 2017 15:05:15 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by alsa0.perex.cz (Postfix) with ESMTP id 3D68A2677C4 for ; Thu, 9 Nov 2017 15:05:12 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 09 Nov 2017 06:05:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,370,1505804400"; d="scan'208";a="171630710" Received: from nm-b85m-d3h.iind.intel.com ([10.223.163.12]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2017 06:05:09 -0800 From: Naveen Manohar To: alsa-devel@alsa-project.org Date: Thu, 9 Nov 2017 19:34:36 +0530 Message-Id: <1510236276-3416-3-git-send-email-naveen.m@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510236276-3416-1-git-send-email-naveen.m@intel.com> References: <1510236276-3416-1-git-send-email-naveen.m@intel.com> 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: [alsa-devel] [PATCH 2/2] ASoC: Intel: kbl: update dmic fixup params X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);