From patchwork Thu Jul 30 08:13:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 11692479 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 1F6426C1 for ; Thu, 30 Jul 2020 08:19:52 +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 A787F2074B for ; Thu, 30 Jul 2020 08:19:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="LMwRCbch" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A787F2074B 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 31A9D1770; Thu, 30 Jul 2020 10:19:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 31A9D1770 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596097190; bh=hq2SoT39gabgZPtzelejazXBJuBf8IU3oTF+N87Mgeo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LMwRCbchADn4CihZw2QaX4NQ4+5Qzxz6WGaevQZ0Ekj5mCLWfMzTMtpIuFbClDcAW 1gMQ+qGe3xwwDBwy5hSIFEgu1HI83VzIGbeYT6HBTbMwdQfXQF3zTzuMtsyPpDhiRW Kt+60tz/CwBp1DKPYtyrMWIzTZeCqVSpSzyp6yNg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AFE80F8027B; Thu, 30 Jul 2020 10:18:31 +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 0EC09F8028D; Thu, 30 Jul 2020 10:18:30 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 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 06A70F8012F for ; Thu, 30 Jul 2020 10:18:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 06A70F8012F IronPort-SDR: 8d2l07jjCRIVi+jqh0JZueLYHNr/3CoSmH9DXbYS5IPzubF75C/Cdsamqv0yIn1Ye1LmkjVZlX 7zmtxaISyLMQ== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="152784364" X-IronPort-AV: E=Sophos;i="5.75,413,1589266800"; d="scan'208";a="152784364" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2020 01:18:19 -0700 IronPort-SDR: k0kGGPm0otlYqoP7r1Zz2We7YFrNk5rK8v6oAb+SU6HippbZesdgZMt2V/i2BuuFOUrIfeHDqd 7dvdEoZrLqpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,413,1589266800"; d="scan'208";a="272863433" Received: from brentlu-desk0.itwn.intel.com ([10.5.253.11]) by fmsmga007.fm.intel.com with ESMTP; 30 Jul 2020 01:18:15 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Subject: [PATCH v2 1/2] ASoC: intel: atom: Add period size constraint Date: Thu, 30 Jul 2020 16:13:34 +0800 Message-Id: <1596096815-32043-2-git-send-email-brent.lu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596096815-32043-1-git-send-email-brent.lu@intel.com> References: <1596096815-32043-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..70100ef 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); From patchwork Thu Jul 30 08:13:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Lu X-Patchwork-Id: 11692481 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 B0F5D14E3 for ; Thu, 30 Jul 2020 08:20:40 +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 4777520809 for ; Thu, 30 Jul 2020 08:20:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="DEs1jZig" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4777520809 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 C9850176A; Thu, 30 Jul 2020 10:19:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C9850176A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596097238; bh=CyJ0Xsmhq/iB6sLmlnOWDOpEeUlTFnjHlr2D9JGNuvs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DEs1jZigR6Pc6xkxhOxg+5hfZ5Kd99Q2Hms4xmS7R3YbvxytBP+KRAzo9EWYdagt7 cTNDQNOkYxf1Hj7ao9QG0GSLekCApVSflVcj/G6rmhGNl/rlmFodwqW9zBcLai9v5b PCRjzpZuvdTc+2WkwjUGwIkEYTrYnlcsvmO5uNtM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6A78DF802DB; Thu, 30 Jul 2020 10:18:42 +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 EB6CFF802DC; Thu, 30 Jul 2020 10:18:40 +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_PASS,SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 CD992F802C2 for ; Thu, 30 Jul 2020 10:18:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CD992F802C2 IronPort-SDR: pJj3gkq1YmLDjODkNYngFyEEKwHsqHEOg4vL1YMQeRCswxYD7qEk6O8kmN4CaNNqHQfG1K5V9C sYulpY4ATG9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="131117820" X-IronPort-AV: E=Sophos;i="5.75,413,1589266800"; d="scan'208";a="131117820" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2020 01:18:25 -0700 IronPort-SDR: 1fVS2jg0dgV/a8QpBMPaWqGS1VfFv14PttNzgl6lt8t/13HJslfgDb43NLnV9KyKTuywB3y7nw aZMAT4cvVGVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,413,1589266800"; d="scan'208";a="272863448" Received: from brentlu-desk0.itwn.intel.com ([10.5.253.11]) by fmsmga007.fm.intel.com with ESMTP; 30 Jul 2020 01:18:21 -0700 From: Brent Lu To: alsa-devel@alsa-project.org Subject: [PATCH v2 2/2] ASoC: Intel: Add period size constraint on strago board Date: Thu, 30 Jul 2020 16:13:35 +0800 Message-Id: <1596096815-32043-3-git-send-email-brent.lu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596096815-32043-1-git-send-email-brent.lu@intel.com> References: <1596096815-32043-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" 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 = {