Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1369590rwb; Fri, 5 Aug 2022 00:07:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR4QeVvZdtiFQ836LHNoaSaCjOh4K6Wo2kTxvbJozFHlcQBNjlbJe4zaOsDwHPLO2G4p8dXe X-Received: by 2002:a05:6a00:17a4:b0:52e:6e3e:a1d with SMTP id s36-20020a056a0017a400b0052e6e3e0a1dmr5476937pfg.12.1659683249031; Fri, 05 Aug 2022 00:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659683249; cv=none; d=google.com; s=arc-20160816; b=jrn1nyPA62PlBumXwVUmK9Sfxt7uVf4fDfhUK9vZ7S6weYlS+uTfAKo5mhL5jqpKM4 V18XSf6DXiAFIqkYDOg5u2dwBocTAvyYQMwTl2V49Kk6iB1e0prRou58NWHsO8+T2OSG Rh+tDrC5Q8aSZl1vnMiIcq1fCeV/XI1LGiSHqamSvEoUcfH4+JSWR91h1jNuBs+TqLId lb3TaBMbLlzZzlAXdojo22vWFCg5Eme7tPDLAneGavCbSigPA3BQm3CrXYQFvbBE014O RR6w8I2uC6l1xnr3kQfdOXim9CcIT5r9w8kUz5GT0X3hQztZqishR8uj72jXod1c7KUA saCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=ztyilUAIN4MBXn8iVhvnWVDME5fqULsyOJ6YSDe40Oo=; b=ng6LxV07OgjctktYoIdbDt4w/1AyTmlnw3p8ZyIJm6wxftcVymboAo/e/mWMo/STs+ ReTaCtp+JLX+rYHvTuxUi2BTofVgiZ9+xMqmrJB6/9G4qTyxMEcm0pmSEvVGogJ+Mp2H 4YYV4pmkItDvIjAbFrDeynOP4OBBCU7+jEzmYQHUPJ5g0h9SWACbXTnhLdiefvm/6BoY NOgnQdBLP+Wplxwh9/+RvpXoM9180JupWpvlVMfhjk9t2Advm5wYSYxsWFmp78p32cK/ BxiSvDIxcDkX/yYv9SuQUgZnti2iRQgYTFMX4CFZAFM3oOZgJKiXR9V/Cb4UZoDWvgZk c5hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020a170902da8b00b0016dba016f15si4084430plx.227.2022.08.05.00.07.15; Fri, 05 Aug 2022 00:07:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240009AbiHEHCR (ORCPT + 99 others); Fri, 5 Aug 2022 03:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231528AbiHEHCP (ORCPT ); Fri, 5 Aug 2022 03:02:15 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34462248C7 for ; Fri, 5 Aug 2022 00:02:13 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 92BE71A1929; Fri, 5 Aug 2022 09:02:12 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 679611A1912; Fri, 5 Aug 2022 09:02:12 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id E4C6A180031C; Fri, 5 Aug 2022 15:02:10 +0800 (+08) From: Shengjiu Wang To: nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, shengjiu.wang@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl_sai: Update slots number according to bclk_ratio Date: Fri, 5 Aug 2022 14:45:26 +0800 Message-Id: <1659681926-13493-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The bclk_ratio is set by .set_bclk_ratio API. bclk_ratio = slots * slot_width So if slots is not set by .set_tdm_slot, then it can be calculated by bclk_ratio. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_sai.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 7523bb944b21..acf76ea21138 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -535,12 +535,14 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, u32 pins, bclk; int ret, i; - if (sai->slots) - slots = sai->slots; - if (sai->slot_width) slot_width = sai->slot_width; + if (sai->slots) + slots = sai->slots; + else if (sai->bclk_ratio) + slots = sai->bclk_ratio / slot_width; + pins = DIV_ROUND_UP(channels, slots); /* -- 2.17.1