From patchwork Sat Feb 10 07:09:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 13552188 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56321C48260 for ; Sat, 10 Feb 2024 07:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yGQ52VKIfeBcITFfAfyIl7dFdc9aXJs+l4AcOBjSazc=; b=1HXzPTLALbGfLq nrSC0hJXdRWdkCaF9kU0WqjfJLGa4dFpeHJ9SySs6Cznxn9Cdtbkwvbqb81a3DLPNvwh1xa2LLFXI 0CTyFNLDhmVj7VxsoYGA/VBsGQwNb0lsJtO9TjdzQCQyYu+3Gybrg79VhZSz8BBtLVzcujd5JkhVf jLerhThTJyTkMv8b3mllQrQ1H9y9qVyGyG3mEQqDiVA2/hAtjqHPsRubhic8quyT8her8ltha8Oos d2dIBYlmKJkCg1kugxOOvV7KlZS8celRzM4Barfw+F/k1snkyU0rQIWyDreNG6HAPSYKvWZja+TPL OZoMabvb6/j59JiOcXPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rYhVX-00000001KIR-1RRG; Sat, 10 Feb 2024 07:10:39 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rYhUx-00000001JpS-1og8 for linux-arm-kernel@lists.infradead.org; Sat, 10 Feb 2024 07:10:05 +0000 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3bd4e6a7cb0so1127532b6e.3 for ; Fri, 09 Feb 2024 23:10:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549002; x=1708153802; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lDKP545ncIGfTtTSVlBXDPYZUg/LkNBLMZfBasJozE4=; b=KEPqiuBQ8UHkSAgSqezpr007G+27A6beeeoEjUYtaNYmNySKfhM3it0xHppbCx4zW9 fTqR0bZssJlivHofdj2mWxzecb47pylWMoSi7Lq5mcRSLGSssSVcMmILLgDleBRTCbvZ DNcK8V5JaukbcV1Z8TOqL5CmhHVWfjFvq4tVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549002; x=1708153802; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lDKP545ncIGfTtTSVlBXDPYZUg/LkNBLMZfBasJozE4=; b=i9JWT7WDE4KYzqery0B6VA5ORhgn3TSeiU6wFjKZtCRHfff/JKOeNNsgWyUZVWANnM AORDlIXtkcITYttOavFIf9nkrS48bv+Qi4zOB7L2aqkv+GjHCUgaFQQVfboX7AcAdL76 BYjTBgD/395dv9Bk5kMhn1qdrV2KEvl8M20LMDu4ByWvLTiAoMo2SchoSQHUNOJDq9l3 lGLIGPI/suA8k22BJwgxRGySAYg3/hck0bpFZuWNra0BiQXVXsmUJBGxjp29vFLmF1f8 7xWGq5iqKYXuyrU6BHV31uPXNsn5++FY0ZvQwaBLc5boAZCnaVY8KGdblVHPOMLzfy0M R6nA== X-Gm-Message-State: AOJu0Yw2Uw42aZg7XM1Ihyt4CgyS0y6VlEdTN8bfJKc3tVbHXw621uW9 NWRA4qUvXImWxdKdPHamOJBf5hEcAJ9JkmSVpY9vORf8ELE/E4vMFG4UilWRbQ== X-Google-Smtp-Source: AGHT+IHfhNbINEK47mtM27Xc5vDyW74i+uZgmEoJwD3UJ6z8ChV5NU+V1lHowi8SgTL6HxzPAHmg2g== X-Received: by 2002:a05:6808:1988:b0:3bf:f0a8:cb2 with SMTP id bj8-20020a056808198800b003bff0a80cb2mr1400608oib.37.1707549001771; Fri, 09 Feb 2024 23:10:01 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW2HrdVmLOcw4Sf/frtnmvY4PJIlX3jT5jll7lFNna1Fpso9xTbdH9rvhiDq6GKPHHy1tZP4nw+5TDy7xMM/ogtsU1SgxEzFe0tDscca19xhkYhiPP6/KxaZgNxED4kb45lZugMR1ueAcwlz73PlvoNVig+xlqg15ALJbOr24kaaMtk0JYVNbP2Bjh74jvcp/MQW8OqL3U+PxPXPx2XWt6f/aCwTpSDDSWlQlg+n5HEMAjSkyX1cXYupkVHBkqGYIE2xV0/cRdSfMTVX7W+S8Y9q1iB4OFy4BcyqIJrxmvu3X2zbPyXxtBBCYeid94cWjS+Jx2IRX/YwbEBBPTNgro10RnVy6XEswrD/FgV2RoWFpccIW2m76rNfVu31Pndn7Vr6pBD244bFKBBWVx8nh/0pEXtzYyqbKkyzItyMaiM5hMJEGV+f8+/O7FuWJzi3bCVO5qE3cASR9QgC6wGqN+KFRKFwh05svoB8WAvy9WayFj+Bv8z7BUa/G6m1m7BbjrMSg7np2qG Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id b18-20020aa78712000000b006dfbecb5027sm1687313pfo.171.2024.02.09.23.10.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:01 -0800 (PST) From: Stephen Boyd To: chrome-platform@lists.linux.dev Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Douglas Anderson , Pin-yen Lin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Benson Leung , Guenter Roeck , Prashant Malani , Tzung-Bi Shih Subject: [PATCH 13/22] dt-bindings: chrome: Add google,cros-ec-typec-switch binding Date: Fri, 9 Feb 2024 23:09:24 -0800 Message-ID: <20240210070934.2549994-14-swboyd@chromium.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240210070934.2549994-1-swboyd@chromium.org> References: <20240210070934.2549994-1-swboyd@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240209_231003_536569_39E2C747 X-CRM114-Status: GOOD ( 17.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a binding for the USB type-c switch controls found on some ChromeOS Embedded Controllers (ECs). When this device is a mode switch, it takes one DisplayPort (DP) port as input and some number (possibly zero) of USB SuperSpeed ports (bundles of USB SS lanes) as input, and muxes those lanes into USB type-c SuperSpeed lanes suitable for the SSTRX1/2 pins on a usb-c-connector. When this device is an orientation switch, it redirects the DP lanes to the proper USB type-c SSTRX lanes. Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Lee Jones Cc: Benson Leung Cc: Guenter Roeck Cc: Prashant Malani Cc: Tzung-Bi Shih Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- .../chrome/google,cros-ec-typec-switch.yaml | 365 ++++++++++++++++++ .../bindings/mfd/google,cros-ec.yaml | 5 + 2 files changed, 370 insertions(+) create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-ec-typec-switch.yaml diff --git a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec-switch.yaml b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec-switch.yaml new file mode 100644 index 000000000000..17a0ba928f5d --- /dev/null +++ b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec-switch.yaml @@ -0,0 +1,365 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/chrome/google,cros-ec-typec-switch.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chrome OS EC(Embedded Controller) USB Type C Switch + +maintainers: + - Benson Leung + - Prashant Malani + - Stephen Boyd + +description: + Chrome OS devices have an Embedded Controller(EC) which has access to USB + Type C switching. This node is intended to allow the OS to control Type C + signal muxing for USB-C orientation and alternate modes. The node for this + device should be under a cros-ec node like google,cros-ec-spi. + +properties: + compatible: + const: google,cros-ec-typec-switch + + mode-switch: + description: Indicates this device controls altmode switching + type: boolean + + orientation-switch: + description: Indicates this device controls orientation switching + type: boolean + + mux-gpios: + description: GPIOs indicating which way the DP mux is steered + + no-hpd: + description: Indicates this device doesn't signal HPD for DisplayPort + type: boolean + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + description: Input port to receive DisplayPort (DP) data + unevaluatedProperties: false + + properties: + endpoint@0: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: DisplayPort data + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical DP data lane indexes + - 0 is DP ML0 lane + - 1 is DP ML1 lane + - 2 is DP ML2 lane + - 3 is DP ML3 lane + oneOf: + - items: + - const: 0 + - const: 1 + - items: + - const: 0 + - const: 1 + - const: 2 + - const: 3 + + required: + - endpoint@0 + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port to receive USB SuperSpeed (SS) data + properties: + endpoint@0: + $ref: /schemas/graph.yaml#/properties/endpoint + description: USB SS data + + endpoint@1: + $ref: /schemas/graph.yaml#/properties/endpoint + description: USB SS data + + anyOf: + - required: + - endpoint@0 + - required: + - endpoint@1 + + port@2: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Output port for USB-C data + properties: + endpoint@0: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@1: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 1st type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@2: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 2nd type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@3: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 3rd type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@4: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 4th type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@5: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 5th type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@6: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 6th type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + endpoint@7: + $ref: /schemas/graph.yaml#/$defs/endpoint-base + description: USB-C data for EC's 7th type-c port + unevaluatedProperties: false + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + An array of physical USB-C data lane indexes. + - 0 is SSRX1 lane + - 1 is SSTX1 lane + - 2 is SSTX2 lane + - 3 is SSRX2 lane + minItems: 4 + maxItems: 4 + items: + maximum: 3 + + anyOf: + - required: + - endpoint@0 + - required: + - endpoint@1 + - required: + - endpoint@2 + - required: + - endpoint@3 + - required: + - endpoint@4 + - required: + - endpoint@5 + - required: + - endpoint@6 + - required: + - endpoint@7 + + required: + - port@2 + anyOf: + - required: + - port@0 + - required: + - port@1 + +required: + - compatible + - ports + +allOf: + - if: + properties: + no-hpd: true + required: + - no-hpd + then: + properties: + ports: + required: + - port@0 + - if: + properties: + mode-switch: true + required: + - mode-switch + then: + properties: + ports: + required: + - port@0 + +additionalProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + cros_ec: ec@0 { + compatible = "google,cros-ec-spi"; + reg = <0>; + interrupts = <35 0>; + + typec-switch { + compatible = "google,cros-ec-typec-switch"; + mode-switch; + orientation-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + dp_in: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_phy>; + data-lanes = <0 1>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + usb_in_0: endpoint@0 { + reg = <0>; + remote-endpoint = <&usb_ss_0_out>; + }; + + usb_in_1: endpoint@1 { + reg = <1>; + remote-endpoint = <&usb_ss_1_out>; + }; + }; + + port@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + + cros_typec_c0_ss: endpoint@0 { + reg = <0>; + remote-endpoint = <&usb_c0_ss>; + }; + + cros_typec_c1_ss: endpoint@1 { + reg = <1>; + remote-endpoint = <&usb_c1_ss>; + }; + }; + }; + }; + }; + }; +... diff --git a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml index ded396b28fba..563c51a4a39c 100644 --- a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml +++ b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml @@ -164,6 +164,10 @@ patternProperties: type: object $ref: /schemas/extcon/extcon-usbc-cros-ec.yaml# + "^typec-switch[0-9]*$": + type: object + $ref: /schemas/chrome/google,cros-ec-typec-switch.yaml# + required: - compatible @@ -227,6 +231,7 @@ allOf: "^i2c-tunnel[0-9]*$": false "^regulator@[0-9]+$": false "^extcon[0-9]*$": false + "^typec-switch[0-9]*$": false # Using additionalProperties: false here and # listing true properties doesn't work