From patchwork Fri Jul 31 12:26:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 11694871 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A25313B6 for ; Fri, 31 Jul 2020 12:31:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E60F821744 for ; Fri, 31 Jul 2020 12:31:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="tQl+WfJF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E60F821744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EC1F216C1; Fri, 31 Jul 2020 14:30:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EC1F216C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596198706; bh=1lNOPr8kAO3gSIr2gDJJM6aJSoHF4xnhVCgWjVUjqG4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tQl+WfJFcB0h7uDpJRRVs0tIS1Y/J7pj2TmJzgnaudxHvdsj1cDqigoHkNNoBEqHd 5N4iFe88fydpUZaLbhx/QkqreAKY7Jsu/UPHh0q89Dq7JPadvyQbKpJXoJNGZVD3Lc 2IQZYEYr/tcmDNx2yz0ECck1UvGXZdcGnlry6vvc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 21B88F80161; Fri, 31 Jul 2020 14:30:56 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id C1972F8028D; Fri, 31 Jul 2020 14:30:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BD367F80171 for ; Fri, 31 Jul 2020 14:30:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BD367F80171 IronPort-SDR: yhaV3LGKlP1X1EtqHgPTPO3Jaw+N4n/MPHwlp4BYbUWexv7qtQ77tcTwQYeb0zYMpCg19kNB5c +C6jpJ5ZKjrQ== X-IronPort-AV: E=McAfee;i="6000,8403,9698"; a="131836821" X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="131836821" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2020 05:30:44 -0700 IronPort-SDR: 3ncVmCcCNj+kcfqtoxKO0Smsyp/L27d5EyoqOCNhtQ0vcZITqrgOHCAvmFVOhXoDdTpZHljAzH My9r2MEzGXwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,418,1589266800"; d="scan'208";a="365483171" Received: from brentlu-desk0.itwn.intel.com ([10.5.253.11]) by orsmga001.jf.intel.com with ESMTP; 31 Jul 2020 05:30:40 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Subject: [PATCH v3 1/2] ASoC: intel: atom: Add period size constraint Date: Fri, 31 Jul 2020 20:26:04 +0800 Message-Id: <1596198365-10105-2-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> Cc: Guennadi Liakhovetski , Cezary Rojewski , Kai Vehmanen , Kuninori Morimoto , linux-kernel@vger.kernel.org, Takashi Iwai , Jie Yang , Pierre-Louis Bossart , Liam Girdwood , Sam McNally , Mark Brown , Ranjani Sridharan , Yu-Hsuan Hsu , Daniel Stuart , Andy Shevchenko , Brent Lu , Damian van Soelen X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Use constraint to make sure the period size could always be multiple of 1ms to align with the fundamental design/limitation of firmware. Signed-off-by: Brent Lu --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 49b9f18..5f89956 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -333,6 +333,17 @@ static int sst_media_open(struct snd_pcm_substream *substream, if (ret_val < 0) return ret_val; + /* + * Make sure the period to be multiple of 1ms to align the + * design of firmware. Apply same rule to buffer size to make + * sure alsa could always find a value for period size + * regardless the buffer size given by user space. + */ + snd_pcm_hw_constraint_step(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 48); + snd_pcm_hw_constraint_step(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 48); + /* Make sure, that the period size is always even */ snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, 2);