From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26892C433E0 for ; Wed, 29 Jul 2020 11:10:04 +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 9F7802076E for ; Wed, 29 Jul 2020 11:10:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="O3u+rPKy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F7802076E 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 2886516E6; Wed, 29 Jul 2020 13:09:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2886516E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596021002; bh=TzSyS/8ZTCf+2AcaYlnspjOhQyWGxtY/lfD6N//xNcY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=O3u+rPKy5qriIQX96Ygc5SYQibOpSWN4fs2ej6mqTP0cc22TpL3Ky+9/fNCjejZ+P rdPwcgSnySli3Nx4JtZxf+2jzW4tczWblZtS499ALVHgCMnyOg1ySlt7G/guI2HLvw TZzy91rKoptwFby/epI6XrvJNwvgZeDGuwmdKcQI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E7B05F801ED; Wed, 29 Jul 2020 13:08:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AAB73F801ED; Wed, 29 Jul 2020 13:08:24 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 F189DF801D9 for ; Wed, 29 Jul 2020 13:08:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F189DF801D9 IronPort-SDR: JsaHRNXzj5OeF7FQTo6sjatntoVf5pe44N1AW3mZphFNq2mnagkyAQq0vBH/SzU7ZwlrOmp0uZ ufmZ8klYH5eA== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="152630213" X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="152630213" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 04:08:09 -0700 IronPort-SDR: AO3PU3+cTojgJG5rY8AxheuIRFa8c/s1CriqdfLJlNmCXd1k+jDSYx07EzR4Jf0KMfS0YUkL9L idfCemrmoRLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="490254770" Received: from brentlu-desk0.itwn.intel.com ([10.5.253.11]) by fmsmga006.fm.intel.com with ESMTP; 29 Jul 2020 04:08:04 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Subject: [PATCH 1/2] ASoC: intel: atom: Add period size constraint Date: Wed, 29 Jul 2020 19:03:04 +0800 Message-Id: <1596020585-11517-2-git-send-email-brent.lu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596020585-11517-1-git-send-email-brent.lu@intel.com> References: <1596020585-11517-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 enforce the period sizes which are validated in Android BSP. Signed-off-by: Brent Lu --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 15 +++++++++++++++ 1 file changed, 15 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..f614651 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -300,6 +300,16 @@ static void power_down_sst(struct sst_runtime_stream *stream) stream->ops->power(sst->dev, false); } +static const unsigned int media_period_size[] = { + /* sizes validated on Android platform */ + 240, 320, 960, 3072 +}; + +static const struct snd_pcm_hw_constraint_list constraints_media_period_size = { + .count = ARRAY_SIZE(media_period_size), + .list = media_period_size, +}; + static int sst_media_open(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -333,6 +343,11 @@ static int sst_media_open(struct snd_pcm_substream *substream, if (ret_val < 0) return ret_val; + /* Avoid using period size which is not validated */ + snd_pcm_hw_constraint_list(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + &constraints_media_period_size); + /* Make sure, that the period size is always even */ snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, 2); -- 2.7.4