Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp585445rwi; Mon, 10 Oct 2022 04:48:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mbE+FBgQjy7lTgCWZcV42n5ay804qDr0Iol4do9WNFd+sq2m4SCHtw9zY0GJofmWD81ch X-Received: by 2002:a17:906:58c6:b0:78d:b37f:5ce5 with SMTP id e6-20020a17090658c600b0078db37f5ce5mr4947059ejs.707.1665402520400; Mon, 10 Oct 2022 04:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665402520; cv=none; d=google.com; s=arc-20160816; b=L7Ttq5N7kMH8Bz9FmejPAjjBz8N5MpbEUNHri4rAist/Ot/81Y7e9mn4k3AtYlFhHa VkpCS/W7gq/74TLtTZPzX6OkhJig3MBnFoQs6h4/Zwu8XJwV0kYZ6x8B4mUdh7ycV8ER yOt58mkm1tVbTixoUkXr65t2kFHgDelBoUrckqUiNe1/afuYprQ9cb/A2jzsLJwyUCJi GtMTCWJygiBwq2JqIakP8WNplZ8b/YekjWxIeFXqU/uNy0c6CJyw1EEUXRYQP1ykEkSb IlHE4sDJmLJLoxe0GkTaWlKJ8jT6wGwu/Th4V27LGMTK8pxKezL1WkXk0bn+9CCxqtwl F3Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=mrUwBNnbqd4ksk/FmUIV1AB6T9m45SMvhXf0F8HKU5I=; b=N0ReXtrthBT/6OfneQs2KDqv6Y43fP4pds5jZvmH7JiUw0qlFhGJMe5F4JS7pbqf6U K4lBE64H3vMMd0TGqdsxfEUNHvPg0cT0YbnkbPIRBv+yt9Jen3a+S9XBU2F7Ph5g0/8R aYGgl0uAYixa7H7ZveyC6sSOOmBgvOjLGro/beBt6kowpVrr/avOoiNCm71lnSxi1p9v iP9Z77Bmn4jVEinKoQV14LTdsI54aAw3YTCNB2ScF82UkoAeqnA4cokzPAnSy8FGWYV4 jH8CCwlkyVsFvvk0lDQ3MDLPtlUtBLe7kRekd9YXlSNFGmyPGYC7jsn/2ctawGo79kDi jtgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xqD0qMsT; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du17-20020a17090772d100b0077e29d27c39si11958303ejc.5.2022.10.10.04.48.15; Mon, 10 Oct 2022 04:48:40 -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=@linaro.org header.s=google header.b=xqD0qMsT; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231480AbiJJK2m (ORCPT + 99 others); Mon, 10 Oct 2022 06:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231817AbiJJK2e (ORCPT ); Mon, 10 Oct 2022 06:28:34 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 410B71AF2F for ; Mon, 10 Oct 2022 03:28:32 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id a5so1350338qkl.6 for ; Mon, 10 Oct 2022 03:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=mrUwBNnbqd4ksk/FmUIV1AB6T9m45SMvhXf0F8HKU5I=; b=xqD0qMsTR9VP3gwWUCR5g70s4AZojnbDrPy5m1C+Iv93XOLUncuIAcb4fDca1cAOKh +6qsfkS1Uito0MzSemkYyh4IJwRLvnXcAgcI49RS1I1cgRNTvoUYP1ALnRJUSFt0LqUP 2jm09DApo5685+hakOwf78NX/hFgmBFahtzFbxKAG2fNrf1gxqyPo7E89oE282o4XU8O 6ZTnyaGg2W37Gjiqkz312cWf8IFeTUvtn04GWdGXUsjQ8u4XVS51WYtzD5mj/kdU8YT2 KLQe9OzOVObKx9zuIuuP62K6cprOhSTtWF6HDkNHLRoV1CQj0+qPDadZhGAe5uwiIzKS ty7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mrUwBNnbqd4ksk/FmUIV1AB6T9m45SMvhXf0F8HKU5I=; b=KVLhVD3lWOJO9D9iiBvAPfUYwK/PAClC+ajDZWdxsAfwS7xiERvd7hiB65VGsmkoD4 ILSIqMv5ZzMtS/+782mBcXuH8deBZ/dp9FnPar2XZKGKsgH9xZhPKKgk7lVPXjzAAUtY 3BkLIeJMNgikEF/VBcmcoeJ5nWmjqNvG9enlfV0x9iRJlgvUxcKowBmKv1f7Xeyy/n+l IrOM16mi/I1YFYIfeh3x1gQvjIwoxdlYtOlodt0nWxreSampt3q+ggRLlz0hpy90Skw/ IT/2We0fEVU/ONj+aedcfpP5DEHCukGa0cto7JF4e9GPBODFhJyHLUMLcEBkgQl0NEMu B+iQ== X-Gm-Message-State: ACrzQf3BTZaMUGM8toocGGaYjFJo6pfKJADlBN2gUkBmmcQbHkyEnOFs ab+osNhgkX5QTF7zYrGPh2u4jw== X-Received: by 2002:a05:620a:284a:b0:6ab:9cc5:cb4c with SMTP id h10-20020a05620a284a00b006ab9cc5cb4cmr12163260qkp.609.1665397711394; Mon, 10 Oct 2022 03:28:31 -0700 (PDT) Received: from [192.168.1.57] (cpe-72-225-192-120.nyc.res.rr.com. [72.225.192.120]) by smtp.gmail.com with ESMTPSA id bl23-20020a05620a1a9700b006ce30a5f892sm5732273qkb.102.2022.10.10.03.28.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Oct 2022 03:28:30 -0700 (PDT) Message-ID: Date: Mon, 10 Oct 2022 06:26:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [v9 1/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants Content-Language: en-US To: Serge Semin Cc: Patrick Rudolph , Peter Rosin , Laurent Pinchart , robh@kernel.org, wsa@kernel.org, Rob Herring , Krzysztof Kozlowski , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221007075354.568752-1-patrick.rudolph@9elements.com> <20221007075354.568752-2-patrick.rudolph@9elements.com> <20221008115019.6jxsbawtye7cdkfh@mobilestation> <68327197-6835-1ec4-e8f1-217b5d2ef947@linaro.org> <20221009180340.hqt3ngp5d26g3euw@mobilestation> From: Krzysztof Kozlowski In-Reply-To: <20221009180340.hqt3ngp5d26g3euw@mobilestation> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org On 09/10/2022 14:03, Serge Semin wrote: > On Sun, Oct 09, 2022 at 05:25:22PM +0200, Krzysztof Kozlowski wrote: >> On 08/10/2022 13:50, Serge Semin wrote: >>> On Fri, Oct 07, 2022 at 09:53:50AM +0200, Patrick Rudolph wrote: >>>> Update the pca954x bindings to add support for the Maxim MAX735x/MAX736x >>>> chips. The functionality will be provided by the exisintg pca954x driver. >>>> >>>> While on it make the interrupts support conditionally as not all of the >>>> existing chips have interrupts. >>>> >>>> For chips that are powered off by default add an optional regulator >>>> called vdd-supply. >>>> >>>> Signed-off-by: Patrick Rudolph >>>> --- >>>> .../bindings/i2c/i2c-mux-pca954x.yaml | 39 ++++++++++++++++--- >>>> 1 file changed, 34 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml >>>> index 9f1726d0356b..efad0a95806f 100644 >>>> --- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml >>>> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml >>>> @@ -4,21 +4,25 @@ >>>> $id: http://devicetree.org/schemas/i2c/i2c-mux-pca954x.yaml# >>>> $schema: http://devicetree.org/meta-schemas/core.yaml# >>>> >>>> -title: NXP PCA954x I2C bus switch >>>> +title: NXP PCA954x I2C and compatible bus switches >>>> >>>> maintainers: >>>> - Laurent Pinchart >>>> >>>> description: >>>> - The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. >>>> - >>> >>>> -allOf: >>>> - - $ref: /schemas/i2c/i2c-mux.yaml# >>> >>> Why do you move the allOf statement to the bottom of the schema? >> > >> Because it goes with 'ifs' at the bottom of the schema... > > Is there a requirement to move the allOf array to the bottom of the > schema if it contains the 'if' statement? If only there were some > kernel doc with all such implicit conventions... It's just a convention, although quite logical because "ifs" can grow significantly, so putting it before properties is outside of context. Reader does not know yet to what this if applies. > >> >>> >>>> + The binding supports NXP PCA954x and PCA984x I2C mux/switch devices, >>>> + and the Maxim MAX735x and MAX736x I2C mux/switch devices. >>> >>> What about combining the sentence: "The binding supports NXP >>> PCA954x/PCA984x and Maxim MAX735x/MAX736x I2C mux/switch devices." ? >>> Currently it does look a bit bulky. >> >> Drop "The binding supports". Instead describe the hardware. >> >>> >>>> >>>> properties: >>>> compatible: >>>> oneOf: >>>> - enum: >>>> + - maxim,max7356 >>>> + - maxim,max7357 >>>> + - maxim,max7358 >>>> + - maxim,max7367 >>>> + - maxim,max7368 >>>> + - maxim,max7369 >>>> - nxp,pca9540 >>>> - nxp,pca9542 >>>> - nxp,pca9543 >>>> @@ -59,10 +63,33 @@ properties: >>>> description: if present, overrides i2c-mux-idle-disconnect >>>> $ref: /schemas/mux/mux-controller.yaml#/properties/idle-state >>>> >>>> + vdd-supply: >>>> + description: A voltage regulator supplying power to the chip. >>>> + >>>> required: >>>> - compatible >>>> - reg >>>> >>>> +allOf: >>>> + - $ref: /schemas/i2c/i2c-mux.yaml# >>>> + - if: >>>> + not: >>>> + properties: >>>> + compatible: >>>> + contains: >>>> + enum: >>>> + - maxim,max7367 >>>> + - maxim,max7369 >>>> + - nxp,pca9542 >>>> + - nxp,pca9543 >>>> + - nxp,pca9544 >>>> + - nxp,pca9545 >>>> + then: >>> >>>> + properties: >>>> + interrupts: false >>>> + "#interrupt-cells": false >>>> + interrupt-controller: false >>> >>> I'd suggest to add an opposite definition. Evaluate the properties for >>> the devices which expect them being evaluated instead of falsing their >>> existence for the devices which don't support the interrupts. >> > >> The properties rather should be defined in top-level than in "if", so I >> am not sure how would you want to achieve opposite way. > > With one more implicit convention like "preferably define the > properties in the top-level than in if" of course I can't. Otherwise I > thought something like this would work: > +allOf: > + - ... > + - if: > + properties: > + compatible: > + contains: > + enum: [...] > + then: > + properties: > + interrupts: ... > + "#interrupt-cells": ... > + interrupt-controller: ... > ... > - interrupts: > - "#interrupt-cells": > - interrupt-controller: ... > > With unevaluatedProperties set to false and evaluation performed for > the particular compatibles such schema shall work with the same > semantic. Yes, this will work, but defining properties inside "if" is usually not readable. Best regards, Krzysztof