Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1031229ybg; Wed, 29 Jul 2020 04:08:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV+eTjQF0caw0BY/Zat4nebaCkqftujuN6958Jw/lYuDYpd1NAB9vPfYRNir33TwQn6JOk X-Received: by 2002:a17:906:2490:: with SMTP id e16mr18161232ejb.386.1596020933948; Wed, 29 Jul 2020 04:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596020933; cv=none; d=google.com; s=arc-20160816; b=z0ZBcjB+/HKLwmVqIzfGXESHAzyUqq4YRugBjKz0nUn1qyhxMoHrGCyJI6kXxp2RYx LZ+qhrJ9P4dQNwMN9aqTNI5UP4grNZbseKBiHgaI4GNsfD0Y/ErLPC74VqqyaraXRVOZ K1gkMIMnpvGKbtDFfaLbT5/n2SjS4AudJVH74aduP/Yxcx4t4kgzHNRt2DdnVsvDkfSR zdz/ZMDpIibr2/3gnJfUbQ9wQijQInWV/Dvm23KJgNvSjWXALY4+h6NPwVypTMzSbo7v aHc97K6hfX5/PJJvpGqiBVAI2mNPmjzQ9D8K+nl8pVBw2fT/ECtYLKXVWrbWaSAZzQJW voeA== 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=YHvLc9wuD/FsyGB77AlwHEddvDSkqNGH2KzuwDym69I=; b=btOTRxR3nx0sfa9/XI7mUxrMTsUBC7IVcBZRfY4ZN42QQknSX+7OVtstuhAWPz207P /dPbj2BJ+hgEEKtQdV6/rMbijW8wLqAH4f6OazOx1B/7ClOe35cZf+9Kev7WYqgOWh+S jXZU5fUtrjsGB2wwinCzJCVzfInn+TeN+fblIG08IkabU3+FXQTw9jJa7UPggQRw6rPK 29nkcdUzJS90LWOyA7uxwCbfKRci37Cmpf+1uaMgxU6Gi6+QuUG5MbkYNUwNgMr8t2sG yM6d983VFThoB3PJruCuuPLeINOGJ5rR2h6SmUsZbxThjwN1wiMYH6pzqvE/kErQZZIc YM9Q== 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 g6si1072908edl.330.2020.07.29.04.08.31; Wed, 29 Jul 2020 04:08:53 -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 S1726707AbgG2LIJ (ORCPT + 99 others); Wed, 29 Jul 2020 07:08:09 -0400 Received: from mga09.intel.com ([134.134.136.24]:16189 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbgG2LIJ (ORCPT ); Wed, 29 Jul 2020 07:08:09 -0400 IronPort-SDR: oYquUDkkdU9+j9LoxlYAdLR1PpJOqcL7yKhed6OfAuS0zWxTSt0y6M16Lu5W8WGvl4QKDARWCs trq+OD7oIxGQ== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="152630212" X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="152630212" 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 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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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