Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2612517ybg; Fri, 31 Jul 2020 05:32:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2J13Ua3UXrsv60FWf28l3WkqOBPOIbXd9vSGbXUYW3x9/zQcWt+MlNgyDpNqqNJKmcdk8 X-Received: by 2002:a17:906:2a41:: with SMTP id k1mr3818144eje.300.1596198735311; Fri, 31 Jul 2020 05:32:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596198735; cv=none; d=google.com; s=arc-20160816; b=0RtFjDvw4xJaibZd7ONBt7ykBYtpX0Q/Gkv31JT7V+xwNIpZ4kg00kbwh4BKjxQsAl BnkEnjlRjrYi4oP58AByw4xHie0blEPqf7mXeIRJjHGGqngJnzvi3kALFG7SIeTg8fMP nhBoFaFs0p+U93n3a8IzySkUNxTRYjTWoaQN5m49YhRKuDg4Hwm7Thqv0dmNPiCm5Kz2 me1ehLJwTpezGVaTf5FNCoPPn3NmPFPI/9xOIW1yRCSMyF3chJ6AuhXooP4eu3oRC1C8 8FBUlyrxlXbaguiV45S9DtrXn+P9Rmp3ymI2S+UzmrVVGXJWYwSHzMjp++Rn0dzSAdGN 3jrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=ADNNWX03FGBFRIj82zG+I4Ry90XZFWJPLi0fWOwe+24=; b=xH9663/le9/wKoyNKJwMZoLR2cJ4wpPWCQZmn6PYuwwAAROB0YmNO+3v2wyqrJXwwl i7OyQkQuiT0HVf3/iQIFDwtYhwdXXu31BbXfQ4ESa5v+WPSstEwRWzxgndBdwoAS0Vo7 PRStVW09+fNDHk8lvthdU54K0N2NKZzmU2FaSuHXOMSfZVSN8Q08Ax6Yf3nprADqAlY+ R8eEZ3QSPWGY3wqZYxattFwXW0LU5FNGRTgbQsw9XHFPQRZiYF/0d9Z0EskUO6l8QF1x LEU7U5xVJQfffg6PyP9XTiGg7k1M6yPTXorrVlsCmeoFn2ZZbkwVLRJfW4jwmrio/vYR If7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si1265249ejc.710.2020.07.31.05.31.52; Fri, 31 Jul 2020 05:32:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733217AbgGaMau (ORCPT + 99 others); Fri, 31 Jul 2020 08:30:50 -0400 Received: from mga05.intel.com ([192.55.52.43]:14340 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733165AbgGaMat (ORCPT ); Fri, 31 Jul 2020 08:30:49 -0400 IronPort-SDR: qso0NXiYmIYGRL9sBAHvzKYD5ogzs9Nur3tYLTSv/lTFVh/Y/SuxSrevimSWY1F9eH99QCQLBE H8H165BaG7oQ== X-IronPort-AV: E=McAfee;i="6000,8403,9698"; a="236630446" X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="236630446" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2020 05:30:49 -0700 IronPort-SDR: tBj6JDEK8ejNGpSr8gZ1dVM+t2WX/vR5FImmYsuAiPYGCPcU5PYRFf+B24IFK6YaDH71gxt5Z9 cZmfCbwdAmtQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="365483191" Received: from brentlu-desk0.itwn.intel.com ([10.5.253.11]) by orsmga001.jf.intel.com with ESMTP; 31 Jul 2020 05:30:45 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Cc: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , Ranjani Sridharan , Brent Lu , linux-kernel@vger.kernel.org, Daniel Stuart , Andy Shevchenko , Yu-Hsuan Hsu , Guennadi Liakhovetski , Kai Vehmanen , Sam McNally , Damian van Soelen Subject: [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board Date: Fri, 31 Jul 2020 20:26:05 +0800 Message-Id: <1596198365-10105-3-git-send-email-brent.lu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596198365-10105-1-git-send-email-brent.lu@intel.com> References: <1596020585-11517-1-git-send-email-brent.lu@intel.com> <1596198365-10105-1-git-send-email-brent.lu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yu-Hsuan Hsu The CRAS server does not set the period size in hw_param so ALSA will calculate a value for period size which is based on the buffer size and other parameters. The value may not always be aligned with Atom's dsp design so a constraint is added to make sure the board always has a good value. Cyan uses chtmax98090 and others(banon, celes, edgar, kefka...) use rt5650. Signed-off-by: Yu-Hsuan Hsu Signed-off-by: Brent Lu --- sound/soc/intel/boards/cht_bsw_max98090_ti.c | 14 +++++++++++++- sound/soc/intel/boards/cht_bsw_rt5645.c | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c index 835e9bd..bf67254 100644 --- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c +++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c @@ -283,8 +283,20 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, static int cht_aif1_startup(struct snd_pcm_substream *substream) { - return snd_pcm_hw_constraint_single(substream->runtime, + int err; + + /* Set period size to 240 to align with Atom design */ + err = snd_pcm_hw_constraint_minmax(substream->runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 240, 240); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_single(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, 48000); + if (err < 0) + return err; + + return 0; } static int cht_max98090_headset_init(struct snd_soc_component *component) diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index b53c024..6e62f0d 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -414,8 +414,20 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd, static int cht_aif1_startup(struct snd_pcm_substream *substream) { - return snd_pcm_hw_constraint_single(substream->runtime, + int err; + + /* Set period size to 240 to align with Atom design */ + err = snd_pcm_hw_constraint_minmax(substream->runtime, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 240, 240); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_single(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, 48000); + if (err < 0) + return err; + + return 0; } static const struct snd_soc_ops cht_aif1_ops = { -- 2.7.4