Message ID | 20221028103418.17578-2-aidanmacdonald.0x0@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp747591wru; Fri, 28 Oct 2022 03:39:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56g3Qe9nNsuprsYU1iZHmY1IQWgkCxZ6r4xZmXm1H7SKHq+KfekvAj14fNMeOBM7kURrTX X-Received: by 2002:a17:907:2bda:b0:78d:9144:fb6d with SMTP id gv26-20020a1709072bda00b0078d9144fb6dmr46338030ejc.238.1666953559350; Fri, 28 Oct 2022 03:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666953559; cv=none; d=google.com; s=arc-20160816; b=wipc974ibPEljFIeonwTuCZeO+5fguoqqXqXvf9zrtjzq5PmIzfyz4RMJgziNcdevr dMBq0b3IUREYEMajvt/4MoHJBcNsE96rRmEQ5Yf/7UidgK0eDZQxFkbRu63nc/4lYcWn Bi9JZEN8BK2nJUiyoa4Z5MBkl38WoaGPGdxyequCC8o7hXU5oZJaMTUArjY83N5qP2Bh C4Ga6MJmk2O2eef8gxq9zeDGn4yVmb/LOIa22BfgMiu3jXfwH4l9YYAz1FfJ/pxdY+eb WiCBPKXugRS59b1HcmU6P9HGWlIEXfsTMc9jROJRoMt96/ZYY8qaUH4mmx53cEtQ6wtc lu3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Iza2TaCkyzr/G3RQNexbZUSAsDCgwwO2VTwP3e6lVI8=; b=Ga/b3dFBK2qMJzknxiFqg91VCxSRda3OO8TQTxwnuR4G7Y9D7bcIaNSDZJF/OzxFCS maLUjp1nYqmvyBsl2f+tRc4qhi3o95k2ScI4fec0reDnIBun49pc4m0i5JS+DDKuP9tM ClWKe4SbYGHvYgY7NZ78XC2Wp3pglgZIMbSK+W1MLswAgAkYJ+oUjrv9mGPhGKG1rlJf JhXlzWWPxlhvNdnMEcqgIF4Big6c6IR+Xjn4Yoor2xitIlhLlhruvqBuzubUKL2vxors jEKLJPOocA/5tokm1FShrZt6aXIBtF0/913JlYw4IwxIFeeBt5+YTDipjwIQxyE8kZbk Tvfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nW7fKiq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020aa7dd05000000b0045c23138cd8si2557839edv.45.2022.10.28.03.38.54; Fri, 28 Oct 2022 03:39:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nW7fKiq0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230409AbiJ1Kem (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Fri, 28 Oct 2022 06:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230216AbiJ1Keg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Oct 2022 06:34:36 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C42AE78; Fri, 28 Oct 2022 03:34:28 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id j15so6050367wrq.3; Fri, 28 Oct 2022 03:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Iza2TaCkyzr/G3RQNexbZUSAsDCgwwO2VTwP3e6lVI8=; b=nW7fKiq0XchkjTwPif5/83pUEVQb8//GqUC5uhhUirUS6EJZuSMdXSHs6nLBgLTQaH RP+PV2sgBThhpc6tpxzcCKQDMB1ZWkJZWE7Yty8YssrnqRAcnAN8HMP7xGycQLjNhCVf Ii7EpJkfEE6yRF+jRooqGofJQ5AtBTSTL2Jg4RuipYp313d7aOp+Urtv0Wzzc5sNgVXn RZ+aF+vagSFcIDQEoGudviHGjkMTRfdxhJebL6KGym/eube2RhT+KuCqWlNO5rvm9q8S 8ZA7lvHm3ny9+M75y0T++kY9JeGTEh7Pbtoy/f390PL2DHxJTLL4owiGBWD9UjIeOSJ2 ryVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iza2TaCkyzr/G3RQNexbZUSAsDCgwwO2VTwP3e6lVI8=; b=noaecvtjlW/+DMv0MsiOfsyam45qvVFn48kpoHMHurZ5q+7fnnrbPh6fWT1O1yv2Ur zGiFA98kblzX06tuH16VgtBgqhWzquiKIzaSweRSniK0y0+/s0/bXsMVvS+Esluq4WS9 2LMH5Ie/lfyKZsBgFRiQUQWKFeok8fEtinZklW1C40FxAxAs8UNTEV71X8fv+BJWe3EB 5VT2tIFTb4H/a6YQTNK1p4kNMvl2GydRDqcjaU51KCtnRhVnCAMsIZtzkz4gbX/pS+PW KfBKTrs7PdWgsdLzI45NWQ2pcqi7SI1amVyi1P71IJY89+TEVbdxhsYHIdx8xI9OYrRZ PQCw== X-Gm-Message-State: ACrzQf0DDMGHN20qXPH6edCXaYAUZIUFUo8OJpLM339zxRm++I9RAJvC wF8+zWJA5dIrElm8txRVvJQ= X-Received: by 2002:a05:6000:144f:b0:231:2053:ef7c with SMTP id v15-20020a056000144f00b002312053ef7cmr34870075wrx.179.1666953266605; Fri, 28 Oct 2022 03:34:26 -0700 (PDT) Received: from localhost (94.197.40.204.threembb.co.uk. [94.197.40.204]) by smtp.gmail.com with ESMTPSA id e8-20020adffd08000000b0022e653f5abbsm3300645wrr.69.2022.10.28.03.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 03:34:26 -0700 (PDT) From: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> To: paul@crapouillou.net, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, tsbogend@alpha.franken.de, perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-mips@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/3] dt-bindings: ingenic,aic: Remove unnecessary clocks from schema Date: Fri, 28 Oct 2022 11:34:16 +0100 Message-Id: <20221028103418.17578-2-aidanmacdonald.0x0@gmail.com> In-Reply-To: <20221028103418.17578-1-aidanmacdonald.0x0@gmail.com> References: <20221028103418.17578-1-aidanmacdonald.0x0@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747927495149842746?= X-GMAIL-MSGID: =?utf-8?q?1747927495149842746?= |
Series |
ASoC: jz4740-i2s: Remove .set_sysclk() & friends
|
|
Commit Message
Aidan MacDonald
Oct. 28, 2022, 10:34 a.m. UTC
The AIC needs only the first two clocks: "aic" is a gate that's used
for gating the I2S controller when it's suspended, and "i2s" is the
system clock, from which the bit and frame clocks are derived. Both
clocks are therefore reasonably part of the AIC and should be passed
to the OS.
But the "ext" and "pll half" clocks are a little more questionable.
It appears these bindings were introduced when the schema was first
converted to YAML, but weren't present in the original .txt binding.
They are intended to be the possible parent clocks of "i2s".
The JZ4770 actually has three parents for its "i2s" clock, named
"ext", "pll0", and "pll1" in the Linux driver. The JZ4780 has two
parents but it doesn't have a "pll half" clock, instead it has an
"i2s_pll" clock which behaves much differently to the actual
"pll half" clock found on the JZ4740 & JZ4760. And there are other
Ingenic SoCs that share the JZ4780's clock layout, eg, the X1000.
Therefore, the bindings aren't really adequate for the JZ4770 and
a bit misleading for the JZ4780. Either we should fix the bindings,
or remove them entirely.
This patch opts to remove the bindings. There is a good case to be
made that "ext" and "pll half" don't belong here because they aren't
directly used by the AIC. They are only used to set the parent of
the "i2s" clock; they have no other effect on the AIC.
A good way to think of it is in terms of how the AIC constrains
clocks. The AIC can only generate the bit & frame clocks from the
system clock in certain ratios. Setting the sample rate effectively
constrains the frame clock, which, because of the clock dividers
controlled by the AIC, translates to constraints on the "i2s" clock.
Nothing in the AIC imposes a direct constraint on the parents of
the "i2s" clock, and the AIC does not need to enable or disable
the parents directly, so in principle the AIC doesn't need to be
aware of the parent clocks at all.
The choice of parent clock is still important, but the AIC doesn't
have enough information to apply such constraints itself. The sound
card does have that information because it knows how the AIC is
connected to other components. We need to use other DT mechanisms
to communicate those constraints at the sound card level, instead
of passing the clocks through to the AIC, and inventing ad-hoc ways
to plumb the constraints around behind the scenes.
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
---
.../devicetree/bindings/sound/ingenic,aic.yaml | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Comments
Hi, Le ven. 28 oct. 2022 à 11:34:16 +0100, Aidan MacDonald <aidanmacdonald.0x0@gmail.com> a écrit : > The AIC needs only the first two clocks: "aic" is a gate that's used > for gating the I2S controller when it's suspended, and "i2s" is the > system clock, from which the bit and frame clocks are derived. Both > clocks are therefore reasonably part of the AIC and should be passed > to the OS. > > But the "ext" and "pll half" clocks are a little more questionable. > It appears these bindings were introduced when the schema was first > converted to YAML, but weren't present in the original .txt binding. > They are intended to be the possible parent clocks of "i2s". > > The JZ4770 actually has three parents for its "i2s" clock, named > "ext", "pll0", and "pll1" in the Linux driver. The JZ4780 has two > parents but it doesn't have a "pll half" clock, instead it has an > "i2s_pll" clock which behaves much differently to the actual > "pll half" clock found on the JZ4740 & JZ4760. And there are other > Ingenic SoCs that share the JZ4780's clock layout, eg, the X1000. > > Therefore, the bindings aren't really adequate for the JZ4770 and > a bit misleading for the JZ4780. Either we should fix the bindings, > or remove them entirely. > > This patch opts to remove the bindings. There is a good case to be > made that "ext" and "pll half" don't belong here because they aren't > directly used by the AIC. They are only used to set the parent of > the "i2s" clock; they have no other effect on the AIC. > > A good way to think of it is in terms of how the AIC constrains > clocks. The AIC can only generate the bit & frame clocks from the > system clock in certain ratios. Setting the sample rate effectively > constrains the frame clock, which, because of the clock dividers > controlled by the AIC, translates to constraints on the "i2s" clock. > Nothing in the AIC imposes a direct constraint on the parents of > the "i2s" clock, and the AIC does not need to enable or disable > the parents directly, so in principle the AIC doesn't need to be > aware of the parent clocks at all. > > The choice of parent clock is still important, but the AIC doesn't > have enough information to apply such constraints itself. The sound > card does have that information because it knows how the AIC is > connected to other components. We need to use other DT mechanisms > to communicate those constraints at the sound card level, instead > of passing the clocks through to the AIC, and inventing ad-hoc ways > to plumb the constraints around behind the scenes. > > Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> Yes, it makes sense also because from a DT point of view, these clocks were redundant information. It's enough to know the i2s clock to also know its parents. Acked-by: Paul Cercueil <paul@crapouillou.net> Cheers, -Paul > --- > .../devicetree/bindings/sound/ingenic,aic.yaml | 10 > ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/Documentation/devicetree/bindings/sound/ingenic,aic.yaml > b/Documentation/devicetree/bindings/sound/ingenic,aic.yaml > index d607325f2f15..c4f9b3c2bde5 100644 > --- a/Documentation/devicetree/bindings/sound/ingenic,aic.yaml > +++ b/Documentation/devicetree/bindings/sound/ingenic,aic.yaml > @@ -37,15 +37,11 @@ properties: > items: > - description: AIC clock > - description: I2S clock > - - description: EXT clock > - - description: PLL/2 clock > > clock-names: > items: > - const: aic > - const: i2s > - - const: ext > - - const: pll half > > dmas: > items: > @@ -82,10 +78,8 @@ examples: > interrupts = <18>; > > clocks = <&cgu JZ4740_CLK_AIC>, > - <&cgu JZ4740_CLK_I2S>, > - <&cgu JZ4740_CLK_EXT>, > - <&cgu JZ4740_CLK_PLL_HALF>; > - clock-names = "aic", "i2s", "ext", "pll half"; > + <&cgu JZ4740_CLK_I2S>; > + clock-names = "aic", "i2s"; > > dmas = <&dmac 25 0xffffffff>, <&dmac 24 0xffffffff>; > dma-names = "rx", "tx"; > -- > 2.38.1 >
On Fri, Oct 28, 2022 at 11:34:16AM +0100, Aidan MacDonald wrote: > The AIC needs only the first two clocks: "aic" is a gate that's used > for gating the I2S controller when it's suspended, and "i2s" is the > system clock, from which the bit and frame clocks are derived. Both > clocks are therefore reasonably part of the AIC and should be passed > to the OS. Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
On Fri, 28 Oct 2022 11:34:16 +0100, Aidan MacDonald wrote: > The AIC needs only the first two clocks: "aic" is a gate that's used > for gating the I2S controller when it's suspended, and "i2s" is the > system clock, from which the bit and frame clocks are derived. Both > clocks are therefore reasonably part of the AIC and should be passed > to the OS. > > But the "ext" and "pll half" clocks are a little more questionable. > It appears these bindings were introduced when the schema was first > converted to YAML, but weren't present in the original .txt binding. > They are intended to be the possible parent clocks of "i2s". > > The JZ4770 actually has three parents for its "i2s" clock, named > "ext", "pll0", and "pll1" in the Linux driver. The JZ4780 has two > parents but it doesn't have a "pll half" clock, instead it has an > "i2s_pll" clock which behaves much differently to the actual > "pll half" clock found on the JZ4740 & JZ4760. And there are other > Ingenic SoCs that share the JZ4780's clock layout, eg, the X1000. > > Therefore, the bindings aren't really adequate for the JZ4770 and > a bit misleading for the JZ4780. Either we should fix the bindings, > or remove them entirely. > > This patch opts to remove the bindings. There is a good case to be > made that "ext" and "pll half" don't belong here because they aren't > directly used by the AIC. They are only used to set the parent of > the "i2s" clock; they have no other effect on the AIC. > > A good way to think of it is in terms of how the AIC constrains > clocks. The AIC can only generate the bit & frame clocks from the > system clock in certain ratios. Setting the sample rate effectively > constrains the frame clock, which, because of the clock dividers > controlled by the AIC, translates to constraints on the "i2s" clock. > Nothing in the AIC imposes a direct constraint on the parents of > the "i2s" clock, and the AIC does not need to enable or disable > the parents directly, so in principle the AIC doesn't need to be > aware of the parent clocks at all. > > The choice of parent clock is still important, but the AIC doesn't > have enough information to apply such constraints itself. The sound > card does have that information because it knows how the AIC is > connected to other components. We need to use other DT mechanisms > to communicate those constraints at the sound card level, instead > of passing the clocks through to the AIC, and inventing ad-hoc ways > to plumb the constraints around behind the scenes. > > Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> > --- > .../devicetree/bindings/sound/ingenic,aic.yaml | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > Acked-by: Rob Herring <robh@kernel.org>
diff --git a/Documentation/devicetree/bindings/sound/ingenic,aic.yaml b/Documentation/devicetree/bindings/sound/ingenic,aic.yaml index d607325f2f15..c4f9b3c2bde5 100644 --- a/Documentation/devicetree/bindings/sound/ingenic,aic.yaml +++ b/Documentation/devicetree/bindings/sound/ingenic,aic.yaml @@ -37,15 +37,11 @@ properties: items: - description: AIC clock - description: I2S clock - - description: EXT clock - - description: PLL/2 clock clock-names: items: - const: aic - const: i2s - - const: ext - - const: pll half dmas: items: @@ -82,10 +78,8 @@ examples: interrupts = <18>; clocks = <&cgu JZ4740_CLK_AIC>, - <&cgu JZ4740_CLK_I2S>, - <&cgu JZ4740_CLK_EXT>, - <&cgu JZ4740_CLK_PLL_HALF>; - clock-names = "aic", "i2s", "ext", "pll half"; + <&cgu JZ4740_CLK_I2S>; + clock-names = "aic", "i2s"; dmas = <&dmac 25 0xffffffff>, <&dmac 24 0xffffffff>; dma-names = "rx", "tx";