Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1182139rdf; Wed, 22 Nov 2023 07:40:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFr09GDRnzHkh5bfDEX78RzmJF2lde8iV1vJn8lMrbXiTcCe+QGz08T/AuxYTcXOg3flTK+ X-Received: by 2002:a17:902:6944:b0:1cc:5a74:b1df with SMTP id k4-20020a170902694400b001cc5a74b1dfmr2687205plt.2.1700667605169; Wed, 22 Nov 2023 07:40:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700667605; cv=none; d=google.com; s=arc-20160816; b=SVp5M/Lhs7JSAK8TIdyraEMLoMNpeHMA+3XQAF/bMOUuqxhbzI7ylHOH6NJgkWILAO R64Rfz6rZTx6eTECbDiGCuLPXWQnTqcslL858x0c4DpV5pN+XZEEgwNn3Try7diJzVeY InItwZxFDTucFMZjAGbZvvLMpdxzCOWdUmwGbtTpKCoCmIjok+iOyA1Cllm+fsDPo5U3 0udRTyu5sMKi/i/JjJP6VVFxond+/tePyOCRt90vCy7rGKoAVmQK7jVE/bhjbyqS2g6n g8ZrcN6lduzBep1DLXejYljLsLBlikVJBXiwZxqTGBDemRIP5ElkbzOPKApw9BwOzWhw xnaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=y8Vt9CUrYfqTteQo2x/zGWzw0yrZ7ZPsBgxHvitgnm8=; fh=lrGMuxM5hJXPnWXYGdTlDBf4KL9xxNBg4RNtyaWXX2s=; b=ZkycD2hnM/gdOys1xHKwVFH91Hv8xMoihFZGwHudXqqMpPZsFdfeyuEbchwhqU/2Gt 1uZXASw/4rdDpmeVc/rMi53XFk9LpWMQM5edt8VT2dbOiB+E+4ghY1IL+GeRWQIRh1wl N8mI/tPHaGTohd/xeObMzuRDMby2JaxFHHZ4LxO/4i5vUSSCD3/v7Ngrv5NwIoY+A2On PPH299WViqHxF2KrtO59uSeGzW1N8Eyc+Nqw6vdxiObI83Xhw4QuHDB4bJ+N2+0J6pEX 0ksUL7vSNJLy1DNb2MHh08RgzCxTRJdZtgcCcCuov0DqG5J63utsFnJy6z4wBe0h5y11 0krA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mZPX+pE6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z23-20020a1709028f9700b001cf7a4b9dcesi1278794plo.93.2023.11.22.07.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:40:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mZPX+pE6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 397EF8213F17; Wed, 22 Nov 2023 07:40:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344699AbjKVPjs (ORCPT + 99 others); Wed, 22 Nov 2023 10:39:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344703AbjKVPje (ORCPT ); Wed, 22 Nov 2023 10:39:34 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19CE63C3C for ; Wed, 22 Nov 2023 07:36:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE038C433CD; Wed, 22 Nov 2023 15:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700667393; bh=OKh33AzVm9uxL93RkAbKxEVBTDGFce76r325kliI7Zw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mZPX+pE6BgQhCxnyvz2us7GgaC44S5Pm6jVPhcdDLXl90vZs0wDYN5mgcYmJS9oV3 5Tb/Vq+g8RXzDFpRFiNg4Wtyzl8+l/BYT1etESchluIJmgYh1EmHDNbK1rU/R4Gmyi H0JnKPpKkFQ/VYScjMQqwZBecPdIQibiQ7bh0YkPhHwYVxVLQXFcITDcrqhUyNPdvY PTNzGNAxjIm3fKgEDJ2Vpb9Dw+R+kAzRJj/avhXp55kO85BQ43eL+DdLFN15trIPGK YUDtYXB+oHgIAzwu48xkIaDsbIcJCvOJnZMlfApmACGPwvFpnH/pFBao3qsnBe1xJj cKM8+EHFSbViQ== Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-507f1c29f25so9498010e87.1; Wed, 22 Nov 2023 07:36:33 -0800 (PST) X-Gm-Message-State: AOJu0YyTLyZBgJbvGlNlGor8cbnopohkC3Gn2zrFk1g65U6T4gzjOuq0 vAdEA5oqmmOjB1XbyP5Fqk6AKQ71+f79qSSQkg== X-Received: by 2002:a05:6512:158e:b0:507:a766:ad27 with SMTP id bp14-20020a056512158e00b00507a766ad27mr2845995lfb.16.1700667391875; Wed, 22 Nov 2023 07:36:31 -0800 (PST) MIME-Version: 1.0 References: <20230807174159.1140957-1-kyletso@google.com> <20230807174159.1140957-2-kyletso@google.com> <20230821162517.GA1832382-robh@kernel.org> In-Reply-To: From: Rob Herring Date: Wed, 22 Nov 2023 08:36:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] dt-bindings: connector: Add child nodes for multiple PD capabilities To: Kyle Tso Cc: krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, badhri@google.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:40:04 -0800 (PST) On Wed, Oct 18, 2023 at 12:19=E2=80=AFPM Kyle Tso wrot= e: > > On Tue, Aug 22, 2023 at 12:25=E2=80=AFAM Rob Herring wr= ote: > > > > Sorry for the late response... > > > On Tue, Aug 08, 2023 at 01:41:58AM +0800, Kyle Tso wrote: > > > Define a new optional property "capabilities" which is a child node > > > under connector to contain multiple USB Power Delivery capabilities. > > > > > > Define a new property with pattern (e.g. caps-0, caps-1) which is a > > > > A property in json-schema terms, but for DT it's a node not a property. > > 'Define a child node ...' would be clearer. > > > > Will do in the future patch > > > > child node under "capabilities". Each node contains PDO data of a > > > selectable Power Delivery capability. > > > > > > Also define common properties for source-pdos, sink-pdos, and > > > op-sink-microwatt that can be referenced. > > > > Why do we need this? What issue does this solve? The commit message > > should answer those questions (always). > > > > Will state the rationale in the future patch > > > > Signed-off-by: Kyle Tso > > > --- > > > v1 -> v2: > > > - move source/sink-pdos to $defs and reference them in properties > > > > > > .../bindings/connector/usb-connector.yaml | 80 +++++++++++++----= -- > > > 1 file changed, 57 insertions(+), 23 deletions(-) > > > > > > diff --git a/Documentation/devicetree/bindings/connector/usb-connecto= r.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > index 1c4d3eb87763..c6b02dbda83f 100644 > > > --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml > > > @@ -117,28 +117,10 @@ properties: > > > # The following are optional properties for "usb-c-connector" with= power > > > # delivery support. > > > source-pdos: > > > - description: An array of u32 with each entry providing supported= power > > > - source data object(PDO), the detailed bit definitions of PDO c= an be found > > > - in "Universal Serial Bus Power Delivery Specification" chapter= 6.4.1.2 > > > - Source_Capabilities Message, the order of each entry(PDO) shou= ld follow > > > - the PD spec chapter 6.4.1. Required for power source and power= dual role. > > > - User can specify the source PDO array via PDO_FIXED/BATT/VAR/P= PS_APDO() > > > - defined in dt-bindings/usb/pd.h. > > > - minItems: 1 > > > - maxItems: 7 > > > - $ref: /schemas/types.yaml#/definitions/uint32-array > > > + $ref: "#/$defs/source-pdos" > > > > > > sink-pdos: > > > - description: An array of u32 with each entry providing supported= power sink > > > - data object(PDO), the detailed bit definitions of PDO can be f= ound in > > > - "Universal Serial Bus Power Delivery Specification" chapter 6.= 4.1.3 > > > - Sink Capabilities Message, the order of each entry(PDO) should= follow the > > > - PD spec chapter 6.4.1. Required for power sink and power dual = role. User > > > - can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO= () defined > > > - in dt-bindings/usb/pd.h. > > > - minItems: 1 > > > - maxItems: 7 > > > - $ref: /schemas/types.yaml#/definitions/uint32-array > > > + $ref: "#/$defs/sink-pdos" > > > > > > sink-vdos: > > > description: An array of u32 with each entry, a Vendor Defined M= essage Object (VDO), > > > @@ -164,9 +146,7 @@ properties: > > > $ref: /schemas/types.yaml#/definitions/uint32-array > > > > > > op-sink-microwatt: > > > - description: Sink required operating power in microwatt, if sour= ce can't > > > - offer the power, Capability Mismatch is set. Required for powe= r sink and > > > - power dual role. > > > + $ref: "#/$defs/op-sink-microwatt" > > > > > > port: > > > $ref: /schemas/graph.yaml#/properties/port > > > @@ -228,6 +208,30 @@ properties: > > > SNK_READY for non-pd link. > > > type: boolean > > > > > > + capabilities: > > > + description: A child node to contain all the selectable USB Powe= r Delivery capabilities. > > > + type: object > > > + > > > + patternProperties: > > > + "^caps-[0-9]+$": > > > + description: Child nodes under "capabilities" node. Each nod= e contains a selectable USB > > > + Power Delivery capability. > > > + type: object > > > + > > > + properties: > > > + source-pdos: > > > + $ref: "#/$defs/source-pdos" > > > + > > > + sink-pdos: > > > + $ref: "#/$defs/sink-pdos" > > > + > > > + op-sink-microwatt: > > > + $ref: "#/$defs/op-sink-microwatt" > > > + > > > + additionalProperties: false > > > + > > > + additionalProperties: false > > > + > > > dependencies: > > > sink-vdos-v1: [ 'sink-vdos' ] > > > sink-vdos: [ 'sink-vdos-v1' ] > > > @@ -235,6 +239,36 @@ dependencies: > > > required: > > > - compatible > > > > > > +$defs: > > > > Make this: > > > > $defs: > > capabilities: > > properties: > > ... > > > > And then just reference "#/$defs/capabilities" at the top-level and in > > caps-[0-9] node schema. > > > > You'll need to use unevaluatedProperties instead of additionalPropertie= s > > as well. > > > > I am sorry I don't understand this part. Could you explain more? > > In $defs, define a whole structure of "capabilities" which has > patternProperties "caps-[0-9]+", and inside "caps-[0-9]+" there are > properties "source/sink-pdos" ? No, define a list of properties under a def. Here's a more complete example= : $defs: capabilities: properties: source-pdos: ... sink-pdos: ... And then add "$ref: '#/$defs/capabilities'" at the top-level of this schema doc and under "caps-[0-9]+": patternProperties: "^caps-[0-9]+$": description: Child nodes under "capabilities" node. Each node contains a selectable USB Power Delivery capability. type: object $ref: "#/$defs/capabilities" unevaluatedProperties: false unevaluatedProperties is needed because it can "see" properties defined in a $ref to get the full list of properties for a node. Rob