Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1039049ybg; Wed, 29 Jul 2020 04:20:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYKRLox6s2DJ0da4Q8Nz2TlzeLtso721zfsBUnYlhqd504cSnz9eKIFiXuSj02zOKmJbuA X-Received: by 2002:a17:906:924d:: with SMTP id c13mr28747358ejx.518.1596021630928; Wed, 29 Jul 2020 04:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596021630; cv=none; d=google.com; s=arc-20160816; b=lb1ZPMRmnqpORuf1u6gerx79mnbyCR1A/Xet75gfRL6MYrLizXfkKvj4Fk+Zm+NrT5 vNYzlsEmqp3dC0YGBtEfNtRPTut5NiuniFrdhXfA/bpIEXhrGGiYjrbNlbC92ZIvMC/a NKy2XoPoCue9+bYa7Eov4xTVleet9LDJm1PAp3C/HzGKuM3FtCeStesbrXzDdLYUjmCI hV017vycM3s8Y+4JRdYpsEA23X+xyWzczvCMfUthwkhenzxP4suRYSrXVITkVn0VWziG CpJ4xIZoePMo798D/Srb2HSzqSapSYqqGFy+ko/zpeWuV8iTwdlguWu3FslcC7P42VcX WgWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=pm0ubHgdIBnSCi368vm85kzJbMnydtXxSxnetpUVEhk=; b=P7Itvb6ZeorQsjqNMEIeV8XJJzbBLbsBn8By6z/42hz8v2rxBg5xEg7eoUdotGJZHz j2zfqrDs9Lwwm1kGvzLYRinTeDwiUHFYAbyO9O8qjNXlq7lXEnqkP48V4m8tovvSqdYA oGKxHr4wSXHkXSzjbohwLGG6ySKar+TlrS/VWvj9LAtgJWQ1TPjP6y+EgPD5DFgTwZNA mDsBmOWfD2ADvsRx9VjZQdSVJwUqajaKqFpnB27ST2pwsAC62+OXJ1N0Bi/uxUBLDZna +O9G3nto9tX7WEwnQ8HHHu20YweqRTrTb34Dx+UPAz7buOU6NRghzWQqZPNJ0ELZSbo3 KXXA== 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 e23si890602eja.122.2020.07.29.04.20.06; Wed, 29 Jul 2020 04:20:30 -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 S1726449AbgG2LTd (ORCPT + 99 others); Wed, 29 Jul 2020 07:19:33 -0400 Received: from mga02.intel.com ([134.134.136.20]:15810 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgG2LTc (ORCPT ); Wed, 29 Jul 2020 07:19:32 -0400 IronPort-SDR: uBO9NlicRWMgH9pdShLvHfXWNGi3cM+0uoF2Ps3TG5MBCTkpwE3ary7aAsDWS0R8Oi6HM+IN2p z3sMfcLt+QcQ== X-IronPort-AV: E=McAfee;i="6000,8403,9696"; a="139410650" X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="139410650" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 04:19:32 -0700 IronPort-SDR: p88OI+P5yPX3nTPCMXDzuzWyzJRVyFyhyuhhTQHhfAbFp3LGMMp4OpFuHF7QZg/wDP0y0d3Fyp gu/tKhW/ZNgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,410,1589266800"; d="scan'208";a="312991400" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004.fm.intel.com with ESMTP; 29 Jul 2020 04:19:28 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1k0k7L-004gAn-KP; Wed, 29 Jul 2020 14:19:27 +0300 Date: Wed, 29 Jul 2020 14:19:27 +0300 From: Andy Shevchenko To: Brent Lu Cc: alsa-devel@alsa-project.org, Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , Ranjani Sridharan , linux-kernel@vger.kernel.org, Daniel Stuart , Yu-Hsuan Hsu , Guennadi Liakhovetski , Kai Vehmanen , Sam McNally , Damian van Soelen Subject: Re: [PATCH 1/2] ASoC: intel: atom: Add period size constraint Message-ID: <20200729111927.GV3703480@smile.fi.intel.com> References: <1596020585-11517-1-git-send-email-brent.lu@intel.com> <1596020585-11517-2-git-send-email-brent.lu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1596020585-11517-2-git-send-email-brent.lu@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 29, 2020 at 07:03:04PM +0800, Brent Lu wrote: > 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 Leave comma at the end. > +}; > + > +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 > -- With Best Regards, Andy Shevchenko