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=-2.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 A8839CA9EBC for ; Fri, 25 Oct 2019 06:55:47 +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 36ECF20867 for ; Fri, 25 Oct 2019 06:55:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="NmtMQ4V+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MD7VplAM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36ECF20867 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 6695E1757; Fri, 25 Oct 2019 08:54:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6695E1757 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1571986545; bh=a6IYVujwJA7EAORVvJLOIDhQh5nq6ZsBru9HlbQLNEI=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NmtMQ4V+/zEve3GYBgw6mW9cQKAsYHAPHtfScl/fsBuRUdHYcNjpy8pYg08iQW53p GY8pyoPONvJ91ojsbs4/6pHQqEgxgWzThTnhsFoLnzuHaLD3RDcVK/waOJ83rrIpj/ xQp4DTVq8Pihg40LcWEggYIoR/+9nlfpdq+ocZAw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 02EBFF80274; Fri, 25 Oct 2019 08:54:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E9036F803A6; Fri, 25 Oct 2019 08:54:52 +0200 (CEST) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4B571F80274 for ; Fri, 25 Oct 2019 08:54:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4B571F80274 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MD7VplAM" Received: by mail-pg1-x529.google.com with SMTP id u23so924647pgo.0 for ; Thu, 24 Oct 2019 23:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=m+VkYOgB7cCdSZGNDZmPasUQ1M1DmEk9SPAL9l8GP1A=; b=MD7VplAMSnE6eBcOxhBncJ1w7gZgL2vajru9wAqudsdqaQdHSjaosigKCexVhSgoKE Nq9j/jeyMN+LeTVVmmAoP0z/DFE4hUYz9NCVTZMKqbSqX+i3ZAtgwb7gGHg+p4X7+TEo 3kiESUbManeemJ3xCExgKIBZWb6+cHq4shtvyoPft8qTN7pMtV8ZWbnQUD2XM4XdY7Rv loSwM9UinPzIrmZwAFqKpGadpFiLSvlbq7vDyppqk/Uv5sf04RsliKidoTQAgdRVtUfz RAZdpGYb6zsW5Uu31WIZHN9C6A5UeFjipvLod8tVE4H1EvCHExEQKbX315/EAQDHfeGM 9Nyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=m+VkYOgB7cCdSZGNDZmPasUQ1M1DmEk9SPAL9l8GP1A=; b=V47hg0W3O8ywVUOBrAk3IHrxicOjRFsIU8p9jOyJkA0zqsoTHodVw15Wt3SHvLgRIh LhH8WKm7pkfUBgmGhmsx/fKWget1DxGBLevRppJ5LcNl3XJteLluOBmw4XL6/rSYjvFZ iR3q0ZFogYV4mkmMfTMjSNWwUMpHKVk4iIQPmF40r9Xhzl03m/dDgtksPuQhr66eVnXY puqz7igrPD3rtWzs5SN/VGKTppBMNZfYsbuCPJxkh9CR9kI6MOmymTu1BGcswDB6RNjK 7XXtws9Kfu+e40pGY5nI3ZlLuo52DMmivIE/ssUYDqgSF/CE2RV3r1ADxFcGEPPkHRmd yPvg== X-Gm-Message-State: APjAAAUsnmqGcpBtZ41KnENLWcYJqzGfqVuEOuB3Jr9suCC7A/cnWeOu 5hYbWY/8eH8BoDon+FG0almJOH/L X-Google-Smtp-Source: APXvYqwQ2i3psJ0yIsvpXC4E8x2YWCDuJQPZ1N62DtBq1Tv3B55wCjarX0d9MG67laCjyfLsu1WfCA== X-Received: by 2002:a17:90a:fe04:: with SMTP id ck4mr2048608pjb.90.1571986487460; Thu, 24 Oct 2019 23:54:47 -0700 (PDT) Received: from Asurada (c-73-162-191-63.hsd1.ca.comcast.net. [73.162.191.63]) by smtp.gmail.com with ESMTPSA id d14sm1800708pfh.36.2019.10.24.23.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Oct 2019 23:54:47 -0700 (PDT) Date: Thu, 24 Oct 2019 23:54:34 -0700 From: Nicolin Chen To: "S.j. Wang" Message-ID: <20191025065433.GA4632@Asurada> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: "alsa-devel@alsa-project.org" , "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "linuxppc-dev@lists.ozlabs.org" , "tiwai@suse.com" , "lgirdwood@gmail.com" , "broonie@kernel.org" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" Subject: Re: [alsa-devel] [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, Oct 25, 2019 at 05:33:17AM +0000, S.j. Wang wrote: > > > > > + pair_err("The divider can't be used for non ideal mode\n"); > > > > > + return -EINVAL; > > > > > + } > > > > > + > > > > > + /* Divider range is [1, 1024] */ > > > > > + div[IN] = min_t(u32, 1024, div[IN]); > > > > > + div[OUT] = min_t(u32, 1024, div[OUT]); > > > > > > > > Hmm, this looks like we want to allow ideal ratio cases and p2p > > > > cases to operate any way, even if the divider wasn't within the > > > > range to get the in/out rates from the output clock? > > > > > > Yes. We still allow the p2p = true, ideal = false. Note that p2p is > > > not Equal to ideal. > > > > Got it. > > > > Overall, I feel it's better to have a naming to state the purpose of using > > ideal configurations without the IDEAL_RATIO_RATE setup. > > bool use_ideal_rate; > > And we can put into the asrc_config structure if there's no major problem. > > > > Asrc_config may exposed to user, I don't think user need to care about > The using of ideal rate or not. Given that M2M could use output rate instead of ideal ratio rate as well, it could be a configuration from my point of view. Yet, we may just add it as a function parameter like you did, for now to ease the situation, until we have such a need someday. > > > So the condition check for the calculation would be: > > + if (ideal && config->use_ideal_rate) > > + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE); > > + else > > + rem[OUT] = do_div(clk_rate, outrate); > > + div[OUT] = clk_rate; > > > > And for that if (!ideal && div[IN]....rem[OUT]), I feel it would be clear to > > have them separately, as the existing "div[IN] == 0" > > and "div[OUT] == 0" checks, so that we can tell users which side of the > > divider is out of range and what the sample rate and clock rate are. > > > Do you mean need to combine this judgement with "div[IN] == 0" > Or "div[OUT] == 0"? Not necessarily. Could put in the else path so its error message would be more ideal ratio configuration specific. Thanks _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel 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=-1.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 732D5CA9EA0 for ; Fri, 25 Oct 2019 06:57:01 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 D40F220867 for ; Fri, 25 Oct 2019 06:57:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MD7VplAM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D40F220867 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46zvzt14kkzDqZN for ; Fri, 25 Oct 2019 17:56:58 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::430; helo=mail-pf1-x430.google.com; envelope-from=nicoleotsuka@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MD7VplAM"; dkim-atps=neutral Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46zvxR4MgwzDqf9 for ; Fri, 25 Oct 2019 17:54:51 +1100 (AEDT) Received: by mail-pf1-x430.google.com with SMTP id 205so939039pfw.2 for ; Thu, 24 Oct 2019 23:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=m+VkYOgB7cCdSZGNDZmPasUQ1M1DmEk9SPAL9l8GP1A=; b=MD7VplAMSnE6eBcOxhBncJ1w7gZgL2vajru9wAqudsdqaQdHSjaosigKCexVhSgoKE Nq9j/jeyMN+LeTVVmmAoP0z/DFE4hUYz9NCVTZMKqbSqX+i3ZAtgwb7gGHg+p4X7+TEo 3kiESUbManeemJ3xCExgKIBZWb6+cHq4shtvyoPft8qTN7pMtV8ZWbnQUD2XM4XdY7Rv loSwM9UinPzIrmZwAFqKpGadpFiLSvlbq7vDyppqk/Uv5sf04RsliKidoTQAgdRVtUfz RAZdpGYb6zsW5Uu31WIZHN9C6A5UeFjipvLod8tVE4H1EvCHExEQKbX315/EAQDHfeGM 9Nyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=m+VkYOgB7cCdSZGNDZmPasUQ1M1DmEk9SPAL9l8GP1A=; b=uKKjYyUyIyu7droh7O7M89ln99Gg9UAGbC0eETBAjWJEXJaz8CvATx9gkXxuwllQTy r1I6Z/68eEiAaEPavyYzwe86/g7zDE7Y8oBVaf6sEd+7AgBE+OSyLJtC9F76w7kMoTiL COZ0ccbjxb2AFSk1zNzXm+jW3sv48BG2Elbrs0xCcMQnxUMK2NBDXqYcWIcdokwf6Tz4 VCruK0kRyN806mIxDUVu5conL8vKYWDPEXeZdy2myUtsB9BAa4bbLDgXD1Ob9JBD6xV1 8lbwqZ1JNhcP4JPCOEVFMUpx4BYol+rsJCXwnJoo37KOvo6AhCn0ocR8mMUgmJfSdgrv zJ8g== X-Gm-Message-State: APjAAAUEbMQOhyoVdt4fZ98Qtms2yL10UidVLoAxALi2vBDyupb/icOA KTf6CaVmJH0WOHirfb02m+4= X-Google-Smtp-Source: APXvYqwQ2i3psJ0yIsvpXC4E8x2YWCDuJQPZ1N62DtBq1Tv3B55wCjarX0d9MG67laCjyfLsu1WfCA== X-Received: by 2002:a17:90a:fe04:: with SMTP id ck4mr2048608pjb.90.1571986487460; Thu, 24 Oct 2019 23:54:47 -0700 (PDT) Received: from Asurada (c-73-162-191-63.hsd1.ca.comcast.net. [73.162.191.63]) by smtp.gmail.com with ESMTPSA id d14sm1800708pfh.36.2019.10.24.23.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Oct 2019 23:54:47 -0700 (PDT) Date: Thu, 24 Oct 2019 23:54:34 -0700 From: Nicolin Chen To: "S.j. Wang" Subject: Re: [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider Message-ID: <20191025065433.GA4632@Asurada> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alsa-devel@alsa-project.org" , "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "linuxppc-dev@lists.ozlabs.org" , "tiwai@suse.com" , "lgirdwood@gmail.com" , "perex@perex.cz" , "broonie@kernel.org" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, Oct 25, 2019 at 05:33:17AM +0000, S.j. Wang wrote: > > > > > + pair_err("The divider can't be used for non ideal mode\n"); > > > > > + return -EINVAL; > > > > > + } > > > > > + > > > > > + /* Divider range is [1, 1024] */ > > > > > + div[IN] = min_t(u32, 1024, div[IN]); > > > > > + div[OUT] = min_t(u32, 1024, div[OUT]); > > > > > > > > Hmm, this looks like we want to allow ideal ratio cases and p2p > > > > cases to operate any way, even if the divider wasn't within the > > > > range to get the in/out rates from the output clock? > > > > > > Yes. We still allow the p2p = true, ideal = false. Note that p2p is > > > not Equal to ideal. > > > > Got it. > > > > Overall, I feel it's better to have a naming to state the purpose of using > > ideal configurations without the IDEAL_RATIO_RATE setup. > > bool use_ideal_rate; > > And we can put into the asrc_config structure if there's no major problem. > > > > Asrc_config may exposed to user, I don't think user need to care about > The using of ideal rate or not. Given that M2M could use output rate instead of ideal ratio rate as well, it could be a configuration from my point of view. Yet, we may just add it as a function parameter like you did, for now to ease the situation, until we have such a need someday. > > > So the condition check for the calculation would be: > > + if (ideal && config->use_ideal_rate) > > + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE); > > + else > > + rem[OUT] = do_div(clk_rate, outrate); > > + div[OUT] = clk_rate; > > > > And for that if (!ideal && div[IN]....rem[OUT]), I feel it would be clear to > > have them separately, as the existing "div[IN] == 0" > > and "div[OUT] == 0" checks, so that we can tell users which side of the > > divider is out of range and what the sample rate and clock rate are. > > > Do you mean need to combine this judgement with "div[IN] == 0" > Or "div[OUT] == 0"? Not necessarily. Could put in the else path so its error message would be more ideal ratio configuration specific. Thanks 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=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 98B1DCA9EBC for ; Fri, 25 Oct 2019 06:54:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7168820867 for ; Fri, 25 Oct 2019 06:54:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MD7VplAM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393212AbfJYGys (ORCPT ); Fri, 25 Oct 2019 02:54:48 -0400 Received: from mail-pf1-f169.google.com ([209.85.210.169]:45218 "EHLO mail-pf1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733098AbfJYGys (ORCPT ); Fri, 25 Oct 2019 02:54:48 -0400 Received: by mail-pf1-f169.google.com with SMTP id x28so909083pfi.12 for ; Thu, 24 Oct 2019 23:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=m+VkYOgB7cCdSZGNDZmPasUQ1M1DmEk9SPAL9l8GP1A=; b=MD7VplAMSnE6eBcOxhBncJ1w7gZgL2vajru9wAqudsdqaQdHSjaosigKCexVhSgoKE Nq9j/jeyMN+LeTVVmmAoP0z/DFE4hUYz9NCVTZMKqbSqX+i3ZAtgwb7gGHg+p4X7+TEo 3kiESUbManeemJ3xCExgKIBZWb6+cHq4shtvyoPft8qTN7pMtV8ZWbnQUD2XM4XdY7Rv loSwM9UinPzIrmZwAFqKpGadpFiLSvlbq7vDyppqk/Uv5sf04RsliKidoTQAgdRVtUfz RAZdpGYb6zsW5Uu31WIZHN9C6A5UeFjipvLod8tVE4H1EvCHExEQKbX315/EAQDHfeGM 9Nyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=m+VkYOgB7cCdSZGNDZmPasUQ1M1DmEk9SPAL9l8GP1A=; b=hhzSnF51MAjkUWxOidFL7X1PqHDwE1Ll5IqjQcb+NGH+udp/n/YgyjZYBvVrOA+85z JTovrdvUVxet+pv5TJXXG3urM3gGY8+zBG+9SdsUt2CkqubESly6q23qP5ruYVhfqwT/ nOhXkpuizdxdjxJQs8T8zgC+nPmNM0XRbDif3UpolASB32ndGggYH7tz9sotY6Ft9ksq yq5xKoESi87L0ssDKIGRpb6MNpRh2Fd/zBBGuSe/6BCArGXXm23sWyyWRKmQPXIproOD e0mtgcWh2LHIRG28wtPI8gJZZAo4ntScLQcgkIyqv851TDorIHtgCwL2HvIIQmVFTY9i +02Q== X-Gm-Message-State: APjAAAW1DNvESfgPOR7UtNLvLr9yGMn5sxW8Y/mc+N2MqkEhqZTsGYNX N9yl/yIB5tJD5KnI5BUu6Go= X-Google-Smtp-Source: APXvYqwQ2i3psJ0yIsvpXC4E8x2YWCDuJQPZ1N62DtBq1Tv3B55wCjarX0d9MG67laCjyfLsu1WfCA== X-Received: by 2002:a17:90a:fe04:: with SMTP id ck4mr2048608pjb.90.1571986487460; Thu, 24 Oct 2019 23:54:47 -0700 (PDT) Received: from Asurada (c-73-162-191-63.hsd1.ca.comcast.net. [73.162.191.63]) by smtp.gmail.com with ESMTPSA id d14sm1800708pfh.36.2019.10.24.23.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Oct 2019 23:54:47 -0700 (PDT) Date: Thu, 24 Oct 2019 23:54:34 -0700 From: Nicolin Chen To: "S.j. Wang" Cc: "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "broonie@kernel.org" , "alsa-devel@alsa-project.org" , "lgirdwood@gmail.com" , "perex@perex.cz" , "tiwai@suse.com" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ASoC: fsl_asrc: refine the setting of internal clock divider Message-ID: <20191025065433.GA4632@Asurada> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 25, 2019 at 05:33:17AM +0000, S.j. Wang wrote: > > > > > + pair_err("The divider can't be used for non ideal mode\n"); > > > > > + return -EINVAL; > > > > > + } > > > > > + > > > > > + /* Divider range is [1, 1024] */ > > > > > + div[IN] = min_t(u32, 1024, div[IN]); > > > > > + div[OUT] = min_t(u32, 1024, div[OUT]); > > > > > > > > Hmm, this looks like we want to allow ideal ratio cases and p2p > > > > cases to operate any way, even if the divider wasn't within the > > > > range to get the in/out rates from the output clock? > > > > > > Yes. We still allow the p2p = true, ideal = false. Note that p2p is > > > not Equal to ideal. > > > > Got it. > > > > Overall, I feel it's better to have a naming to state the purpose of using > > ideal configurations without the IDEAL_RATIO_RATE setup. > > bool use_ideal_rate; > > And we can put into the asrc_config structure if there's no major problem. > > > > Asrc_config may exposed to user, I don't think user need to care about > The using of ideal rate or not. Given that M2M could use output rate instead of ideal ratio rate as well, it could be a configuration from my point of view. Yet, we may just add it as a function parameter like you did, for now to ease the situation, until we have such a need someday. > > > So the condition check for the calculation would be: > > + if (ideal && config->use_ideal_rate) > > + rem[OUT] = do_div(clk_rate, IDEAL_RATIO_RATE); > > + else > > + rem[OUT] = do_div(clk_rate, outrate); > > + div[OUT] = clk_rate; > > > > And for that if (!ideal && div[IN]....rem[OUT]), I feel it would be clear to > > have them separately, as the existing "div[IN] == 0" > > and "div[OUT] == 0" checks, so that we can tell users which side of the > > divider is out of range and what the sample rate and clock rate are. > > > Do you mean need to combine this judgement with "div[IN] == 0" > Or "div[OUT] == 0"? Not necessarily. Could put in the else path so its error message would be more ideal ratio configuration specific. Thanks