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: 1818113 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=5ONjLihZ; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RKNtf5ZJRz1yYl for ; Tue, 8 Aug 2023 03:42:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231531AbjHGRmR (ORCPT ); Mon, 7 Aug 2023 13:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbjHGRmQ (ORCPT ); Mon, 7 Aug 2023 13:42:16 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58063F9 for ; Mon, 7 Aug 2023 10:42:15 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d074da73c3eso4276378276.3 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=L43d862ruRFJ7r6Q6Bm6+9XRzBv0OMNWEJFqBXkl653WYgwA5C4QqdEwJ0Ks+YQbiY aLmKlITB4rGeKbYIsU1R9LoaYUbadxLhJmJvCIEZNLlp7jaNO5w8B1ZDOFdWg4AHqIFf rhMBb3JTGYxhcdwnWestvjkCQTJWNEgBEtvT6Tt1H15ezwsatGCE/OMovpyEy9Kh5xx+ koStPH/RsPMyyjydk8iBI0BZ2iZh6XdyPtcSmCqKC61aCHQ8inB97uYsLplDVPsW5/Rt O4466JOUzuIpjKIzgucuVM+wEwQ/+AXSvmE5Kl6flZXd4SDzCk82lfDsGOLvVhfaDBth YtUg== X-Gm-Message-State: AOJu0Yy12F1JcJgdY/K7bIhYV7x1VlobHchpZPDcC6u7bPIXXhXMKZcZ yxhR4t6N77cKxPRz7EACedPTGMP8ctgn 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 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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: devicetree@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: