Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2549588pxb; Thu, 11 Feb 2021 15:48:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzckXApwCbRA8j1D4BnnIl9VQLkxczjX3y9i89x1HxbAaW5i/f2+0r9T1NIhTTtJ+o1A9b7 X-Received: by 2002:a17:906:71d5:: with SMTP id i21mr204187ejk.232.1613087338374; Thu, 11 Feb 2021 15:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613087338; cv=none; d=google.com; s=arc-20160816; b=KqgLuBiCa3Y5DkSxtc/RRVvrj5cDqimGw1BEZ+fVjBdBhkXynTo6AcWiFWz3JtEeAx EXgXUEAmp1/WoIADgva1jK3N3AZ5DM+hDv3SiuA6CHoCsPzi2DrBeundiOZTvHFcf/R3 mVmrwv7zvtFCn68O+yp/qaWZWJV3bJoS0wlYCzsQ7YQre6sUMOD/x9Rno+tlCLYp/J5u ipJv3JXjq9cnEBaqsXmlg//jd57O/VctX67skYqLUlIHxns9Zkw4VtOu5gPf65TucLe9 8pJtX+EaJ91idNeY8dyaEaJNlpqCKYnRJ8ekbHM5FrSyjpUE0QYwhS6UyO7yyQkMmYUj NKDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=jObq8Stp4JBntXi0xImN1gGu0r49TqTFsnFE8OUsuT4=; b=CzpwO2sNTZr9axSz5LU3UKaG6WOoLG+xUxi5azzu06wWj4ilY+2nzZ1KvkvRw7pFhB XTz5GvcB+abzhBDD4sgktYi1TBV6IE8EFG/tc1yDUukvmV5Z4natf5+99sDdcxnVcVnw zaa6x5uZasRltyHCgNfAei/ELjZc/uUPqRLh82pdi1hHJZcCoojISezqtFpwT+Lx7iUA eacnsMtNmN2zbJvN+KTw+gwN0NtLGmVgkrFeGL9Kms4XFtWyMJrHFLiozDtzDygT7Gd9 yVj+UsB9p+1mAT45bI5F+QxOQG2XCpHzU3vXy25TEmYaoe4YiDsOXgSYoFU5Qep9qPQx oKtg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de28si4516315edb.466.2021.02.11.15.48.35; Thu, 11 Feb 2021 15:48:58 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbhBKXpl (ORCPT + 99 others); Thu, 11 Feb 2021 18:45:41 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:45254 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229997AbhBKXpg (ORCPT ); Thu, 11 Feb 2021 18:45:36 -0500 Date: 12 Feb 2021 08:44:43 +0900 X-IronPort-AV: E=Sophos;i="5.81,172,1610377200"; d="scan'208";a="71834855" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 12 Feb 2021 08:44:43 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 894464003EDC; Fri, 12 Feb 2021 08:44:43 +0900 (JST) Message-ID: <87im6y5fv8.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Sameer Pujar Cc: , , , , , , , , Subject: Re: [PATCH 1/3] ASoC: simple-card-utils: Fix device module clock In-Reply-To: <1612939421-19900-2-git-send-email-spujar@nvidia.com> References: <1612939421-19900-1-git-send-email-spujar@nvidia.com> <1612939421-19900-2-git-send-email-spujar@nvidia.com> User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sameer > diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c > index bc0b62e..0754d70 100644 > --- a/sound/soc/generic/simple-card-utils.c > +++ b/sound/soc/generic/simple-card-utils.c > @@ -173,16 +173,15 @@ int asoc_simple_parse_clk(struct device *dev, > * or device's module clock. > */ > clk = devm_get_clk_from_child(dev, node, NULL); > - if (!IS_ERR(clk)) { > - simple_dai->sysclk = clk_get_rate(clk); > + if (IS_ERR(clk)) > + clk = devm_get_clk_from_child(dev, dlc->of_node, NULL); > > + if (!IS_ERR(clk)) { > simple_dai->clk = clk; > - } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { > + simple_dai->sysclk = clk_get_rate(clk); > + } else if (!of_property_read_u32(node, "system-clock-frequency", > + &val)) { > simple_dai->sysclk = val; > - } else { > - clk = devm_get_clk_from_child(dev, dlc->of_node, NULL); > - if (!IS_ERR(clk)) > - simple_dai->sysclk = clk_get_rate(clk); > } The comment is indicating that that the clock parsing order, but this patch exchanges it. This comment also should be updated, I think. /* * Parse dai->sysclk come from "clocks = <&xxx>" * (if system has common clock) * or "system-clock-frequency = " * or device's module clock. */ asoc_simple_set_clk_rate() will be called if it has simple_dai->clk. CPU or Codec component clock rate will be exchanged by this patch, I think. I'm not sure the effect of this patch to existing boards. And also, this patch has too many unneeded exchange, thus it was difficult to read for me. I think it can be simply like this ? It is understandable what it want to do. diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 8c423afb9d2e..d441890de4dc 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -168,16 +168,14 @@ int asoc_simple_parse_clk(struct device *dev, * or device's module clock. */ clk = devm_get_clk_from_child(dev, node, NULL); + if (IS_ERR(clk)) + clk = devm_get_clk_from_child(dev, dlc->of_node, NULL); + if (!IS_ERR(clk)) { simple_dai->sysclk = clk_get_rate(clk); - simple_dai->clk = clk; } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { simple_dai->sysclk = val; - } else { - clk = devm_get_clk_from_child(dev, dlc->of_node, NULL); - if (!IS_ERR(clk)) - simple_dai->sysclk = clk_get_rate(clk); } if (of_property_read_bool(node, "system-clock-direction-out")) Thank you for your help !! Best regards --- Kuninori Morimoto