Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3593546ybt; Tue, 30 Jun 2020 06:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDKIBWyekGIHKUg3VnTvLnbwGwUQJcrmYeZ6zNbje94h9qdmJA38UyQgzkk4JRJrD56EgK X-Received: by 2002:a17:906:6dda:: with SMTP id j26mr18873002ejt.336.1593525117849; Tue, 30 Jun 2020 06:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593525117; cv=none; d=google.com; s=arc-20160816; b=KzzO9+KON2oFH3StsPKjahR9T6n2rgxoEaTIhzNVHFH7SPK4RqFYBfvUuBIuqnt3NP cFu33iEBac7+bl0MrRBUG8hABIm+lmEFjuKIw6q2R6GzJGO80fz+NNGMiZXFXV7VR5qJ 3dBtn8ajqbLXe4cH2MvEIaY4FF+TkdHgqsV/2c5rovX+6+eUmcTql4hdIGKVaLIaHUT9 jEra+Jk3Ra7v3K0kOc8spZA292013dTWfC5DcCCmnyNMx1re/xerg4cYvXoaV8O0StJY MO8Pmf3FmB0uJcFNimjwCeCReqFQ/ipgNfCW02ZSdjDIci1LEND4thVfgNyTu+x4hbSe z/9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GrXmMzhrfpzqEnud4K6uwivgEJVrHc8/GZLkP2z6bGw=; b=Hxqi4X5Zig40J5cRiNtbJ5ack2FjMV7MR/YjGoGuWFaI6+xXEWa1IdvN5ZDhatZrxQ 3aBGn4oA9Vuh/qHgEY7vItuD9+d54T89zTfcj2L2GWohsAZPxKrYFyxiktBHuEsTYrJY Y6jgFAxJ4L7F2NWvTmeNGlWj63R46GONlUJ7TQX2xYqxhyQT4pemA03o1PaaTwoPivFQ JIOxNymM7VVxu9IhH660HpdiAI/9wdnBu4sHA7JT7jY5uWbGg3Rp5X56m+Y4QdGx39GM 0YGJGqzh9fMEKLm/O0YpjJhoh+VcVoKaduLim714QjJbK/TikgEftIXoiQg4FGA04dB1 kHtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uewoGiRO; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k23si1744937ejk.35.2020.06.30.06.51.34; Tue, 30 Jun 2020 06:51:57 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uewoGiRO; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732211AbgF3NbJ (ORCPT + 99 others); Tue, 30 Jun 2020 09:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729122AbgF3NbI (ORCPT ); Tue, 30 Jun 2020 09:31:08 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BCE6C061755 for ; Tue, 30 Jun 2020 06:31:08 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id i3so15482967qtq.13 for ; Tue, 30 Jun 2020 06:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GrXmMzhrfpzqEnud4K6uwivgEJVrHc8/GZLkP2z6bGw=; b=uewoGiROevRWGxnXkAJqkTKhBwCX3F01qbv8NnE285I74F2oy/ioesvxP5bb2T6UyH tK4BUrjPZkT3l4FbvbPaBf+QFdlQHVs49OU+NBHS5cw7kQdRDjj8TN+6Gadcxk8Etx8Y mITwoEduSsKLQKCp7zgxCWsrBXbxgsqL/mf3ojHw1E7V9C9dC+UNfLld+VnHi6emvQUr zrJR18Di74bbcPB1YeeSAbCaT63eDCDQfdtc9W1jY8beAKws1KKSVXXJJU+SI/OlHNan 3jNsvQruSMsuQm29+GuAeqJv/nsrMBVdIqQNzT9jhXOL4G4G/0y50BvIVFp5xgTTz6QO ORbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GrXmMzhrfpzqEnud4K6uwivgEJVrHc8/GZLkP2z6bGw=; b=K/QNHMTeM4UVM4UPYwIzTYlXCyJyiWHYSlj1xZygofwHryf00+MCnCAxbaiGItLwfh YertSRi2J1EaiTROhSyWXvA+ERQS2KGQAmwYXmup7yYQtrYhf3Q+CLi5EF2yNIRVf0rS dlOQxnby+HCh+AeanqzYVcPZv1roPDeSLHJLAuFpsQY8TJNep5U+nQPFSntrLWJ1U2IU WPP68eNjGtGqOAeZTzBkKyCBYAzX7zJW6x3uUjNirq3MAVoSIUQCNh+kordAms2ga7Dj eDIQ1H/vY9iTxPNhb/4HQv1giSxMQvIfz1n8PLY1t+7dCS79dG3rxGB6Czw9uZQMpk7v SVEg== X-Gm-Message-State: AOAM533hlzZcqK0n0OIshDDMFcH/WQV2/8LnzmFIzqFlEkdeKXQFUawb +q/J3Nb0hHIqwpr1xgk0/p8qksuwZ2O/O5C4/y9aHAla X-Received: by 2002:ac8:4316:: with SMTP id z22mr20775262qtm.121.1593523867006; Tue, 30 Jun 2020 06:31:07 -0700 (PDT) MIME-Version: 1.0 References: <1593439115-19282-1-git-send-email-shengjiu.wang@nxp.com> In-Reply-To: From: Shengjiu Wang Date: Tue, 30 Jun 2020 21:30:55 +0800 Message-ID: Subject: Re: [PATCH] ASoC: fsl_asrc: Add an option to select internal ratio mode To: Fabio Estevam Cc: Shengjiu Wang , Linux-ALSA , Timur Tabi , Xiubo Li , linux-kernel , Takashi Iwai , Liam Girdwood , Nicolin Chen , Mark Brown , linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 30, 2020 at 8:38 PM Fabio Estevam wrote: > > Hi Shengjiu, > > On Mon, Jun 29, 2020 at 11:10 AM Shengjiu Wang wrote: > > > +/** > > "/**" notation may confuse 'make htmldocs". Since this is a single > line comment you could do: > > /* Select proper clock source for internal ratio mode */ > > > > + * Select proper clock source for internal ratio mode > > + */ > > +static int fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv, > > + struct fsl_asrc_pair *pair, > > + int in_rate, > > + int out_rate) > > +{ > > + struct fsl_asrc_pair_priv *pair_priv = pair->private; > > + struct asrc_config *config = pair_priv->config; > > + int rate[2], select_clk[2]; /* Array size 2 means IN and OUT */ > > + int clk_rate, clk_index; > > + int i = 0, j = 0; > > + bool clk_sel[2]; > > + > > + rate[0] = in_rate; > > + rate[1] = out_rate; > > + > > + /* Select proper clock source for internal ratio mode */ > > + for (j = 0; j < 2; j++) { > > + for (i = 0; i < ASRC_CLK_MAP_LEN; i++) { > > + clk_index = asrc_priv->clk_map[j][i]; > > + clk_rate = clk_get_rate(asrc_priv->asrck_clk[clk_index]); > > + if (clk_rate != 0 && (clk_rate / rate[j]) <= 1024 && > > + (clk_rate % rate[j]) == 0) > > + break; > > + } > > + > > + if (i == ASRC_CLK_MAP_LEN) { > > + select_clk[j] = OUTCLK_ASRCK1_CLK; > > + clk_sel[j] = false; > > + } else { > > + select_clk[j] = i; > > + clk_sel[j] = true; > > + } > > + } > > + > > + /* Switch to ideal ratio mode if there is no proper clock source */ > > + if (!clk_sel[IN] || !clk_sel[OUT]) > > + select_clk[IN] = INCLK_NONE; > > + > > + config->inclk = select_clk[IN]; > > + config->outclk = select_clk[OUT]; > > + > > + return 0; > > This new function always returns 0. Should it be converted to 'void' > type instead? > > > + ret = fsl_asrc_select_clk(asrc_priv, pair, > > + config.input_sample_rate, > > + config.output_sample_rate); > > + if (ret) { > > + dev_err(dai->dev, "fail to select clock\n"); > > fsl_asrc_select_clk() does not return error, so you could skip the > error checking. ok, will update the patch best regards wang shengjiu