From patchwork Mon Aug 7 17:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Tso X-Patchwork-Id: 13344664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0DF8C04A6A for ; Mon, 7 Aug 2023 17:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231416AbjHGRmS (ORCPT ); Mon, 7 Aug 2023 13:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbjHGRmR (ORCPT ); Mon, 7 Aug 2023 13:42:17 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 588E8E6A for ; Mon, 7 Aug 2023 10:42:15 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d06d36b49f9so4285131276.1 for ; Mon, 07 Aug 2023 10:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691430134; x=1692034934; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=j3yZHfkW3liJsGu+2g/OBERI8jeu8fmQFUJTPAyU4Fw=; b=5ONjLihZwyJZ1ST9PSkQnPmCV+PjdedUtLZQVeWd54i4/k0NAKxElTP0o38DfHyVTM lJY0Antl/aAQKfmyeYe2UbRmtUN0iIsbYSuDd6rRjmFmU99Mcwgf2PadUnQ1qwoA/IIh wh7SbOhp1f8xKBXoa5KBbdrBJRgIRZwDum1SIUc3o5yGHHvELZ5v1DU5x/TI4Sm9UNAh dBUGYfph8d39Em0PqOhuR4i6Cm0CVyxTEPE6hToPR+iINwbbsZessKgA3B93b7DncGfG 1hnIjQKmAnTGmbs99s5EbzSN//2dzngsXFdsLQTppbqMsEJ6qcy7XbRiaNfT3BaS7R7M BhRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691430134; x=1692034934; 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=j3yZHfkW3liJsGu+2g/OBERI8jeu8fmQFUJTPAyU4Fw=; b=eQE8K/q+wK54kkYtOh0+9kOQ4sAvGj9DnTNyGnvZXHxu9IEjg/nCWJqMiuFQY6gPGt XamF6agwTMuF6rPJX42Mbt5EoWnKX16qn5OPQd/dJgbVskXFIlI/9OsLmje2srqwzsY9 GH644vczkjVpnIdss0lPraVdHSSXKq6FHrCv71pdcdTQIGEOjhdbqBU7/Xanv6X+gGwK we5C6EsOQ12fZW2yQaqX241BlpfJy/o9pkHEu72EHSDQ7xOiZdiZkxxuYLFQ1rRb5FK6 vdupreqh7IQM6rfyhMGN6nV/SRBpTZ3TqhZlzXxkYaEfszISDsLFb78wqZ4CcHPHxdHp SSDw== X-Gm-Message-State: AOJu0YxWbDZpG2YeevkhzH0nT8Y48sbMTHqLhPFb8Crb/D3vQqyutJQO rj7tizVqQsg+4f7U/+sgaAEs+R2hy+7U X-Google-Smtp-Source: AGHT+IE7+duX24KVIi0dzvlLRonPpi02Udwbsn2dW1nnRPllxJS1t9P2UpTwOWZvaz5m31KSrVi5oSXDuBKs X-Received: from kyletso-p620lin01.ntc.corp.google.com ([2401:fa00:fc:202:c7c:f93d:372a:1641]) (user=kyletso job=sendgmr) by 2002:a25:bc81:0:b0:d4d:564d:8fbf with SMTP id e1-20020a25bc81000000b00d4d564d8fbfmr40097ybk.13.1691430134612; Mon, 07 Aug 2023 10:42:14 -0700 (PDT) Date: Tue, 8 Aug 2023 01:41:58 +0800 In-Reply-To: <20230807174159.1140957-1-kyletso@google.com> Mime-Version: 1.0 References: <20230807174159.1140957-1-kyletso@google.com> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog Message-ID: <20230807174159.1140957-2-kyletso@google.com> Subject: [PATCH v2 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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 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. 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-connector.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 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), @@ -164,9 +146,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 @@ -228,6 +208,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' ] @@ -235,6 +239,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: