Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp181373ybt; Tue, 16 Jun 2020 20:45:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUx1v2mLD8dWWlUEOrtAhag4plGApOZL2ZivZ2CmOad38QYjCrwZgfpJBJMIQfCNtMq8xX X-Received: by 2002:a05:6402:6cc:: with SMTP id n12mr5235954edy.266.1592365553731; Tue, 16 Jun 2020 20:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592365553; cv=none; d=google.com; s=arc-20160816; b=CIWLD/F7pjO2Alor+KioHa7jWrRbVxVBf/eWLrAsGYIJk28WrWsE/gHzfBtfHDl9Jm tlaihai1rL6TjxdAgbo1KPqXLewFXHfQtu1Jejd9lxDDnXgnf15RHXaSRz3GzwM/ofDZ mrO+l61KsqBfvIa6SrM01n7r1WftLSRkCCL0lR4dxDEdI/btfz6dPu6YND4fGzu6lRls ug3EAFa74PPYnfAqTdy1LJD+TvetKriqIHZW2j7U2RDlfne+ebE2Yzxlc8Rx3XRl1m+H MNyIlBvVfmipN3wLuztxjahoOT76FvzAKe2lQr3j9oIqEsyQFCXFrr1c177qE5obAeOB cXdg== 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=0vu+NO376NKYI1jWLgdkbjWwFJw4rHiE2cx4A9CRwj8=; b=vuhNzeOIAat0S8kZ2+LCEuIstOUZdheBTlm0CgKArvV6RJUnF+2ccu7AmELYrjeFN2 9sqg2Amixzjnd5DT/YzANzGQvhzgeRhXIkmPBrQnx8YDze0wQx+EtQ6IZ8iJz5Sja9Gq na7OimWY/G5f6E5DdUCPg/lnJvYTHkgVXUYkBGUNCswouFqi40ov1atYmvKMBX4voxk9 H9yhNKz/N1PMAs5ApXYYMnMqOBW8E3HDlTLYkSQpJM0gcXY6dqo6SnZKIU68SEBNw64L jR+krnjshiAFMhSG25Wi8tbROaymkUh7j0FEtGHjW1Aher43GY9K7jlQKKnVrpslKkYG TBbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rLXf0FXm; 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 dd10si10999056edb.245.2020.06.16.20.45.30; Tue, 16 Jun 2020 20:45:53 -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=rLXf0FXm; 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 S1726728AbgFQDnY (ORCPT + 99 others); Tue, 16 Jun 2020 23:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbgFQDnX (ORCPT ); Tue, 16 Jun 2020 23:43:23 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DDE5C061573; Tue, 16 Jun 2020 20:43:23 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id q8so762417qkm.12; Tue, 16 Jun 2020 20:43:23 -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=0vu+NO376NKYI1jWLgdkbjWwFJw4rHiE2cx4A9CRwj8=; b=rLXf0FXmhfaJqwRhe7pzmFH+I+5Jzl+4mGdC8v2m0Lm3iaDGlAH3hqj8lfuKZH8obQ SRV1JMUu0z5+zc2o19KWm6yO8G1kgZ50kIc+3naYW/anOSrAwoEac5sA2keGAK/W102h qxCUwKnNcV5tfpStRlLLA2V49N18kqd6rPVDQ4T7Q6EY7W3p3TqRfdV6NEbeRxb9ROZd x7Xw3OyEQ4JiY/LGYSbJ7jRR/86tBZWNItSDIX1v2cnl0fF5hqwrE0zA6Xt9R7jQEbZX yaLVuBpMHhd5R9p0xoVsMyZ7+EXwMdJgxtLXQ/FjnTbvPBmyqY12rwTJNOWZaP/UWf9d 5+Lw== 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=0vu+NO376NKYI1jWLgdkbjWwFJw4rHiE2cx4A9CRwj8=; b=f+AM5Jxt5XKWECX42PzR+i9/HEwWUP38LB0pnz0l0dcDT9QH7Ue1tEzQ8JPZ/ziGxk WehBZRa+ywKBnxyKPZWeifEgezVrOqLYtTynhL94MAODPXxvzbCJZkFMcoSkxtEBt129 ZRzvgw2YjZ3VK8T37XhAfdTmiP9dHswCapzM5qp8/336fVltms/kEQE3nNwHWSspZ9qA WjGaLcNXNHErmkMj1DrROOrsCvD84Otdcpm+WmasUeh7MaoJWhS2hU2GfXzVptyFipM2 Cif+scA3bn5tsOoc1Joknl3/3qM5l+K1/5fqIo5hyd3wG9jeifuK2ROOOyYhq7PuQ86S FwQA== X-Gm-Message-State: AOAM533OBASx3T2ZFjU//cIhX8QGvlJhJxpjWLzYr3HX6ZFfO0bWxWD/ FjUC9pptdpnPKPGQjmsPb/UOvRp9cF7qmNazhVJsYw== X-Received: by 2002:a37:b50:: with SMTP id 77mr23894892qkl.152.1592365402625; Tue, 16 Jun 2020 20:43:22 -0700 (PDT) MIME-Version: 1.0 References: <1592289761-29118-1-git-send-email-shengjiu.wang@nxp.com> <1592289761-29118-2-git-send-email-shengjiu.wang@nxp.com> <20200616232810.GA19896@Asurada-Nvidia> In-Reply-To: <20200616232810.GA19896@Asurada-Nvidia> From: Shengjiu Wang Date: Wed, 17 Jun 2020 11:43:11 +0800 Message-ID: Subject: Re: [PATCH 2/2] ASoC: fsl_spdif: Add support for imx6sx platform To: Nicolin Chen Cc: Shengjiu Wang , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-ALSA , Timur Tabi , Xiubo Li , Liam Girdwood , linuxppc-dev@lists.ozlabs.org, Takashi Iwai , Rob Herring , Mark Brown , Fabio Estevam , 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 On Wed, Jun 17, 2020 at 7:30 AM Nicolin Chen wrote: > > On Tue, Jun 16, 2020 at 02:42:41PM +0800, Shengjiu Wang wrote: > > The one difference on imx6sx platform is that the root clock > > is shared with ASRC module, so we add a new flags "ind_root_clk" > > which means the root clock is independent, then we will not > > do the clk_set_rate and clk_round_rate to avoid impact ASRC > > module usage. > > > > As add a new flags, we include the soc specific data struct. > > > > Signed-off-by: Shengjiu Wang > > --- > > sound/soc/fsl/fsl_spdif.c | 43 +++++++++++++++++++++++++++++++++++---- > > 1 file changed, 39 insertions(+), 4 deletions(-) > > > > diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c > > index 1b2e516f9162..00e06803d32f 100644 > > --- a/sound/soc/fsl/fsl_spdif.c > > +++ b/sound/soc/fsl/fsl_spdif.c > > @@ -42,6 +42,17 @@ static u8 srpc_dpll_locked[] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0xa, 0xb }; > > > > #define DEFAULT_RXCLK_SRC 1 > > > > +/** > > + * struct fsl_spdif_soc_data: soc specific data > > + * > > + * @imx: for imx platform > > + * @ind_root_clk: flag for round clk rate > > + */ > > +struct fsl_spdif_soc_data { > > + bool imx; > > + bool ind_root_clk; > > "ind" doesn't look very straightforward; maybe "shared_root_clock"? > > And for its comments: > * @shared_root_clock: flag of sharing a clock source with others; > * so the driver shouldn't set root clock rate > > > +}; > > + > > /* > > * SPDIF control structure > > * Defines channel status, subcode and Q sub > > @@ -93,6 +104,7 @@ struct fsl_spdif_priv { > > struct snd_soc_dai_driver cpu_dai_drv; > > struct platform_device *pdev; > > struct regmap *regmap; > > + const struct fsl_spdif_soc_data *soc; > > Looks better if we move it to the top of the list :) > > > @@ -421,7 +448,7 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream, > > sysclk_df = spdif_priv->sysclk_df[rate]; > > > > /* Don't mess up the clocks from other modules */ > > - if (clk != STC_TXCLK_SPDIF_ROOT) > > + if (clk != STC_TXCLK_SPDIF_ROOT || !spdif_priv->soc->ind_root_clk) > > goto clk_set_bypass; > > > > /* The S/PDIF block needs a clock of 64 * fs * txclk_df */ > > @@ -1186,7 +1213,8 @@ static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, > > continue; > > > > ret = fsl_spdif_txclk_caldiv(spdif_priv, clk, savesub, index, > > - i == STC_TXCLK_SPDIF_ROOT); > > + i == STC_TXCLK_SPDIF_ROOT && > > + spdif_priv->soc->ind_root_clk); > > Having more than one place that checks the condition, we can add: > > /* Check if clk is a root clock that does not share clock source with others */ > static inline bool fsl_spdif_can_set_clk_rate(struct fsl_spdif_priv *spdif, int clk) > { > return (clk == STC_TXCLK_SPDIF_ROOT) && !spdif->soc->shared_root_clock; > } will update them in v2 best regards wang shengjiu