Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2881434rdh; Mon, 30 Oct 2023 10:14:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8fT/qv2iAdsT9Y0iSuRyJ3coD2TtN4V0CUVzm83YyNs+NBgwiCgrXnkvHdjixTLXnAgyg X-Received: by 2002:a05:6a00:1748:b0:68e:2c2a:5172 with SMTP id j8-20020a056a00174800b0068e2c2a5172mr309602pfc.6.1698686055084; Mon, 30 Oct 2023 10:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698686055; cv=none; d=google.com; s=arc-20160816; b=vFpKVNdJMhAwPpWJ3KQ5c00itYFgWGWlAnvxQw0eciJiuT3trC6gwrdizIN9ZdgeHQ 3zSlS/RHqAyZkNTcUA6j5lj4haOFJBl7s0QdtNUWG6s9IO8Jfx3iBotsxJnr6GqQQpdQ XXMEWIl8W5JQvANXwsfZGKhtlSInCUd+duIXlsnezQ2EHD3oCwansncWKy79CN0c5toF lvi8y041m641J5Qif03uouYuWMNNgWRXraUd+lNDE4YYGN1jeO7XAcofyZZjvv9KI7UU H8022OsHsyerF47e8HAcyCrzmECg+ouGQm6FUlylRfhR0dNqZ5p2zN4rH8TjJVIg2pbe pUYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=z8iKDVNsfQwoRxvvaiYCTHXcr4RTujdFfq5CMELZsH0=; fh=gdvDTN+Cm+9LzcJd/caAKD4T07XKqXeUTdaNaPhPksY=; b=ibZxn9Uwo2xdPq04mwR0EWcr/H6pURgZ7B8GxhQRacy7EmZAyFSJF1lFo8k5uskR07 AK65BDN6K/xbg/fiM5XimQhLnUP5JEm8PASTY30BfxtsebIhOk+F0LJrzNnsKvTXEaNe TpDOs+ud9GEicQd42MylemJ1CMQp7FqbqN1orgcNQRJKpLPx3ZaQTGYfdu1AdaYxUuRN d4OEaE5PjyhiM5VhieTcHQzSlx9Z/otY6S+Cd0SoZ3mVaB+mrzuNIRA1p5QYvUBWkoOv 8W4Yu9PxW6pIG5XaWjP5RMznneBF9baxnDs6Bwv7sJG2Zktq4J4/PGJ6I7DIBW8jBRlH xY7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dnkuBXmB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k128-20020a636f86000000b005aa6b242005si5240072pgc.24.2023.10.30.10.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 10:14:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dnkuBXmB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3F2F2807C749; Mon, 30 Oct 2023 10:14:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233829AbjJ3ROG (ORCPT + 99 others); Mon, 30 Oct 2023 13:14:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232864AbjJ3ROD (ORCPT ); Mon, 30 Oct 2023 13:14:03 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AAB29F for ; Mon, 30 Oct 2023 10:14:00 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5afe220cadeso35034967b3.3 for ; Mon, 30 Oct 2023 10:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698686040; x=1699290840; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=z8iKDVNsfQwoRxvvaiYCTHXcr4RTujdFfq5CMELZsH0=; b=dnkuBXmBEng6TyQi9oKbkeeiXz7SZVRKOHuqElRgAZQy+14HPuTf4oUstfyka50zht B2WX87SkdQQD6IdvwD+miiJHLvg0u4d5+aVDO0vBu1hXEwOtlpWqEcSsx8be5pZPHmY1 dCCJYU5xmWzVb0OxJ2N/ojYorcCuuahlUH+d09sVTwkm04PYgSIEEGs7gvYZRyN4N1eP e3bv+yX6xuDLUfvIHG1nmv5PDkstz7KoiMAKe/47yPsM3P1hn7GzJ2XZ2veppQr0kEN+ n5W2F/BfIWBaYh1ZC19Yi/j9h2ACUIXLJJjvMI9JVfxE9z6nLiFWvNYy8nghTdjLYU8J qBqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698686040; x=1699290840; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z8iKDVNsfQwoRxvvaiYCTHXcr4RTujdFfq5CMELZsH0=; b=ZjjaN3CYgIOjn6qLfwZXTDO/KOkU7gfM1bVSIIlsOxvqTb2FG/wWd2Dx8iCTRu1qsO VGMSRiJh6ypYiEWslPcMPGtTBcI/WdzobTk5at+4ic7mG2wRVBlHWl5PHyUdy6LoTxNK gZkKqXNTv2eUB1M1etGmO3trEIvOIcmrpjUQt5RjGzSLYpTnwd23MrHo8NIfQU5Y93Ct aY9pw2JZshgoT0CTiN+r++xukNk7l57TdNO/npEvvZsF3OQoWz6/E3bY6nFSNGyHRvHg Q7jU+V/XwYVpB2GekcEiWE69c8LdBxomiQUOUAwyejWui1A9CqQRA8b/bbSMNOhyw2rQ jrSQ== X-Gm-Message-State: AOJu0Yw6pEIRmt+dqZbZG+hGDJhyuiqOGqdteDZe9pvqucZioBRmpDLy Xaj4MJjlDm6qxSl8zDH+P9G+ADn3tm1/ X-Received: from kyletso-p620lin01.ntc.corp.google.com ([2401:fa00:fc:202:99ae:e3b5:518:c5b4]) (user=kyletso job=sendgmr) by 2002:a25:9841:0:b0:d9a:3a14:a5a2 with SMTP id k1-20020a259841000000b00d9a3a14a5a2mr212052ybo.13.1698686039808; Mon, 30 Oct 2023 10:13:59 -0700 (PDT) Date: Tue, 31 Oct 2023 01:13:47 +0800 In-Reply-To: <20231030171348.600621-1-kyletso@google.com> Mime-Version: 1.0 References: <20231030171348.600621-1-kyletso@google.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231030171348.600621-2-kyletso@google.com> Subject: [PATCH v3 1/2] dt-bindings: connector: Add child nodes for multiple PD capabilities From: Kyle Tso To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org Cc: badhri@google.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Kyle Tso Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 30 Oct 2023 10:14:12 -0700 (PDT) Commit 662a60102c12 ("usb: typec: Separate USB Power Delivery from USB Type-C") allows userspace to configure the PD of a port by selecting different set of predefined PD capabilities. Define the PD capability sets in DT for better configurability in device modules. Define a child node "capabilities" to contain multiple USB Power Delivery capabilities. Define a child node with pattern (e.g. caps-0, caps-1) 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. Signed-off-by: Kyle Tso --- v2 -> v3 - Updated the commit message - Remain unchanged for the comments about the property/node refactor .../bindings/connector/usb-connector.yaml | 80 +++++++++++++------ 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml index 7c8a3e8430d3..d7ece063cb2c 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml @@ -120,28 +120,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 can be found - in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2 - Source_Capabilities Message, the order of each entry(PDO) should 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/PPS_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 found 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 Message Object (VDO), @@ -167,9 +149,7 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32-array op-sink-microwatt: - description: Sink required operating power in microwatt, if source can't - offer the power, Capability Mismatch is set. Required for power sink and - power dual role. + $ref: "#/$defs/op-sink-microwatt" port: $ref: /schemas/graph.yaml#/properties/port @@ -231,6 +211,30 @@ properties: SNK_READY for non-pd link. type: boolean + capabilities: + description: A child node to contain all the selectable USB Power Delivery capabilities. + type: object + + patternProperties: + "^caps-[0-9]+$": + description: Child nodes under "capabilities" node. Each node 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 ] @@ -238,6 +242,36 @@ dependencies: required: - compatible +$defs: + source-pdos: + description: An array of u32 with each entry providing supported power + source data object(PDO), the detailed bit definitions of PDO can be found + in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2 + Source_Capabilities Message, the order of each entry(PDO) should 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/PPS_APDO() + defined in dt-bindings/usb/pd.h. + minItems: 1 + maxItems: 7 + $ref: /schemas/types.yaml#/definitions/uint32-array + + 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 found 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 + + op-sink-microwatt: + description: Sink required operating power in microwatt, if source can't + offer the power, Capability Mismatch is set. Required for power sink and + power dual role. + allOf: - if: properties: -- 2.42.0.820.g83a721a137-goog