Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2365174lqt; Mon, 22 Apr 2024 08:46:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWP4TiDBEkaUmlZQxj5HACDVGAbnYxGNrzqECAzI6PCYIRo/8zSAAwCgSAP/VceJ/KCaeG4dLUcbEloz855Of5B7Z+BCzIVMqTF88KYPQ== X-Google-Smtp-Source: AGHT+IHqqnKRFOldekvc3XNRtdSqxhm8ChnC2GtIjkg5ulhun7k+7P84OdPjbWNvfyHoMhw70o1k X-Received: by 2002:a05:6870:13c3:b0:22e:8406:5bc4 with SMTP id 3-20020a05687013c300b0022e84065bc4mr8683808oat.32.1713800792569; Mon, 22 Apr 2024 08:46:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713800792; cv=pass; d=google.com; s=arc-20160816; b=dHW+kHWTB3RQz0FibwrTnNSADruDM3AWP5FyS3VPkm4yW21ln0RmrS9iErBYeWqc9a YEXivKP74YRKiaTOpXP8SGftFSvhm+Skb5FSAavO6uQuIVnQ4LxPOI0JKCds7LbDFaqr z215Pmu2JzEceclvSHTrTmWQn6MSRMYztMDQISBAxAUxoe3aoeEyOMjrvHcldIfGWKgr VeoU1+LPpV5jmtrJOVZlyV23hou97Lf5Wvdvb+gc5wmYUdPTpDCiA9GGbRvIjdqyFStR rQgh5q8+sKJKEgPmjZdfASgOhyNe+ntYnOgvMa88LYdOnwiV+X9wjPxvzxQWKpLwA1Sl 8qXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-filter; bh=td+cQQmmoWiC0135uzzD4HbFAfBHnTihVjdufMcC/aA=; fh=Lo6xEBIO4STGnx3Wq9FBHGWEK51H8jknZm0U61dUpWc=; b=ycZ9IaEfywATK1LAxm2o/R5MUUg53jplA5oeS38JBwnqd4QZRiYiIVDAHCvPd7osZt ayrvV0E7dWlRW6ILn9yvNMIssjgnjtzs+7V70eFf3Ljz8pdRGuKvmQXp9WXV07mE5QHE Cv/c8UoM6rrTUb2Jl/4U5MVPm1bPE8G9z5aT6rpiRtCTPnAPubyl49gEnPaa1oxcVc/6 MV39XmF3Nj7JYeQnWJ55dwL7BpktB5DEybAGu9Y/XqDTdyeK/n3yraRQ3WCWdkwm5MNP SDhXjMwa+yAQxWyG9whcDKSSfRtgSGvMGcpxd3fLbpujkd7D7N0b7H2kxYznkmbAIkQ2 om2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=Z353ZiPs; arc=pass (i=1 spf=pass spfdomain=sberdevices.ru dkim=pass dkdomain=salutedevices.com dmarc=pass fromdomain=salutedevices.com); spf=pass (google.com: domain of linux-kernel+bounces-153652-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=salutedevices.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u20-20020a05622a011400b0043702c489acsi10931087qtw.209.2024.04.22.08.46.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 08:46:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153652-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=Z353ZiPs; arc=pass (i=1 spf=pass spfdomain=sberdevices.ru dkim=pass dkdomain=salutedevices.com dmarc=pass fromdomain=salutedevices.com); spf=pass (google.com: domain of linux-kernel+bounces-153652-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=salutedevices.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 38F561C21E61 for ; Mon, 22 Apr 2024 15:46:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 236D6153565; Mon, 22 Apr 2024 15:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b="Z353ZiPs" Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4512314F10F; Mon, 22 Apr 2024 15:46:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.89.224.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713800785; cv=none; b=NAhz7LWqh2ps1GCB29rBhCVbmakJNWkJdaQgubutPQrDNJVl43u2i2ZKZJfn3cTBAdkBEoy+ARrN/n7B/W87z15h0du+dfGdAwdd4LvTZl4+JkMEIh3pqkvnveYekDadHWVEo9T/vgN9sJeY2PmXVjOGSlvU7b4uXZw9V4H6f2w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713800785; c=relaxed/simple; bh=AFMisq5Sdxp1gKXAMU2mShBZLEUodYxJtyLg4irlzAY=; h=Message-ID:Date:MIME-Version:Subject:From:To:CC:References: In-Reply-To:Content-Type; b=EvEdY9mBO09CKukD8/l0Yk44cCirZy6nERaaVErR7H8bLMggosFPLT317cHmu9HVj6oJweda5AUTpAx58RKO0dX0kx9ubLxBER9gp3NGjVuBUt/oxDDbOSTVqnjRLN8CiB4MWYVOOfoVqnNVAwzhJfpBDY0dl1B5+ccNT3w8Phs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com; spf=pass smtp.mailfrom=sberdevices.ru; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b=Z353ZiPs; arc=none smtp.client-ip=45.89.224.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sberdevices.ru Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 6B224120002; Mon, 22 Apr 2024 18:46:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 6B224120002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1713800772; bh=td+cQQmmoWiC0135uzzD4HbFAfBHnTihVjdufMcC/aA=; h=Message-ID:Date:MIME-Version:Subject:From:To:Content-Type:From; b=Z353ZiPsX3DKx5GGU19HXFiKFfkXBuI823ffer1CpWKOAsfIuWaTVKmdozJpkIKgR fv4UwOzxiyeyzmJHEB8Dl7GK1l5R5rqgD6b8e00d/j/TAg9kZUiHzfErmoiFL9BnA8 eG5rTU9hNG+J2YzFtROL1C8YGQm8QRarEMwr20LDzQcT4rCubQZkzySunYuOwiYju0 T8uEQSLtZMJ5eV1nCHJKpG2I2LkCys+tTdO+63axq/Gt0UyLLoMSNvOgdoBlcN6uoH AZSNXy72iEIcnOtA9x5zg5PLatbClXr4GilHpsP4SXsM0+7Z469Hyp3bRo8Ljaehhm DV/knpHkPIDvw== Received: from smtp.sberdevices.ru (p-i-exch-sc-m02.sberdevices.ru [172.16.192.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Mon, 22 Apr 2024 18:46:12 +0300 (MSK) Received: from [172.28.225.118] (100.64.160.123) by p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 22 Apr 2024 18:46:11 +0300 Message-ID: Date: Mon, 22 Apr 2024 18:43:54 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v3 4/6] dt-bindings: clock: meson: document A1 SoC audio clock controller driver Content-Language: en-US From: Jan Dakinevich To: Jerome Brunet CC: Krzysztof Kozlowski , Rob Herring , Neil Armstrong , Michael Turquette , Stephen Boyd , Krzysztof Kozlowski , Conor Dooley , Kevin Hilman , Martin Blumenstingl , Philipp Zabel , Jiucheng Xu , , , , , References: <20240419125812.983409-1-jan.dakinevich@salutedevices.com> <20240419125812.983409-5-jan.dakinevich@salutedevices.com> <20240419210949.GA3979121-robh@kernel.org> <48e9f035-390b-40c9-a3ad-49880c0b972d@kernel.org> <1jle55c0bl.fsf@starbuckisacylon.baylibre.com> <1jzftlakgg.fsf@starbuckisacylon.baylibre.com> <0272deb1-5427-4805-a6f1-df223a5c14f5@salutedevices.com> In-Reply-To: <0272deb1-5427-4805-a6f1-df223a5c14f5@salutedevices.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) To p-i-exch-sc-m02.sberdevices.ru (172.16.192.103) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 184856 [Apr 22 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: YVDakinevich@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 18 0.3.18 b9d6ada76958f07c6a68617a7ac8df800bc4166c, {Tracking_smtp_not_equal_from}, {Tracking_uf_ne_domains}, {Tracking_from_domain_doesnt_match_to}, smtp.sberdevices.ru:5.0.1,7.1.1;salutedevices.com:7.1.1;100.64.160.123:7.1.2;127.0.0.199:7.1.2;lore.kernel.org:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;sberdevices.ru:5.0.1,7.1.1, FromAlignment: n, {Tracking_smtp_domain_mismatch}, {Tracking_smtp_domain_2level_mismatch}, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean, bases: 2024/04/22 14:47:00 X-KSMG-LinksScanning: Clean, bases: 2024/04/22 14:47:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2024/04/22 13:36:00 #24921842 X-KSMG-AntiVirus-Status: Clean, skipped On 4/22/24 17:31, Jan Dakinevich wrote: > > > On 4/22/24 10:57, Jerome Brunet wrote: >> >> On Mon 22 Apr 2024 at 09:16, Jerome Brunet wrote: >> >>> On Sun 21 Apr 2024 at 20:14, Krzysztof Kozlowski wrote: >>> >>>> On 20/04/2024 18:15, Jan Dakinevich wrote: >>>>> >>>>> >>>>> On 4/20/24 00:09, Rob Herring wrote: >>>>>> On Fri, Apr 19, 2024 at 03:58:10PM +0300, Jan Dakinevich wrote: >>>>>>> Add device tree bindings for A1 SoC audio clock and reset controllers. >>>>>>> >>>>>>> Signed-off-by: Jan Dakinevich >>>>>>> --- >>>>>>> >>>>>>> This controller has 6 mandatory and up to 20 optional clocks. To describe >>>>>>> this, I use 'additionalItems'. It produces correct processed-schema.json: >>>>>>> >>>>>>> "clock-names": { >>>>>>> "maxItems": 26, >>>>>>> "items": [ >>>>>>> { >>>>>>> "const": "pclk" >>>>>>> }, >>>>>>> { >>>>>>> "const": "dds_in" >>>>>>> }, >>>>>>> { >>>>>>> "const": "fclk_div2" >>>>>>> }, >>>>>>> { >>>>>>> "const": "fclk_div3" >>>>>>> }, >>>>>>> { >>>>>>> "const": "hifi_pll" >>>>>>> }, >>>>>>> { >>>>>>> "const": "xtal" >>>>>>> } >>>>>>> ], >>>>>>> "additionalItems": { >>>>>>> "oneOf": [ >>>>>>> { >>>>>>> "pattern": "^slv_sclk[0-9]$" >>>>>>> }, >>>>>>> { >>>>>>> "pattern": "^slv_lrclk[0-9]$" >>>>>>> } >>>>>>> ] >>>>>>> }, >>>>>>> "type": "array", >>>>>>> "minItems": 6 >>>>>>> }, >>>>>>> >>>>>>> and it behaves as expected. However, the checking is followed by >>>>>>> complaints like this: >>>>>>> >>>>>>> Documentation/devicetree/bindings/clock/amlogic,a1-audio-clkc.yaml: properties:clock-names:additionalItems: {'oneOf': [{'pattern': '^slv_sclk[0-9]$'}, {'pattern': '^slv_lrclk[0-9]$'}]} is not of type 'boolean' >>>>>>> >>>>>>> And indeed, 'additionalItems' has boolean type in meta-schema. So, how to >>>>>>> do it right? >>>>>> >>>>>> The meta-schemas are written both to prevent nonsense that json-schema >>>>>> allows by default (e.g additionalitems (wrong case)) and constraints to >>>>>> follow the patterns we expect. I'm happy to loosen the latter case if >>>>>> there's really a need. >>>>>> >>>>>> Generally, most bindings shouldn't be using 'additionalItems' at all as >>>>>> all entries should be defined, but there's a few exceptions. Here, the >>>>>> only reasoning I see is 26 entries is a lot to write out, but that >>>>>> wouldn't really justify it. >>>>> >>>>> Writing a lot of entries don't scary me too much, but the reason is that >>>>> the existence of optional clock sources depends on schematics. Also, we >>>> >>>> Aren't you documenting SoC component, not a board? So how exactly it >>>> depends on schematics? SoC is done or not done... >>>> >>>>> unable to declare dt-nodes for 'clocks' array in any generic way, >>>>> because their declaration would depends on that what is actually >>>>> connected to the SoC (dt-node could be "fixed-clock" with specific rate >>>>> or something else). >>>> >>>> So these are clock inputs to the SoC? >>>> >>> >>> Yes, possibly. >>> Like an external crystal or a set clocks provided by an external codec >>> where the codec is the clock master of the link. >>> >>> This is same case as the AXG that was discussed here: >>> https://lore.kernel.org/linux-devicetree/20230808194811.113087-1-alexander.stein@mailbox.org/ >>> >>> IMO, like the AXG, only the pclk is a required clock. >>> All the others - master and slave clocks - are optional. >>> The controller is designed to operate with grounded inputs >> >> Looking again at the implementation of the controller, there is a clear >> indication in patch 3 that the controller interface is the same as the >> AXG and that the above statement is true. >>> The AXG had 8 master clocks wired in. The A1 just has 5 - and 3 grounded >> master clocks. This is why you to had to provide a mux input table to >> skip the grounded inputs. You would not have to do so if the controller was >> properly declared with the 8 master clock input, as it actually is. >> > > For simplicity, I could make something like this in device tree: > > clocks = <&clk0, > &clk1, > &clk2, > &clk3, > &clk4, > 0, > 0, > 0> > clock-names = <"mst_in0", > "mst_in1", > "mst_in2" > "mst_in2" > "mst_in3" > "mst_in4" > "mst_in5" > "mst_in6" > "mst_in7"> > > But I don't see in the doc that the last 3 clocks are grounded to > anywhere. It will be just community's assumption about internals of the > controller. > > Anyway, I still don't understand what to do with external slv_* clocks. > I can do the same as in example above: list slv_(s|lr)clk[0-9] in > "clock-names" and fill the rest if "clocks" by "0" phandles. > Sorry, I missed that you suggested similar thing: >>> I think the simpliest way to deal with this to just list all the clocks >>> with 'minItems = 1'. It is going be hard to read with a lot of '<0>,' in >>> the DTS when do need those slave clocks but at least the binding doc >>> will be simple. But, may be it could be better to claim that all clocks are mandatory and list all of them (including slv_*)? So, 'minItems = 1' can be omitted. What do you think? clocks = <&pclk, &clk0, &clk1, &clk2, &clk3, &clk4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>; clock-names = <"pclk", "mst_in0", "mst_in1", "mst_in2" "mst_in2" "mst_in3" "mst_in4" "mst_in5" "mst_in6" "mst_in7", "slv_sclk0", "slv_sclk1", "slv_sclk2", "slv_sclk3", "slv_sclk4", "slv_sclk5", "slv_sclk6", "slv_sclk7", "slv_sclk8", "slv_sclk9", "slv_lrclk0", "slv_lrclk1", "slv_lrclk2", "slv_lrclk3", "slv_lrclk4", "slv_lrclk5", "slv_lrclk6", "slv_lrclk7", "slv_lrclk8", "slv_lrclk9">; >> It also shows that it is a bad idea to name input after what is coming >> in (like you do with "dds_in" or "fclk_div2") instead of what they >> actually are like in the AXG (mst0, mst1, etc ...) >> > > I agree, these are not the best names. > >>> >>>>> >>>>> By the way, I don't know any example (neither for A1 SoC nor for other >>>>> Amlogic's SoCs) where these optional clocks are used, but they are >>>>> allowed by hw. >>> >>> Those scenario exists and have been tested. There is just no dts using >>> that upstream because they are all mostly copy of the AML ref design. >>> >>>>> >>>>> This is my understanding of this controller. I hope, Jerome Brunet will >>>>> clarify how it actually works. >>>> >>> >>> I think the simpliest way to deal with this to just list all the clocks >>> with 'minItems = 1'. It is going be hard to read with a lot of '<0>,' in >>> the DTS when do need those slave clocks but at least the binding doc >>> will be simple. >>> >>>> Best regards, >>>> Krzysztof >>> >>> If you are going ahead with this, please name the file >>> amlogic,axg-audio-clkc.yaml because this is really the first controller >>> of the type and is meant to be documented in the same file. >>> >>> You are free to handle the conversion of the AXG at the same time if >>> you'd like. It would be much appreciated if you do. >> >> > -- Best regards Jan Dakinevich