Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3542958ybt; Tue, 30 Jun 2020 05:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQ9MHFIGpydk6QiKjc0SL1Kkr7d2KZnsyCHvG1bgSojFgOujPXlF/sXH2Qh7q/ZRPuFL4t X-Received: by 2002:a17:907:4240:: with SMTP id oi24mr17539716ejb.23.1593520740205; Tue, 30 Jun 2020 05:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593520740; cv=none; d=google.com; s=arc-20160816; b=ZGGDLkd9afx3FYMcb5YKgKtD/Zj3dvwRso+OuzL+sFdXePA8QTLAFkrVqAIINZgKI7 L8NKZXrlaLMUDpysw6kFbDNSpr7QJ7fmkKjeczuQ6nROIRzvXhwAo64KeSas25VBoKoh 5eF6oQiVDbQllXRqUAlICFKnq7vU+e+Imr/q/um/jbI+um4EIw0/0Xrd+jWMlTjgdfiG cmuJUhbzldlHBJV/uiRT5ayEM6fIIIEFY0DwtPYsXZrt66O9YhPhagvMFZcDwFC+JvWI ofMsA8R5/K1eqocdHmoMBIzNkPLrdwu2LLfPkjZ4NW7Bc5Ugv8OFSxJe6Dszp69opgns bTGQ== 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=pjZ6pxTtSr9uxy/gwY+hSwq1zDBqrweQsuZnBCKIprM=; b=uVkT61D4K5IInw/ogiMbZZEWw9gzrUG5GZ9VOrp5YfPQqEkIIAq7U9pN6z89RADahp C5AdbqzWSSMJ0Owm9wdbKtWXM5bbpQ+P2yEn5ZvswES5Rw08bFFAZ4Q0Xk37UdboqPkR FhyQzj6iy1eaYeDY5C0NTtnqfTibXC2z9o0fSOFGgIKoJyOQZwT5/adWkQqfR//eTsIc 1DOwVNPLIXqACZaeG0OELq5oTF7mdZnyC+/idszzy6IPTD/A4dPOhGERG6jicIWkp3su akIirFuR5F0otOczhgqZoA9HeLduSO/0ROlkJjt65AOo0rv8I8sEc0AjJPehCr75VkNY WO5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p+1avq+W; 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 f14si1595644edm.269.2020.06.30.05.38.37; Tue, 30 Jun 2020 05:39:00 -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=p+1avq+W; 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 S2387743AbgF3MhL (ORCPT + 99 others); Tue, 30 Jun 2020 08:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732042AbgF3MhK (ORCPT ); Tue, 30 Jun 2020 08:37:10 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E891C061755 for ; Tue, 30 Jun 2020 05:37:10 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id 9so22254438ljc.8 for ; Tue, 30 Jun 2020 05:37:10 -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=pjZ6pxTtSr9uxy/gwY+hSwq1zDBqrweQsuZnBCKIprM=; b=p+1avq+WJ5MS40d96OKyqyYSxO3pkEL1n6EmXdtseZ+6YX4nfvKqMa9GJEsluECWqU cd+Uy1Ua1W6INq+V0RwNjtjCT2Py5m+g7rZ7r8whvJIFmOdgL1wUayXf+08iCfAqvbNw pyWc9kpmPofFDJRC4avDXqO6o3bt8kYMZRPsjGYXIT7Io7+4q1ZBQDSCjuEvPfeBc1L/ UsnZWXHMdtJw+fksTbIw3xGp5ZXbb02J/igC66udsYra3yAWTT5ru/Ai54aJEGelYwxX MbNlevxnzE0EWj5nsBlgNvo/Zf67PxhRRvv/1l+84WKLCy9oCiyYQC1NBBH6qIa6VonX lHfw== 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=pjZ6pxTtSr9uxy/gwY+hSwq1zDBqrweQsuZnBCKIprM=; b=jlBUF6GxLDUmlpHhRb51B3fCUk1Rsv147GBpCJyTUbtXEKm98kPqFXwmbMI2JHOELj p2mscJFsAqNEqVvXW/FtzIBZgB5xxTM2zG3MyqorV6+uqQ7yY+eyirZlagZJBr5o5FKu Y/2IOC4ItHm0eQC1l/TqpabHXJE3jgIpk/0i9wmqRF8CKTi92hadSsSYdDhifYBdB1Jv EC1WBhJOpW3O2oZfqBfeh4Ycgzcq+Ma1cREs7IwWJ+kZcj+n2eqpckxWLwAztuC2FS0W L8ZxOkogYmGMIAQrNDClggAxAqLy1v4s520hphpqCYeH6osUc0QkRU8l9gmbFUfQpd5w GLHw== X-Gm-Message-State: AOAM532w40vktRTTJFy23UaI1GAgB0+E8BgfR0FfSYGbG6wAC58wfPgk zrYJ3NwO0Zf8cHL0vZTmPDdkmneUMR1Xlfo/q1w= X-Received: by 2002:a2e:880e:: with SMTP id x14mr745594ljh.218.1593520628813; Tue, 30 Jun 2020 05:37:08 -0700 (PDT) MIME-Version: 1.0 References: <1593439115-19282-1-git-send-email-shengjiu.wang@nxp.com> In-Reply-To: <1593439115-19282-1-git-send-email-shengjiu.wang@nxp.com> From: Fabio Estevam Date: Tue, 30 Jun 2020 09:36:57 -0300 Message-ID: Subject: Re: [PATCH] ASoC: fsl_asrc: Add an option to select internal ratio mode To: Shengjiu Wang Cc: Timur Tabi , Nicolin Chen , Xiubo Li , Mark Brown , Linux-ALSA , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linuxppc-dev@lists.ozlabs.org, linux-kernel 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 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.