From patchwork Sat Feb 10 07:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336578dyd; Fri, 9 Feb 2024 23:12:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM2VIRx3LbO/XfdlUXewU+ifOLLEDbpTFNCTDhL1eyWcQhEJ3NeQ40DSP5qlC35dlgnN9J X-Received: by 2002:a05:6a20:269d:b0:19c:6877:9943 with SMTP id h29-20020a056a20269d00b0019c68779943mr965629pze.41.1707549178296; Fri, 09 Feb 2024 23:12:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549178; cv=pass; d=google.com; s=arc-20160816; b=ELLzn3KdW1mtE8vnW321tVbekVz0jYqRB80esC2kkPLtyqVN5YRxfE4T1hZJyjfT/x lp26IxBPEpTfSHH6PG2G5/QR7wsZZEKex1DDOjMsDGPNf90XYb8Fheu2HRoAu6hk6KhJ ZPVhLet6l86L6pDFAcocmDS4ktSvS/c+4fP810fGwJM0HIOXVp944Ij1bcCB75nr9x+3 +tO8L9+O/87tKToDCVs67b+3OB9w1HIRUyYBAe5U2UVrZX404rSPZel50CkwJV/URVBk Obw3py7YcIiwznWdOoNavBS7N1f0nLl4D8oqj9hYNnYuBk15etIMXkaJKQjyikBvKrFw wbGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=q+i5FQpJgQZM9grJNtVDZ+U7TB243p9ucbtyKq1qJsw=; fh=muIDoBxM0+OX8ECb0zISKVZq//f3dUtcwU10nwri430=; b=rp5bodBPZH07/OODzypCY71lTlrwh9q2CGR5on3KtAfPzpPd3oiKc8DdGH4cs2+W9I zas08fEjyqGprvkB5ix8fhUdQZSpcfZxxegMoH4dRoRqFY0AaZ5gQsbZLqfjq8IbF5Xl V+wTKw8MClEqnva8pNKae+A4a60pcrArhbpnxrhylwFYVdMoxW58nqvjqWarYB6Jy5oV O8LdAWM/J6pm8UdCVohrVu8cA9QQeTBIqa7WPw1zuDA03ShGtaDqhg1yptGxk4fMYHUN 0YSEoMAdj08mxgPjjc0RkfRzsIApN5dYBTz0OHRGlaVkwKePN2xQPf0ysZg3sLEdCaFe xIig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ncUZbEt4; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUdgwSjrV9JnVmEgKRO7qf2zAqT0e6u+9Vspy0tNFe0c6YyQXRJKIAMSBdzSRJooxafkRI6HDdHH2s9F9OUdg8IFi//ZQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id sl15-20020a17090b2e0f00b0029706041e5csi3055813pjb.24.2024.02.09.23.12.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:12:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ncUZbEt4; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60307-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9DE9AB24690 for ; Sat, 10 Feb 2024 07:10:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 348E7364C2; Sat, 10 Feb 2024 07:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ncUZbEt4" Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5CB325619 for ; Sat, 10 Feb 2024 07:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548983; cv=none; b=SwSSHkd+5nHj5qYDf4pBZYw2K8EVmfD9FaT+e/+uvFV6LiDQwAoW+NbRsR5SkhESMvejZjV481lh5WOSLWleB1CxKrFA7SYyvEPprEygOZ7DuGBdgp68yH1E0Ggs9+Cqq0RX66G+42uyqmOn2JeBnNLs+ZRPPRsABv/gySYjZdA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548983; c=relaxed/simple; bh=WXij6tQJVWGfA0jVq1TwtVWpf8MLUZF7maDtetHyCq8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tqLjtAaSFP3+2HVPcmyWXezUc3caONqfRg4h04i7GyT13w9cNCe1D1M/iVB+tRtSHIgIYookoKfMmBaoZsGcC0Gne8gmB9TrPqV5L8djz4x3gsOoBKwtI9fMkMm4Bgn6DWvuvpxV939ADNKjeLZGuGdv0ZiAAjvAjFUCfL9I8JQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ncUZbEt4; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5ce6b5e3c4eso1277349a12.2 for ; Fri, 09 Feb 2024 23:09:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548981; x=1708153781; darn=vger.kernel.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=q+i5FQpJgQZM9grJNtVDZ+U7TB243p9ucbtyKq1qJsw=; b=ncUZbEt4RjEMhyWQ/qi54rYwzgQG+iBLYaLTjLTBugzcZVXaAN5z/Rpncyh3TX3O+Q LFMQc0L1Jpr+FaLKQrZ5e3CFeNAGiIbZkq2xKpegEd9LBvZGDyMuMYyCT0M9ewWzNhKo CoV/UI1iN6oLOfEO5c6GiG1wVK3KCMOAImUIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548981; x=1708153781; 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=q+i5FQpJgQZM9grJNtVDZ+U7TB243p9ucbtyKq1qJsw=; b=w9K2Ef3aqPPXqp+D9jWWOrd3QvB0ypZP4v7hbe0vhTq4A4nDD5DzoM1LVEmDIIo7z+ IiBoqFTdVMhRYxHEvh5WN7LK5UnlC6mHF/u9yZoEjHLsF/jWyOtg6pzcVTZI07LDxeP/ x4nwn37sUJxbhtqX6nXKQzgHu6lxPSyPRItQVajTND+QFfDfB39Ka3nq04mo5lVYjh4e NXd2y+vNdhjgvLXFxRtvMa+oWGhKkVs7VyRq9J0LLy6xxGD62AKL2vbWTKdXBvfGgfy5 M64EOfuyTqlvbhD9/JuYleizQK2pjwtiGZZy2M0ddlbbIXfkm+Lpmfucs384ci3uBtyn iEUA== X-Gm-Message-State: AOJu0YwHP5MC5FJvzDBRTkPDZMNlI8kTMbISX21OZDrTqQ3yi0ARDiMv 7y9oBXW8bFr1BH/kXCJEhfKqh6301aeX/QgTglWhf6GJsKE+owghknOu2/HX+w== X-Received: by 2002:a05:6a00:990:b0:6e0:6c89:e30b with SMTP id u16-20020a056a00099000b006e06c89e30bmr2062527pfg.19.1707548981026; Fri, 09 Feb 2024 23:09:41 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXfaOQFPe2ptrEFchii8p8d5wFLx6aGOVBzgPCXZjXz6vMArnzaBrz54ebBSrY7Rc7Zb7W2VUAj9BdKIpE0W9dkz5cxBOzIBdQ4QU0l/WvK0O7VjhRWZMwqOXXJ5ykMFpmTSqgratP/faTwzXpvQwn39FSfIVAhwQwraGaTVviZc4cp5j3/BD5CdKGz4B69dvTKZDYXQVUFxLlqnjUvGKFk/DOrZ2zHtEL4xejpVDpzr3Dej3ggRlW+HoqkdCsWPepKV9T+nn9nGOIx4uY7HkdsNGhKIBRFHvFYOERt3EAfj1LY3bkRx0U41mzkKYcK1byjGEHYtEjLSBA3XWVqiZEGmSVaJTnW7QekqO11p2FvukW0hU6g6S8g5ev5eGJBl644kRvLYhHhmgIt237GF/RFZeOSkp6lJLy6lhPpBTyHf9wAeXRDf4/GfAKkUsAuhXX6e5pxcnu723SER6nLBovy4WVE9TkC2SLLkdafuZ/oWR/6aqc7YxZlFlDXXfwdiEzrdLr2sP1bzMCNmf2WF+hM6HhJXzB0gz/8ZcEMMipVJH9k Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id z16-20020aa78890000000b006dff3ca9e26sm1635066pfe.102.2024.02.09.23.09.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:40 -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 , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Benson Leung , Guenter Roeck , linux-gpio@vger.kernel.org Subject: [PATCH 01/22] dt-bindings: gpio: Add binding for ChromeOS EC GPIO controller Date: Fri, 9 Feb 2024 23:09:12 -0800 Message-ID: <20240210070934.2549994-2-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495086935659469 X-GMAIL-MSGID: 1790495086935659469 The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a binding to describe these GPIOs in DT so that other devices described in DT can read the GPIOs on the EC. Cc: Linus Walleij Cc: Bartosz Golaszewski Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Lee Jones Cc: Benson Leung Cc: Guenter Roeck Cc: Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- .../bindings/gpio/google,cros-ec-gpio.yaml | 49 +++++++++++++++++++ .../bindings/mfd/google,cros-ec.yaml | 3 ++ 2 files changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/google,cros-ec-gpio.yaml diff --git a/Documentation/devicetree/bindings/gpio/google,cros-ec-gpio.yaml b/Documentation/devicetree/bindings/gpio/google,cros-ec-gpio.yaml new file mode 100644 index 000000000000..a9f1d7784070 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/google,cros-ec-gpio.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/google,cros-ec-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GPIOs controlled by ChromeOS EC + +maintainers: + - Stephen Boyd + +description: + Google's ChromeOS EC has a gpio controller inside the Embedded Controller + (EC) and controlled via a host-command interface. The node for this + device should be under a cros-ec node like google,cros-ec-spi. + +properties: + compatible: + const: google,cros-ec-gpio + + '#gpio-cells': + const: 2 + + gpio-controller: true + +required: + - compatible + - '#gpio-cells' + - gpio-controller + +additionalProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + cros-ec@0 { + compatible = "google,cros-ec-spi"; + reg = <0>; + interrupts = <101 0>; + gpio { + compatible = "google,cros-ec-gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + }; + }; diff --git a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml index e1ca4f297c6d..ded396b28fba 100644 --- a/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml +++ b/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml @@ -93,6 +93,9 @@ properties: '#size-cells': const: 0 + gpio: + $ref: /schemas/gpio/google,cros-ec-gpio.yaml# + typec: $ref: /schemas/chrome/google,cros-ec-typec.yaml# From patchwork Sat Feb 10 07:09:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336480dyd; Fri, 9 Feb 2024 23:12:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQTty/zRslzZxeIszc75k3rLnMu/n1J8wm8eM1s/V7AK/D+AS6SFjS7eZZt6cUQUolZR7q X-Received: by 2002:a17:906:830b:b0:a3c:2581:85ea with SMTP id j11-20020a170906830b00b00a3c258185eamr632006ejx.16.1707549160148; Fri, 09 Feb 2024 23:12:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549160; cv=pass; d=google.com; s=arc-20160816; b=0rWEs7MTm7JFXieB8dhIQT9+KZDmQsHZ5XWoiRIMerYNrJjLPeqM4o7JiZisXn3Biv 1IdoHDgLvpl8Z/bm4iLLSiukl+LSib04dojXJaI4FuCNlYMFwdoI/uryzDxxxoFoah/5 kzVqIoQnfzdKxtXIKUcruxMIgnJteGF/w+5Td5d9GRTIxGdka7HJQLXmhcOvJ6sFw2s/ FAhWtQTSIyY32AFbh3kLavB7ZWjV8ZFEzAmSnucglrGWjjHEQXqSEs8+Cm1WCXU1/Mr+ Guw6mcX2RP8M0eMqwYyRQKNhuqP+x1mhuRXqJ+dbMwW8S1Eju2yiIXfnbzacf0GFH5Gn YEBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=o84QHSqn+ObMNs1MLh+nj630dEtvLSjAJedEuzESKd8=; fh=8nDqVV/1AGShfS3WkxSDaSv7ZOrc5UQ+rlc6jPRVo18=; b=s2zpZS6cxRujZEjcn8E/31goBuxZiP8c0rIsMRi5rq5LCwqaUCeSRwaVvlnwxrDi83 MRxq+QG+gbn/Q4N7WCiFpoihdT6YLPs16HvSmMSxEVHMewR7AHH2SQoO5Xl3BtoOcAIC CsUaczNPpyDWkHYinVmRitacGCJ6ebvsuwDbaCVgNqQAaIu0QhG+ASzC4oo0Yi21vVCs Hb5r13JRS4ZwujpA+z6ziBDkOV28vSRRO+dKG2JllT7V+UtR7ysDVa9cJ6lpKQRDbKcD FyuBkBkwLJRPH53Yx78N79cjL8+I5Ap1aeraaHqjJJp+DOqiM8oHIFwwcyLq/EPO9Fau dbJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BHBbMjYP; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60308-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60308-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUgCWp16bbDxKC8E//lQXPJG+M+O0LgDzmkEYV4NLE89wjahGxmP8aLoDaUYwOj/tUS4vHOmkN/2LL7WQm5BfoAV2Xxyw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qb20-20020a1709077e9400b00a3bf5607934si1478993ejc.838.2024.02.09.23.12.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:12:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60308-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BHBbMjYP; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60308-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60308-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3EC4B1F24D9B for ; Sat, 10 Feb 2024 07:11:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39EEC364A8; Sat, 10 Feb 2024 07:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BHBbMjYP" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A7E1200DC for ; Sat, 10 Feb 2024 07:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548986; cv=none; b=SKmVgorTOBEVxXEQTFO8L5usN+4XLvUMhYrLy7sxdNCNdB0n893eZkM87NJHhK15C51t0OTl2UUBEQ5AIlwrQiKfsaIFws3X5ZvhuQ2/h8I1HE5ZQ1kAykGj9ohn8yLhvyUKOX9lAPhlaT3ik9mtjjnDseFQIQbdhboblr/Mmjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548986; c=relaxed/simple; bh=gPaBS0oQVJX1UXa+pMAzOknoNywuSAjjRI9YDTj0/xk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tbOdbch4vOIemf5qmV2f6zkX3/IkFAvbIRamJ42b7QMy7EfyK2FNceLI7eS06+oUNxHw37lvKkC8sSDxH13DGl+GrsxaKLuWtfKlytXC9W92vC9oCJkTwQPRBmrlYz2e81VKriPqH5DBzZGdRTGmnM69zqGZy36RaUg0Eo3MVpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=BHBbMjYP; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d7431e702dso15755105ad.1 for ; Fri, 09 Feb 2024 23:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548983; x=1708153783; darn=vger.kernel.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=o84QHSqn+ObMNs1MLh+nj630dEtvLSjAJedEuzESKd8=; b=BHBbMjYPKEFlgeJHbV5ap6HI5KNG+EKrdD1Wa+1KDF41YcPxxSB7DOclm+OwpyFUN9 uDqKnenXFCJJ+I8cmJbAMl0UhgPlL1RzwArbElHlA0AfFlUpK81FSBYJ/mVC96efB3vy w3ByCcFHMRrTHiUA+4a0gwL+excBDgBUSvMpg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548983; x=1708153783; 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=o84QHSqn+ObMNs1MLh+nj630dEtvLSjAJedEuzESKd8=; b=KTa3l9gv1Ag4J1q3pwNr65Q5jcTBbsm1SUyU200ocTfNVlqvBLbtJlHncUGcy+mmUG WurEdcQPVeWOwsCED6mNAtgI+kC/j321i0lt2ZHsmJjvhq9LOLLMwR9c532WhjEzEO4B zX3dkiTv0JqZdo3SfTvb2qNRVYLCN52Z5/l/AmYL2ATSPN9FGQY74eRoGvQC3WmsAA+v PZI8obDalAzha7nemzvBWsiKcw0w2MaGekfqKrsWs85nwMPwHh1kjFp/dfJs55GZ9GPv cMMPVxEGMhkioRdexGwXYLi7vLAtFwovji9YEQk2op7ZjMjoL2rJQfjJLJrzvCjqm3l+ DtGw== X-Gm-Message-State: AOJu0YxEWhYx4DqaoMG8GhobsHEIlpAdC8OvM4SWQA79VPOwB2uelTwt 4ok5a0/BtSktcZrAMocvHPlbdp93ijJEZTR9aXpBmBXg7+ilA87fyxkYlaj58g== X-Received: by 2002:a17:90a:9b89:b0:296:111b:9f54 with SMTP id g9-20020a17090a9b8900b00296111b9f54mr804884pjp.19.1707548982684; Fri, 09 Feb 2024 23:09:42 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUZvkpINzfgQ79HHlVYtLDFq1tpexnzLkHo5LRNFPbTvlqmQn54F9Mwd4587ls60RSzNQHZUAfL/GfLqhDQ0LGkkfy1w/Zp4ydvD/im29I8IJRiAbr8fTRNMBd+EmSIpoOGgsNVxLHfuR+JQ5UO9UYe6NEallKgWwjKgAf0NrRPbvILevlY/iuAVnlwX0QpqJ5B6DCCk5WSdWbD46OV7cTzJDdhwNzC37HEXY9Ce+rIAZWozg6k+9aHP7kHptVEKa3CfcLoU5SuDiF+sGzCemr9VpyrScYnpqoMWsGxZlYPexj5hRwrYP2UdVX57fCmdeGEWH7R7q1jPCD+NK/80TtWguEKO7t8BY4t2JgVIxPNl2/oBdyhDqFh2H16xj7Ord01E3pFFx2qbGQqDcVv/6/Mz5vPOmeDwzoZ2ZMMCxc2u4X7U6D8Kg== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id r8-20020a17090ad40800b002967bc2c852sm2903295pju.43.2024.02.09.23.09.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:42 -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 , Linus Walleij , Bartosz Golaszewski , Benson Leung , Guenter Roeck , linux-gpio@vger.kernel.org Subject: [PATCH 02/22] gpio: Add ChromeOS EC GPIO driver Date: Fri, 9 Feb 2024 23:09:13 -0800 Message-ID: <20240210070934.2549994-3-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495068073796600 X-GMAIL-MSGID: 1790495068073796600 The ChromeOS embedded controller (EC) supports setting the state of GPIOs when the system is unlocked, and getting the state of GPIOs in all cases. The GPIOs are on the EC itself, so the EC acts similar to a GPIO expander. Add a driver to get and set the GPIOs on the EC through the host command interface. Cc: Linus Walleij Cc: Bartosz Golaszewski Cc: Benson Leung Cc: Guenter Roeck Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd Reviewed-by: Linus Walleij --- drivers/gpio/Kconfig | 10 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-cros-ec.c | 218 ++++++++++++++++++++++++++++++++++++ 3 files changed, 229 insertions(+) create mode 100644 drivers/gpio/gpio-cros-ec.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index b3a133ed31ee..62b0ae25a727 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1220,6 +1220,16 @@ config GPIO_BD9571MWV This driver can also be built as a module. If so, the module will be called gpio-bd9571mwv. +config GPIO_CROS_EC + tristate "ChromeOS EC GPIO support" + depends on CROS_EC + help + GPIO driver for exposing GPIOs on the ChromeOS Embedded + Controller. + + This driver can also be built as a module. If so, the module + will be called gpio-cros-ec. + config GPIO_CRYSTAL_COVE tristate "GPIO support for Crystal Cove PMIC" depends on (X86 || COMPILE_TEST) && INTEL_SOC_PMIC diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index eb73b5d633eb..2e66410c1da6 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o obj-$(CONFIG_GPIO_CADENCE) += gpio-cadence.o obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_SNPS_CREG) += gpio-creg-snps.o +obj-$(CONFIG_GPIO_CROS_EC) += gpio-cros-ec.o obj-$(CONFIG_GPIO_CRYSTAL_COVE) += gpio-crystalcove.o obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o diff --git a/drivers/gpio/gpio-cros-ec.c b/drivers/gpio/gpio-cros-ec.c new file mode 100644 index 000000000000..0d35558304bf --- /dev/null +++ b/drivers/gpio/gpio-cros-ec.c @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2024 Google LLC + * + * This driver provides the ability to control GPIOs on the Chrome OS EC. + * There isn't any direction control, and setting values on GPIOs is only + * possible when the system is unlocked. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Setting gpios is only supported when the system is unlocked */ +static void cros_ec_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) +{ + const char *name = gc->names[gpio]; + struct cros_ec_device *cros_ec = gpiochip_get_data(gc); + struct ec_params_gpio_set params = { + .val = val, + }; + int ret; + ssize_t copied; + + copied = strscpy(params.name, name, sizeof(params.name)); + if (copied < 0) + return; + + ret = cros_ec_cmd(cros_ec, 0, EC_CMD_GPIO_SET, ¶ms, + sizeof(params), NULL, 0); + if (ret < 0) + dev_err(gc->parent, "error setting gpio%d (%s) on EC: %d\n", gpio, name, ret); +} + +static int cros_ec_gpio_get(struct gpio_chip *gc, unsigned int gpio) +{ + const char *name = gc->names[gpio]; + struct cros_ec_device *cros_ec = gpiochip_get_data(gc); + struct ec_params_gpio_get params; + struct ec_response_gpio_get response; + int ret; + ssize_t copied; + + copied = strscpy(params.name, name, sizeof(params.name)); + if (copied < 0) + return -EINVAL; + + ret = cros_ec_cmd(cros_ec, 0, EC_CMD_GPIO_GET, ¶ms, + sizeof(params), &response, sizeof(response)); + if (ret < 0) { + dev_err(gc->parent, "error getting gpio%d (%s) on EC: %d\n", gpio, name, ret); + return ret; + } + + return response.val; +} + +#define CROS_EC_GPIO_INPUT BIT(8) +#define CROS_EC_GPIO_OUTPUT BIT(9) + +static int cros_ec_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio) +{ + const char *name = gc->names[gpio]; + struct cros_ec_device *cros_ec = gpiochip_get_data(gc); + struct ec_params_gpio_get_v1 params = { + .subcmd = EC_GPIO_GET_INFO, + .get_info.index = gpio, + }; + struct ec_response_gpio_get_v1 response; + int ret; + + ret = cros_ec_cmd(cros_ec, 1, EC_CMD_GPIO_GET, ¶ms, + sizeof(params), &response, sizeof(response)); + if (ret < 0) { + dev_err(gc->parent, "error getting direction of gpio%d (%s) on EC: %d\n", gpio, name, ret); + return ret; + } + + if (response.get_info.flags & CROS_EC_GPIO_INPUT) + return GPIO_LINE_DIRECTION_IN; + + if (response.get_info.flags & CROS_EC_GPIO_OUTPUT) + return GPIO_LINE_DIRECTION_OUT; + + return -EINVAL; +} + +static int cros_ec_gpio_request(struct gpio_chip *chip, unsigned gpio_pin) +{ + if (gpio_pin < chip->ngpio) + return 0; + + return -EINVAL; +} + +/* Query EC for all gpio line names */ +static int cros_ec_gpio_init_names(struct cros_ec_device *cros_ec, struct gpio_chip *gc) +{ + struct ec_params_gpio_get_v1 params = { + .subcmd = EC_GPIO_GET_INFO, + }; + struct ec_response_gpio_get_v1 response; + int ret, i; + /* EC may not NUL terminate */ + size_t name_len = sizeof(response.get_info.name) + 1; + ssize_t copied; + const char **names; + char *str; + + names = devm_kcalloc(gc->parent, gc->ngpio, sizeof(*names), GFP_KERNEL); + if (!names) + return -ENOMEM; + gc->names = names; + + str = devm_kcalloc(gc->parent, gc->ngpio, name_len, GFP_KERNEL); + if (!str) + return -ENOMEM; + + /* Get gpio line names one at a time */ + for (i = 0; i < gc->ngpio; i++) { + params.get_info.index = i; + ret = cros_ec_cmd(cros_ec, 1, EC_CMD_GPIO_GET, ¶ms, + sizeof(params), &response, sizeof(response)); + if (ret < 0) { + dev_err_probe(gc->parent, ret, "error getting gpio%d info\n", i); + return ret; + } + + names[i] = str; + copied = strscpy(str, response.get_info.name, name_len); + if (copied < 0) + return copied; + + str += copied + 1; + } + + return 0; +} + +/* Query EC for number of gpios */ +static int cros_ec_gpio_ngpios(struct cros_ec_device *cros_ec) +{ + struct ec_params_gpio_get_v1 params = { + .subcmd = EC_GPIO_GET_COUNT, + }; + struct ec_response_gpio_get_v1 response; + int ret; + + ret = cros_ec_cmd(cros_ec, 1, EC_CMD_GPIO_GET, ¶ms, + sizeof(params), &response, sizeof(response)); + if (ret < 0) + return ret; + + return response.get_count.val; +} + +static int cros_ec_gpio_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct cros_ec_device *cros_ec = dev_get_drvdata(dev->parent); + struct gpio_chip *gc; + int ngpios; + int ret; + + ngpios = cros_ec_gpio_ngpios(cros_ec); + if (ngpios < 0) { + dev_err_probe(dev, ngpios, "error getting gpio count\n"); + return ngpios; + } + + gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); + if (!gc) + return -ENOMEM; + + gc->ngpio = ngpios; + gc->parent = dev; + ret = cros_ec_gpio_init_names(cros_ec, gc); + if (ret) + return ret; + + gc->can_sleep = true; + gc->label = dev_name(dev); + gc->base = -1; + gc->set = cros_ec_gpio_set; + gc->get = cros_ec_gpio_get; + gc->get_direction = cros_ec_gpio_get_direction; + gc->request = cros_ec_gpio_request; + + return devm_gpiochip_add_data(&pdev->dev, gc, cros_ec); +} + +#ifdef CONFIG_OF +static const struct of_device_id cros_ec_gpio_of_match[] = { + { .compatible = "google,cros-ec-gpio" }, + {} +}; +MODULE_DEVICE_TABLE(of, cros_ec_gpio_of_match); +#endif + +static struct platform_driver cros_ec_gpio_driver = { + .probe = cros_ec_gpio_probe, + .driver = { + .name = "cros-ec-gpio", + .of_match_table = of_match_ptr(cros_ec_gpio_of_match), + }, +}; +module_platform_driver(cros_ec_gpio_driver); + +MODULE_DESCRIPTION("ChromeOS EC GPIO Driver"); +MODULE_LICENSE("GPL"); From patchwork Sat Feb 10 07:09:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336468dyd; Fri, 9 Feb 2024 23:12:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHblE7W/7B+s4v0vuzcVNgU+ZQDuu31ysmTf3sm2atuhvVWy9bgXFSryKPOEk2W2mz1fPe/ X-Received: by 2002:a05:6402:1493:b0:561:2711:9585 with SMTP id e19-20020a056402149300b0056127119585mr646742edv.32.1707549158755; Fri, 09 Feb 2024 23:12:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549158; cv=pass; d=google.com; s=arc-20160816; b=ErK1c1tDT1zQVP2/ZhO2KlYIHl/rCcuJEOuysYmui+nzImmumMDdMIRZXEp++DOSyP ktt8P6Wk+NdjOBQuI7ajOgYdPwwdEUVozaIk3w+Gsbro47YtwpLLqCLVd2ubYgMIIccj jdhGn2qX8R5Hpxef+D6DOvbrmGDD96f6BDLvxDr2f6O0gzfcsBdSbm2qq+uv6Va1cZSY oRq0B06d4p3LYs8rf4m42ywP092yHpXKcS3pejsYcObdgFGfh9Aor+yhzgW9lpsQMbG5 alSqjJSU+RN0en6BuP59/7IWFjlnwBCyHjae3Y17xJZdN1jQQZup9E6PuA1CYMNOH2ml zQpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=UENrcY9RF89XEYAUM3UR0Kbw3cAWGOtKrrlH+rPz1Os=; fh=Wg6HpxyAn6784lxts9XUxlLt4f30aSRJBq2EKCYU360=; b=wwgekMyYv95aqgYVYHamJoDw1Sn1AqaXGiUsaf66iIKhoiR17rgbGYX9ZYS4NEdJMC mxt7fxr/XSxFmwfajxGb3wAnTagCXndPeeB7nKYoOoWswjeFE/KNRyeFJFgDRe+EDC5l twhTlQA3eSjvhvvbV8gIyYwgwGGNDsSzrSV2ol5J2S+i8taA5rhNVOAvJcIkMWSnX9sT FcrV5j9RzqVJ5CuGALfvCYk+psX5lo0yuig32UyLd3y6AwkutJAdpXsCtD0m46kOMmIM 5EhV7JFywwa3te7aPA2QscFSvsu3BXUfI4ZqPi8ev8XhypUzANNhgISDQSvgKvy71H3g ZOMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V8Rpmmbt; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60309-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60309-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCWD1PZFKpQpFm74PptXcN5XPniNsQNBPlcsuy2nXgLFdxg0a4grWw4Dn90z7x4Cm33bAJ6qI2+6OvAPVts9C7LfhjlUSA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b12-20020aa7c6cc000000b00560f8bef51bsi564954eds.381.2024.02.09.23.12.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:12:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60309-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V8Rpmmbt; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60309-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60309-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D14791F24BC5 for ; Sat, 10 Feb 2024 07:11:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA4EB383BA; Sat, 10 Feb 2024 07:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="V8Rpmmbt" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65415360BC for ; Sat, 10 Feb 2024 07:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548987; cv=none; b=erCiGttdWAbC99OAKcjr4TTg/b47WsIepCEG397COxbmvjktS8zhIcl2FBstqOejrjB52qTeCT3gSTWPZKOf5cUCyNf9cY9fKlqaYk+SX266Xd+NA8xcTDgdZLDujUWsHFAbBSGBMLfMHZ0hT3pNhlYNX99/Fowl8Rc0ct11JVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548987; c=relaxed/simple; bh=PeDZQIpv2F0nTTHxmAelufZ+9YaQdvo2eTiG/pHOI/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KSe9Sz4nE+fk8FGGcvqkw0GRSDBfdLrNbYs2nOSP8QRYLUsHZRp7Nyrjzz1MH/Er+FjLsHFr6Dk0YHRPpRmXE8qY2qhZtWW7NSEfXXfATAiMP0Vl9zNjdVqVKG65eQVCnsMxNx/y3Ev5AesAuAWtM7Is4gjSOqUnkWavHWJh8NE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=V8Rpmmbt; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d7431e702dso15755315ad.1 for ; Fri, 09 Feb 2024 23:09:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548985; x=1708153785; darn=vger.kernel.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=UENrcY9RF89XEYAUM3UR0Kbw3cAWGOtKrrlH+rPz1Os=; b=V8RpmmbtVgxWHoxqOFc7tENIuYkwazXzg4eidDuBlO8Cq9PtVTk96TkMHZNBHr8LlV bEP7G12qkPEmZbzH81YOLuf7qRWq/RQLZpIAQu33wcQq415kvWxBySIQ4uFLKsybJsL9 e2COkiut7CVrcyNLBGYULG5RSOideCB1ks9Kk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548985; x=1708153785; 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=UENrcY9RF89XEYAUM3UR0Kbw3cAWGOtKrrlH+rPz1Os=; b=BABsPAep65zV4qCFBnMhqv4M1Ne5OkaJdGhouVsICvuv4T4ZD5S69934QDFtcKUKKq mlSApwLLeJNYghiBvInVZ4Bc4nZqbgLwTpBlMUdcD/j7JA/Xy5hbJMDnTYscll8OPAU+ Gssq7blPC7k8O4VIyFseR1qgO1isXBVBLf/uX3H16reUcXj2v3FmZST/TK6pzdbBVhuF Blg5BpxuAMNwRXKEskCkXzxZyyVCJbaM67VwaTwtS5STtup6a6ENS/th8pOzcVRoH/IQ PS9C1VSUDqiS1PYTKTqSi01huK0T0F76ik0tddgjawa4IvOpcUugnCFzVsqH+PngqvT/ oN7A== X-Gm-Message-State: AOJu0YwwP41pMiLtHddSnRGAajoIwp2r5ujs2zkQt1VEL/PsGdQQvVmi Za64iIsNtXBGPJwVFu9HtxNQ+aqU0mODkLLcWerT0HdsosmUYT3NN+WyK3gXIA== X-Received: by 2002:a17:903:58b:b0:1d9:b789:b1bd with SMTP id jv11-20020a170903058b00b001d9b789b1bdmr1490617plb.9.1707548984724; Fri, 09 Feb 2024 23:09:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW8sDzfMYBYjxyemsK+fiduXCKeElhlPm2IA15iWaQTyosgIv3SXegARx/7gWwIoNMf/OYJ1E5L5O5Yb2b2cIysWnO1oBD1SfE/Xesyq0bvl9Qttr51I2bt9ClXYAhX3IXr8h4Hu9CW6OoRfdlMa2TibWpE7LcBN1K8yo7rWf7F8oEzsK7wzzFq8ZitQ252uzLEjAaf+53MhwjFdA1ZyhuS8wLGDgnSyuia6hk1G3N/eEipCDs89DaebviqoHKBjDRZHKPc3zKsHGXtXUZUiqWOIKZLxWz89I6rUigdeA3U8/KzF/uxgWGJgOMP5mj52kafxMePldEjGbWkyKShGLNqo7W47/Z/OE8vsmZt8/drrEqhpc97BRAuzJ0UEJ+6JdgF89TFwnsdyCGgr29sP1qQcsFwW9SU6tKWO36qSqLHbn5pCKLzla/cJafZwaHTtTm2gWe9W6TnaLjptpvJDvFXaSttVVWHj7K67Uou9dL/lbB0Q+WtVQK/o8teLN2FjNT7QQlI Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id d4-20020a170903230400b001d90a67e10bsm2489560plh.109.2024.02.09.23.09.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:44 -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 , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Kaehlcke , linux-usb@vger.kernel.org, maciek swiech Subject: [PATCH 03/22] dt-bindings: usb: Add downstream facing ports to realtek binding Date: Fri, 9 Feb 2024 23:09:14 -0800 Message-ID: <20240210070934.2549994-4-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495066807298023 X-GMAIL-MSGID: 1790495066807298023 Add a graph with 4 output endpoints to this hub binding to support the scenario where a downstream facing port is connected to a device that isn't a connector or a USB device with a VID:PID. This will be used to connect downstream facing ports to USB type-c switches so the USB superspeed and high speed lanes can be put onto USB connectors. Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Matthias Kaehlcke Cc: Cc: Cc: Pin-yen Lin Cc: maciek swiech Signed-off-by: Stephen Boyd --- .../bindings/usb/realtek,rts5411.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml index f0784d2e86da..5480a31698be 100644 --- a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml +++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml @@ -21,6 +21,12 @@ properties: reg: true + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + vdd-supply: description: phandle to the regulator that provides power to the hub. @@ -30,6 +36,36 @@ properties: description: phandle to the peer hub on the controller. + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: + 1st downstream facing USB port + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: + 2nd downstream facing USB port + + port@3: + $ref: /schemas/graph.yaml#/properties/port + description: + 3rd downstream facing USB port + + port@4: + $ref: /schemas/graph.yaml#/properties/port + description: + 4th downstream facing USB port + +patternProperties: + "^.*@[1-4]$": + description: The hard wired USB devices + type: object + $ref: /schemas/usb/usb-device.yaml + required: - peer-hub - compatible @@ -50,6 +86,11 @@ examples: reg = <1>; vdd-supply = <&pp3300_hub>; peer-hub = <&hub_3_0>; + /* USB 2.0 device on port 2 */ + device@2 { + compatible = "usb123,4567"; + reg = <2>; + }; }; /* 3.0 hub on port 2 */ @@ -58,5 +99,14 @@ examples: reg = <2>; vdd-supply = <&pp3300_hub>; peer-hub = <&hub_2_0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + remote-endpoint = <&usb_a0_ss>; + }; + }; }; }; From patchwork Sat Feb 10 07:09:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337117dyd; Fri, 9 Feb 2024 23:14:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFctusjz6vzJovtVOtUFdvdVXVfcg2GzIM8oDdiOoj8y+cHinVOcvTdLfXLvwn8Bp6d2dU+ X-Received: by 2002:a17:902:654d:b0:1d8:ee41:de89 with SMTP id d13-20020a170902654d00b001d8ee41de89mr1617565pln.69.1707549290331; Fri, 09 Feb 2024 23:14:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549290; cv=pass; d=google.com; s=arc-20160816; b=xF1jCbGmfdbMoXRg+x6vLOlnkCbbxOjHR7+Aw0huEqURAq/MWYO3w+di06qulKxVdx 2whg5vpAyWhcT8kog41ELlqF0cgJzX/SDgcXjkxV0mIYfZGL0zjF4GOleWH+4FgwmNbF CVfHqHs6WyywC3u9ia3zRV4yJheRWKhjb2muuuiNCAK5wqo0lsFW/VKcaEHpzfxnePQA D+Zc4FmA428wHh5f8MZskyZsONV5lVVGEtslHycgy2t1H8JFqGXsngRuX3qY4FpgJhAb 5A8x1kiqQhY4irB+39/KSRI0FathFCkYP+sBjiVYTB7rRLVThrSrdOA4YEQ0WtyajIUD 0C9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fkD+zP+NWB9AGWV79+gv+/kfpMf3rGsHXh6c/wyG7zI=; fh=SDs4mUbnOJ8FmcGVpKgV+QO1BcEX3qxfyA0DT+ImRjI=; b=mSOoolQkapQco4PmacihNPxfN6/kXjI+QHeTHBYjwlTqt1UA2Ai2YZOgOdJQA8Klxh rw5+TaPC6H6eG5vXkOdnTRqXDg/6oQgQnirhRXs+xfiVa6b4uIWlLmsn9OvRxJDaAQXC lrY5uZSpBtLSKqwK4JUYsEZ6lj3O9cBXE7WadfOyVUMlupZrlizMkbC2tMYWXxof/mge TiYo8Job7P8c5W3tBIWjTJMN3g++rRufRycn/caXUg2m+pNkBrCpBmkKxQvzFGzCn12I YMoXMsQ+SxmtOZr3tS2kv07oHlN4b8i62/4aF1+m8gMU7k7BDvaeWu6A+wie+ObyTEXZ OBxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TyjwoXwY; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60310-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60310-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUSSO1A8QvX3lv2flpYxiEenGKTorp7suzk5FS/bwPq/vtRm77i5gIjX3UnDM4HVupN1r1IsvBZUy+l/+gkbdWADR6VQQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id sl15-20020a17090b2e0f00b0029706041e5csi3055813pjb.24.2024.02.09.23.14.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:14:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60310-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TyjwoXwY; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60310-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60310-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7E0F0B22054 for ; Sat, 10 Feb 2024 07:11:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA60038F9B; Sat, 10 Feb 2024 07:09:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TyjwoXwY" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD073364AC for ; Sat, 10 Feb 2024 07:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548989; cv=none; b=OTmohq7dXNKFwtCH8+TRDTDd88YecyKAKNGmY+gknTxuu8fQNKBizKMsJd/u6A6meJTFYSpZGQJFkOLmcaYpRk5kwHfKWHiOXolIiSHs4z2R5e47jTzfe89uYvwBwty2fwKi2Q/+gA6FLduMyxt7PrVNIrdZW1lbUzbI7T/RIxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548989; c=relaxed/simple; bh=W4vZ4x3CP8SVyUrgLk7eS968yXX65ZHvPF7MpQkPKkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DICVWzm35dHKlV7Z0J9xhWxEkRCy5I4vagnPaE06KPdh9mcMN9hLBPIiIbaTtI9AkrJWfKlZDpz9uOybf0enCNpg/ISvZXe/j2rnX6yUU2U0Qhg9jQ0vvnSgjW4b4XRA5etcsGlw4ade6mq7RsGRMi2Xl0z4QCAbwpJyk3zvY+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=TyjwoXwY; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d7354ba334so14818075ad.1 for ; Fri, 09 Feb 2024 23:09:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548986; x=1708153786; darn=vger.kernel.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=fkD+zP+NWB9AGWV79+gv+/kfpMf3rGsHXh6c/wyG7zI=; b=TyjwoXwYgnd5orU7V6QnnN2OS9KYbnGH+gVPPF7XRwWQuAc1FxMfwBXZBSJlJqNOLt c/11weyUy7oAyNbewcfYDqSTc2Jm+hMKYn2qePF8ny7grKTi1ws/OLrkYKrm0mIKkoKF CTY+ov395mLQWmuFmGG5A/cd5od+1l16RwWwI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548986; x=1708153786; 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=fkD+zP+NWB9AGWV79+gv+/kfpMf3rGsHXh6c/wyG7zI=; b=Vcuv7vOkesmdoz6NHPF2FR0n/efaB6uanKrRxY5AyfCVQaxWd96IjVe9nQZ/gfgyHi nMMa/tYzWJFldP28J0aI3gZM/Hh4ZatveoqqbMAzX9OO1GtNkB6nsyadUdRK6N3y/W7t cr4jHz7E6ehNmFfjNuLpCv+bgR9lWQRPN9R7ORvIeEucZmZTziH1m+era79r+DRZ3jxw /BXtA1defmUaQY2dlFlXlV+WwPDpBddI+KPU5rBilqKcBEUa1Fj7SszOvE7uR5yB8xm+ WQHN1BruLFQv9Dlec3zBXjE5M89VBntEihvLHawQiBNFZgKK9CBeYLezYWu/gNEzmJJm /2zg== X-Gm-Message-State: AOJu0YwqMAGm3VaOR6Ewbv6gRxV7QAiDmxHpsbhIDOXQyU+At+RbMiO+ OTLwRkdnGVoY7mJ7g86LxNBVI+EEu5oLsdo4JdEurd0Q445DZxS18gatZ6QnkA== X-Received: by 2002:a17:902:be14:b0:1d9:a609:dd7e with SMTP id r20-20020a170902be1400b001d9a609dd7emr1710601pls.55.1707548986273; Fri, 09 Feb 2024 23:09:46 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWI/ch18h9Q0LqkhYI9qvNSPXFKaQ+zZTw5iEWVutGXC3kUt5cSlLojPVIjctJzLIWli2TuZoulZ+xv5+4F5cm7BXzU7J5caPmQUVkQv44C6fgnze1u2LBEoJf8sgUoniTVtWZLh4LZvZ8AJIM0I7jYhvtvTaaRqt3PeoJmmTByxWzuN7Ik8fhGlYmoSGsGpd5UHFVZ9L0sCnLiMBuFuKlczas0/e64Cxru+iSkN39jwppcmC1t0TpWb8QRmt0LqsNfljAZTuKdWjvhzbz2EhmN/NRUdJVChHtcwqwPFitd97FaAVr1uzBS7oqnZruWzoFzq9fZSmAWd+ZAMD5jmNYZCDrPho+8AiRsCrSChYF0TsCKV8fj15RoxF6c8Rql53xnKG6zFvg2TN2LT5wAkXlr7HPGiA0ZcDk= Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id s7-20020a170903320700b001d9b749d281sm2493240plh.53.2024.02.09.23.09.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:45 -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 , Greg Kroah-Hartman , Matthias Kaehlcke , linux-usb@vger.kernel.org, maciek swiech Subject: [PATCH 04/22] usb: core: Set connect_type of ports based on DT node Date: Fri, 9 Feb 2024 23:09:15 -0800 Message-ID: <20240210070934.2549994-5-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495204398302391 X-GMAIL-MSGID: 1790495204398302391 When a USB hub is described in DT, such as any device that matches the onboard-hub driver, the connect_type is set to "unknown" or USB_PORT_CONNECT_TYPE_UNKNOWN. This makes any device plugged into that USB port report their 'removable' device attribute as "unknown". Improve the connect_type attribute for ports, and in turn the removable attribute for USB devices, by looking for child devices with a reg property or an OF graph when the device is described in DT. If the graph exists, endpoints that are connected to a remote node must be something like a usb-{a,b,c}-connector compatible node, or an intermediate node like a redriver, and not a hardwired USB device on the board. Set the connect_type to USB_PORT_CONNECT_TYPE_HOT_PLUG in this case because the device is going to be plugged in. Set the connect_type to USB_PORT_CONNECT_TYPE_HARD_WIRED if there's a child node for the port like 'device@2' for port2. Set the connect_type to USB_PORT_NOT_USED if there isn't an endpoint or child node corresponding to the port number. To make sure things don't change, only set the port to not used if there are child nodes. This way an onboard hub connect_type doesn't change until ports are added or child nodes are added to describe hardwired devices. It's assumed that all ports or no ports will be described for a device. Cc: Greg Kroah-Hartman Cc: Matthias Kaehlcke Cc: Cc: Cc: Pin-yen Lin Cc: maciek swiech Signed-off-by: Stephen Boyd --- drivers/usb/core/port.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index c628c1abc907..622b8ada157c 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -9,6 +9,8 @@ #include #include +#include +#include #include #include @@ -696,7 +698,10 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) { struct usb_port *port_dev; struct usb_device *hdev = hub->hdev; + struct device_node *np, *child, *ep, *remote_np, *port_np; int retval; + enum usb_port_connect_type connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN; + u32 reg; port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); if (!port_dev) @@ -708,6 +713,38 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) return -ENOMEM; } + np = hdev->dev.of_node; + /* Only set connect_type if binding has ports/hardwired devices. */ + if (of_get_child_count(np)) + connect_type = USB_PORT_NOT_USED; + + /* Hotplug ports are connected and available in the OF graph. */ + if (of_graph_is_present(np)) { + port_np = of_graph_get_port_by_id(np, port1); + if (port_np) { + ep = of_graph_get_endpoint_by_regs(np, port1, -1); + if (ep) { + remote_np = of_graph_get_remote_port_parent(ep); + of_node_put(ep); + if (of_device_is_available(remote_np)) + connect_type = USB_PORT_CONNECT_TYPE_HOT_PLUG; + of_node_put(remote_np); + } + } + of_node_put(port_np); + } + + /* + * Hard-wired ports are child nodes with a reg property corresponding + * to the port number. + */ + for_each_available_child_of_node(np, child) { + if (!of_property_read_u32(child, "reg", ®) && reg == port1) + connect_type = USB_PORT_CONNECT_TYPE_HARD_WIRED; + } + + port_dev->connect_type = connect_type; + hub->ports[port1 - 1] = port_dev; port_dev->portnum = port1; set_bit(port1, hub->power_bits); From patchwork Sat Feb 10 07:09:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336587dyd; Fri, 9 Feb 2024 23:12:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXFABu5OZqjkQhCYPk85fbcC/m1y6Cnn7sTSRRraQmyKVrLB+i8/bRI826WjphDmXKI7lROKxSZ7pbk/ACaluNrUL33uw== X-Google-Smtp-Source: AGHT+IGyjv3fbe+raMDOEhRZWcx4KG0+81XqXP3kmAyTzbXk2RO175tXh0ArEAujmiareXOrXjq+ X-Received: by 2002:a05:6402:292:b0:561:2711:68cd with SMTP id l18-20020a056402029200b00561271168cdmr620396edv.3.1707549179440; Fri, 09 Feb 2024 23:12:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549179; cv=pass; d=google.com; s=arc-20160816; b=BbRdj1UEhdbNOLyNzwUzxe2eyy0fiwkgvgVwNl2eLg2sAQCfSYfe1pvf67k9kEbNN9 NuKGn9BJHc7KlGU2aVfiJpWKUu5ZdqB8rxSYHZdHqHBtcx0YBlsRsJAHzD4CgKpK+euC ahcAoORAx+ItmEADPAmMSKNGamqD5q15buxVzxu6jLS/gRV46rzJ4oLXkaRtiL6vSiEo ygb3YrUpLTzejdsle0a9hlju3lIrX6X4YjAIm1LMmeXFdTLQmcM4cofag9ODJVQQoFc8 x4SOFhvagcpbQFWiuyQDYU0kX2P1XFrxWCckATuUydXEMWBWRItgdztTlAQKBv6wqme3 H4Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hhcGY0pJW+kaFughUNfil3pAisJaqEi+Mlm0h6qD8C4=; fh=0IMnvOoPzRWlItaP/XFL7nguf6XtB5Lp6AGKjXTRVi8=; b=KB5rZ7XPENywDqTmRv9KJ7LalbMQw89gk1xb1O8ZqEkvqfXqBGLIVoXXby1iOeF5ji 3RvOYYVTOADzqy30huQZtU9vuH+HgTFuvmfdmsW6qU0W0pCgxt/h3ouW8kGNZ7xjLiZV JNJtEs382ObGQ6gSHVdxX6CW2QQwBGq4v932aZnM3kYGh1mX86nGL/mg/+JJ6foa0l2D MxGzkhgcLAU/FhVERAJ9JFdXUn+ZSDQAYLbl+GuKgO47TEu/jb1S3KM9/YDrgKVOavWw CijWxeiOdxcXtoMAge5jRR1veZWv8uOx/fwBdMedVy1j2+rE1ZIGH+eYiSM+lC93vb9I Z5rQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LMb4XSJr; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60311-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60311-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCU8ZpkgMGSrGjGFF71cXeDxY/bAxT9frFw1iS+3s1km0nY3eZV+Mt7egqRJH+4W7ADsnRYLxCDUd9T2g3lVzm0bNoHREw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v5-20020aa7d645000000b00560ba41655asi566475edr.328.2024.02.09.23.12.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:12:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60311-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LMb4XSJr; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60311-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60311-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7E6B91F23955 for ; Sat, 10 Feb 2024 07:12:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFE9229406; Sat, 10 Feb 2024 07:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LMb4XSJr" Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C107376ED for ; Sat, 10 Feb 2024 07:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548992; cv=none; b=Je3ml+XyZd28qCRNu+sSQzS+cDWD4e25KrVThjs4ZfecyXySQOMy4OmDT/VJx9i5Nso6IlQ26PzFyjFwiTJ7eCJPHuBuIDWY5JcYiyeOuSlaqcDXLobANVqAawdHArNjzxV7KYyQ2kyA7ZrcDTDfhEkhYi02n4Ib7OkARpN+aS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548992; c=relaxed/simple; bh=jL/gG9D8lG06mow1s8GNyHxflUWLSuC/auB5hTAdw0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PhdiYKBnFqXddSR2ithbAtf2BulAqNIxe44JMqfNbJm6IIPVg9xjd7+5HXFH5itM8G6St1MBSraLpzm5ZatVHjIRUsOQcFDN58SMWa2caMIUjgArzEtE5ywahjpn7NivnVene5gDi4D3ftkZIFhaue+MetDMn70GG96PxYRGC1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=LMb4XSJr; arc=none smtp.client-ip=209.85.167.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3bba50cd318so1220200b6e.0 for ; Fri, 09 Feb 2024 23:09:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548988; x=1708153788; darn=vger.kernel.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=hhcGY0pJW+kaFughUNfil3pAisJaqEi+Mlm0h6qD8C4=; b=LMb4XSJr/AtRiNKyFWuEIB/sbAY4X5AP2GLY2VSF/Hg/fHOUkFttnS4glVWEu0ONYe e8d78noShDDn7RtYcNi50/D1laeKqMeke63izqYIiwLHCSo52ZKtxcumnYHeFHE8D46a C9QWw/u9t9RDBBwhSjuSk03QPb4/LffulCies= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548988; x=1708153788; 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=hhcGY0pJW+kaFughUNfil3pAisJaqEi+Mlm0h6qD8C4=; b=NcBVYvA8AoO4aEnTrwOI3/xWfbt+L2jb86duze08X+F57/5lZZHOOrEq08Run4PdQp TXJLMYoHiupqNT0YWB9VuhfGuuNyQ5igGXhbyWfsAY0WKBgxDAmNKX9jirnPnLq0+3U+ YRsyNNmAF4E402hgHGm+vjPLGaQsuxvKAp6eZw9db7bTy3Wmc5UZJ4nzljN/dwDeNYoQ U3O1RJR1KSXsqKdOG/Fyf6pU1+ImqHdMGfMoMpHd/YuMJIeLTm+PYvPE4hFfBGi1gUa3 5VY8MPCHK64TB0RyXSKfPkncNeD4NC0xsG9xdvpzLYciiogUA/E9tmwZque03Y82JfEn Yvaw== X-Gm-Message-State: AOJu0YxuxlVFVuVpaT5Dsr7pNdF+VJBlO/J/w6m2dOG+ejMeTo0p3IJ5 08mGJ/C6kk6z9pPhDhZedcI3/2WGBVNl+JGJQ0lreZm1PZN0MXY1NdY8fY3jgQ== X-Received: by 2002:a05:6808:1154:b0:3be:459a:b373 with SMTP id u20-20020a056808115400b003be459ab373mr1858284oiu.52.1707548988259; Fri, 09 Feb 2024 23:09:48 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWfg+QEjW5TkMN4yEs4j/hGTro4fPsmIMv+/GkLsSyKpPXxknHnXcMzvSJZhJsl1lg7IyadrS3Kjw4OTEmQ6hIJcoRx5Qmxpxt4DU50F8HnZ3rraSeppCM5Num5mdpQ5uKGPXy9XWKjnmjnyYsNlVGJmbUsVR6bzZP0Ke6I/GxDVL6hXL8xZofWfNdddRFllmzXhxZsldGorzdP0hGlRTrugqA8prmIN69jc21X9nuzmMGau/oYxAilSWF2o6Uo8PPj+nIgy4m4+QWgIO+TSHiM2qvXy/IWHaFHfmqvWXFL8tEWy37wfxdm7t2BR8wQsWdEMjEDfwyZvo7ASqhLqnBipuFS2C7IAVhf58k4yvXcNIGifcJnNwfK9HxLzLBzM8V6GkW+zpWnaAQWGmdeiG8qwkkpQqmjHuW9amz8RCQhV/lmrOVety//gSyNNFf7LNytox5MAKvNJEfGH597G684E3DrPI9MQRlRZP/fPyTjtb4gGbThd5gZQKOepaGySvVcmL4OnqGyiyLZzjz2rw/GTkHQOam37GjCWM3he2a/Wmr6E2HDBEHmiQCZOX7Gqo8bxkpzlcdzTW0Xa3Fdo+sMZiANkkHjLmrRQkRkRBR/q2tdMi3GFPQIKK50nIwxC+3ZUAnZbTxk/TWdJaGXOnsCFlG/tZuk7EnWUaHg Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id y2-20020aa78542000000b006e096ff7c91sm1645603pfn.100.2024.02.09.23.09.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:47 -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 , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 05/22] drm/atomic-helper: Introduce lane remapping support to bridges Date: Fri, 9 Feb 2024 23:09:16 -0800 Message-ID: <20240210070934.2549994-6-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495088613721895 X-GMAIL-MSGID: 1790495088613721895 Add support to the DRM atomic logic to support lane remapping between bridges, encoders and connectors. Typically lane mapping is handled statically in firmware, e.g. on DT we use the data-lanes property to assign lanes when connecting display bridges. Lane assignment is dynamic with USB-C DisplayPort altmodes, e.g. pin conf D assigns 2 lanes of DP to pins on the USB-C connector while pin conf C assigns 4 lanes of DP to pins on the USB-C connector. The lane assignment can't be set statically because the DP altmode repurposes USB-C pins for the DP lanes while also limiting the number of DP lanes or their pin assignment at runtime. Bridge drivers should point their 'struct drm_bus_cfg::lanes' pointer to an allocated array of 'struct drm_lane_cfg' structures and indicate the size of this allocated array with 'struct drm_bus_cfg::num_lanes' in their atomic_check() callback. The previous bridge in the bridge chain can look at this information by calling drm_bridge_next_bridge_lane_cfg() in their atomic_check() callback to figure out what lanes need to be logically assigned to the physical output lanes to satisfy the next bridge's lane assignment. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/gpu/drm/drm_atomic_state_helper.c | 2 ++ drivers/gpu/drm/drm_bridge.c | 34 +++++++++++++++++++++++ include/drm/drm_atomic.h | 31 +++++++++++++++++++++ include/drm/drm_bridge.h | 4 +++ 4 files changed, 71 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 784e63d70a42..2e989fbeb503 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -764,6 +764,8 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state); void drm_atomic_helper_bridge_destroy_state(struct drm_bridge *bridge, struct drm_bridge_state *state) { + kfree(state->input_bus_cfg.lanes); + kfree(state->output_bus_cfg.lanes); kfree(state); } EXPORT_SYMBOL(drm_atomic_helper_bridge_destroy_state); diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 30d66bee0ec6..3fce0d8d7dcb 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -843,6 +843,40 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_atomic_bridge_chain_enable); +/** + * drm_bridge_next_bridge_lane_cfg - get the lane configuration of the next bridge + * @bridge: bridge control structure + * @state: new atomic state + * @num_lanes: will contain the size of the returned array + * + * This function is typically called from &drm_bridge_funcs.atomic_check(). + * The @bridge driver calls this function to determine what the next bridge in + * the bridge chain requires for the physical to logical lane assignments. + * + * Return: Lane configuration array of size @num_lanes for the next bridge + * after @bridge in the bridge chain, or NULL if the lane configuration is + * unchanged from the default. + */ +const struct drm_lane_cfg * +drm_bridge_next_bridge_lane_cfg(struct drm_bridge *bridge, + struct drm_atomic_state *state, + u8 *num_lanes) +{ + const struct drm_bridge_state *next_bridge_state; + struct drm_bridge *next_bridge = drm_bridge_get_next_bridge(bridge); + + next_bridge_state = drm_atomic_get_new_bridge_state(state, next_bridge); + if (!next_bridge_state) { + *num_lanes = 0; + return NULL; + } + + *num_lanes = next_bridge_state->input_bus_cfg.num_lanes; + + return next_bridge_state->input_bus_cfg.lanes; +} +EXPORT_SYMBOL(drm_bridge_next_bridge_lane_cfg); + static int drm_atomic_bridge_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index cf8e1220a4ac..b206ae2654d8 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -1074,6 +1074,27 @@ drm_atomic_crtc_effectively_active(const struct drm_crtc_state *state) return state->active || state->self_refresh_active; } +/** + * struct drm_lane_cfg - lane configuration + * + * This structure stores the lange configuration of a physical bus between + * two components in an output pipeline, usually between two bridges, an + * encoder and a bridge, or a bridge and a connector. + * + * The lane configuration is stored in &drm_bus_cfg. + */ +struct drm_lane_cfg { + /** + * @logical: Logical lane number + */ + u8 logical; + + /** + * @inverted: True if lane polarity is inverted, false otherwise + */ + bool inverted; +}; + /** * struct drm_bus_cfg - bus configuration * @@ -1104,6 +1125,16 @@ struct drm_bus_cfg { * @flags: DRM_BUS_* flags used on this bus */ u32 flags; + + /** + * @lanes: Lane mapping for this bus + */ + struct drm_lane_cfg *lanes; + + /** + * @num_lanes: Number of lanes in @lanes + */ + u8 num_lanes; }; /** diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index cfb7dcdb66c4..5f64f6e822e1 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -884,6 +884,10 @@ drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge, struct drm_connector_state *conn_state, u32 output_fmt, unsigned int *num_input_fmts); +const struct drm_lane_cfg * +drm_bridge_next_bridge_lane_cfg(struct drm_bridge *bridge, + struct drm_atomic_state *state, + u8 *num_lanes); enum drm_connector_status drm_bridge_detect(struct drm_bridge *bridge); int drm_bridge_get_modes(struct drm_bridge *bridge, From patchwork Sat Feb 10 07:09:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337548dyd; Fri, 9 Feb 2024 23:16:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLXAX2IKloQBa/TfAUJDGRlN8qHmUdogBDMgE1IAVM4KrL8HA8Pdp0GdDwjaZ7O0q8J3jX X-Received: by 2002:a17:903:2346:b0:1d9:b099:6f9 with SMTP id c6-20020a170903234600b001d9b09906f9mr1770739plh.45.1707549369278; Fri, 09 Feb 2024 23:16:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549369; cv=pass; d=google.com; s=arc-20160816; b=Qqat+pIjLnbGKT4wBSNxpjC5ro8lNB1zIn+nIpElI1epnxoXAxDIGk+YuaqrB53cZ7 ZgbK3sZli5av7lpZCDOGbwTcMDf4U1R4ThnUcho44YF/oDnAv701gBPDbPuyMwkp4RuQ BwGle/OWxG8GKPVxr92hYI54IJXrSPeIFsQdAWZ2e8uMx4s5dzk8l0cVu3addXj0QWV9 4LOgGrWUVeubPGPxBXWUpQewm3NZW53mAMMQJCeW6uR45hYDym7zifgo7/Tb2F292wzZ 7gG0HECrksksclZ0R2kPRoRVMb6WqYwKSd5usmYUDbX6r8DQ52uwpGDdB0x2xEHmlG7C qWjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lH45L1cL1xUVSD3papAAYvPuLoLqwTUuYKVsS6HzrjY=; fh=l61yWRx6GoCZ3G4bnuFwLXO7qyrfAEVgKI97wLQtTCA=; b=hKiZctlc3QOwo2CHk9hMDEbILAxFWklGf4dvl1GJisfH+Wf+6uCSnMTq5QPPf0ZuQp BN2nI4oc63LRD3Q+xUgUBWLGZ3WsbAMBM7a0kSnB1MTvUt6bc/TWIWr7OVleiL0Phali +DPFAtMLJ/9aNLkr4qPJp07zXJb72U0aXywrXvIO5gIu+WH6EHvBAPBB6D6knMtHa6rT WkUej0D/oya+3q0acoFKXGXBjJlkghDjcOokvScgayh4TNZZJzW/Ipma2f3VRj5YH9HG oOWnPgyEH+lIVIOL8pgIJ/hR4VXDeCITPSad2YpsRKZlmu8ah1owF9zYPacAR1TGzaA9 74mQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h1qp2nNV; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60312-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60312-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCV0gjd3AWR44VWTkQ5GpG35WGfAG3F+DNRVXISS/RnVch3ewzJLu9DVmHyxc3dyCFfzMYU/ppyMprdWiaElZUUSk0GZdg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i4-20020a170902c94400b001d7195d8a0fsi3052770pla.117.2024.02.09.23.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:16:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60312-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h1qp2nNV; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60312-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60312-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0F5ABB23D4F for ; Sat, 10 Feb 2024 07:12:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 297F039FCB; Sat, 10 Feb 2024 07:09:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="h1qp2nNV" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A84DA383AF for ; Sat, 10 Feb 2024 07:09:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548993; cv=none; b=Ccp2fRe3z9gB1/WEaxK2KjpVDILAPYO6VaVvqhH6NJZyKmoYIfWfOLc/xxio/MBeT1K8rvFcgk7/b/MUsNOeW8IBFnZQmA1tYSyvHXnjUpkABjflZQGd6F5cn8zjoyipYtGmor9uyS1ChjuvaPuWKcT4LE/R+FoULI/hQXCF9TE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548993; c=relaxed/simple; bh=CsEWTa39QEyyhyQJgHJzIAqwTPpRwHJNuxlR8WNSCvE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=De4rL2r2ojXbDDWgI7bqFzfW6w26bDtLmls/mSw5rKzcrZyf5P9ZrrKapROPTiGW5GQpBjiQ+1uMIfx0RJY+NFWqflp/VOzuIgnuCUi6BmkSmqDSCBEE7zh+NLnjeULlOw2Zi8Snx64o4d2ofcn/w/WPqVckGUmAneSjFvmdYv0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=h1qp2nNV; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6e096229192so1082431b3a.1 for ; Fri, 09 Feb 2024 23:09:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548990; x=1708153790; darn=vger.kernel.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=lH45L1cL1xUVSD3papAAYvPuLoLqwTUuYKVsS6HzrjY=; b=h1qp2nNVYpKBvfjEKNwdNYViMp173CbOGeylz7FJebYTHr05VBFwNOwoVuhhdWa6kH TibnYnSOgFlm55yTnKwYhAI2MkqCc7LSWROmQhOJNl2gR4jR2qv9TQgHVfEpEeRJ130A Vd5DAnC9p4IJt6xsegWKL2oIeTADzcJy6Wa6k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548990; x=1708153790; 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=lH45L1cL1xUVSD3papAAYvPuLoLqwTUuYKVsS6HzrjY=; b=YLTa8iR5NwGpVTd1lhRmahtEhi1gwkiKvHXP//3T6LLhBBOKhajlNSzeX9hBH7K+iO cvNiykmttuhz3jriTyb+/lqhWl6uMpfRrvsfgLorP8Ri4pFsA0TNbNFjLbZKUHmYQDsB uB7vwg4zEuCSBg4aO9zjOHsQ5BBKjHPZta4qkyzn0fTI+6HDTkVSM8TknRnkXQ8pUXCZ OBSVeudRed9PPKASdh/NuhSXjaERFp5WcfCoa35OaKqMBYyd/Nn05/ni/Rv4pT5N2RvU tSr8JE57W5yB4PcYxKoepZFxMRwhLK9lTRanIjIR6jmdkjv2Ozu/onhumCIeEZRDV86L 6XQw== X-Gm-Message-State: AOJu0YyozEkha+15IQfuvxLdglWek9Cj8cNWTUV/yp6J2PjVV5FXkZ6C dxfD9/0sfMe/EoARebMdVxQSk96ye/n3J3fVbLnWitfxcCYQ4V3za9RDvs5iYA== X-Received: by 2002:a05:6a20:ce4e:b0:19c:9c1d:6090 with SMTP id id14-20020a056a20ce4e00b0019c9c1d6090mr1772103pzb.6.1707548990096; Fri, 09 Feb 2024 23:09:50 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUaHaP7nLmXfSvHc7FAhO6xSnWm2pSdndktsvLRg9SOw9ntG09kMLqAGaWWETpHm/KUgqubzPqjL/Ug1m0wuCZQFQAfipUOOv/4ObeMpoa78rcvpWY7qWqMiI3J1J6K1xJDQqGMqUsjqGR5VKNNvb3UrIvQBvWZqScgSEjo2EFLs3jxE1+yNe5/Y0KFvJBDYOEyaxeLPqm7s8HXa9VuXNj1qJTnM6eKE0RP2o9DDWTZd1MylApc/eKY4r6gqdiBX+NyrBUBvfhwFmrDdVPkY/3RYmmM2COXuk+/+uYKVghN/SKHdYPzOhxv/ClNxcF2rNhndqchWKLLIooMMmxKC7HWTUASBqF2lCMlyc2A2J9PyQy1ZqXFPMzSfTshHaSJOQlr1QLH/Pxuoi0lfeegRyzss9b11hyOGQ3KsNNKAyhnzm4mC0tG8dMYkbedAhCPyV1eLkbqY3poeMOCQxPZsgbYCSYKiIHLUKI9FGYcD8WO4bj7Ap7cACyM7ndWBIzqVFbmJFIsj8ezXhgP2hTaQkO/AtmkTQixy4QQrYUM17+2lS+zVJVCTqJZMqz1jgM2zSNv7FSXGcFMC8kL0ov5mHp+fvCqwCZaZDhD7Pbe5OdfbB5NQIeIHZ5M1bpOEHVYYn4Uo1fRX9PgIvBF+V34KXDJtkmpWbFmFNJVWAz9 Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id se14-20020a17090b518e00b00296d3598f9asm2910769pjb.35.2024.02.09.23.09.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:49 -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 , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH 06/22] drm/bridge: Verify lane assignment is going to work during atomic_check Date: Fri, 9 Feb 2024 23:09:17 -0800 Message-ID: <20240210070934.2549994-7-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495287405109879 X-GMAIL-MSGID: 1790495287405109879 Verify during drm_atomic_bridge_check() that the lane assignment set in a bridge's atomic_check() callback is going to be satisfied by the previous bridge. If the next bridge is requiring something besides the default 1:1 lane assignment on its input then there must be an output lane assignment on the previous bridge's output. Otherwise the next bridge won't get the lanes assigned that it needs. Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/gpu/drm/drm_bridge.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 3fce0d8d7dcb..5097e7c65ddf 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -881,6 +881,10 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + u8 num_input_lanes, num_output_lanes = 0; + const struct drm_lane_cfg *input_lanes; + int i; + if (bridge->funcs->atomic_check) { struct drm_bridge_state *bridge_state; int ret; @@ -894,12 +898,24 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, crtc_state, conn_state); if (ret) return ret; + num_output_lanes = bridge_state->output_bus_cfg.num_lanes; } else if (bridge->funcs->mode_fixup) { if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, &crtc_state->adjusted_mode)) return -EINVAL; } + input_lanes = drm_bridge_next_bridge_lane_cfg(bridge, + crtc_state->state, + &num_input_lanes); + /* + * Ensure this bridge is aware that the next bridge wants to + * reassign lanes. + */ + for (i = 0; i < num_input_lanes; i++) + if (i != input_lanes[i].logical && !num_output_lanes) + return -ENOTSUPP; + return 0; } From patchwork Sat Feb 10 07:09:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337856dyd; Fri, 9 Feb 2024 23:17:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVquEYYKbwVWxg2AB54hEiYa2XXA5gy4sA3iVc31psWMdlgokvjcHm4FBmdCC/tQz43zH5T/Zj8+c/TGSGzk+WoxCQNAA== X-Google-Smtp-Source: AGHT+IGALxXAYvaxHKCHzgKZJ2h8gShNr8vmpthw/jqeJF1LxtUx49XMLEhLRLr7lEhKEX08JXTp X-Received: by 2002:a05:6808:3c89:b0:3be:d043:518c with SMTP id gs9-20020a0568083c8900b003bed043518cmr2718642oib.34.1707549431762; Fri, 09 Feb 2024 23:17:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549431; cv=pass; d=google.com; s=arc-20160816; b=yYpCjeKsXEj/A4fc5pjhHPTpVJm0/bmL/WaWsCwEzIuH5ZSV2g3Z73nTUP7CeKXseg OqJMHXRYe4YBTTkIF37CqWJOvOyjBenwT4C3tgQI3EbpwEjc5V/QrJArk+BeX9vgS3CC 0NVOAJEv+Sv5qoazNL0Z1ivPS3NAhBVyLDqBkZMZXfEGP2pIPW26WZGROtD6NcLKqgl3 ZXDg2QICsMgdKjyqTailSsM+Q7msED9Y7OkiQgBT7hQ8ELEXWlab/NRCuS779zxbMeL/ sQKY5YJzjEuUnGORaLERcfNNxTNlkqu4r2DXmFpFmkkrjxfrJOjfyNawh1OwqSdDLg4t 9q2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3zER2Ilw0QhxMBzy8PRis9D7e+HIgnB5hYCQzM4YYso=; fh=/YJLvszDcjtoXugZJbo9EDX/hbIc43nbnsjhflflBMM=; b=kxW+FvD0njPgS31vr7Iy/XEB2h/Th25/FS3bt7DC3D96x9Y06UNNwSF9aD8R4RM7FK h5BzAPKTLeNZArZkDu9Kirk0csnJpiHI5DiigQ8RYbTH3VgC5GGDWQbMC/fiLEmkcSkO EYunwBEAgKqtF0RZgcrpqyiN0k3JM3MY5gosL2cNYqaSYpv6TGnoi6mhyEZ7P5adKfGB a4FO9/o4RJou6Z2RNRyft2ybDn7m0/qgscbYlCIejH/7CNAtF6jdRBV5+Koi/34Mp1/D 0VIPXk5hTl9liqmOHTTlXBFlBuW6GgpyeHzeTSObNW8H5IUwhdrTtv98f2o9zLhMVRjU e1OA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="jz/ArCb7"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60313-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60313-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCV7lMN6KQ85RExxWXEY4MiXOLslHGOGxMfjQD01QcWqNMCfQGkJfZwjWcgajEN4WPBSBEiNEpMrd9UAlAJtYM3aXe4WwQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id qj12-20020a17090b28cc00b00296a6604850si2997605pjb.169.2024.02.09.23.17.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:17:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60313-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="jz/ArCb7"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60313-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60313-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DA1FBB2668A for ; Sat, 10 Feb 2024 07:13:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9AEA53A1D3; Sat, 10 Feb 2024 07:10:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jz/ArCb7" Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D08C738F91 for ; Sat, 10 Feb 2024 07:09:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548995; cv=none; b=lL5/9yyXHCiDkQaf/fbOe4J7rUPU3J4QI4Ir2yY+OuSc3PAuWRGTZiSOcPInpcAenybSkqVFqhecEzalrRM2+RV5ZQt03SKQGyuVMkbF6oUfKyY7fHQCACOkJszbh7ZV9kqllcwQhis8xrM/XRn2Hg/WQXzd23eiU5EAEEZdzfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548995; c=relaxed/simple; bh=Mzv0e8b5maH+R5VJl6DotCRRWAOOTWYpXPhTaIdR8Cs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bPa+xCSmQxmRwYtOrjVeNK2kgiFX3ytv5PL0c6LDJ7ZBjqgE6KzxA6TYMww0Rc1j0DsQwOrBWkrizRGY3R9sQdjnVjx7A/CmmeTUEECTmNwVpZ6ZLChO+k7xMhCy6ib+WyPZWy1LEc/4q7Kf3DvgFNTxlaykQMzzKKzvOUdeBzo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=jz/ArCb7; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6e12d0af927so1090964a34.0 for ; Fri, 09 Feb 2024 23:09:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548992; x=1708153792; darn=vger.kernel.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=3zER2Ilw0QhxMBzy8PRis9D7e+HIgnB5hYCQzM4YYso=; b=jz/ArCb7aEf0XnTaxG1zjmhkLoFwyxZZaMLIe+xtmyAQQnbAY24szJImOrWBYYXqYQ s2fWTnNfG1703YCto5g2pF4m5/7itmj/NfS1smC/ix2iJ008hcD/8TM2hqOmKGEIhwLU e9tJQTKxexhottbvJNZsp8nD7CmBkB87TuaME= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548992; x=1708153792; 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=3zER2Ilw0QhxMBzy8PRis9D7e+HIgnB5hYCQzM4YYso=; b=hZecS59S3DFmiQkmX+CYHrGdozinuAsCJzoH/Wvo4pj4mb45m0WvHTIrKXb0jqu4Ji 5UVEdZs9fI+MvrXi85HFRk6sbMrswM8PRU+9fEI1p30YmKIeEgR9tytGlCo+kg7fD1p1 7nmPxbwHoaYCEy28ezXf6FPUsvHiItnoeo/P54MB8ZfYA+zMMmi3h0UQlxGcZ9Dc2iOS bEvnvCG2Cz4EOvy7OxBh9i0XZUlZc+CBvyob9o6hkcRUABBg0hV0axgcjxM61g92jCvj 2TkfkHQqMu34Pvi/BWeT9i2R4WoiU2V0CteXvzc4B0AvD8/hJltRAhWYHNVw+bJG+8Dx zKUQ== X-Gm-Message-State: AOJu0Yws1bViS3vSEubEetxA9/m0QCw63reAUPh1TxVRNkr6yuVpLhP5 6hJSlhxMHiskYZVw+E9t8z1s5vJZPiGNJFwlarIN09RN9XUO3fWB6VWr9u6+XA== X-Received: by 2002:a9d:76d6:0:b0:6dd:dd86:ad81 with SMTP id p22-20020a9d76d6000000b006dddd86ad81mr1490798otl.14.1707548992033; Fri, 09 Feb 2024 23:09:52 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWItJfkduQ4ZlMb/4WI7wMAHcsdDlwLJlkD/syq6yJf1sHeXjYYBIe/frbmiy2XGR50jAWFjh9GanqxX17f+9vt7lUWBccaf/pksRS1ZUnaOkGP4dsQwnsx4zPGeqe43Z6C2X4iWLb/Q42Ko20wMp5+d7KTL4cQ0T9VPc0Z0x02Q6Dx+CIG4ziunVGuwntKCgGgDiMcyfUKwU01vEtnRrfZLHGsZYtXzK1umwuiFrXDznvJZnpN1VFqnk5qw9F5CIHJXQ1cNUpESF9mPy5SkuKua+aAdxO81ycYVQ5ClhPOQzHr0mfcZyUwh1ey7EDduqAuq8v/zJkwd3HDl1vSknkzlzPO7ws3fFF/Y2v5CZTUXwtR5EqYwwhLJWXoBzwaCdlC/28MFNSXvMPPPRS7GI0YN9O/JgHHx4MIJV0YthaE583CCVMKPD+5cQolzSPifOhy/9eGQxmb6hzwiZvi6CIRfuQj0SobOxZPh36DEJ68I7dl368YlcYb8kCiQAG7fmsAbs7ru8zRdnRsnNg1IU3FltumjwDbfwJBAj2zz0JksLQHKZL5Co94BVGmDzEL63lWOxFLaBnGEPWOW3aYiRUfa8JGVlNmH2cAikNC+tptaFMse3Aqg5sDg8eq1nQur7Ss0h+xuFfTmw3DIvxVR35+3g983eWVTucCBMlQeVx9fuGCIEgJ4+4zhcPsG3j/oVi1hhfegECRwMJ0NePewQjjHsJnyBsiGvmWFdp4RQfFg/wj6T7sZdPV0KdSPX93F2ZbOok58pOGEzxthPwChtL+GP4mm0ENWmjuf8+xS6KNk/rlaETSsg3C5saKLtn8j9epQEnkJQ== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id y30-20020a63b51e000000b005dc5289c4edsm2717207pge.64.2024.02.09.23.09.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:51 -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 , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , Vinod Koul , "Rafael J. Wysocki" , Mika Westerberg , Alexandre Belloni , Ivan Orlov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-usb@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH 07/22] device property: Add remote endpoint to devcon matcher Date: Fri, 9 Feb 2024 23:09:18 -0800 Message-ID: <20240210070934.2549994-8-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495352798157068 X-GMAIL-MSGID: 1790495352798157068 When a single DT node has a graph connected to more than one usb-c-connector node we can't differentiate which typec switch registered for the device is associated with the USB connector because the devcon matcher code assumes a 1:1 relationship between remote node and typec switch. Furthermore, we don't have a #typec-switch-cells property so there can only be one node per typec switch. Support multiple USB typec switches exposed by one node by passing the remote endpoint node in addition to the remote node to the devcon matcher function (devcon_match_fn_t). With this change, typec switch drivers can register switches with the device node pointer for a graph endpoint so that they can support more than one typec switch if necessary. Either way, a DT property like 'mode-switch' is always in the graph's parent node and not in the endpoint node. Cc: Andy Shevchenko Cc: Daniel Scally Cc: Heikki Krogerus Cc: Sakari Ailus Cc: Greg Kroah-Hartman Cc: Vinod Koul Cc: "Rafael J. Wysocki" Cc: Mika Westerberg Cc: Alexandre Belloni Cc: Ivan Orlov Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/base/property.c | 7 +++++-- drivers/usb/roles/class.c | 4 ++-- drivers/usb/typec/mux.c | 8 ++++++++ drivers/usb/typec/retimer.c | 7 ++++++- include/linux/property.h | 5 +++-- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 8c40abed7852..cae81ed4e298 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1289,6 +1289,7 @@ static unsigned int fwnode_graph_devcon_matches(const struct fwnode_handle *fwno { struct fwnode_handle *node; struct fwnode_handle *ep; + struct fwnode_handle *remote_ep; unsigned int count = 0; void *ret; @@ -1304,7 +1305,9 @@ static unsigned int fwnode_graph_devcon_matches(const struct fwnode_handle *fwno continue; } - ret = match(node, con_id, data); + remote_ep = fwnode_graph_get_remote_endpoint(ep); + ret = match(node, remote_ep, con_id, data); + fwnode_handle_put(remote_ep); fwnode_handle_put(node); if (ret) { if (matches) @@ -1334,7 +1337,7 @@ static unsigned int fwnode_devcon_matches(const struct fwnode_handle *fwnode, if (IS_ERR(node)) break; - ret = match(node, NULL, data); + ret = match(node, NULL, NULL, data); fwnode_handle_put(node); if (ret) { if (matches) diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index ae41578bd014..9a0ef5fa0a19 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -89,8 +89,8 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw) } EXPORT_SYMBOL_GPL(usb_role_switch_get_role); -static void *usb_role_switch_match(const struct fwnode_handle *fwnode, const char *id, - void *data) +static void *usb_role_switch_match(const struct fwnode_handle *fwnode, const struct fwnode_handle *endpoint, + const char *id, void *data) { struct device *dev; diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index 80dd91938d96..3eabd0d62f47 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -33,6 +33,7 @@ static int switch_fwnode_match(struct device *dev, const void *fwnode) } static void *typec_switch_match(const struct fwnode_handle *fwnode, + const struct fwnode_handle *endpoint, const char *id, void *data) { struct device *dev; @@ -55,6 +56,9 @@ static void *typec_switch_match(const struct fwnode_handle *fwnode, */ dev = class_find_device(&typec_mux_class, NULL, fwnode, switch_fwnode_match); + if (!dev) + dev = class_find_device(&typec_mux_class, NULL, endpoint, + switch_fwnode_match); return dev ? to_typec_switch_dev(dev) : ERR_PTR(-EPROBE_DEFER); } @@ -263,6 +267,7 @@ static int mux_fwnode_match(struct device *dev, const void *fwnode) } static void *typec_mux_match(const struct fwnode_handle *fwnode, + const struct fwnode_handle *endpoint, const char *id, void *data) { struct device *dev; @@ -280,6 +285,9 @@ static void *typec_mux_match(const struct fwnode_handle *fwnode, dev = class_find_device(&typec_mux_class, NULL, fwnode, mux_fwnode_match); + if (!dev) + dev = class_find_device(&typec_mux_class, NULL, endpoint, + mux_fwnode_match); return dev ? to_typec_mux_dev(dev) : ERR_PTR(-EPROBE_DEFER); } diff --git a/drivers/usb/typec/retimer.c b/drivers/usb/typec/retimer.c index 4a7d1b5c4d86..eb74abee6619 100644 --- a/drivers/usb/typec/retimer.c +++ b/drivers/usb/typec/retimer.c @@ -22,7 +22,9 @@ static int retimer_fwnode_match(struct device *dev, const void *fwnode) return is_typec_retimer(dev) && device_match_fwnode(dev, fwnode); } -static void *typec_retimer_match(const struct fwnode_handle *fwnode, const char *id, void *data) +static void *typec_retimer_match(const struct fwnode_handle *fwnode, + const struct fwnode_handle *endpoint, + const char *id, void *data) { struct device *dev; @@ -31,6 +33,9 @@ static void *typec_retimer_match(const struct fwnode_handle *fwnode, const char dev = class_find_device(&retimer_class, NULL, fwnode, retimer_fwnode_match); + if (!dev) + dev = class_find_device(&retimer_class, NULL, endpoint, + retimer_fwnode_match); return dev ? to_typec_retimer(dev) : ERR_PTR(-EPROBE_DEFER); } diff --git a/include/linux/property.h b/include/linux/property.h index 9f2585d705a8..0f20df1f0a49 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -455,8 +455,9 @@ unsigned int fwnode_graph_get_endpoint_count(const struct fwnode_handle *fwnode, int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, struct fwnode_endpoint *endpoint); -typedef void *(*devcon_match_fn_t)(const struct fwnode_handle *fwnode, const char *id, - void *data); +typedef void *(*devcon_match_fn_t)(const struct fwnode_handle *fwnode, + const struct fwnode_handle *endpoint, + const char *id, void *data); void *fwnode_connection_find_match(const struct fwnode_handle *fwnode, const char *con_id, void *data, From patchwork Sat Feb 10 07:09:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336697dyd; Fri, 9 Feb 2024 23:13:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVfklhvyTIVlTbxC6uvl6DGqRHTDASosjD2GJMxetzKiYks9XWgUjI7zgjhZI6mmloDb7QiKtWXI6wLc55jU6V8LaUAjw== X-Google-Smtp-Source: AGHT+IEmqG1RYw0uVLgXUEoHYpY6LEHMLge4/30IxR1tZ4AyXwhItAHU3s4oJ9jV7tY9GtuDVl0q X-Received: by 2002:a17:906:b210:b0:a3b:db46:496a with SMTP id p16-20020a170906b21000b00a3bdb46496amr2465041ejz.30.1707549202780; Fri, 09 Feb 2024 23:13:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549202; cv=pass; d=google.com; s=arc-20160816; b=mGl8Rw9vRssHpD9nXDExwvg6NTZFuf/eOa2KBm2EYQypB/eoFdZAHtHusasDAGAnxd q5yQj2cW60EfpWqsYnHB4vj21gUIYYtoIES6sPprQJTxy41vbx7+TDZmMmiga2kHy2Sb 4KIkmrf4HXmPcpWQ6uSPQC3JuC7LtNi9wOWP7er1CXxwps7YeE56KPs2aY1DdzTaITTj N44aVSAVnhNftGMsoFcxUmbS0JUgYrOmhh+e9vKvhC51+scEaH698riJ0SLEaewlqBO2 GfbVPgdHvJr2UUvTuuu/Gtg6Vf3oBQrOrfIT9bsGfGCnzyUQsPMz5ZAK/SUMh49IH0BA IVfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0hZ7H2Ratg3rpkz8VVpxhu5TODDBGSfCSSbP4Wfsjkw=; fh=tQbKlD0ASed3iva/0oTuEDqYXSCsfxKjX8aF4sM3laI=; b=LvJ+G3d0PmG0pIiNHg9szUm7DlkqseH5NP0MYyvXeC9UO6CGwo1OHIZudGzX4LDQOG YiqALn7x+K3HG3TEh2b504LhyrkKDDM1RLjbUSB9kiLqXrFzlC2WoHPIsXpgz10bzEHF nEzO8egbLKgDwI/gOG7y7G6QQHQHd1nCFxJ414ZFm3zPIoAMDrIwm0agpKM9Jg1VE14s KP2iYtyRLLAcqXCJfdv59pqxy00hc8D/1oZJnx2L7eoj8kPyKwGXvl/77U8UdMHAK87D 0MZtcZLPiMeb3wZlVuLSVRRELDnKdArbxYyyNHmxLwxrdIeIyguvX5EckcI0wcV+n8St BJ1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lGoXDUwj; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60314-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60314-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCXpW2pbNFz65g3AXUK5T1f6iv/I7pCv1lOuxDaxhvqaklZPA2uO7bTQri0qF0idot4ZarIPC9JwvPIsptpft7LSrBL1xg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kg6-20020a17090776e600b00a3bd699061bsi1663073ejc.412.2024.02.09.23.13.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:13:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60314-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lGoXDUwj; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60314-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60314-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3C5DC1F2118A for ; Sat, 10 Feb 2024 07:13:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95D4F3A1B0; Sat, 10 Feb 2024 07:09:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lGoXDUwj" Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C85139846 for ; Sat, 10 Feb 2024 07:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548996; cv=none; b=ok8+5jQwYWx1xJV9Feueaok3cQGFGf092IrTr2GDTRX1lW7Wjjqhy14lRo5FWDdwPjKjMO5jrHq3rGklrbM2fxtqqTijCEP2FgydZYUx6p/WaQ0EbOPX8A+YnFeDDcUqFR0z39e4PEGQDfNxzelJBMD4+I9sKLvCbAMYGoZwTgw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548996; c=relaxed/simple; bh=ZrfWbNRvVHxNeML0mxoQMrfj5rYIPsgYNkk8cvKEzno=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DjUB4pThI/yzfKSg/MdW/Da4GZZs9QVYwWf2wEEDooBT7PwleJjVDlhNICnj+R7O1KICyBZvuWtsvsqYis5KxdX+6WvZrja9sOpCqbWFVPVmGeimrEnPfV1JDX3TiQHQP9InXUYLdJMJT380R2X5+K750GPTiilJui8rDi5bXqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=lGoXDUwj; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d99c5f6bfeso17923215ad.1 for ; Fri, 09 Feb 2024 23:09:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548994; x=1708153794; darn=vger.kernel.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=0hZ7H2Ratg3rpkz8VVpxhu5TODDBGSfCSSbP4Wfsjkw=; b=lGoXDUwj8GWKwtpOWYDgfsHqHSHSG+rG8wc5DWl/zvir8K5/qwHucx9ksNwEwKe13D /HNTISSx0r+pUk/LCaDbr/AlPGyDaz/aUSGO9XqTV1FKe2NkvC4KY1t4bYtgmtIkfQEs /g2SroUcjkl5QaHZNTSjVQ66tWA2aVefzJdU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548994; x=1708153794; 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=0hZ7H2Ratg3rpkz8VVpxhu5TODDBGSfCSSbP4Wfsjkw=; b=GhOw7OXkfEYoLe6zo0RETt1BRN8SsjQiTl0Tap5Ue645pL4/jjk8nAGBvHTYX9ghgC LbZ89KSdAgnFYp0d2JF/wYARoxt05ZBRv4tAv+N0a4IDi9o7UP2JmqS1hgpPeb0NBZH2 1DAxrCNvYTqlmRsGrhSs0SqRIx0JOPdW/5c8RgiE9HZLcCPPrO5NXARAQJZC2KQdbgmM yFqx6kUCx76vCu5GtC7q+iARYw+Hnq2nyddH17agqNp11PxtqAExpQdXTIrE/VvpqnC1 fsmPenWwHuisCo3+fhbz5V1ufhzR9YfXGmtD9kkjPb8ubcX12CUwylfTAVMK0jOsvK1H 5LxA== X-Forwarded-Encrypted: i=1; AJvYcCUaHWHfKYLd8C479jgtPpEIdY0VrzGsgiTNOw7zXSNQMLfkSU0xsF8ccxYc3eqWFTM1/SneCaeVNgTLEmACkKZLmi7niUqIAjrW253Z X-Gm-Message-State: AOJu0Yx3M8rmeO3DR/mITbk1IqcIe9Q9kcw62MUy0MRIbZQ1spplg65B izkwbsyD3T194M6stApd5dcbDdshxQWJ0nKPKn6VXVIRtfZcgBuBO7k8fr50Gg== X-Received: by 2002:a17:90a:b881:b0:296:1dcf:c297 with SMTP id o1-20020a17090ab88100b002961dcfc297mr2038853pjr.7.1707548993706; Fri, 09 Feb 2024 23:09:53 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUdlXLg5og70qheFVtE2wxLh4Aatgr2JuX6qBZq1Hzv0Ubz4IIv0qIg/xzMHN8EPeDldrbsRJa3EkSGd6FVIRCmDYEQU7VCTD8/9qn7/J/564Dc7YbBVXVx8GJprDInmAOehoOK4VzXaKKoWRxaJ9KfPxwEMKT1MC/9v0Ff2/2IkDw/oc//N8Zhp/aQ9VKlfE9UkS6Fnijj/S/phDX7qkp3imWWVKdocEDgtZlC6S+PFY5tMBwxIIWO0DQuvwakgIw9Pkiw/m0OR/Tf5UowBvq5FMaYjhtiX49jof2ZrCDRMUIVmH2SxGcFfvixC1irDXKWqyJ53IAG89qM3wqEcRJLc02ftkUhCV6aUZ61aFJk5a0i04AG+zB5QHE/mrdyixBvB6qRjd12JpR5l31MK1K3O7ZL3/hK0ZUFt2faCzREy/6eMaNZdEBQGEQTB2U+LRYjZEQ= Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id bj13-20020a17090b088d00b0029552a03219sm2883297pjb.29.2024.02.09.23.09.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:53 -0800 (PST) From: Stephen Boyd To: chrome-platform@lists.linux.dev Cc: Prashant Malani , 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 , Chen-Yu Tsai , AngeloGioacchino Del Regno , Heikki Krogerus Subject: [PATCH 08/22] platform/chrome: cros_ec_typec: Purge blocking switch devlinks Date: Fri, 9 Feb 2024 23:09:19 -0800 Message-ID: <20240210070934.2549994-9-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495112628768481 X-GMAIL-MSGID: 1790495112628768481 From: Prashant Malani When using OF graph, the fw_devlink code will create links between the individual port driver (cros-ec-typec here) and the parent device for a Type-C switch (like mode-switch). Since the mode-switch will in turn have the usb-c-connector (i.e the child of the port driver) as a supplier, fw_devlink will not be able to resolve the cyclic dependency correctly. As a result, the mode-switch driver probe() never runs, so mode-switches are never registered. Because of that, the port driver probe constantly fails with -EPROBE_DEFER, because the Type-C connector class requires all switch devices to be registered prior to port registration. To break this deadlock and allow the mode-switch registration to occur, purge all the usb-c-connector nodes' absent suppliers. This eliminates the connector as a supplier for a switch and allows it to be probed. Signed-off-by: Prashant Malani Signed-off-by: Pin-yen Lin Reviewed-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Tested-by: Chen-Yu Tsai Acked-by: Heikki Krogerus Link: https://lore.kernel.org/r/20230331091145.737305-3-treapking@chromium.org Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_ec_typec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 2b2f14a1b711..cc5269a4b2f1 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -325,6 +325,16 @@ static int cros_typec_init_ports(struct cros_typec_data *typec) return -EINVAL; } + /* + * OF graph may have set up some device links with switches, + * since connectors have their own compatible. Purge these + * to avoid a deadlock in switch probe (the switch mistakenly + * assumes the connector is a supplier). + */ + if (dev_of_node(dev)) + device_for_each_child_node(dev, fwnode) + fw_devlink_purge_absent_suppliers(fwnode); + /* DT uses "reg" to specify port number. */ port_prop = dev->of_node ? "reg" : "port-number"; device_for_each_child_node(dev, fwnode) { From patchwork Sat Feb 10 07:09:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336878dyd; Fri, 9 Feb 2024 23:13:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTkxj4vqAZGtFCNRcaj8WBcaAGaRpAM8tFDD/0kEYyHCuEaxwVI8D69KLdQS7oyXZ0LuO+ X-Received: by 2002:a05:622a:1113:b0:42c:6897:8c0 with SMTP id e19-20020a05622a111300b0042c689708c0mr703606qty.7.1707549239522; Fri, 09 Feb 2024 23:13:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549239; cv=pass; d=google.com; s=arc-20160816; b=fS2BMh2/D3gd1ddCdznhSvaTpAi4xfO7h2i7XkdZBnkmGrc+uwkI8+RiAr4vTxk7SN udxrG2BTmTGHFMLKhczyQfTkk+LAlRFmW6pnRiwbiTGhJc8Nsjo1hpQKUiNVCT+ro83I zGqoSG8/EvYsSsaY7gfunuK169FJYOFgqPHh4FfDXQ73lUeoF0dwtGktbHkShMvTCVv8 Zy9cnNISUESasZeU0r/gGAULk1rxkfC5AnVeqv5puH9Ripoh/Vd8JxnP/twe8p11B0q+ Glc3QO9JeqlJoNN8zdYc3DwNAVhN20loAI6kcY90aErd7f39lhebmbVg1YRyA1sPpFSJ Llew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Z/bbTxm+QSm0yQFEh/0bzSR3JAbVtUoJm+LTlB5jixM=; fh=KwBvXqA0xoekSM1RKBj/ss/f2CVO9Jy5PXR31aohWTQ=; b=Qmfmd/m5XC2IHiG9bwBWkjCcuRE59MbhfCJqC08DIRfseR7zQuVV6/B5aq6wc6q/Qg weptQvE1Bf2OWxanO4QJU4aVN2LTYanelaXbS80uS/kz8ccG13Gf+pkI/l8JCu0qJHF+ rETMhg/xJJu3yhsRceO9cYjUIfYAksku9ljeOQXejB71Ft5SUmGD6mYpikCnFkHXQAL0 uC/y2NlwVFNrqEqUi5weBi15OKGBPulU7ZiNE0Togw5eD1bE6zvyaZmCpLX4vfzihRui GvbliXh2pN7SQoTB/7HKl9NXvbCModjau2SCODI7yxzp8dP4HIW67XmYa5cCY13EZ1BS agjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ITvZnoCo; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60315-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60315-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCVsewygKLwADDgWXoV+/mpCtPS0W/wu/nd2h8bamQrQUlkZOMF6mjC1aeWfv+t62nRfwTjvCGJDp9BUNAid6YSKj4vlWg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g22-20020ac87f56000000b0042c0d9329f2si3803140qtk.254.2024.02.09.23.13.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:13:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60315-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ITvZnoCo; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60315-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60315-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 422B81C226BB for ; Sat, 10 Feb 2024 07:13:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4591D3A8DA; Sat, 10 Feb 2024 07:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ITvZnoCo" Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF62A39ACC for ; Sat, 10 Feb 2024 07:09:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548998; cv=none; b=OEhxZVSUNyvcviaMM81cOGhkRKPiL8FU5YM3fnvCnqyuOsrbJKh8E1+oaQpOysZ5aahXn0k8CoIOXWXWnNLaZHguuEOtkp3TkbX6F0pKRoqdY4wzXUamJBkFk+cJrJ2ev+cuHd1/7uIm8aILoYv4DIm/n0NkK1C1FpAuAe3JVh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548998; c=relaxed/simple; bh=Z2VNjfcE3E5eWdhGG5oCDx/zw3CYXQmcbgOU3PEqB0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YWm1ZIZHFxYW1T1PhQib0TwvVaDjrTl49pvfQX0Wd+1wGKpoTs+58Mdqiw7OvnClL9zdCXgK/iPARzaqDStqMjc6hlMKvsx9WkrGrlFRViR0fqKpSu3fxrzpTRQpknfNYVSJwcfzCFNEQekPtidSHR/CVWasRnFgORmaF3b4NXQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ITvZnoCo; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-296dc0cab6aso1193727a91.1 for ; Fri, 09 Feb 2024 23:09:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548995; x=1708153795; darn=vger.kernel.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=Z/bbTxm+QSm0yQFEh/0bzSR3JAbVtUoJm+LTlB5jixM=; b=ITvZnoCo3sbMz8CKHhyJKsfnXc8lW5oo2FAY+67dcn5PyBnoL4Xz9eBq6iMm/zCQYG tEC4D1tD/G0dSVziWwYe73xZWkTXUSbZ2vHkewEWosxg2Ppt254uws9dpH4DmJ5LdgGw RBY6erTC6O1Q4kHfCdVAzQopD8YLbgYEdjap4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548995; x=1708153795; 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=Z/bbTxm+QSm0yQFEh/0bzSR3JAbVtUoJm+LTlB5jixM=; b=MGZRfZxg0ODC9CjqVTd34GbWjfSRFB+ypk0AzXkBpJgcGn5RarQFwSoxaSl6TRAXhJ W/UpfPZgRUqzculvIGydi8riJxcc8RloR0wmCeCR7EExRqrPrGS/iEhmc3Wjtm+vy7Hq 3Lbq2Le3+a3URtD4b5PRZmGXPV+TZwITruY0T/BfzUB1jlGZkhPBfPEfLHxu0j2f61rD wTjZv6nAkmjhxqAV8CmjhM+URqNLRFZm78XAqi+oKb0hUT+a5Pns20tijzJmXUn9T0aQ 7UH5z7m7/gtJejMepdIYt1Zllt9+KvHCV8ZNGRJ1w7LxlE3u20ylK3v8Y9BxTWHFN15C Mttw== X-Gm-Message-State: AOJu0YwWjtdsmUj3KjFbnE+F+cvsczkMan94BSJsMaxohGh7KQ8skmQo PB/uYOoo5VGST0u4o3vgnelFEynJnqtfdyE9lRP0urnSNM3bLtmCU4Jts8oLpr+gG8MQhkxoKRM = X-Received: by 2002:a17:90a:b881:b0:296:1dcf:c297 with SMTP id o1-20020a17090ab88100b002961dcfc297mr2038905pjr.7.1707548995258; Fri, 09 Feb 2024 23:09:55 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWMBbmOEi0xo6ox6Wu38zgJl1YBIA9riNYFCafGlKAAN8+ZPlZ1F0jEvy+MUZ3tc1A0V3HjPW8DiWhK+yVH42jv2NvxaLqGPMd2bVdadwnobW/q9lAIQrHQdK5F03bwogZKK+ILzFmzkzfbRQlWt1ARp3meQ8e0OfIPHFbh8QM6uYJRAebiYG85x9mDSD6CEM52nrEQP9skTJpBxSYPbOVns1y1hktPql80CxyEL0isVwWU9NpD0jozK5EGEvhh7wxGC6ot7Rn3wf9s9Gu3/9tp65gjUDuFteXi2cfKL+FyWQtRPF1PyUNDInAIns030RQCnsYv6BEto50mq4NYzAIYIn7qZrHlMK/Y35iJoLfYGbiLAe9eWA== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id ip3-20020a17090b314300b00296fd5e0de1sm2828227pjb.34.2024.02.09.23.09.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:54 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 09/22] platform/chrome: cros_typec_switch: Use read_poll_timeout helper Date: Fri, 9 Feb 2024 23:09:20 -0800 Message-ID: <20240210070934.2549994-10-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495151164513949 X-GMAIL-MSGID: 1790495151164513949 It's possible for this polling loop to get scheduled away for a long time right after checking the status on the EC. If that happens, we will never try to check the status at least one more time before giving up and saying that it timed out. Let's use the read_poll_timeout() macro to construct the loop with a proper timeout mechanism and the ability to check that the condition is true once more when the timeout hits. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 07a19386dc4e..a23fe80d9d4b 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include @@ -108,7 +108,6 @@ static bool cros_typec_check_event(struct cros_typec_switch_data *sdata, int por static int cros_typec_configure_mux(struct cros_typec_switch_data *sdata, int port_num, int index, unsigned long mode, struct typec_altmode *alt) { - unsigned long end; u32 event_mask; u8 mux_state; int ret; @@ -134,18 +133,14 @@ static int cros_typec_configure_mux(struct cros_typec_switch_data *sdata, int po return ret; /* Check for the mux set done event. */ - end = jiffies + msecs_to_jiffies(1000); - do { - if (cros_typec_check_event(sdata, port_num, event_mask)) - return 0; + if (read_poll_timeout(cros_typec_check_event, ret, ret == 0, 1000, + 1000 * 1000UL, false, sdata, port_num, event_mask)) { + dev_err(sdata->dev, "Timed out waiting for mux set done on index: %d, state: %d\n", + index, mux_state); + return -ETIMEDOUT; + } - usleep_range(500, 1000); - } while (time_before(jiffies, end)); - - dev_err(sdata->dev, "Timed out waiting for mux set done on index: %d, state: %d\n", - index, mux_state); - - return -ETIMEDOUT; + return 0; } static int cros_typec_mode_switch_set(struct typec_mux_dev *mode_switch, From patchwork Sat Feb 10 07:09:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1336949dyd; Fri, 9 Feb 2024 23:14:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUb2cJEc5zAOUqVcAaOkxLAKOCuREH0uj4xPxG6n/NsfxdQiP5f0zvo1na2VdmEkSgBFdAfC96synW3fcnPHA+KbXnf1g== X-Google-Smtp-Source: AGHT+IFjkvzVU0Vl1q4iAzP1pXwl8BIgnRKZu1EQg9x3kptzcgsgrparXVojaYbLl3R6h8a2mbps X-Received: by 2002:aa7:da1a:0:b0:560:b00:440d with SMTP id r26-20020aa7da1a000000b005600b00440dmr959886eds.13.1707549252597; Fri, 09 Feb 2024 23:14:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549252; cv=pass; d=google.com; s=arc-20160816; b=O/Is5TU5RGsbJKNShX1ZF1CGYlp+oOz14dxELbyPWckAGQralZDdDb3BFZpZUDJKy3 9/M0kOn40wIThP6B6B6a9eRR/74cyvK77y0wvcaLHN/5Ou908Kn4laD3Wu5IrQQA3DWl Mgn4VD8qxraF8Tq1GGRy3HAXBmipRrBrIgqNPWJbtB5Y4SVRmQOvk6HeFiblZb4wYqeg tfCUGlEPoQjXN9NXz0yvZWqXJH46v/j1QskEtsV2FFOxMm4O09oDfZn+dvbbh1dAdFL/ 1XGG/IjP5Twaj2IVwVcL1hYoslSbE5h779RK6dxj+0/xe82KimFGrqnUxYrTZARCcFXE +KFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cLa98sn79mVMdRvO7elcd3rFtE2dKbRCTOlf+cCBAQk=; fh=gzpupdJqLhGneHqWb2Brp5we2h2NGlP5S/MFO2DeNoU=; b=KLgvWuxbkxqTdCDxxo4bEvFupq+dHE0RfPqA4xDXepY4yK+2wTOGtdXXMtTv7+vbmk WmpfdBWSL/Ip3JOpO7CM2Hp6rHSql7w0gbBiCvXmepp1BowIzY12IM0oZC5U7uGtV52X gwvTU1SNRH3qabi+skXRWlg+qdI851IU0K/kabvdgTrz4jEZO2Tz8WJD1/sl61cQNf7T FcjOCJXr/Pzcdp40pT2SNnOrK3hI+h3IQd0XucrD2lWYlJpjPq1QNepHhWbQHmdwXWIm o8WMP1z6I0YQ8+JcrwNnl16qvhPLG8Ztl1JpLty4XBm2Juy1Wh9EhVB6kA9kutN/fVvi eVug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lyw5x2J3; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60316-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60316-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCXicwpRCT4Sf3lZU5HdytuH1a961eBM0AIW+MeTl09BxeNRyuK/W1TpK6UK496v1Vp/CbHFmMKcnQxR2+Kvi7Xq+FeLSw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v5-20020aa7d645000000b00560ba41655asi566475edr.328.2024.02.09.23.14.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:14:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60316-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lyw5x2J3; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60316-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60316-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0C7BE1F223CD for ; Sat, 10 Feb 2024 07:14:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1858D39ACC; Sat, 10 Feb 2024 07:10:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lyw5x2J3" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A95939FD6 for ; Sat, 10 Feb 2024 07:09:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548999; cv=none; b=C+7qqjnzO9DG1asJQNUBoN6p1k0j5fci9nn5fv63xR82mAzxvJfFhMvp2QAsXUxiCQVWkC8Ie1DppdQUBiCmtpknu0CihPfOxP+PTeOg7LMbLCMi0MhkNWI6zdYZqtvXsg0TZWF8LEF80mU0BMcvppjBUMteqQpu+KiyGuKkUd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548999; c=relaxed/simple; bh=GwUq4JCcVzOBtEc3gN3wYan172xsmr2kIqhpahEGCT0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hRfix0PMu43cj9HBHA7tQ4NJ29bgqH5oqplZ0dAnqJnWeZC1iXPJ9Sw9Jy+7ygoVd7Ele8782TcUMyNjVZ88fcg13irdXCCICrjqAcfq4lE/aWoosf2JI61bVIHsdZ5+XTyjcFG5V1jxgiRzhBUI/z3JumdrihOzOzsrOgSZkHA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=lyw5x2J3; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d958e0d73dso12440735ad.1 for ; Fri, 09 Feb 2024 23:09:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548997; x=1708153797; darn=vger.kernel.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=cLa98sn79mVMdRvO7elcd3rFtE2dKbRCTOlf+cCBAQk=; b=lyw5x2J3+uK9Cx1DsuoFqkMjc2l1K8/1ncJqiF8tRyAcxvKsSnL7bYeP0y5cJbM6Fl bDuYZ168C7Y5Z6yl4kSXgCoJ9ZTQ8Gmh5iQnc75KRzSdROsBCEisbxVCuT0xg+88kzV+ GESSJaAvwyJWPZLbllmTxcRkUwr2OLndBccNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548997; x=1708153797; 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=cLa98sn79mVMdRvO7elcd3rFtE2dKbRCTOlf+cCBAQk=; b=t34qCaJ1TwZLFB0uUrpNKFRRVhZmE2FJFbJMycuPCoFADvsLfSlTQNzNJvvcrZJM6R u24RqX0Lz/YBLj2VIWbg2VHJaIFADZkUYknxn2Phpp6TyGesBIox5fIFLp1poAKhHET8 ivk7wyg2GzNIHtbooxPAwr98g8tJvUF9tH2+2qm+HIFANxbyo0mEcJROMkAqFZbPMhx+ d8d1grz8qwvgGRFn2rJ7HBnrWFjF34qnWhqd5adfj8cuTiEjFJFOTlZYfvXlnSmv/+Zh RB/GIiBk3iMSf6y9j6e06fQPnUv/BgtKELZRRjmFMkcKfvAfmhMMJe7HmGpTh8zkAoe+ q1lQ== X-Gm-Message-State: AOJu0Yyb7criSvlsr2XR0R0wJj5byOqKoKspaFO1P2PMZFrHYavDFKe6 0YvLSQQX31MBAocLJtY6bxx8SFQOC2eu8rc5Lui68qPfZZZIR5gqA9L5FfKZPQ== X-Received: by 2002:a17:903:1d2:b0:1d9:4143:5fe1 with SMTP id e18-20020a17090301d200b001d941435fe1mr2369262plh.0.1707548996758; Fri, 09 Feb 2024 23:09:56 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX+9S47JyY4gdCNtKq6p6Q6R+TDCHy2IVHoHTOc3nq7FC2K4H+Qinp22boBPl2v6yZ3Q4nfK7yLXXNWHe0/UTHmWNVaY/x9pnV6ASHZjzlnHxUq/8MIEm+7/wUgodRVAn/yDQml5JspzkxJ78jfbivxNH9PUZJYbHMO0JQsxmgvSDNgkoUCsh5a+HE/+D7s3CmQJalrJlAc8t8MMidr7MP8A4QvVyfbaYvDJvKdvLo32/1Gr8tkoxt77ColNbqnY/a/7yQvf+M78QElBKweLeuDALe465OoJDkDM8V/8O/PiPQQAlZWfuKn/H6RPamx7SvzoEjD3ONViFyUaucVVRZ5bniRH6uPktTYY0H9qt3tU/QN1jh9xQ== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id ko13-20020a17090307cd00b001d88d791eccsm2507677plb.160.2024.02.09.23.09.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:56 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 10/22] platform/chrome: cros_typec_switch: Move port creation code to sub-function Date: Fri, 9 Feb 2024 23:09:21 -0800 Message-ID: <20240210070934.2549994-11-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495164787691391 X-GMAIL-MSGID: 1790495164787691391 This driver will soon support devicetree firmwares. Extract the struct cros_typec_port creation part of cros_typec_register_switches() into a sub-function so that we can extend it for DT, where a graph is used instead of child nodes. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 113 +++++++++++--------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index a23fe80d9d4b..1a718b661203 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -201,13 +201,69 @@ static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwno return PTR_ERR_OR_ZERO(port->retimer); } -static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) +static int cros_typec_register_port(struct cros_typec_switch_data *sdata, + struct fwnode_handle *fwnode) { struct cros_typec_port *port; struct device *dev = sdata->dev; - struct fwnode_handle *fwnode; struct acpi_device *adev; unsigned long long index; + int ret; + + port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); + if (!port) + return -ENOMEM; + + adev = to_acpi_device_node(fwnode); + if (adev) { + ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &index); + if (ACPI_FAILURE(ret)) { + dev_err(fwnode->dev, "_ADR wasn't evaluated\n"); + return -ENODATA; + } + } + + if (!adev) { + dev_err(fwnode->dev, "Couldn't get ACPI handle\n"); + return -ENODEV; + } + + if (index >= EC_USB_PD_MAX_PORTS) { + dev_err(fwnode->dev, "Invalid port index number: %llu\n", index); + return -EINVAL; + } + port->sdata = sdata; + port->port_num = index; + sdata->ports[index] = port; + + if (fwnode_property_present(fwnode, "retimer-switch")) { + ret = cros_typec_register_retimer(port, fwnode); + if (ret) { + dev_err(dev, "Retimer switch register failed\n"); + return ret; + } + + dev_dbg(dev, "Retimer switch registered for index %llu\n", index); + } + + if (!fwnode_property_present(fwnode, "mode-switch")) + return 0; + + ret = cros_typec_register_mode_switch(port, fwnode); + if (ret) { + dev_err(dev, "Mode switch register failed\n"); + return ret; + } + + dev_dbg(dev, "Mode switch registered for index %llu\n", index); + + return ret; +} + +static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) +{ + struct device *dev = sdata->dev; + struct fwnode_handle *fwnode; int nports, ret; nports = device_get_child_node_count(dev); @@ -217,60 +273,15 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) } device_for_each_child_node(dev, fwnode) { - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); - if (!port) { - ret = -ENOMEM; - goto err_switch; - } - - adev = to_acpi_device_node(fwnode); - if (!adev) { - dev_err(fwnode->dev, "Couldn't get ACPI device handle\n"); - ret = -ENODEV; - goto err_switch; - } - - ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &index); - if (ACPI_FAILURE(ret)) { - dev_err(fwnode->dev, "_ADR wasn't evaluated\n"); - ret = -ENODATA; - goto err_switch; - } - - if (index >= EC_USB_PD_MAX_PORTS) { - dev_err(fwnode->dev, "Invalid port index number: %llu\n", index); - ret = -EINVAL; - goto err_switch; - } - port->sdata = sdata; - port->port_num = index; - sdata->ports[index] = port; - - if (fwnode_property_present(fwnode, "retimer-switch")) { - ret = cros_typec_register_retimer(port, fwnode); - if (ret) { - dev_err(dev, "Retimer switch register failed\n"); - goto err_switch; - } - - dev_dbg(dev, "Retimer switch registered for index %llu\n", index); - } - - if (!fwnode_property_present(fwnode, "mode-switch")) - continue; - - ret = cros_typec_register_mode_switch(port, fwnode); + ret = cros_typec_register_port(sdata, fwnode); if (ret) { - dev_err(dev, "Mode switch register failed\n"); - goto err_switch; + fwnode_handle_put(fwnode); + goto err; } - - dev_dbg(dev, "Mode switch registered for index %llu\n", index); } return 0; -err_switch: - fwnode_handle_put(fwnode); +err: cros_typec_unregister_switches(sdata); return ret; } From patchwork Sat Feb 10 07:09:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1338852dyd; Fri, 9 Feb 2024 23:20:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFhPzBgri6ByBo92CHAaFN/5VfZCBaQUPoCv3Dpc3cMBv4P58M13RE1+aUXyxOxivNWmoIW X-Received: by 2002:a05:6870:ebc5:b0:218:5017:af07 with SMTP id cr5-20020a056870ebc500b002185017af07mr1714470oab.0.1707549626277; Fri, 09 Feb 2024 23:20:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549626; cv=pass; d=google.com; s=arc-20160816; b=xAljKAKx4bov/Hp8whRsZW7yeLBVUxLvwK1QsbvaUrlx6j9WcyjBVSdEEDNoyn+npA Lw0nt+7Ogf8HwjcLvs+vdRlBH3p+00XBq9VWwykDU/eCoKM1VgKdeYpzr8Kc4jYEaQqP dpA404Ct0oYLQVDFved+KmpJcZqsiHKAp8yvhPJncm6t1eSPGfe4TqMWvF0uaDTdelVD QoXS0RR6qmrxai2g1twhdHfNURAuSpQOw2FI/7BdHtLQgx7WxCdMvCKUX1IcbPaGmMTF 9LLLJ+p3igS60zZyrZDhHkNJ7ivC+nBrDXOa7Z1QgDbMjslevkYU4XxD70X6EARwC8xa y5mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=o6rwt10FSsSf9ZLI/+GmfDcWiK/rJgtd/StxIlWC43k=; fh=f1H57yfhL/v3eExeLNOvFj/J5MC1PfDu6MBY9PFdOx8=; b=La3/9GxW0Ay/ThBpTkosGgeetCZ+ZQJ3OtBVV28CLrg4f1J592U4bqLevEvMdp+FlF ZFMU8CXKdF8rL6sJr/5HF7hhZDCR434eeFevFm3r14isBLBRRGqo3OHJV/O23BYlj3yH o/h5wQeNDcpR7UlzRacf++nD/GcO8M0AlCU37lwCh70+gplHfZprv4p6VuAjG6SX2EW9 zGt2QQlr0M8nPfY801zxpncJb7/MCaXXRdqex+vfJ3mrz1AexuqR7Apq6nOL8kMbyAIi BSRZSyztWTQaxp8Ab1LHG7ryzYOiQ0vlYkqRsn/Aq+SMmgwnPkuJwoHRAOyTFDqtdUWJ IQHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=g7IbOi+R; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60317-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUg2rL333APz1RkMLwK08cOYiumnf/zI2P1YXvfFvnJD65WNVnK6goM70MvuomFeluWH9hv6dq48QlLWpPLztJddHulpg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e4-20020a656884000000b005d798062b8csi3098859pgt.499.2024.02.09.23.20.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:20:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=g7IbOi+R; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60317-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60317-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C265EB22621 for ; Sat, 10 Feb 2024 07:14:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56D493B191; Sat, 10 Feb 2024 07:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="g7IbOi+R" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A81439FFB for ; Sat, 10 Feb 2024 07:09:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549001; cv=none; b=pWTgP1EOcWiYTVJ6EQXhUbV9P+kHpCKLc9tx5ZLTY/QXVyI25EdXapno4uFT/xr6/qio091GLRLVrld5pBUxknCPyMLUGpeliQG50RN3fW1Aovw+EC51q5OT3z14RncB7HN1VDs/N49gaCAFuttjH1PcA0ezs7+uaDIizHuNBBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549001; c=relaxed/simple; bh=XNvI42j+7FmHqNECdaZBEQBh8CeG71yHi4CBUyp0EFE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tlVVvLM6syYufm6tiFFD7/J4ZMKj4pT29HSeIbpph4lH4WIEo8kdp764LyaiwZ6jwR9tR2+zNVXL3SuvKjwEC8PMngwmWvVRAWGQADoi+Rs6OB2B4JmDpbdpzjBPsFjRDewZpX94KsZJlKAPiq6UBWzh970dZynjM+Z995qm7Co= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=g7IbOi+R; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d7232dcb3eso14438815ad.2 for ; Fri, 09 Feb 2024 23:09:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548998; x=1708153798; darn=vger.kernel.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=o6rwt10FSsSf9ZLI/+GmfDcWiK/rJgtd/StxIlWC43k=; b=g7IbOi+Ra2rUoZ7bDPpUvDqlna2c3MLNh80mv0pomgcpD3xiJJwxXySjFl7VpELmfO VLpUqRx+JRb49StXfst3hmXJHSvO4QGfaj7fKSdk/NDjbMWFuLaXX1I4lui06sdArmgz Pp8isuJ257fauNoY82viDVOI8l70y4iVGvJ3w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707548998; x=1708153798; 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=o6rwt10FSsSf9ZLI/+GmfDcWiK/rJgtd/StxIlWC43k=; b=VOvmS4898ljQYDBkt8ZnJUpm1/3pMsH4VhmxrqcoXfiBmbC9FmsKKNKqp+Vm5Ka+rA Y5jPgrfjDN0wVfx+384rqKUOUkME3zWnXoBDZGQaUv2pvJ8eI2YGAN/bBk0lj6bOsrmn YmrYr2q+WXmXQE2J/6jffEi8ipgCaTadjyXnJ+Q4J+5qvpmL/6LQzvchFTNrUIeOcdyI 4idysIoB+vnuHW+lGFfq4QwqIKDQX/spyn68yROgA7OmB5yVOeT+n6QZJvIQwmc/yMbi zquZwLpJIMZvfQV/xC56SmMKVW9dbUczvjVBRHJ7GjW4BB09pU23plc0r70AhkkHz2Hg b9WA== X-Gm-Message-State: AOJu0YzpUBZMODMF34DEkrm+IlIWsIBxDuxCOneHFqSFFF6Ae5b3RrhZ epOXbh/N/GvIX0Na6GU85o1FDUT6nHRrsx8dnOoWEl4OedrU+YBOPrbxXgcPDg== X-Received: by 2002:a17:902:cec8:b0:1d7:15ea:4249 with SMTP id d8-20020a170902cec800b001d715ea4249mr1845301plg.7.1707548998453; Fri, 09 Feb 2024 23:09:58 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWPZfxVECZHV+IGwDF6uOIynzL9NdXLQpNK0tbkQ2Mz94NuD0bNKUXlIQOfURhM40ViSH6Y1bQHXrsL8QcTVDOpfp9IhmOli0B86t20P56YmH7Rr4fAmaobUBFshZ4oU90czIyB424aoMm1H+P2EVicSoFANLiOl5FkWrmppBq5oc36Xrf4nuB7SdV1JThyyJ8z8JM5+TKC2pJ+AgoekkFkutv2sLbDR0scg1x1psNNG/JpJjSZyNS2qmYHXz0+MRY2R7QDIVzqnbQfrb+vVDMMCUdks9KrCwRtZlhhWcLOnkjyz56KiF+ALWd/V9lMy2R1pN7E8cNV2PDc0DG3Q5t8Jx8/7dBqnRYs7yLTySXvmKsPondkLQ== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id h9-20020a170902f2c900b001d921bcc621sm2478144plc.243.2024.02.09.23.09.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:57 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 11/22] platform/chrome: cros_typec_switch: Use fwnode instead of ACPI APIs Date: Fri, 9 Feb 2024 23:09:22 -0800 Message-ID: <20240210070934.2549994-12-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495556840525257 X-GMAIL-MSGID: 1790495556840525257 Use fwnode APIs instead of ACPI ones because this driver will soon support devicetree firmwares. Using fwnode APIs makes it easier to support either ACPI or DT. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 1a718b661203..373e0e86ebfc 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -207,29 +207,31 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, struct cros_typec_port *port; struct device *dev = sdata->dev; struct acpi_device *adev; - unsigned long long index; + u32 index; int ret; + const char *prop_name; port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); if (!port) return -ENOMEM; adev = to_acpi_device_node(fwnode); - if (adev) { - ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &index); - if (ACPI_FAILURE(ret)) { - dev_err(fwnode->dev, "_ADR wasn't evaluated\n"); - return -ENODATA; - } - } + if (adev) + prop_name = "_ADR"; if (!adev) { dev_err(fwnode->dev, "Couldn't get ACPI handle\n"); return -ENODEV; } + ret = fwnode_property_read_u32(fwnode, prop_name, &index); + if (ret) { + dev_err(fwnode->dev, "%s property wasn't found\n", prop_name); + return ret; + } + if (index >= EC_USB_PD_MAX_PORTS) { - dev_err(fwnode->dev, "Invalid port index number: %llu\n", index); + dev_err(fwnode->dev, "Invalid port index number: %u\n", index); return -EINVAL; } port->sdata = sdata; @@ -243,7 +245,7 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, return ret; } - dev_dbg(dev, "Retimer switch registered for index %llu\n", index); + dev_dbg(dev, "Retimer switch registered for index %u\n", index); } if (!fwnode_property_present(fwnode, "mode-switch")) @@ -255,7 +257,7 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, return ret; } - dev_dbg(dev, "Mode switch registered for index %llu\n", index); + dev_dbg(dev, "Mode switch registered for index %u\n", index); return ret; } From patchwork Sat Feb 10 07:09:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337395dyd; Fri, 9 Feb 2024 23:15:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYhzmwWZ0zb/e0QHz0Ze1u5Jt6X7K7M8oi2m+BPv6b1GQdVWHCD4XhXzsXSK23AKrnbWoCMDxbYAVdLmZs014DTOvahA== X-Google-Smtp-Source: AGHT+IERoD7cUA592DjzfTnYNazcjQ78SNjjgl0cRhs9BCcGA3aUoa/PSbguwtlWrQOAiHL0iAkP X-Received: by 2002:a17:902:7402:b0:1d9:650a:92e3 with SMTP id g2-20020a170902740200b001d9650a92e3mr1901552pll.22.1707549344934; Fri, 09 Feb 2024 23:15:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549344; cv=pass; d=google.com; s=arc-20160816; b=yQMSIGKdaYxwAA33dHoI83/56Kc6EXaQuLVH8N+tmAl4RoGxpch097+1XqgV7VFz2c xY4frBx+8pnaNV1CxgiikXfuHePRHDB/UEJv0aUmU9keOVdEjJcYT6t/dhh32YmN56wL oZPDygssDgcZwLhUj8C96K17vThPX4autAhdpbxaSr9tIwzA/TJwSZ5/ovXsgtaiVXXl Mm6q0kMFYsY7qMIR69YyclAjOwll+L/ZL0K+/VHPll1mV21rNAWEBMpyazsp4RCYf3xq tlRURFVncGbdWaXc+4JjqeRtHOpfN8Em4DjaXtHZOs54BxZyHN/4+IWXKEDgUWtGm2qT m3lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7RRDNZyVj04t5JHoAjAOJhQ0Jr4YTOazbyEccudCdmM=; fh=Ac9uSmmFg2nz89gjpEjVvYh4p6LoHsPMdMbDwtiFfqo=; b=HZSN/s8/uPgWww1ohPsnrW7+cZ2kT2X1y4/yuORU/ZtPrDfxNBdHg8/xjTJS1EVnQf Kqq5UzVXE27GZ9n0iKyqshdriMnpIS485HcOqCNIxJ+qdsiIjQ0J8Kpp2a7ZuSoOQysp eiezZGbMuLNUj/I/H6TwnuKQM5rgQ24q9SyCCEuIXjHGMzyJ5U4o4kIjfrxoLgKulBXy f6rAiVaDRyCBxfEXpF71OVAt3XAP+Ug9ncwipByscPE+ZjLdFAlAnwTVq9GyX9u36/+u e2kdbX2RZurn82bf9LjjcqLnKdVNLXdrSQATwk9QpKPMbJ9tUvd6Rza2XVYmn3/40TyA yqjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FfDLwiUI; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60318-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60318-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCXd+R2dtT5tSwbxH7ji4zcavz9nwthTh+MtHteI3ou7nOQZy2kLUpirgIB8GUGUtk1gk9V4/jdMDgY41GUe1R0spqh5wg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id im22-20020a170902bb1600b001d73a2acc14si2943898plb.558.2024.02.09.23.15.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:15:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60318-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FfDLwiUI; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60318-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60318-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BE34F2863F3 for ; Sat, 10 Feb 2024 07:14:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13EBA3B797; Sat, 10 Feb 2024 07:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FfDLwiUI" Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA1C63A1D9 for ; Sat, 10 Feb 2024 07:10:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549003; cv=none; b=Q1UlIlQdzAVOzVznmsbkQYuf8G06bWcMCgBBQpblSYYJvgClxQFvSQPi/N3P0baV8j1OTtbMqqkdErV0Gwz7lyw8F4/2KBpCALNkJuqgeQ5Rewicw409T2dHOVR5OjDQvPN7bHDej6AUJMhlc/gJqMxK/HnCQyulGwJflDmFvi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549003; c=relaxed/simple; bh=t7tvQJG6YlEt+ycy0C88MvbSQbeNL2T8HNinf+f8mhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t7IW0CAiKeseXsc4jemFxznuMqsrJXcwzUW+slfQKWCb0yInlPP5FpvyycCH7W7RwItmLKzUkI/lDZGsDixF5m42PKLHt0lVXFQ6P35NaPJqdadxwb5qE13a0R4GSHKJ79QIxqexMOGl8uu3SR0n2mRG9hJKQkVRe9NSv04qZX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=FfDLwiUI; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so1329521a12.1 for ; Fri, 09 Feb 2024 23:10:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549000; x=1708153800; darn=vger.kernel.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=7RRDNZyVj04t5JHoAjAOJhQ0Jr4YTOazbyEccudCdmM=; b=FfDLwiUIWlO4efWPGrTLTM+PBUlPw7lyhvqQD5jNq0RsqOBJyMplwuCq2+l2HWZq4q Bq4MhYRx4at8o+0/ed9IKsynk6TRdh/OZMPxAANtZWuVeEYd0um6Dm8hvcLk7NX+ycJc j0pQLtCh3vVj6e/yjnuH9YQgnW7rzw+Qo0p2c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549000; x=1708153800; 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=7RRDNZyVj04t5JHoAjAOJhQ0Jr4YTOazbyEccudCdmM=; b=bPv2NETGOhdA9NA7lF4f8yui5K2hJj/euB8w9x1/aSMPUdDKQhlzn99OGmoS8IqKP4 S/6ZsEBU6lrPsYmh0ZDOXYf+sFlnhYPluL+DFl/HU7b5CH0ptVZ19Jdidsy6CA+dJWCX zrMpVHq3FQzUoFxDWvUMJsaAGzm5bg4yuq8jkEWjFUaxcvd4lfhGb5q7xkxRTwS+KkTO reLPVWHx9VEndaiHS4il+KbqLUJqJg1TrJ7nUHFYchrnZQec43ovyL2pVUPkiivqt1Ta FxYDtW8QbabLqvwZpwRKSxBHJ7p2BvB6xUSSom/8O2R4oUUoK7qOa2hvHswQEhzZQD7u pDYQ== X-Gm-Message-State: AOJu0Yz/QAjckhm5BhxlOgz/hVLlo5JgmW3Bahg0J7jsumSu0esFEcYG sK+/JPxx/0o3Vvq71i0ii8qoUc29wFhj3pPlYuzEIweTyGgaPs6NkiqAdNMc3Q== X-Received: by 2002:a17:902:ed0d:b0:1d8:f106:cb92 with SMTP id b13-20020a170902ed0d00b001d8f106cb92mr1839715pld.10.1707549000129; Fri, 09 Feb 2024 23:10:00 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU0h1bRFaEg+rFVuvzPvT72dcm+HAwsdsZCtHAhkEgEg7ayFRJauNl11VSY6YyDygPUNI2UG6VppFLvyEcP1cUA7q4TWT/wBEpaKTuLlo1sFWBgnfseptqeqG6Hg1IkRQ9dNwDd4lqNtxcY52R6emzrYCP7HCrScCjDEWljoS6c7AOh87gnSGt5+hp5SlsPjSsnpQtKieFzEbu0EOef+qB5OGN6nxsB9GMlCKqB/j68OVjeK744K3lk0ESlRGxMYhNXMCSKFgk8Elqiyq2vZevQj+KQpmzXdYRkOfd+wDBcyqvMIwCuM9ETiJeHyCkeUomMvvZov9KbLZH8a3E6K5cRdwkpph2vzwvMDbKrzGVewJpz8y0J7g== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id kw3-20020a170902f90300b001d9fc6cbc51sm2487629plb.244.2024.02.09.23.09.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:09:59 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 12/22] platform/chrome: cros_typec_switch: Use dev_err_probe() Date: Fri, 9 Feb 2024 23:09:23 -0800 Message-ID: <20240210070934.2549994-13-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495262013947302 X-GMAIL-MSGID: 1790495262013947302 Use dev_err_probe() helper so we can get better diagnostics when driver probes fails for any reason. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 36 +++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 373e0e86ebfc..769de2889f2f 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -219,31 +219,23 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, if (adev) prop_name = "_ADR"; - if (!adev) { - dev_err(fwnode->dev, "Couldn't get ACPI handle\n"); - return -ENODEV; - } + if (!adev) + return dev_err_probe(fwnode->dev, -ENODEV, "Couldn't get ACPI handle\n"); ret = fwnode_property_read_u32(fwnode, prop_name, &index); - if (ret) { - dev_err(fwnode->dev, "%s property wasn't found\n", prop_name); - return ret; - } + if (ret) + return dev_err_probe(fwnode->dev, ret, "%s property wasn't found\n", prop_name); - if (index >= EC_USB_PD_MAX_PORTS) { - dev_err(fwnode->dev, "Invalid port index number: %u\n", index); - return -EINVAL; - } + if (index >= EC_USB_PD_MAX_PORTS) + return dev_err_probe(fwnode->dev, -EINVAL, "Invalid port index number: %u\n", index); port->sdata = sdata; port->port_num = index; sdata->ports[index] = port; if (fwnode_property_present(fwnode, "retimer-switch")) { ret = cros_typec_register_retimer(port, fwnode); - if (ret) { - dev_err(dev, "Retimer switch register failed\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Retimer switch register failed\n"); dev_dbg(dev, "Retimer switch registered for index %u\n", index); } @@ -252,10 +244,8 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, return 0; ret = cros_typec_register_mode_switch(port, fwnode); - if (ret) { - dev_err(dev, "Mode switch register failed\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, "Mode switch register failed\n"); dev_dbg(dev, "Mode switch registered for index %u\n", index); @@ -269,10 +259,8 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) int nports, ret; nports = device_get_child_node_count(dev); - if (nports == 0) { - dev_err(dev, "No switch devices found.\n"); - return -ENODEV; - } + if (nports == 0) + return dev_err_probe(dev, -ENODEV, "No switch devices found\n"); device_for_each_child_node(dev, fwnode) { ret = cros_typec_register_port(sdata, fwnode); 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: 199214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337529dyd; Fri, 9 Feb 2024 23:16:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAntrk+ltg01YL2BK+9P6Ov8FiMYxk9pcj6hjTBekpj4s3ShtMWGk/dCZeoBRtsljNXWFB X-Received: by 2002:a05:6871:440d:b0:214:ff12:3dda with SMTP id nd13-20020a056871440d00b00214ff123ddamr1649611oab.2.1707549367253; Fri, 09 Feb 2024 23:16:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549367; cv=pass; d=google.com; s=arc-20160816; b=jPyplg+Uk98pSEpKqfM2sjy9SSXs4S6LrhXWWQmYmKNqMNlcskhdSeaS03bVQbMlZd ypJA8hzhz0Q2/VWlSTbwwTSB3qC3yj1Ne/y9lJMKp2S6vjSpbxaUXuCU/HLWcB/5Vl8K ZsRYUXgQ0vNMXK/Tetd4HA/z2EXn6x4dOcSdU14ycZTMUZiabIwMsC3bn7WC662l5OWA KHjnaeFV3STFCE53K+40Z+MhTBn5T7/0GIXlb5RBW8J+v52oH2tHatkdBOke5mRjfAgg GlpBl0CPAMtGiW8rbjLbRYgbMR02/zn+LW/GzSve+uuLS4ps0kgD7soIpXRKQhWD3ZEy h1YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lDKP545ncIGfTtTSVlBXDPYZUg/LkNBLMZfBasJozE4=; fh=F6/oJ2Fu133B0X3KTNiOL6zvvpjTUJNVyzZVVIaZiPg=; b=aASKDSZ/jUGJQlTly1IfpMSfA/BbDFa2kP3leW7rbLVB2fFbqfezaBotJ5b0Lodh3c 9y7K1nrHJgk5gS44ByBd/K29xED6yLIpkiIRva1rfotJLIW3Ex6ZoomhSMM4ZLCqiGyZ SC67iOWsyKk5o1/7rtbmgff8Wiz3sivF0WM412zUwit77UlqWURRo62cMne6YHUSSirw hw76frs6jnj72LbPUsyiB1EVKnE06hRXPecI0PNFdNU9vCXccDgL7wMTmgFZsQt1w9pF DEuTZ2cIKenGDzSu5ph/gt+zpUXIlEgAQN6xYwuD1tqgXumBToBf2PEHkOpBsoB3R3YO Gz5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NJeVySfl; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60319-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60319-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUpjKkTE4eeDAp7BKkwQvYaRmRBHbvM0Oq2oGq4rgbo79ero+P47up80C692MQgtuLsagc/ovgZnw5jfbTMW7zRfmu44w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y29-20020a63b51d000000b005d3c533ffa1si3048421pge.590.2024.02.09.23.16.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:16:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60319-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NJeVySfl; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60319-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60319-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C6FB7283B11 for ; Sat, 10 Feb 2024 07:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F6913C485; Sat, 10 Feb 2024 07:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="NJeVySfl" Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 950813A8EA for ; Sat, 10 Feb 2024 07:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549004; cv=none; b=KgJif7t4zas8/DolCeMly9ILsIBW5PW43q83kLL1MlbEIGLmCB4TEFiRRpdh6NJHu5eVDOYshKuxE9nKYo6kY8FRk55LVQiUByIK/yn1PJJ8waukEwF99OVLR0zAuHnI/D/UJckW7/VOepnz2GB6lpxJSC4Omj5M0EQEjFImI1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549004; c=relaxed/simple; bh=KWg4agLN18znoG2Iygxv4/gRG3/yzkv60PQlSKgj+cA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mHKIe6bsmssmCsEcN12bvTQZS0Qd8wR5u0EJvZqf++BMOaVBDhFivkm2bwtFprNFKDYZG19Spg/ka3SOD38ppoMCgN/nM7JSjl+iSL7f1+02csxpNQxSyUePMhv1NN2Ac+XxyT9XWp5za+/92Jw+yhpLQ6upqwcqtEBQcpKu/Q4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=NJeVySfl; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3bbbc6bcc78so1193402b6e.1 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=vger.kernel.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=NJeVySflWRDpHnw3WR2V4zfwxfb1J6kJA24de80XtS7OuPgKedrvRgyYalYc1nrrC4 4BQzvcrJSHw/x7+QzGfBazRpfGsT9O7wIApCSbALbaPvV36FPguAgudQAEVaPRiSCaMN geHgz3BxuW5+MpXo71rQPSPKfgo9G5UyZEUqA= 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=VaI0ZA1d0a6w+C2tDl6FiIqakAVad/gqgEqwp5u21VF2+3P6yX5nked5B00ZmARKcW k43MNukWyIGUY4Hj599Id6ahsDpvJHhq8b6eN1HALe7FVvIlOgAZY+i7X1Uy7h6nJaZg 313OX9waxElL2GFcnsmcCIUVNM09QuUHf6CFzXVjlnD1AUrL2d+JSSgUniE9zZjhLFHv 69jd3n9xw5eed3km6XgZLfEa5bK9+3kbUFwO/R8PYhrJy+ajjOyX3vTyZ4HQ4gxLbUO6 LmVe588efqHRXBF4qLvgtePfcsACFY9AZmTWCkCV6+kPryy/nLPq/oonOJ+LVa2fJj0A 34cg== X-Gm-Message-State: AOJu0Yz3Sh0v0+TzahZTId4gv4G/XUHg8ST3IE2uHWlX1pTx2gAP51Qm XSczaDky8dV57ShNDpnrLnWhc0XV9gIZSZivoTgDTZ1788u7ksjlR1X4h3ajFg== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495285147130909 X-GMAIL-MSGID: 1790495285147130909 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 From patchwork Sat Feb 10 07:09:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337478dyd; Fri, 9 Feb 2024 23:16:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWrL/iidkG1nPQp9usHUSOtAo6NsF+dWB20Okatq/NbnxChz9SiDHvqH7+1GtkddbSL9Hln0BYogFRkznO04Kf+Zu4WmQ== X-Google-Smtp-Source: AGHT+IGUXnurwY5ir6mdUR41UvhJQTgW8nkrvVPLATxIVaNH1AUGkBzJkL81CSOqg3FaFAhtblOb X-Received: by 2002:aa7:c596:0:b0:561:51f3:c140 with SMTP id g22-20020aa7c596000000b0056151f3c140mr697087edq.32.1707549359788; Fri, 09 Feb 2024 23:15:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549359; cv=pass; d=google.com; s=arc-20160816; b=UKDKrDvvsCYz1mDkHyawuUXPyNgAcBfdOBTBXI1qJbzwQdAgthQL62KVa+VL4edGM1 WrDrZHkqBwxU6Upk0F9FxGFsqUaQSRIh6q2EZ2O2RnrlHzAGqLFBy3dJLVvB17W4bcrC Wak6H5Kd7eLUcIDXsHLUNQc6edUuMCugFuZAODfGD1CgyH30zkP8Iq2/ATfdbQaC+H1g X5RcFM3WLcBdVjE4t8+LgG8T4V1nAXZD0mXcZtPs9bZvZ6Xb9nTbpOAwTDo0e58XvW/B Dyg1Dw8qbHUreej+0Q5/jMWRAs8Ns0GJX3EaNBo7ZBqlmQRmG8ffLL6irLN+p5e+uYbU atbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hbp6eJs8zNsEh0Ykxh3+aUj/PUIKakisHW7sbgmtdoo=; fh=pHkbgrXSrKsy85t1M5Of4xDgNzz+jEyjI1FGoKOTL2E=; b=gC03EAHl4p+eOB6yciSDvUrV9WI4+v9R1tZ5GEDigCjiarT+y6ffV+pA7t1PCefj3w SiTvkXGeS+oIOw9Vj23TgAp9wNcDdP1Kvdppo1JK1r9uwbX3IfY8Sd5CgDDHsFu+GhwE aI5ywA8gJ2+oanGLyGZ2h0xXAhsmS9fzJt5SPuJrk/WGrzXYzXG8my7UdJVa2mPcrpMq x40PoadXgTK2s5Ntlh8DGAEeSZty99HPLQcSB9RMIiH0L0evpnygqqMnu9vn4k7zNRA/ XyprzjhOid/s3QCa1wXiGWkQSalQt7zOX4RkQZ9jA+0dc3SgMQoD8LEk3lkE7xyeEHSM /LCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XKSerlGM; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60320-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60320-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUVeuk3Ti/ph00FkH457OPZsJ4c0vcXMNw92fmbCQqo47stoCd0Ny5MS3jTaTOINENn7LsURSYnRc2ZZNEYlscUTiMF1g== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l15-20020aa7d94f000000b0055fd3109294si561594eds.659.2024.02.09.23.15.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:15:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60320-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XKSerlGM; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60320-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60320-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3EBF91F225DA for ; Sat, 10 Feb 2024 07:15:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4637B3CF4F; Sat, 10 Feb 2024 07:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XKSerlGM" Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E05D3B194 for ; Sat, 10 Feb 2024 07:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549006; cv=none; b=m+PruRQovmCazQ42mg279bd7Jp9e91IRNlqNfECCk45312Y6TrWFhmjHRUXKNI5MOKyCQGTjY9IC2jhM8ytEmaw7k36r3Fv1NBryvP9CA//FELgS+q+M7bSyNsNhsIpH5Jdg4Boqem8QmmdS7uQbTsxlkim5Yfln5EE4KDVKVAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549006; c=relaxed/simple; bh=0JMdaneE7MUmkdmG9Zc7uuk62ednVzN489PI+iGdkKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z/JNwT6hSXt7kOH1gfjIDQnvExeC2Kl2E3l9FubBkJzY/0wvW6eqCGxrLifhkda/f+arMlQCu7YXk0ZiykTP7qItig9lZjQl4MFPmKwUevWJa1EwCz/emzfkVoAOvgX22nNfCoodNNdKDyoEVkNBFLM+sUfB1WNu3nEhVjG8njw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=XKSerlGM; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-59d3a7e6b05so220128eaf.2 for ; Fri, 09 Feb 2024 23:10:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549003; x=1708153803; darn=vger.kernel.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=hbp6eJs8zNsEh0Ykxh3+aUj/PUIKakisHW7sbgmtdoo=; b=XKSerlGM3xakVo/vX7F3lushzmaJMknRMHoE9iqAuUBAgORrD5xnjMkT4cCcpcbnM0 sEtxea+ik+WzdeUsPGhj17CA6xUBO/RImk7MSgtWRV7nqwtKpFiqPSKF3V0AvIeQSPDe a+hxPJBOpQYNvwT0orr97kzPEhS8wbGtUdvlU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549003; x=1708153803; 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=hbp6eJs8zNsEh0Ykxh3+aUj/PUIKakisHW7sbgmtdoo=; b=G693xA/dFiizsJHn7u87INL6iLI++oAuHQgeqm45ZMwHZr3v2UihOslETn2x/ArrL7 R55aqp+rmSNVN4hK8CSY7coeHTtbhIRI7x8+bjvd5NEcwWMkq1Vm+vajl+GpLkHT6M1k UcTHzfTKWpmv1z+ZiG8YrooPMk7x63HOpLSWrBjqMaJRmshwudiuucVtTcWH3sZdP3Ee b4hToDVIUK1kjE+cvtDxmfcVB+T1xrkkBjmGSpQgUhS1f9+m3En2bVxNfRBg0sN1skad 0LoY6XJKxRTdeApIvrO4znGj87zQEsoTfaVy7fDWRqvpoo0xbIEzOPYq68IrVu0NqQD+ hdoA== X-Gm-Message-State: AOJu0YyCZaZb7QWYe507gqgdFGtpc+TsUPyCylfUSsxcpTggYYq0+Gjs kgLJvp6CpUxVcqh9tQ4P0MXESk5658EUhyl7bkCpO5aaK5Ttu7loYgyeSBFPuw== X-Received: by 2002:a05:6358:652a:b0:177:afce:b12 with SMTP id v42-20020a056358652a00b00177afce0b12mr2080992rwg.31.1707549003396; Fri, 09 Feb 2024 23:10:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVMvzCd7SH06ewnmT2+7fqaQNPTS4l3ecsDM3Kzv8T1bTXUkrfmijg/lFfYl4o1XL+gAqETDT/KfiiPumnlbVgqs+/t85UXTGFSUVUZmaZGr6lSHOMmF8026sf8ubsGIENTarCtdJHon9wcV4ANfXxOTLQHHot5fj0kBkTjQ7kJhRfE5IJfYQI8QAYNv62eIc40oMQLvlOH65EBKAw+qzfc6PjkgoDfAk1/gtJdS6Adi4YOkLqgMlj56kN0+5+fuSsG2fOe5lQlP2VdOCJANbUl8LJq0bwv4FqN8T66eYi+VmIBZm5MugRFUitWd2KGME/dcgFAtKjDn2XC/1dvBS861pgy/DbcQuUkYyycWLUvVaUYN3BN5g== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id r19-20020aa78b93000000b006e02cdad499sm1693139pfd.99.2024.02.09.23.10.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:02 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 14/22] platform/chrome: cros_typec_switch: Add support for signaling HPD to drm_bridge Date: Fri, 9 Feb 2024 23:09:25 -0800 Message-ID: <20240210070934.2549994-15-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495277622928773 X-GMAIL-MSGID: 1790495277622928773 We can imagine that logically the EC is a device that has some number of DisplayPort (DP) connector inputs, some number of USB3 connector inputs, and some number of USB type-c connector outputs. If you squint enough it looks like a USB type-c dock. Logically there's a crossbar pin assignment capability within the EC that can assign USB and DP lanes to USB type-c lanes in the connector (i.e. USB type-c pin configurations). In reality, the EC is a microcontroller that has some TCPCs and redrivers connected to it over something like i2c and DP/USB from the AP is wired directly to those ICs, not the EC. This design allows the EC to abstract many possible USB and DP hardware configurations away from the AP (kernel) so that the AP can largely deal with USB and DP without thinking about USB Type-C much at all. The DP and USB data originate in the AP, not the EC, so it helps to think that the EC takes the DP and USB data as input to mux onto USB type-c ports even if it really doesn't do that. With this split design, the EC forwards the DP HPD state to the AP via a GPIO that's connected to the DP phy. Having that HPD state signaled directly to the DP phy uses precious hardware resources, a GPIO or two and a wire, and it also forces the TCPM to live on the EC. If we want to save costs and move more control of USB type-c to the kernel it's in our interest to get rid of the HPD GPIO entirely and signal HPD to the DP phy some other way. Luckily, the EC already exposes information about the USB Type-C stack to the kernel via the host command interface in the "google,cros-ec-typec" compatible driver, which parses EC messages related to USB type-c and effectively "replays" those messages to the kernel's USB typec subsystem. This includes the state of HPD, which can be interrogated and acted upon by registering a 'struct typec_mux_dev' with the typec subsystem. On DT based systems, the DP display pipeline is abstracted via a 'struct drm_bridge'. If we want to signal HPD state within the kernel we need to hook into the drm_bridge framework somehow to call drm_bridge_hpd_notify() when HPD state changes in the typec framework. Make a drm_bridge in the EC that attaches onto the end of the DP bridge chain and logically moves the display data onto a usb-c-connector. Signal HPD when the typec HPD state changes, as long as this new drm_bridge is the one that's supposed to signal HPD. Do that by registering a 'struct typec_mux_dev' with the typec framework and associating that struct with a usb-c-connector node and a drm_bridge. To keep this patch minimal, just signal HPD state to the drm_bridge chain. Later patches will add more features. Eventually we'll be able to inform userspace about which usb-c-connector node is displaying DP and what USB devices are connected to a connector. Note that this code is placed in the cros_typec_switch driver because that's where mode-switch devices on the EC are controlled by the AP. Logically this drm_bridge sits in front of the mode-switch on the EC, and if there is anything to control on the EC the 'EC_FEATURE_TYPEC_AP_MUX_SET' feature will be set. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/Kconfig | 3 +- drivers/platform/chrome/cros_typec_switch.c | 218 ++++++++++++++++++-- 2 files changed, 204 insertions(+), 17 deletions(-) diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig index 7a83346bfa53..910aa8be9c84 100644 --- a/drivers/platform/chrome/Kconfig +++ b/drivers/platform/chrome/Kconfig @@ -287,7 +287,8 @@ config CHROMEOS_PRIVACY_SCREEN config CROS_TYPEC_SWITCH tristate "ChromeOS EC Type-C Switch Control" - depends on MFD_CROS_EC_DEV && TYPEC && ACPI + depends on MFD_CROS_EC_DEV + depends on TYPEC default MFD_CROS_EC_DEV help If you say Y here, you get support for configuring the ChromeOS EC Type-C diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index 769de2889f2f..d8fb6662cf8d 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,15 @@ #include #include +#include +#include + +struct cros_typec_dp_bridge { + struct cros_typec_switch_data *sdata; + bool hpd_enabled; + struct drm_bridge bridge; +}; + /* Handles and other relevant data required for each port's switches. */ struct cros_typec_port { int port_num; @@ -30,7 +40,9 @@ struct cros_typec_port { struct cros_typec_switch_data { struct device *dev; struct cros_ec_device *ec; + bool typec_cmd_supported; struct cros_typec_port *ports[EC_USB_PD_MAX_PORTS]; + struct cros_typec_dp_bridge *typec_dp_bridge; }; static int cros_typec_cmd_mux_set(struct cros_typec_switch_data *sdata, int port_num, u8 index, @@ -143,13 +155,60 @@ static int cros_typec_configure_mux(struct cros_typec_switch_data *sdata, int po return 0; } +static int cros_typec_dp_port_switch_set(struct typec_mux_dev *mode_switch, + struct typec_mux_state *state) +{ + struct cros_typec_port *port; + const struct typec_displayport_data *dp_data; + struct cros_typec_dp_bridge *typec_dp_bridge; + struct drm_bridge *bridge; + bool hpd_asserted; + + port = typec_mux_get_drvdata(mode_switch); + typec_dp_bridge = port->sdata->typec_dp_bridge; + if (!typec_dp_bridge) + return 0; + + bridge = &typec_dp_bridge->bridge; + + if (state->mode == TYPEC_STATE_SAFE || state->mode == TYPEC_STATE_USB) { + if (typec_dp_bridge->hpd_enabled) + drm_bridge_hpd_notify(bridge, connector_status_disconnected); + + return 0; + } + + if (state->alt && state->alt->svid == USB_TYPEC_DP_SID) { + if (typec_dp_bridge->hpd_enabled) { + dp_data = state->data; + hpd_asserted = dp_data->status & DP_STATUS_HPD_STATE; + + if (hpd_asserted) + drm_bridge_hpd_notify(bridge, connector_status_connected); + else + drm_bridge_hpd_notify(bridge, connector_status_disconnected); + } + } + + return 0; +} + static int cros_typec_mode_switch_set(struct typec_mux_dev *mode_switch, struct typec_mux_state *state) { struct cros_typec_port *port = typec_mux_get_drvdata(mode_switch); + struct cros_typec_switch_data *sdata = port->sdata; + int ret; + + ret = cros_typec_dp_port_switch_set(mode_switch, state); + if (ret) + return ret; /* Mode switches have index 0. */ - return cros_typec_configure_mux(port->sdata, port->port_num, 0, state->mode, state->alt); + if (sdata->typec_cmd_supported) + return cros_typec_configure_mux(port->sdata, port->port_num, 0, state->mode, state->alt); + + return 0; } static int cros_typec_retimer_set(struct typec_retimer *retimer, struct typec_retimer_state *state) @@ -201,12 +260,77 @@ static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwno return PTR_ERR_OR_ZERO(port->retimer); } +static int +cros_typec_dp_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { + DRM_ERROR("Fix bridge driver to make connector optional!\n"); + return -EINVAL; + } + + return 0; +} + +static struct cros_typec_dp_bridge * +bridge_to_cros_typec_dp_bridge(struct drm_bridge *bridge) +{ + return container_of(bridge, struct cros_typec_dp_bridge, bridge); +} + +static void cros_typec_dp_bridge_hpd_enable(struct drm_bridge *bridge) +{ + struct cros_typec_dp_bridge *typec_dp_bridge; + + typec_dp_bridge = bridge_to_cros_typec_dp_bridge(bridge); + typec_dp_bridge->hpd_enabled = true; +} + +static void cros_typec_dp_bridge_hpd_disable(struct drm_bridge *bridge) +{ + struct cros_typec_dp_bridge *typec_dp_bridge; + + typec_dp_bridge = bridge_to_cros_typec_dp_bridge(bridge); + typec_dp_bridge->hpd_enabled = false; +} + +static const struct drm_bridge_funcs cros_typec_dp_bridge_funcs = { + .attach = cros_typec_dp_bridge_attach, + .hpd_enable = cros_typec_dp_bridge_hpd_enable, + .hpd_disable = cros_typec_dp_bridge_hpd_disable, +}; + +static int cros_typec_register_dp_bridge(struct cros_typec_switch_data *sdata, + struct fwnode_handle *fwnode) +{ + struct cros_typec_dp_bridge *typec_dp_bridge; + struct drm_bridge *bridge; + struct device *dev = sdata->dev; + + typec_dp_bridge = devm_kzalloc(dev, sizeof(*typec_dp_bridge), GFP_KERNEL); + if (!typec_dp_bridge) + return -ENOMEM; + + typec_dp_bridge->sdata = sdata; + sdata->typec_dp_bridge = typec_dp_bridge; + bridge = &typec_dp_bridge->bridge; + + bridge->funcs = &cros_typec_dp_bridge_funcs; + bridge->of_node = dev->of_node; + bridge->type = DRM_MODE_CONNECTOR_DisplayPort; + bridge->ops |= DRM_BRIDGE_OP_HPD; + + return devm_drm_bridge_add(dev, bridge); +} + static int cros_typec_register_port(struct cros_typec_switch_data *sdata, struct fwnode_handle *fwnode) { struct cros_typec_port *port; struct device *dev = sdata->dev; struct acpi_device *adev; + struct device_node *np; + struct fwnode_handle *port_node; u32 index; int ret; const char *prop_name; @@ -218,9 +342,12 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, adev = to_acpi_device_node(fwnode); if (adev) prop_name = "_ADR"; + np = to_of_node(fwnode); + if (np) + prop_name = "reg"; - if (!adev) - return dev_err_probe(fwnode->dev, -ENODEV, "Couldn't get ACPI handle\n"); + if (!adev && !np) + return dev_err_probe(fwnode->dev, -ENODEV, "Couldn't get ACPI/OF device handle\n"); ret = fwnode_property_read_u32(fwnode, prop_name, &index); if (ret) @@ -232,41 +359,84 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, port->port_num = index; sdata->ports[index] = port; + port_node = fwnode; + if (np) + fwnode = fwnode_graph_get_port_parent(fwnode); + if (fwnode_property_present(fwnode, "retimer-switch")) { - ret = cros_typec_register_retimer(port, fwnode); - if (ret) - return dev_err_probe(dev, ret, "Retimer switch register failed\n"); + ret = cros_typec_register_retimer(port, port_node); + if (ret) { + dev_err_probe(dev, ret, "Retimer switch register failed\n"); + goto out; + } dev_dbg(dev, "Retimer switch registered for index %u\n", index); } - if (!fwnode_property_present(fwnode, "mode-switch")) - return 0; + if (fwnode_property_present(fwnode, "mode-switch")) { + ret = cros_typec_register_mode_switch(port, port_node); + if (ret) { + dev_err_probe(dev, ret, "Mode switch register failed\n"); + goto out; + } - ret = cros_typec_register_mode_switch(port, fwnode); - if (ret) - return dev_err_probe(dev, ret, "Mode switch register failed\n"); + dev_dbg(dev, "Mode switch registered for index %u\n", index); + } - dev_dbg(dev, "Mode switch registered for index %u\n", index); +out: + if (np) + fwnode_handle_put(fwnode); return ret; } static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) { struct device *dev = sdata->dev; + struct fwnode_handle *devnode; struct fwnode_handle *fwnode; + struct fwnode_endpoint endpoint; int nports, ret; nports = device_get_child_node_count(dev); if (nports == 0) return dev_err_probe(dev, -ENODEV, "No switch devices found\n"); - device_for_each_child_node(dev, fwnode) { - ret = cros_typec_register_port(sdata, fwnode); - if (ret) { + devnode = dev_fwnode(dev); + if (fwnode_graph_get_endpoint_count(devnode, 0)) { + fwnode_graph_for_each_endpoint(devnode, fwnode) { + ret = fwnode_graph_parse_endpoint(fwnode, &endpoint); + if (ret) { + fwnode_handle_put(fwnode); + goto err; + } + /* Skip if not a type-c output port */ + if (endpoint.port != 2) + continue; + + ret = cros_typec_register_port(sdata, fwnode); + if (ret) { + fwnode_handle_put(fwnode); + goto err; + } + } + } else { + device_for_each_child_node(dev, fwnode) { + ret = cros_typec_register_port(sdata, fwnode); + if (ret) { + fwnode_handle_put(fwnode); + goto err; + } + } + } + + if (fwnode_property_present(devnode, "mode-switch")) { + fwnode = fwnode_graph_get_endpoint_by_id(devnode, 0, 0, 0); + if (fwnode) { + ret = cros_typec_register_dp_bridge(sdata, fwnode); fwnode_handle_put(fwnode); - goto err; + if (ret) + goto err; } } @@ -280,6 +450,7 @@ static int cros_typec_switch_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct cros_typec_switch_data *sdata; + struct cros_ec_dev *ec_dev; sdata = devm_kzalloc(dev, sizeof(*sdata), GFP_KERNEL); if (!sdata) @@ -288,6 +459,12 @@ static int cros_typec_switch_probe(struct platform_device *pdev) sdata->dev = dev; sdata->ec = dev_get_drvdata(pdev->dev.parent); + ec_dev = dev_get_drvdata(&sdata->ec->ec->dev); + if (!ec_dev) + return -EPROBE_DEFER; + + sdata->typec_cmd_supported = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_AP_MUX_SET); + platform_set_drvdata(pdev, sdata); return cros_typec_register_switches(sdata); @@ -308,10 +485,19 @@ static const struct acpi_device_id cros_typec_switch_acpi_id[] = { MODULE_DEVICE_TABLE(acpi, cros_typec_switch_acpi_id); #endif +#ifdef CONFIG_OF +static const struct of_device_id cros_typec_switch_of_match_table[] = { + { .compatible = "google,cros-ec-typec-switch" }, + {} +}; +MODULE_DEVICE_TABLE(of, cros_typec_switch_of_match_table); +#endif + static struct platform_driver cros_typec_switch_driver = { .driver = { .name = "cros-typec-switch", .acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id), + .of_match_table = of_match_ptr(cros_typec_switch_of_match_table), }, .probe = cros_typec_switch_probe, .remove_new = cros_typec_switch_remove, From patchwork Sat Feb 10 07:09:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337801dyd; Fri, 9 Feb 2024 23:17:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGz3m8zfiLhqQJ+KAYxhwgy5XiRsFBIcvE0cXYiZWmZ6cvKHs/4FVx9TxFoVTF2LFsJIWJn X-Received: by 2002:a05:620a:5598:b0:785:cb12:c3bb with SMTP id vq24-20020a05620a559800b00785cb12c3bbmr96756qkn.47.1707549422592; Fri, 09 Feb 2024 23:17:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549422; cv=pass; d=google.com; s=arc-20160816; b=UZFTe1t+ombdfjl8Iy6zOoHZXeCs6P1dUjC2gYJfETXWHjt/QzSldvMLFJfetOeGLW NK8BV357YTWpe5flj57bQB5DT2fPHW6wB9fAgrLO3+IPSmpQ3nRrtpx94T2W6n4ZF+Ky RSPIPe/2SFaxJsmxWPLU7iYW5OT7uXsj1a6zsWnHMa7qmAxRmKF7RDfa69g0VCdIbiVq azb+uJALvw0HZyyZp3rB7lwDqh4jxmU1QPEcyzD0FD4EvX3aJgdj1iYew3o3a/lgynYk VJh8Z6mhqvZEqjFs2/CEczuQZ19s3k1I+8FZvEYKDTIHuDZ4u9TQb2U6u3I5i59iThnc LR2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wd31Lb0kMP3/plG0wIxMro3C79SofcRoKH3rOQKLIE8=; fh=/UB/37j8fKgWkgGsASck0uxYaM9JWz7P9Q+jX9gLyO8=; b=UWuTBYbVHnHb12O4piIKMbkymHG1BA9L7iyAq7k5VbYkZdVy8eh1G36s2abWNB1hv3 I8mRKqWPZVNzbqkCC+ouemVNnyCbp1V2Gg9dcyiMJSTgvRMf0P7gh4p+wA659JHdKW6r 2OxLQvIs+FUSXsXH9k00kYkVI98En4tqEt2D0/z6a2/DYTy27BoImbijin77e+qDaFpm hHToq9SbJUuYU1VJRqdvfNAv8kVmcp7V+89q0fM+UzBOEuOJHsuHJXNWpQsj3I6iJqxE xvtbVLfEoUjX9Pqc0adLQxCD2k11M2krpg9sR+p9667Bpab6OzhS/IC7KsHEjq1RyBt0 6sEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R3756kck; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60321-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60321-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUsVKgjpsJpTyzmr0G4+ylOqBzId+SOxJOhzgSRRqJCvJSNrzoWcAYjSZ9a7MLQcAwgCT7A2Au/wqzbHHbXUy6I5T37mg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a16-20020a05620a02f000b007857d50321fsi1136378qko.313.2024.02.09.23.17.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:17:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60321-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R3756kck; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60321-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60321-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9B63A1C234B5 for ; Sat, 10 Feb 2024 07:16:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB1FB3CF52; Sat, 10 Feb 2024 07:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="R3756kck" Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 139383B2A6 for ; Sat, 10 Feb 2024 07:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549008; cv=none; b=jW3DTpgwdXdVNlDf8uBYdKaygHqoL4p45n3GefOLudC3/SmlvqejZfdxcwjfDdyOmlDNM5K6jPsgeiUtLIMzL71syfKe7l4C3+RviBZTro1k7ZBVz0luzneW6DieQ6HRRrCWUdhzTM+W9VYRoyttNzSG+Sn1615cKn629r3MXSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549008; c=relaxed/simple; bh=K7+22g0lNcVFXAqxGfKn8cA8DpWhqUDmXOrSd7iqmCI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ppZ34/YmdLDeMtSaUE5r1wMWppLRz9dOnFgMkPOzf8YyqVbrGfazBvtHq7MSpSaK813X3Z4ouKkTHmwxDeGtHMcK1+9rqKXo+4WL0Q1bupkAxdIi/XMkEoqx1KiMO0B/uNP93aV1qcW/rBhP7gyz91PjtgQCS+oYorCuf6LgGSU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=R3756kck; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-595aa5b1fe0so1131210eaf.2 for ; Fri, 09 Feb 2024 23:10:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549005; x=1708153805; darn=vger.kernel.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=wd31Lb0kMP3/plG0wIxMro3C79SofcRoKH3rOQKLIE8=; b=R3756kckqivhhNaV8joPSBvY9GmES4xXJrauIVR4THQjBLSHU1HnCnV2SmR2QMIhKA BYalkZTeEgUi0kUgjV534Wio2+f604l+B1kYeYMTxPUeEsG7wiPxL2f/5+cOUrShkB24 GEtExNZRIshRgMbHx45/wqFDnq76hFL8Wi2UA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549005; x=1708153805; 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=wd31Lb0kMP3/plG0wIxMro3C79SofcRoKH3rOQKLIE8=; b=B4VV24uo1odZ9hiGRKov0a1EYbd5DpzHh/R8i+8NWm7M/XerBvxFvd8x4onPh+otFg vTaV4d9E+0DJ2OPM7Lf+aUE6UAAZEZtxqhV4GgChg4QyqBLhZS46CuBaJF/XTvKvUWl5 +XghwJcJrNEvuyrecT/+YpQhCfHRDdg3VNgrLbVrSX8qbEsF+9M9ZuqCoCmePe+PENeD tGQyh6t6hjk1YUbUdu6tCjv36Qdfn2ixTzY17UOhgcZvyzlK04EmvblarZ8OS4+O44c5 OCf5hPDNMWK1gVv/xktuaawpcgBc3bEP4U9oEkdVCGhhhyqqBmB3Qjc/hc97ULZP/O1Q k0Og== X-Gm-Message-State: AOJu0Yz3I6AkxTdveGSOzuWLKiNTvxx16VJYZtPS6tvtKPCa0m4MnV79 U/Br54tJMbFdQBBNExJDX2qbgtPhmiEZQ38gZGA/IHuOXjRWrNIbGTVKrRhX9A== X-Received: by 2002:a05:6358:724f:b0:178:a555:c312 with SMTP id i15-20020a056358724f00b00178a555c312mr1815970rwa.32.1707549005109; Fri, 09 Feb 2024 23:10:05 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWsXajTcewLtH1HrGdkpwo/bXi1kEBGm247X7ndwkCI37Be0lgSn/r86+ticjkQ50MAl9j0WkD3/OgNgbjc5CGZLSgMv/O/cn/QLGOfzWSIUXhY+o+i8AeFCE9R7ZxKT5a9xyftvgYlR1a0aXrhwPB0kGGWhAWVIaoVYE2Zp3Le58g3nkYcszmEr2L3pRcSZDA0COGsE5cr9Uiu/yDo/7DaWuk8qmYkODuxvG4jM54L2LusI8+u7w2Xs5IIjla7PJ069w+gYCKzCrLPWIDsvnvX3Tj2vuvt4ao3KMyAJgwDTOUd8MWyhlxc28LdqCpWbuq3CoKNEh1qeJE1BJ8dWXL0jxc8JAmzKqkAwhIshq7JQfxdoeVG+g== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id e12-20020a17090ab38c00b0029652c53a32sm2831885pjr.33.2024.02.09.23.10.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:04 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 15/22] platform/chrome: cros_typec_switch: Support DP muxing via DRM lane assignment Date: Fri, 9 Feb 2024 23:09:26 -0800 Message-ID: <20240210070934.2549994-16-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495343227061561 X-GMAIL-MSGID: 1790495343227061561 Implement DP lane assignment in the drm_bridge atomic_check() callback so that DP altmode configurations like pinconf D can be supported and DP muxing can be implemented. In the DP altmode spec, pinconf C assigns all 4 SuperSpeed lanes in the usb-c-connector node to DP, while pinconf D assigns 2 SuperSpeed lanes to DP and 2 SuperSpeed lanes to USB. Use the 'data-lanes' property from the input DP graph port to calculate the maximum number of lanes coming from the DP source (either 2 or 4) and limit the lanes requested to the smaller of this or the pin configuration. Once we know the maximum number of lanes that can be assigned, map the DP lanes to the active type-c output port with the assigned pin configuration. Use the 'data-lanes' property from the active type-c output port to determine which logical DP lanes should be assigned to the output of the drm_bridge. For now assume the type-c pins are in the normal orientation. This design supports different DP altmode pin configurations and also allows us to effectively mux one DP phy to two different USB type-c connectors by wiring the physical DP lanes to one or the other USB type-c connectors in the hardware. For example, DP ML0/ML1 are hardwired to one USB type-c connector and DP ML2/ML3 are hardwired to the other connector. The 'data-lanes' of the first USB type-c port would be the default "<0 1 2 3>" while the 'data-lanes' of the second USB type-c port would be "<2 3 0 1>". Depending on the active USB type-c port, map the logical DP lane to the logical type-c lane, and then find the physical type-c lane corresponding to that logical lane from the type-c port's 'data-lanes' property. Once we have that, map the physical type-c lane to the physical DP lane and request that physical DP lane as the logical DP lane through the DRM lane assignment logic on the input of the drm_bridge. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 136 +++++++++++++++++++- 1 file changed, 131 insertions(+), 5 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index d8fb6662cf8d..adcbf8f44c98 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -19,20 +19,28 @@ #include #include +#include #include #include struct cros_typec_dp_bridge { + /* TODO: Add mutex lock to protect active_port with respect to drm/typec framework calls */ + struct cros_typec_port *active_port; struct cros_typec_switch_data *sdata; + size_t max_lanes; bool hpd_enabled; struct drm_bridge bridge; }; +#define USBC_LANES_COUNT 4 + /* Handles and other relevant data required for each port's switches. */ struct cros_typec_port { int port_num; struct typec_mux_dev *mode_switch; struct typec_retimer *retimer; + size_t num_dp_lanes; + u32 lane_mapping[USBC_LANES_COUNT]; struct cros_typec_switch_data *sdata; }; @@ -163,6 +171,8 @@ static int cros_typec_dp_port_switch_set(struct typec_mux_dev *mode_switch, struct cros_typec_dp_bridge *typec_dp_bridge; struct drm_bridge *bridge; bool hpd_asserted; + u8 pin_assign; + size_t num_lanes, max_lanes; port = typec_mux_get_drvdata(mode_switch); typec_dp_bridge = port->sdata->typec_dp_bridge; @@ -172,17 +182,41 @@ static int cros_typec_dp_port_switch_set(struct typec_mux_dev *mode_switch, bridge = &typec_dp_bridge->bridge; if (state->mode == TYPEC_STATE_SAFE || state->mode == TYPEC_STATE_USB) { - if (typec_dp_bridge->hpd_enabled) - drm_bridge_hpd_notify(bridge, connector_status_disconnected); + /* Clear active port when port isn't in DP mode */ + port->num_dp_lanes = 0; + if (typec_dp_bridge->active_port == port) { + typec_dp_bridge->active_port = NULL; + if (typec_dp_bridge->hpd_enabled) + drm_bridge_hpd_notify(bridge, connector_status_disconnected); + } return 0; } if (state->alt && state->alt->svid == USB_TYPEC_DP_SID) { - if (typec_dp_bridge->hpd_enabled) { - dp_data = state->data; - hpd_asserted = dp_data->status & DP_STATUS_HPD_STATE; + dp_data = state->data; + hpd_asserted = dp_data->status & DP_STATUS_HPD_STATE; + /* + * Assume the first port to have HPD asserted is the one muxed + * to DP (i.e. active_port). When there's only one port this + * delays setting the active_port until HPD is asserted, but + * before that the drm_connector looks disconnected so + * active_port doesn't need to be set. + */ + if (hpd_asserted && !typec_dp_bridge->active_port) + typec_dp_bridge->active_port = port; + /* Determine number of logical DP lanes from pin assignment */ + pin_assign = DP_CONF_GET_PIN_ASSIGN(dp_data->conf); + if (pin_assign == DP_PIN_ASSIGN_D) + num_lanes = 2; + else + num_lanes = 4; + max_lanes = typec_dp_bridge->max_lanes; + port->num_dp_lanes = min(num_lanes, max_lanes); + + /* Only notify hpd state for the port that has entered DP mode. */ + if (typec_dp_bridge->hpd_enabled && typec_dp_bridge->active_port == port) { if (hpd_asserted) drm_bridge_hpd_notify(bridge, connector_status_connected); else @@ -278,6 +312,81 @@ bridge_to_cros_typec_dp_bridge(struct drm_bridge *bridge) return container_of(bridge, struct cros_typec_dp_bridge, bridge); } +static int dp_lane_to_typec_lane(unsigned int dp_lane) +{ + switch (dp_lane) { + case 0: + return 2; + case 1: + return 3; + case 2: + return 1; + case 3: + return 0; + } + + return -EINVAL; +} + +static int typec_to_dp_lane(unsigned int typec_lane) +{ + switch (typec_lane) { + case 0: + return 3; + case 1: + return 2; + case 2: + return 0; + case 3: + return 1; + } + + return -EINVAL; +} + +static int cros_typec_dp_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct cros_typec_dp_bridge *typec_dp_bridge; + struct drm_lane_cfg *in_lanes; + size_t num_lanes; + struct cros_typec_port *port; + int i, typec_lane; + + typec_dp_bridge = bridge_to_cros_typec_dp_bridge(bridge); + if (!typec_dp_bridge->active_port) + return -ENODEV; + + port = typec_dp_bridge->active_port; + + num_lanes = port->num_dp_lanes; + in_lanes = kcalloc(num_lanes, sizeof(*in_lanes), GFP_KERNEL); + if (!in_lanes) + return -ENOMEM; + + bridge_state->input_bus_cfg.lanes = in_lanes; + bridge_state->input_bus_cfg.num_lanes = num_lanes; + + for (i = 0; i < num_lanes; i++) { + /* Get physical type-c lane for DP lane */ + typec_lane = dp_lane_to_typec_lane(i); + if (typec_lane < 0) { + DRM_ERROR("Invalid type-c lane configuration\n"); + return -EINVAL; + } + + /* Map to logical type-c lane */ + typec_lane = port->lane_mapping[typec_lane]; + + /* Map logical type-c lane to logical DP lane */ + in_lanes[i].logical = typec_to_dp_lane(typec_lane); + } + + return 0; +} + static void cros_typec_dp_bridge_hpd_enable(struct drm_bridge *bridge) { struct cros_typec_dp_bridge *typec_dp_bridge; @@ -296,6 +405,10 @@ static void cros_typec_dp_bridge_hpd_disable(struct drm_bridge *bridge) static const struct drm_bridge_funcs cros_typec_dp_bridge_funcs = { .attach = cros_typec_dp_bridge_attach, + .atomic_check = cros_typec_dp_bridge_atomic_check, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .hpd_enable = cros_typec_dp_bridge_hpd_enable, .hpd_disable = cros_typec_dp_bridge_hpd_disable, }; @@ -305,6 +418,7 @@ static int cros_typec_register_dp_bridge(struct cros_typec_switch_data *sdata, { struct cros_typec_dp_bridge *typec_dp_bridge; struct drm_bridge *bridge; + int num_lanes; struct device *dev = sdata->dev; typec_dp_bridge = devm_kzalloc(dev, sizeof(*typec_dp_bridge), GFP_KERNEL); @@ -313,6 +427,12 @@ static int cros_typec_register_dp_bridge(struct cros_typec_switch_data *sdata, typec_dp_bridge->sdata = sdata; sdata->typec_dp_bridge = typec_dp_bridge; + + num_lanes = fwnode_property_count_u32(fwnode, "data-lanes"); + if (num_lanes < 0) + num_lanes = 4; + typec_dp_bridge->max_lanes = num_lanes; + bridge = &typec_dp_bridge->bridge; bridge->funcs = &cros_typec_dp_bridge_funcs; @@ -333,6 +453,7 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, struct fwnode_handle *port_node; u32 index; int ret; + const u32 default_lane_mapping[] = { 0, 1, 2, 3 }; const char *prop_name; port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); @@ -359,6 +480,11 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, port->port_num = index; sdata->ports[index] = port; + if (fwnode_property_read_u32_array(fwnode, "data-lanes", + port->lane_mapping, + ARRAY_SIZE(port->lane_mapping))) + memcpy(port->lane_mapping, default_lane_mapping, sizeof(default_lane_mapping)); + port_node = fwnode; if (np) fwnode = fwnode_graph_get_port_parent(fwnode); From patchwork Sat Feb 10 07:09:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337942dyd; Fri, 9 Feb 2024 23:17:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPqhjVRQSy1S7EdeTxh0hynMVDmsGpKAJEzL7/93/zrAqggh+zeBUyakTO7uzFmYniNgB8 X-Received: by 2002:a50:ee03:0:b0:560:fd6c:e52d with SMTP id g3-20020a50ee03000000b00560fd6ce52dmr676361eds.11.1707549448596; Fri, 09 Feb 2024 23:17:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549448; cv=pass; d=google.com; s=arc-20160816; b=1EkGroY8DWgT52beQOmX1axmEdmjhuIPCHDSiqNdBNCvfdgUuEbcHSqrYjkPTawzcH x09KupzkFJ3Go/yN7s6seDRw/hRm5ox+ccErcRUGcE7qGi/U0p7iC9xqa9vIGkJjbS55 UIVFmoqErUNG0nnsA8W4ZRZQ/OMJoT/biW/wd1/hGKOjxxpdOsat9OlUAakazVGBCnwj PD7JxaxI7pFIDeomwUYt/af6mk7ewN3dAIBfRTq5BSyW1hbSzcAIHGP+ZGR/fazvsBSm QZgcJeLMS536p2z4j2aKODcaXG45jRb1OQgb1wLVxuzOlVq1XQY5VDQIn1VMb68Hpj+p C/Cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=y6V0amUOjUWvw6MQgN3h/VqwRga/J7+mYEIAgmrb0/c=; fh=yLQVKMbCAJYQ0i8mGRdeIxhBKz7KZ5VDmiBdZsEomzE=; b=QToyimUjUr42rmj+PQ82EeByQmgwrRmk9XA5GQv5ZaG4OgxdfSgexyhYYCjBGjnW7Z lzDPLgGGFbPySPvK+KSs3SU5xj5gS3PgnlPooStF/9TXu9a3G9OU22oM4kmFjo7uwC2T 6Rgf1rX/UVlMdj4MStdmNWsLgGnQqrpWsqk1Y1DB2iBlUO7P0Y9CAlahcad1xlHdtWM3 HbJJLPUwyrXhUuWqM5qpAGiJSVshGSUIu2qAV1O89UY/XUKPkjUvDE8Oim5tXJWREf21 M7jrO5Y5XroiYZdpRVTPc5j4hyhBqrI/ucB4AkCWFeQacyXZhyWNSzOGChs/LOEqt2LD pjcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mAJpPFaX; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60322-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60322-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCU2MTBmzkUVq8Grc1WhnuqSl/H1wY71LTEige2vQF8h1VOuG7UdM0bS5QQx7oAmRlfyMOvNS8ueK+SExWbiYwHn1IZRXQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a3-20020a05640233c300b0055fe8b45abesi571014edc.569.2024.02.09.23.17.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:17:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60322-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mAJpPFaX; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60322-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60322-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 47EBB1F22F0B for ; Sat, 10 Feb 2024 07:16:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF77B3D0B8; Sat, 10 Feb 2024 07:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mAJpPFaX" Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A53003B7AC for ; Sat, 10 Feb 2024 07:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549010; cv=none; b=iHDqsKFRT+jcMMhc9XhlsktxIQOHg3/rTKlVHYHCHZl/+6jMbtFHyu/VBDmCX9ps7qZGFdlEwwV2xQHqRf/sMpPrVNaSo3PxSPyQ1VMxj/QlPc3Tq9iDeHfLb2Cq7cLlFvjBx0m93/k+ZfTESrjtPyshTFja0WSQHX3X9kDUNn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549010; c=relaxed/simple; bh=EG0cKUa80lUC/mdhsPXkhNNLPHcQfpDmZUDBjhurXzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RJyhlaS/J/rpefsIsraP0Rzb/0O1pX0TGOwe3NO7GZhulhpdGazQXymBsTzQA3u2oijnKy2em67ZDIsBF42+/5WmfxgUaz3Oq0nN0s4TCyp7QsjtR3Ir+5sV49GzS9le3QB+tV1iD5nkbi6eDdC1l80az3NW2XOylhZUqLU/yBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mAJpPFaX; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-6e1270e8cd3so692920a34.1 for ; Fri, 09 Feb 2024 23:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549007; x=1708153807; darn=vger.kernel.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=y6V0amUOjUWvw6MQgN3h/VqwRga/J7+mYEIAgmrb0/c=; b=mAJpPFaXHex+H0NNLvG47iF4lNzSiieP4pUS3X8cCwmMzqbzyLdzFHhGsK+cH7yg3z WmiIpqqsMbhMUCBAVDYKwKFKgDZ1OZ4AUPS3NdqdegjUR5j+A5yi+zaikr+hatHpfH0O 828MP+Q+a6WiotnIil0ppKxJN11DSMpClRGTI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549007; x=1708153807; 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=y6V0amUOjUWvw6MQgN3h/VqwRga/J7+mYEIAgmrb0/c=; b=bA/Flk/0etK/BU7rz+SEHRSkLf9oLePApICGb2dnsEwCA6HfGzg4j6hvWjE9g+orFK JqfrBg8C+wDcYr4b5ucnIlCAOXmZDt4Zami4654ddVGOSfL1UC3mebUMPT2Jk1kqIdQZ ihtlCqLhys4WF2hRLQ1N3CGbTm/I1e1AkEcuuF+sw/KkpXHurs4j15A7mXyRsUZXlYEm rwiY3uZXUivgUPmCEjE1m+8+r0FE4HDyW00GvlG/HUDUYCKMFmcoHEyLP1Y0NT4aYOYT qSjwseFfJhlZcGOLC9sb8lnM/gmVnHKTDw6U8X3zZ8UKIV68V5yxXpp/vGpc3Eq5NWW5 MA2A== X-Gm-Message-State: AOJu0YzAJP/WvV2mg+VwSx3ZGBBs/fUc+vwI8CLEbLHRGkP+Hz9C80Za 4xumvnbgRhqZqj5JALb5UCF5xxrYKTMKawnVKlGO+BTbZKX61tr2UqqY1aNWuA== X-Received: by 2002:a05:6358:33a5:b0:178:94bc:72f1 with SMTP id i37-20020a05635833a500b0017894bc72f1mr2096204rwd.22.1707549006715; Fri, 09 Feb 2024 23:10:06 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWaLSbKYBfB1kta5BCH5EdLApsxMVyPshOqjiQkEGr1RgU09aCNI7J26PA5y6zB52NocFHPNEZcSqExxzEebPG0kVUARyga8iDavpXgO/KXj20AkjZcB7wdsTX1/URZ2Nur6K2cfRUMcMqxIorJHw4CLpKd98bgpdp3nq0wUCa3LZzrKJVnVn10AIP2QIsykTSet7oZaAoJxUbbOPTk6nl2OQS0uBX0yVVG6x7OyBWN+x2TGSPTlG+d3mtxW22pMdHjnxeFjLBP9FoLjOJcpjpoBIoDVEv7UUdvnBICbxgiDOO/v3HZVimalG+xqyrgCAwkwHxZ6TDG4Ak651HwlJTFEu+Jah1s+9B9qu0tLmRn08YMO+1n1A== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id p6-20020a625b06000000b006db05eb1301sm1726988pfb.21.2024.02.09.23.10.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:06 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 16/22] platform/chrome: cros_typec_switch: Support orientation-switch Date: Fri, 9 Feb 2024 23:09:27 -0800 Message-ID: <20240210070934.2549994-17-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495370254476308 X-GMAIL-MSGID: 1790495370254476308 Register an orientation switch with the typec subsystem when the 'orientation-switch' DT property is present. In these sorts of hardware designs, the DP phy lanes are wired directly to the usb-c-connector. The EC signals entry and exit of DP mode on the port, and the DP phy lanes are assigned to the pins based on the port orientation (normal or reverse). Stash the orientation of the port and simply wait for the atomic_check phase to request the desired DP lane assignment (normal or reverse). Don't restrict this to the presence of the mode-switch property because it's possible for this device to only be an orientation-switch, in which case the DP mode entry is signaled externally (e.g. through an HPD pin on the DP source). Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 84 ++++++++++++++++++--- 1 file changed, 72 insertions(+), 12 deletions(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index adcbf8f44c98..c22c2531327a 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -38,9 +38,11 @@ struct cros_typec_dp_bridge { struct cros_typec_port { int port_num; struct typec_mux_dev *mode_switch; + struct typec_switch_dev *orientation_switch; struct typec_retimer *retimer; size_t num_dp_lanes; u32 lane_mapping[USBC_LANES_COUNT]; + enum typec_orientation orientation; struct cros_typec_switch_data *sdata; }; @@ -245,6 +247,21 @@ static int cros_typec_mode_switch_set(struct typec_mux_dev *mode_switch, return 0; } +static int cros_typec_dp_port_orientation_set(struct typec_switch_dev *sw, + enum typec_orientation orientation) +{ + struct cros_typec_port *port = typec_switch_get_drvdata(sw); + + /* + * Lane remapping is in cros_typec_dp_bridge_atomic_check(). Whenever + * an orientation changes HPD will go low and then high again so the + * atomic check handles the orientation change. + */ + port->orientation = orientation; + + return 0; +} + static int cros_typec_retimer_set(struct typec_retimer *retimer, struct typec_retimer_state *state) { struct cros_typec_port *port = typec_retimer_get_drvdata(retimer); @@ -280,6 +297,21 @@ static int cros_typec_register_mode_switch(struct cros_typec_port *port, return PTR_ERR_OR_ZERO(port->mode_switch); } +static int cros_typec_register_orientation_switch(struct cros_typec_port *port, + struct fwnode_handle *fwnode) +{ + struct typec_switch_desc orientation_switch_desc = { + .fwnode = fwnode, + .drvdata = port, + .name = fwnode_get_name(fwnode), + .set = cros_typec_dp_port_orientation_set, + }; + + port->orientation_switch = typec_switch_register(port->sdata->dev, &orientation_switch_desc); + + return PTR_ERR_OR_ZERO(port->orientation_switch); +} + static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwnode_handle *fwnode) { struct typec_retimer_desc retimer_desc = { @@ -328,17 +360,35 @@ static int dp_lane_to_typec_lane(unsigned int dp_lane) return -EINVAL; } -static int typec_to_dp_lane(unsigned int typec_lane) +static int typec_to_dp_lane(unsigned int typec_lane, + enum typec_orientation orientation) { - switch (typec_lane) { - case 0: - return 3; - case 1: - return 2; - case 2: - return 0; - case 3: - return 1; + switch (orientation) { + case TYPEC_ORIENTATION_NONE: + case TYPEC_ORIENTATION_NORMAL: + switch (typec_lane) { + case 0: + return 3; + case 1: + return 2; + case 2: + return 0; + case 3: + return 1; + } + break; + case TYPEC_ORIENTATION_REVERSE: + switch (typec_lane) { + case 0: + return 0; + case 1: + return 1; + case 2: + return 3; + case 3: + return 2; + } + break; } return -EINVAL; @@ -381,7 +431,7 @@ static int cros_typec_dp_bridge_atomic_check(struct drm_bridge *bridge, typec_lane = port->lane_mapping[typec_lane]; /* Map logical type-c lane to logical DP lane */ - in_lanes[i].logical = typec_to_dp_lane(typec_lane); + in_lanes[i].logical = typec_to_dp_lane(typec_lane, port->orientation); } return 0; @@ -509,6 +559,15 @@ static int cros_typec_register_port(struct cros_typec_switch_data *sdata, dev_dbg(dev, "Mode switch registered for index %u\n", index); } + if (fwnode_property_present(fwnode, "orientation-switch")) { + ret = cros_typec_register_orientation_switch(port, port_node); + if (ret) { + dev_err(dev, "Orientation switch register failed\n"); + goto out; + } + + dev_dbg(dev, "Orientation switch registered for index %u\n", index); + } out: if (np) @@ -556,7 +615,8 @@ static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) } } - if (fwnode_property_present(devnode, "mode-switch")) { + if (fwnode_property_present(devnode, "mode-switch") || + fwnode_property_present(devnode, "orientation-switch")) { fwnode = fwnode_graph_get_endpoint_by_id(devnode, 0, 0, 0); if (fwnode) { ret = cros_typec_register_dp_bridge(sdata, fwnode); From patchwork Sat Feb 10 07:09:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1339563dyd; Fri, 9 Feb 2024 23:22:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkBrxJgYgUvCifZwKp4jR9DVlSRtLkWYntKZUEwo1b8q8IfqONKO7bV/T2RnIfcK7sHfOT X-Received: by 2002:a17:90b:3553:b0:296:6bd5:42df with SMTP id lt19-20020a17090b355300b002966bd542dfmr1300106pjb.38.1707549773638; Fri, 09 Feb 2024 23:22:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549773; cv=pass; d=google.com; s=arc-20160816; b=HkjVgEx7n0tc52SoRQxsQa7MgyU5Al9eVYjEmIwLzi2z1lopC8yZCbc4mkslw6KBSG bd/X4nqRnWX7LDjKIXoqr6IMbCqKkuksOKACHV+S+7jH4IU1Wy9dYYZNt42NJQeKcRh7 jq3p/NICL/Q1vhCORWs+LQS/4UumUIGpQ6keCGXMawg7edMUwh+qxMdv5skES8JynBg5 xqZeIeA9kAI6BEqeE68dLzQPADsWHxI1zdqeh23wfTl9V30J4wCmVGoZBztOaZeyvd4i 7pfiph+e0M0GtNRIbdL1YRp1gEFFrykBKzms3ujwfhsH5iTsW3M6mSEFbS1EdyhyWOyF hXZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8lS/zI9DieZO4kpyCxOx0tCwEa/sTyMFOHybhXgcQ6k=; fh=+bI2WROCuxCjbFjcsuMvFe/Jh8iACj+Bh9kByQodKNs=; b=Hc8NCsx6e7dDweB3IUPUTe+B9mtgnudNQ0qtBazdY/S1K9sTTBgEc2Qx1SMzx0FSqE fjCySRAlyoADsFiyS5H02losvP5kvJ5yENyuKfqPrwh9yvffZpCO7fhQmjz9aBU9W/kM w71mGZyhufdnIzsauUjTfYzdlYSQHRWq9x3gv57ZcFaySwRD7+VFPOEUbU3BBhijoXLC fsC38s8mzakPgZYLnDIE08fFKi8/P1eg/HRXCQO6qETJPaws2Fw5hcX4LcMXOkv4Yg2r 5TOQqRFXeuveX0cEaKpABKvllZNgTnPG9JyN7rOT5GyqB2LQRXVhw5no+BTGRy93EETf 5mow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Lz2XbzO+; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60323-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60323-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCVIT8NKQp7ICm9bQsJzJVC+ZiNky6HhDcqgGBoliPjj758XH0TQOI4RRtZrvyvBYuXWSXxuY2onS1T1aHah6rqVqdIDPA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id np1-20020a17090b4c4100b002971cb9bcfcsi286783pjb.76.2024.02.09.23.22.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:22:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60323-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Lz2XbzO+; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60323-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60323-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 900E6B2480C for ; Sat, 10 Feb 2024 07:16:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6092C3D0D0; Sat, 10 Feb 2024 07:10:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Lz2XbzO+" Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0099C3BB3C for ; Sat, 10 Feb 2024 07:10:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549010; cv=none; b=HGG7Za7nzTZ1BT/xbU3gg6sqxr41ZZ8kZD7/ZAhME7i9IpMk6eR/AxDWHeynw38LhSWhWespuIN8paatRHBL2lkUMmaH8lshLD0K2veDI5IY9tNhHUOJRSnhQzCkhdfRDBSsV+UZTcMGDajriutPJurWCIHrEkiTehlyuYfk68E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549010; c=relaxed/simple; bh=7ychZbXxS1s4pMACM5Sr3Sm2rydqrFGfJ5B9SLKGry0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DanL3y4AnTKUS4TDAi224aplE6gM/P+ma8M8DZu5k1o3n9+OAwWRhOMMdPAlesmHtZ7HlzHTrn2kr8/njNy27TarkKWvqLJyYJ4cXnFDPi0xg/ih6BBKmcqq9mIxTiyN+MY4h+NJ6a66/Qdn0C89BMfcQdrmbJ9a7qPbz78hgF0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Lz2XbzO+; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso1189244a12.3 for ; Fri, 09 Feb 2024 23:10:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549008; x=1708153808; darn=vger.kernel.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=8lS/zI9DieZO4kpyCxOx0tCwEa/sTyMFOHybhXgcQ6k=; b=Lz2XbzO+E4Wisn2kGNcmhuFhYBk33d16hTwgLvuCh21mHMwujM/lju4CgliLSY8ukZ 4Ik2NeomPQCbrWzCHjBl2UTkqxmxx1s3PSflD/B0qJTjKtwnSN93mKQXRAn5U913CVfn zuGeEJycDWn7NwaAJ81Uw12SMBAb0HitPFwHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549008; x=1708153808; 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=8lS/zI9DieZO4kpyCxOx0tCwEa/sTyMFOHybhXgcQ6k=; b=tcitf4LoBXW5VOtXn1mX1fSCDyNTj2ujzC+Cs+PBQeLn1oW2msCJPmP8bwpmLqOqXV 9flciQkcbIK+05zwvaxR+/lC6o3NxcD5uWqXCzZ+D9ThiNggPN0oudJOXgm4w/gyPI4G JUdCU4yfX3kMAzoZd+XdvmY2ntusmlrLlT/XSBlSjWPYgZHGQe6r+WM9uCTD5vL8z5MB c6jrKVTo9LsSiHdrnzblME3Af35uLcV6IxSrT3pMZz7XVPIgnurNFF8BALOi+mbktsev FVdF9fYaZ43h33VqFb3zmYAsaXOS0UqflEPyU5mCpHkLRpRNdzr3OcZPlHrC3kzwq+zX js0g== X-Gm-Message-State: AOJu0Yw+xcowd2TH48zTRZ901Fz29b4BAmXZqOlkzBtZ3IauTGDx7ta8 aDtsQhBK4iIS6i0lu/9UZ2zLPkalJcXF7R0N+0w1U82fQCnapkgSIAkmA+MMgw== X-Received: by 2002:a05:6a21:9102:b0:19c:9b38:f398 with SMTP id tn2-20020a056a21910200b0019c9b38f398mr1875117pzb.22.1707549008286; Fri, 09 Feb 2024 23:10:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVxVKRsZHGdz7T51QyBOeGTngT9/I4zjnFVZlFgfTySs80AvPD+gcp8pAywzgBSXuGJkHLs8GXlERRa+/aOskm6YO+aBk0O4JsRkPbqsq/HIF9wvIkHJaJ9p3c+S9gPsySDR2YcveYC5Dud+LaWCyR8Ok9AZCpX4R4qQDDHKrCYprfr3SwLujkyt4cOv88KYpJcN21HPl/XGv8wkxYw5o4cNnubbYkfwAMkaB4LbFLguENnb8tOQXJbgBembp46EqkVRYq+iW5mZicLeQN4fDtKo+5cCtS0A4hi6MP2L+NGJIhrjifwCtjNqHHnI4stBwFFIM86Tg7SoV8cY/kVIEid1QpkF6CLTUNGPnGqsP6U+Gt1fEyjSQ== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id fn7-20020a056a002fc700b006e0651ec052sm1650575pfb.32.2024.02.09.23.10.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:07 -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 , Prashant Malani , Benson Leung , Tzung-Bi Shih Subject: [PATCH 17/22] platform/chrome: cros_typec_switch: Handle lack of HPD information Date: Fri, 9 Feb 2024 23:09:28 -0800 Message-ID: <20240210070934.2549994-18-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495711123249680 X-GMAIL-MSGID: 1790495711123249680 Some EC firmwares on Trogdor/Strongbad boards don't properly indicate the state of DP HPD on a type-c port. Instead, the EC only indicates that DP mode is entered or exited for a type-c port. To make matters worse, on these firmwares the DP signal is muxed between two USB type-c connectors, so we can't use the HPD state to figure out which type-c port is actually displaying DP. Read the state of the EC's analog mux from the hpd notification callback to figure out which type-c port is displaying DP. This circumvents the entire host command/message interface, because it doesn't work all the time. Only do this when we have the mux-gpios property in DT, indicating that we have to read the EC gpio state to figure this out. For now we only support a single gpio "bit", so there can only be two USB type-c ports. Cc: Prashant Malani Cc: Benson Leung Cc: Tzung-Bi Shih Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- drivers/platform/chrome/cros_typec_switch.c | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c index c22c2531327a..edd628eab7da 100644 --- a/drivers/platform/chrome/cros_typec_switch.c +++ b/drivers/platform/chrome/cros_typec_switch.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,7 @@ struct cros_typec_dp_bridge { /* TODO: Add mutex lock to protect active_port with respect to drm/typec framework calls */ struct cros_typec_port *active_port; + struct gpio_desc *mux_gpio; struct cros_typec_switch_data *sdata; size_t max_lanes; bool hpd_enabled; @@ -453,6 +455,29 @@ static void cros_typec_dp_bridge_hpd_disable(struct drm_bridge *bridge) typec_dp_bridge->hpd_enabled = false; } +static void cros_typec_dp_bridge_hpd_notify(struct drm_bridge *bridge, + enum drm_connector_status status) +{ + struct cros_typec_dp_bridge *typec_dp_bridge; + struct cros_typec_switch_data *sdata; + struct gpio_desc *mux_gpio; + int mux_val; + + typec_dp_bridge = bridge_to_cros_typec_dp_bridge(bridge); + mux_gpio = typec_dp_bridge->mux_gpio; + + /* + * Some ECs don't notify AP when HPD goes high or low so we have to + * read the EC GPIO that controls the mux to figure out which type-c + * port is connected to DP. + */ + if (mux_gpio) { + sdata = typec_dp_bridge->sdata; + mux_val = gpiod_get_value_cansleep(mux_gpio); + typec_dp_bridge->active_port = sdata->ports[mux_val]; + } +} + static const struct drm_bridge_funcs cros_typec_dp_bridge_funcs = { .attach = cros_typec_dp_bridge_attach, .atomic_check = cros_typec_dp_bridge_atomic_check, @@ -461,6 +486,7 @@ static const struct drm_bridge_funcs cros_typec_dp_bridge_funcs = { .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .hpd_enable = cros_typec_dp_bridge_hpd_enable, .hpd_disable = cros_typec_dp_bridge_hpd_disable, + .hpd_notify = cros_typec_dp_bridge_hpd_notify, }; static int cros_typec_register_dp_bridge(struct cros_typec_switch_data *sdata, @@ -478,6 +504,10 @@ static int cros_typec_register_dp_bridge(struct cros_typec_switch_data *sdata, typec_dp_bridge->sdata = sdata; sdata->typec_dp_bridge = typec_dp_bridge; + typec_dp_bridge->mux_gpio = devm_gpiod_get_optional(dev, "mux", 0); + if (IS_ERR(typec_dp_bridge->mux_gpio)) + return PTR_ERR(typec_dp_bridge->mux_gpio); + num_lanes = fwnode_property_count_u32(fwnode, "data-lanes"); if (num_lanes < 0) num_lanes = 4; @@ -488,7 +518,8 @@ static int cros_typec_register_dp_bridge(struct cros_typec_switch_data *sdata, bridge->funcs = &cros_typec_dp_bridge_funcs; bridge->of_node = dev->of_node; bridge->type = DRM_MODE_CONNECTOR_DisplayPort; - bridge->ops |= DRM_BRIDGE_OP_HPD; + if (!fwnode_property_present(dev_fwnode(dev), "no-hpd")) + bridge->ops |= DRM_BRIDGE_OP_HPD; return devm_drm_bridge_add(dev, bridge); } From patchwork Sat Feb 10 07:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337804dyd; Fri, 9 Feb 2024 23:17:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUm4Jv9MESOtW2EcIQ8aLr2m3Ncp0P3PElR6bHgql3O9FEUQmB8YYgFLAaWYZISEYgVvG7ZuJq0Vz5xt75d9CCiTHrg2w== X-Google-Smtp-Source: AGHT+IGqlzaGH5kBtfBGBhdtZmh8P6oNrpf3bo1KC3BXcIuoFuDl8LObRnSrMFD09zcWlNc8QlWW X-Received: by 2002:a05:6a20:c990:b0:19e:a1b5:e765 with SMTP id gy16-20020a056a20c99000b0019ea1b5e765mr1705660pzb.9.1707549423507; Fri, 09 Feb 2024 23:17:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549423; cv=pass; d=google.com; s=arc-20160816; b=zM3VuMNgab8AsuUs9S+RxKZ4/4bFeHbVX8SDu+Y/DklLed6UCEdopEIHNw71YCpS0u q0Y3xAOtdlJLxSSopg5dPUxAkxR0leZiCEo6zvb+aepPqyGHNDznsaC5sEia5fMMQxAJ zJK1doND0hJh7yeb6NGNHto0eJK3rpkVM9DUel52jaHEzivIIWIHumzKM8kzRoP7NMnM IFxM8WS56vxKwhC4wiQ+4aorvHbxfIZfelnjN6GJ3u/6njvG+JZQXI+zUpwQwnu3mOR1 gXMl+/FcnnF/gqmZzl2VAjUeoAQf3b8q1raVAoBc3wGX1OoY/xd4fE6SiiW60MtYEu5h KZsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nDZTkmgJLWBgtbMLYvgKp9lpTe2pMS2z/gX4STfhWdw=; fh=R7T6aGLfcA4bIMSXmarwxYt3G5eLYmhXdR+spAUpl7w=; b=h/TC08cZvMP3Jxnc64EmGrWN1anLtm169nPXdlMRvFpEW2fRwgOUAI663AR5ncehpb 0OaXT4rq5UZgxlwEHzDMGpSXhWVHiANN8YuwmYyHPxtVId4w6q089J26okeeB8LOlCFa aJEGnOLJ3sqfc/45CuozIxh+iL2wDa8bsvnMiIe/cvu2Tjc6fpBxwBuTn9Bt3Ht7quVo 7a8ZGVKdl7vUhQqtiIE1PFNDdyqT5jFf8WiOqeAhNmrMTuqBoaqJSs1cH0VWrE1TjXZd i0K/Cbn9D+lEliQ9L34l21mt/IjN9X2BqtoztLsfhP39tThOPJyg1uBIPP98AhAwU32I 8MPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EBPCKMmb; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60324-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCWVifUp/vh4Wy1JPvkL982GQjwHQyvFcbhPrSRx0jCk/BNMCWEQOpfzEw0LJx+Ro1HhrgiXpvLk0khOSggPS5jd7KS8+w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lp13-20020a17090b4a8d00b002960e3745cesi3050139pjb.177.2024.02.09.23.17.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:17:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EBPCKMmb; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60324-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 457A1281148 for ; Sat, 10 Feb 2024 07:17:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C29763D542; Sat, 10 Feb 2024 07:10:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EBPCKMmb" Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB14F3C468 for ; Sat, 10 Feb 2024 07:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549013; cv=none; b=JufGPmbt4v1nTxREO4n7fZpAetEWFb3knc8apMpgL14qPPok48QVz58CmcQUn7KUh30O5XlOPs/SXDB1l4uIP3H7kF7NxFpG3YhXTERRb5Eam21HsLmvG5Zu0BaJARVxWQbeOlZBDdCuUcVCJt7JfhbfT8Y+776gDjKslQ5mspY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549013; c=relaxed/simple; bh=QWiqq/EJWFUQcAozvbWJFLlKJLTTtEoiwf9S8hzbqeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dweSFxwrrfiI9Y3aRneabArH+JE6AO7/Jpd7/I+8b2/DYEJXbl/ScYZvlX5xCl7ZoCC54DeZClTjsQuGA8rFGpASmkiFaZPoKCYd6VSDDo49CxDRciCOP8Su4lnx7tAJ+qoN3eLGGriEfLALSQkdYB1+ZYclRnynifhWpqCo/FE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=EBPCKMmb; arc=none smtp.client-ip=209.85.166.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-7c4205020c4so74260039f.1 for ; Fri, 09 Feb 2024 23:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549010; x=1708153810; darn=vger.kernel.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=nDZTkmgJLWBgtbMLYvgKp9lpTe2pMS2z/gX4STfhWdw=; b=EBPCKMmbly507rz+7I39RF8gwJrkMOSmxnE/8DJxt1ozP2LYApwJGDRkbXQAxJjn8e Y3DyhaCixDP9uIPx6ia77hde3rLFk+14P39N3NFLt6H+0VJKt32McTA0weMZLPRVKk9E NKnBL0UAh6Re+yKG4+62UI1RM6Cm+lmYMYd2U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549010; x=1708153810; 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=nDZTkmgJLWBgtbMLYvgKp9lpTe2pMS2z/gX4STfhWdw=; b=K65t6M2SrXjWKqltBnfmKxDTnEN1Ur/dFo591KjAnolgKU4a4exsgJ9QxIP2AEa2Lg bKyJOm91dmlNo5Lt8pCtCNXP6zfY4KPMhRvp0Kioq/V9ZNkTrdj0wtY4i8bkTEt2HI2T mCpCLkwjs2IIx3VPJ0ozFWYraooSJids0LhGRkIeVN4ieu89ZVXCua6mb+3CmMKN03NI QmJHH7+B9rTOsT9QdVcdyT/qsnTT4KnL0vnweLZtiaM0b35BWYmu/vR4hJv+w5EKqdDP nQwwsY7wsgCYuCf5cUazvRkDMoxXEGAoZljHx09SO5FcF22ixJ0SQkGnu7siJ08aollI /kEA== X-Gm-Message-State: AOJu0YxcrNm8B20qeMNGwPq0eTcU6wGN5J9b4kqnygYYD6Ne5Ez54vf6 vPFm8bPpgvNzmEkp8dVMhtac9GfnbgLOUqFbwD94+1v1TBjIBIq9QZPZ/vy0Hw== X-Received: by 2002:a92:d68d:0:b0:363:8440:94af with SMTP id p13-20020a92d68d000000b00363844094afmr1850383iln.4.1707549009907; Fri, 09 Feb 2024 23:10:09 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXcbuzrwhJYBRxjSeZiLO7NiAXZkROYgoL66zUbURb+mKWdFNkE6YZWqeF+fYWzC1OoLZJ7vIaJmnoX3ubJWT7jqdvCY3rb09nwzZNcZhyC6krhPIcpvVvuVMMZNAnyKp9wnSSTH4t5cCAFUNIT7kJ+WfzMIPezrdAnaANZwomwtlICT/Zr6r6RH5dlWO4ezhFtYRQ6Q6Oh3zoSRI5OqGmM7ak06KvSvc3623YX+w3HE1EN3Csld1jrH73e0N3sxhR0B0J3jsxOise0EElL18ApOgIkSprzCthwYIBL1QtBa+JJtH2NCkcO9g0jOyB9NNaWXW17EVaMe/lRlek3BOYXPVYdRj87lUF0pBXGkR6DRfMEjWr7zzTZSsxS1JPLsk6LX/BNGwzXn6f6u6mmbipoH8xhmPQ3KatEpPcQwL4MwelEQEs/zshZ39hj53M= Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id bx34-20020a056a02052200b005d8b69f882esm2566257pgb.38.2024.02.09.23.10.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:09 -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 , Benson Leung , Guenter Roeck Subject: [PATCH 18/22] dt-bindings: chrome: Add binding for ChromeOS Pogo pin connector Date: Fri, 9 Feb 2024 23:09:29 -0800 Message-ID: <20240210070934.2549994-19-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495343911069456 X-GMAIL-MSGID: 1790495343911069456 Describe the set of pins used to connect the detachable keyboard on detachable ChromeOS devices. The set of pins is called the "pogo pins". It's basically USB 2.0 with an extra pin for base detection. We expect to find a keyboard on the other side of this connector with a specific vid/pid, so describe that as a child device at the port of the usb device connected upstream. Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Benson Leung Cc: Guenter Roeck Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- .../chrome/google,pogo-pin-connector.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/chrome/google,pogo-pin-connector.yaml diff --git a/Documentation/devicetree/bindings/chrome/google,pogo-pin-connector.yaml b/Documentation/devicetree/bindings/chrome/google,pogo-pin-connector.yaml new file mode 100644 index 000000000000..5ba68fd95fcd --- /dev/null +++ b/Documentation/devicetree/bindings/chrome/google,pogo-pin-connector.yaml @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/chrome/google,pogo-pin-connector.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Pogo Pin Connector + +maintainers: + - Stephen Boyd + +properties: + compatible: + const: google,pogo-pin-connector + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + port: + $ref: /schemas/graph.yaml#/properties/port + description: Connection to USB2 port providing USB signals + required: + - endpoint + +patternProperties: + "^keyboard@[0-9a-f]{1,2}$": + description: The detachable keyboard + type: object + $ref: /schemas/usb/usb-device.yaml + +required: + - compatible + - '#address-cells' + - '#size-cells' + - port + +additionalProperties: false + +examples: + - | + connector { + compatible = "google,pogo-pin-connector"; + #address-cells = <1>; + #size-cells = <0>; + + keyboard@2 { + compatible = "usb18d1,504c"; + reg = <2>; + }; + + port { + pogo_connector_in: endpoint { + remote-endpoint = <&usb_hub_dsp3_hs>; + }; + }; + }; + +... From patchwork Sat Feb 10 07:09:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1339722dyd; Fri, 9 Feb 2024 23:23:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKIvwCkagdgiMxOxwlXz2GaL6/ie6uXUE8B3bRUdq0QybVLhYaWAsPpv2D0+H0ewzbspPG X-Received: by 2002:a05:6a00:2d17:b0:6e0:92e5:91eb with SMTP id fa23-20020a056a002d1700b006e092e591ebmr2009231pfb.21.1707549809993; Fri, 09 Feb 2024 23:23:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549809; cv=pass; d=google.com; s=arc-20160816; b=W4FYJKmBvJR+eEunP18a7Vch8WNHLHvs/81B+4+0+1Llw2nZSLZx1OQiepQqvUCfF1 Y56MU9M1YNXq+ft0C+rMF2tnEBZFxtzntILIl2wMxHJoebLnzss1fuC9NEGWzqO0/hYJ rk7MpIoEcSWpeXyENVRFkZBRNKgjgFsF9HyoGOKWFyiaitwLJZKMPeHB/d0lgQrVK0Xi 6//1UWNvouocBg9nnjAgAOsyjq8eapmlfnDzRrddC+SB4XKR2Z4v3vqOUioa5Q0U3yHp 3cDTgogwucypBw7qL4lc5NPSb3O83EdbS7f3CipsL5PkLSUhoBXRGYqEaS9lGMEGsyCM uB5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=mgXNRKfD9jGpJ2a+SkuRHm5Sc9bodN7PM+8zG1tEGYs=; fh=/XOF2RuT4secwjllnS57mMW6OBKjMrPe1RjCXgniPcQ=; b=W+UaTwnpshmZQ6rTCwXnN0VpyF3n9+gZr9wQO5ulFKv+LBO9gJ67Bcr+sI9bHqj/4C hlb99sQSfsPunATKN8/WfJ9m2JRvzlotv6cvh4/TFZbinElcwGcF8ypV8XeX2DNAwwcJ G0MJf8II5+DPBqZGKMfxh4Z6/6IZxbEdtIUlShPmCKio6DdMFFfWc/H7k8k0X7wJZvT+ 7pdgAmAhJBefQ9ZCPg+XBGOxbtPlklqffkVl5NRzEHtohSPsoRry4d7D9Sw1H4y5gmcx QRk3o8wW4LTZ1m5v9EZx6/LFPMiTn08WLG8ZA4UrY0rwWYrod4GWDo35l5wKNdQIJocp IXDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kl1t2dbu; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60325-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60325-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCWOH/O6Gdcz8lrnyTf4IEA/ri1fvmK1UPlmI5kdDMuKwQq6QZYQoTGRzEd0bSscOxnW8H03SXvbbbce5cJPGI6UPeZZAA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q11-20020a056a00088b00b006e05de14bd2si1705284pfj.318.2024.02.09.23.23.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:23:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60325-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kl1t2dbu; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60325-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60325-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0F812B276FA for ; Sat, 10 Feb 2024 07:17:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95A9A3CF66; Sat, 10 Feb 2024 07:10:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kl1t2dbu" Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F7C53C499 for ; Sat, 10 Feb 2024 07:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549013; cv=none; b=R5k0U6kj+MCDxxuNIxPuZ/eCMEWLzpd7MYUm6smr2jvjHKjvCi6Sm0BHDRF2Fy+RjmAVX6AzbA4ocXN6dAFjYbp1HCrcqRuqEL8lCPMdC8JbLMjLQYrITGPKlDMJ5NMYEemwMKO3wOLXiGQb/6haEW8XlN3ZW1+MxrdJxwAn0Y8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549013; c=relaxed/simple; bh=19FF8ca0psROBDhCh44aKdtr1cwpixcB8/tkmi6ULFc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h7G46nW+8+Jo4SNJNmM82nuPH9ZRcKaziaGFLRhyMMt24sqgB4AnWKo1ZmAw+6h3HMKZSXwi2daBzRXJevH/rSwrDpUwXgIvEm2OyQb//fqBPqLZ7gUHHMCddzChZBWyCtHl/MJzExy4jew7wA2t8HL/AA9lLUjJX6op0OGzqNo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kl1t2dbu; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d76671e5a4so14015485ad.0 for ; Fri, 09 Feb 2024 23:10:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549011; x=1708153811; darn=vger.kernel.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=mgXNRKfD9jGpJ2a+SkuRHm5Sc9bodN7PM+8zG1tEGYs=; b=kl1t2dbupFaaWyzoExGgXGQR1rD2etkECu10cHNtBmLjSV3PGtP43TPETl7kbP66js 0qyzFCuFVAT4bAygI+Hrr9r7Cf2YHfEFIjGLKKiTmCM5FxAKJn1Mzw9Iy5eKdzESwFjn ACFVNKB4haax/ShIHZFBnrTWYE9qHa8lk6llU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549011; x=1708153811; 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=mgXNRKfD9jGpJ2a+SkuRHm5Sc9bodN7PM+8zG1tEGYs=; b=jmNXGMANi8ViaLwzD0I6rFk4QC+POg1Z6q/+jBGaalUN2aem1ltuzuVZZe37Maukoj TgWkXSMGNawADJEL34Phf8ilf2MR6WFxVL2Dut3JrowpOJuuhUMIYoOFNCxpSP5w76sL zuOFXg7tWcs4+l5+mFTq0lki8tIC2wlNrSxKOEL3MFKihJb/MSaNm+tiUDRdzssd3GZN H1FIfjAOMaSTZBmFTopyK2mT6EQOB2jeURZoL3ilxyWpbHj7l2grRP8rPM2PXaSYzAn/ z6toUN4Edw9tRi1uo9Q+r3V28GUQhV5FlrbI8HiP3gFXDagoGHLRHVHvQuhyRWlHEx4q hx7A== X-Gm-Message-State: AOJu0Yz02ZW+5JpOmnOrKe6XZMBUXaQsrJPzTzU3mxrVGF7CW5bYYRNL oZGpcziofeRswSGqW6Z264wdi1MShpEt5lELrdU5lU6GLObWjkNQE93aJASnDg== X-Received: by 2002:a17:902:fc50:b0:1d7:7edb:e9b9 with SMTP id me16-20020a170902fc5000b001d77edbe9b9mr1962021plb.37.1707549011574; Fri, 09 Feb 2024 23:10:11 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWc71fj8E772kQUvIgRUnbbn899xYkz6hu90/QbF01SB/p9ONLOCbyyKeQbWay0cOj7C5XU5ujrFO94FV3UZrBbWu3tzkbV4hKesd+wu2FtGuIzlAzbbgS56/kn8ndRl2sWJl4bNxYTgiDR0X0Jg/cwLAh6o9nrrSWK2cHBeVpRsB5/YAuM7jssv2+wZAGvHs9HpJj/i/S1wAc41PtNq0YaDMDvwbZIo/NfxhycrerTuOw16U6jVFsMRAJZ0XRPUsL3J40CCLCyfYTfy/QxQyji07poJCg2reoYBXAU4cQbNGAGE7PuAiflUSip4VeYDVHsECl7XXQfSeXb7mU4KFVejzwRRfJ8z67mfaeHP19lVwnXleGXgeM3M12E2OZColcxjFPXcFjXa17fCk5PBq9BRONns7r9bHfXmuOe3goxy8e0k38omSjgnMDUJZe1E6Snt0iQmWpkgk5ENqWSZFWGlU+3hwkAPZ/6Az4sZmkDzpan24j7wxReMHSvHAzf72kAPRdO6Cem5zyl9Q== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id d4-20020a170903230400b001d9469967e8sm2495954plh.122.2024.02.09.23.10.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:11 -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 , cros-qcom-dts-watchers@chromium.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH 19/22] arm64: dts: qcom: sc7180: quackingstick: Disable instead of delete usb_c1 Date: Fri, 9 Feb 2024 23:09:30 -0800 Message-ID: <20240210070934.2549994-20-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495749629024544 X-GMAIL-MSGID: 1790495749629024544 It's simpler to reason about things if we disable nodes instead of deleting them. Disable the second usb type-c connector node on quackingstick instead of deleting it so that we can reason about ports more easily. Cc: Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd Reviewed-by: Dmitry Baryshkov Reviewed-by: Douglas Anderson --- .../arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi index 5f06842c683b..b7de9fd3fa20 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi @@ -10,9 +10,6 @@ #include "sc7180-trogdor.dtsi" #include "sc7180-trogdor-rt5682i-sku.dtsi" -/* This board only has 1 USB Type-C port. */ -/delete-node/ &usb_c1; - / { ppvar_lcd: ppvar-lcd-regulator { compatible = "regulator-fixed"; @@ -136,6 +133,11 @@ pp3300_disp_on: &pp3300_dx_edp { gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>; }; +/* This board only has 1 USB Type-C port. */ +&usb_c1 { + status = "disabled"; +}; + /* PINCTRL - modifications to sc7180-trogdor.dtsi */ /* From patchwork Sat Feb 10 07:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1337925dyd; Fri, 9 Feb 2024 23:17:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEWfzqXGMcIY9awbL9O1OvjdefFZ5ftPBCIMHjLYe/YXvBpSa8EXFOhU0777Ma7/WJ57r8 X-Received: by 2002:ad4:5d4d:0:b0:686:2ff1:8e46 with SMTP id jk13-20020ad45d4d000000b006862ff18e46mr2016598qvb.13.1707549443401; Fri, 09 Feb 2024 23:17:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549443; cv=pass; d=google.com; s=arc-20160816; b=mrVAJMwQop+86GgmX7uhN1RLmLxgUhTCW+FCHywYoTZkfXktchmfCpTN7H/UTKHXu1 Xyr+F7+HUg/bfc3VbiSzBZty2bfHTXO8QqPRg9X/MJUH98wl2NGtqcXLY/pNcKHb+6SQ zVpAv5BJKCFja+/a9oU1+Za36bcgrVxCK9KFpD8k481UjYVRWzsaVtVcd1LVZsUxvapn EqzZ4hul7fnOm30oWRT2bt8UVzA06b5L7S1Jj1ZzkPQS5lJSaYHJdawvFYZZnNVDaWw/ 7+jOppAstqCs5dj3KWw4cDMGhcD6kRCbq1g685dppoPPcPLjqPHbE8Cp3Z17kYihZP6F iaeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2cCreiQeaQPfjD+hacap9EW4I/2E2LqZap0vCweqZeE=; fh=nzpLUb32lhG2vlS+wsVgm8D99+HNe/33A7hz5PHuvss=; b=boMKGnOpsKw3FuEJr1MzejjRf+2cA8XlYJdA2PKoCMk6xdzGyeWj6d0Ol123nwDJaN how5NkbGaIu+h+ZZhF+S1TeaNX/wafhMvN2pB5uKw4/jD5Iy83KYJC2CnC7zev7N3F6K GSbHvDBUF8Hbti3gKT568CnDT8IGDtfqAYstDw8WQ2nKM1Bnk5+URooYSaUsp73Xobu+ +QwN6F37Q85ijDh0MXEEMHTiZP4H3eheD1+C7iN8fE3JC5Acm6jre/FOMjAkdTW19ujr 2xK39hP0kYjgXBmPBwrCrYd7UnXdgi6PmHEQe667Oe+sF+cVBuzf1dv+fET9PeIPvHUA ytQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CXyG0Mzu; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60326-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60326-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCUeggKFArhvj44pUxTVhoiyqMax/InteXdtenpPtLyudGkdAfZzNt+Pinf7CfDalr1QSpuM4Ihw8UFPc0vgQJq/vlq+SQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jz12-20020a0562140e6c00b0068ca0f1faafsi3797504qvb.1.2024.02.09.23.17.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:17:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60326-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CXyG0Mzu; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60326-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60326-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 027881C217F2 for ; Sat, 10 Feb 2024 07:17:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B8EB3D55D; Sat, 10 Feb 2024 07:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="CXyG0Mzu" Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E6A63CF6B for ; Sat, 10 Feb 2024 07:10:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549015; cv=none; b=fSJz8Mv6Sfk5sTTGEcQjl5cfDNKVH0OAcJi8VyO5cbWwOjGRiKwhThsJpOe1C6VjYCc6siQo6dhme059iQf4d4bzQxefHk9PzKno3c4wCKRgoLVtBt7K2HzF5P+SGPWue4MO5dj8KsS1WvSlj5fdHwYEYm0AO8wO00od4Whi+jg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549015; c=relaxed/simple; bh=uNtg6CNmd9g6D1sTnVrmmBjdLymre6S2FvTNdICMapI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S7SWpiJ0hWA87WTAqqzq4gvzWHury6WCR5SdHsB9/+zu2bL1KNES0fsPEA45rcxp9XgPAcl1T+kUDE0ZvUoh7ZggHkhFR2oQz/Ajn/Ggr1aQe77uaSapjRbJzVgTWuF8WuLsdueK7xwIs03/3xbmOfooD3YFtlS5A/tCMgTUiQ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=CXyG0Mzu; arc=none smtp.client-ip=209.85.161.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-595d24ad466so1052237eaf.0 for ; Fri, 09 Feb 2024 23:10:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549013; x=1708153813; darn=vger.kernel.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=2cCreiQeaQPfjD+hacap9EW4I/2E2LqZap0vCweqZeE=; b=CXyG0Mzu2Xvb5nM0nLD9eds/tZdPMrSXNgosUbq5S3rVXViUeI2yNCc3Qq4JwZTp8v dR8P7V5yMKnRLqa/hQTiU8yVfcvPSsi7/e3hg8zdDCeH6m0myFOGMnbbqFGTrOCwS0CO kDQnWAan+oqA+7zkK0RN8e0bWOWRAQ5wlNR50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549013; x=1708153813; 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=2cCreiQeaQPfjD+hacap9EW4I/2E2LqZap0vCweqZeE=; b=QvvP4QYGyAKSZXpQJH0SpRJpvt8P7pJ/yF9W+mIirtlIz7okMX2Fr5sggT5e8b7LYR EyVWWlfDKdU6GalcOxs7X0oPrtdePPFqQ12namcY7WUh6kn1tTz3asjgoPYCVZwSKOwm mhUHMEBwFrqgFkg+rz7FsUXYwiTquTLepHtEttFncCaAuqSGAx2Hdr5urcy2BMFde9FP ErilsTuJzZ/OYI/qYQqnpjCXZVsJGTlShg+Dz1fvw8UA1ol8aQ/NMd+6XmIFskvl7IxL fbI/UYre9dw5GgJj7YbrnOjg4fSw/myD9PYdXFPeuRE9GiRFXAhKZZ4v7kx8gpSFeaQv 8R3A== X-Gm-Message-State: AOJu0Yw6QXQ9IMLq2Lc79IRpoouCrobYXFY6rj0yBXfYtUy14b8k0EkJ zydMdKrCgIgOp8HIkJw4MtINxT4nsekhTd8+U6FWMo/SL5xBLUnqngWDKz7B6g== X-Received: by 2002:a05:6358:750d:b0:175:c1d8:7c61 with SMTP id k13-20020a056358750d00b00175c1d87c61mr2464147rwg.12.1707549013289; Fri, 09 Feb 2024 23:10:13 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVrUedD/UnAk3HKDxEGV83AYo8GBo7hWhlcoAZgULLhTJWi6/kUeog2hDaitCzqURciEjhoayaHgdZ/5X2eKy7547us70905x3X9/a8Yu3Tab0PaOOV3AyTHHRaKGiKrh9swnEiVwYwkwDM2gHfMwsVx3WIRgGwh8paDpPxQ3PgzmPq/kDmKjROhqAlJlYfNi6uvCtki4AehhaQRff9jXrXhX25lUDre0eYuhJPCpc1zZrz24yrxVsBXmt9LmHXpDJR0WlVreLSHV+vw/gWyNyGzSBKJSv9U1+OBKIlqlDiqReIp0VdviRmL0g3I0ntOL9ql8Z6S1WKOwT2rfPOiHJHg2nRfyo8rLWKW8hgscXEIoSggIiFTPde27pOl3+wMUaWZy/O8TktXpmAHRe/VMSMChhv/JKUsya7655B9iFe8QV0Y9t3kHVZZ3hJvDMKXGxkQPiLo1G27Wr+EnLW4JM821QQHEIWPScXd7tPCFPK1bBe41uywl/TFbrP+qkmJx7BFF6FGMfKSR4jhg== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id gm15-20020a17090b100f00b00296f780de33sm2898701pjb.36.2024.02.09.23.10.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:12 -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 , cros-qcom-dts-watchers@chromium.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH 20/22] arm64: dts: qcom: sc7180: pazquel: Add missing comment header Date: Fri, 9 Feb 2024 23:09:31 -0800 Message-ID: <20240210070934.2549994-21-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495365240242490 X-GMAIL-MSGID: 1790495365240242490 We put a header before modifying pinctrl nodes defined in sc7180-trogdor.dtsi in every other file. Add one here so we know that this section is for pinctrl modifications. Cc: Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd Reviewed-by: Dmitry Baryshkov Reviewed-by: Douglas Anderson --- arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi index 8823edbb4d6e..73aa75621721 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi @@ -83,6 +83,8 @@ &pp3300_dx_edp { gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>; }; +/* PINCTRL - modifications to sc7180-trogdor.dtsi */ + &en_pp3300_dx_edp { pins = "gpio67"; }; From patchwork Sat Feb 10 07:09:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1340108dyd; Fri, 9 Feb 2024 23:24:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW1x0yNxHc4T0Z+ldbmgyo1NTIh6KgdFimJYlxeBIwnWdW1pg8sYKsWaSeUgS+riOd6ZxZmtrdruJCdLsztlqQC/FIrLw== X-Google-Smtp-Source: AGHT+IFaA0NUV73Cyh6ZARK2k4trkrkkqR40/5cIvBfrVlDR+B/XMZX6XB93676qgPtFR2E2cyNJ X-Received: by 2002:a05:6a00:2fc3:b0:6e0:25d7:debc with SMTP id fn3-20020a056a002fc300b006e025d7debcmr1379612pfb.24.1707549886614; Fri, 09 Feb 2024 23:24:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549886; cv=pass; d=google.com; s=arc-20160816; b=03cKhcmtNyRiiqMp9HsyZDpenvPCun5/1k7TrDmXVX5fkZQR+napZTPN/YYcL4W0zI rfmoD7MYi6ihjkSL0hhMbMsjxHMPFiHNrPDLv+BidX8YuJdujwXi9gxTBaEe8TIX6Xp4 SOum3ptGZw3NwzhKOvgZSXcFF1mjTSuEDqdDDTxHYMmNL8umGoWlUU8MqOU0NNn009HD ZsUp+NpcencYjzgZS86dfW9Zi20I58qIOBT/ZUuZJq3ddRcfERIBCILLD17X7B7k3/6S +Ylde7TU4xSXf1LsbFI53I/YJfD+W2BvYALK3eVneZvjGX8T7c0AMg0EqZdJyG/v3Wsc iJ8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=uRdeafd1oFQ133DVCweG1iG5WfY6aqYTpGOenc4j5OI=; fh=MzU5h6cJ0WGSSIXUb+yKD+Bcm6eXPtrCLoqiU+2yggg=; b=AMgImz60wN4cebcmSKBIUGmGufjfAThY8syIWNtmS5ktB6Vk2gu6JwXqhpBj1ce69L 3hvrcgIDs258WnHxfem+2v4qXm9TP3RxYPI3KMJBtWUrLbVp6bGFbVmcDzkPHErHgq9x 7EJMYSR255oWvWQ0NOoxHp5ORoVIf5MQvi9RxFJGYDM7neJ7kfW4i79zaIo+/44Qz6e1 Q62a83t7hOl5rwYbjAZy7C6udVqZwLFES19EPSfh0Prrv1wAp3JObLgiu9R4m/ImxFTi lMjY53Y0+vu78hSU7B1qOIQL34jnFAs4d4RUED590cvEsjg2yhzaS+PyRA47tZr/nLip POJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BaKaH5If; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60327-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60327-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCV25ICKIHUhbiDfwX3bIrXt7z2Tc3t8tpQYrbZDv57v4X+7oTu1WQxHQ1dtO5EqaKzzdM9mhX+MlJlyynb5Hl/p6ewcxg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fm25-20020a056a002f9900b006dde1514009si1663093pfb.132.2024.02.09.23.24.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:24:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60327-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BaKaH5If; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60327-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60327-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 035C3286D13 for ; Sat, 10 Feb 2024 07:17:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72A0F3D57C; Sat, 10 Feb 2024 07:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BaKaH5If" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 606CC3D0CF for ; Sat, 10 Feb 2024 07:10:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549018; cv=none; b=u7aNLU92FgYqBvI4qkUe/LPIS+ynmi5XgwXjAOWZAucOeKNrUDZmu8XbkvGqLoM54zKMsBP/g2vK1AC06mkALzoArIUhGuTyzNRC/mTBrQFPF6BVfdbuvCEmSW2nAm6QlLMjw74C5cUo9z1zNBad8PzqhQIG6ED23jOlKc8Cgl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549018; c=relaxed/simple; bh=Gr/cjYsEPFS9YtkIRTTBs4NFAZVd1rZbQ149cefKuGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P5hufHILYFbYj0AcwxDna5L1K2x7s8OTvmcu3dPplFjv9sOT57OLpkiBJtB8oIpQ4YGG4ybAxBc2sKXhUr4zF3AakkpW/BrrkdHqFXjhTw1MmktQBPVP3bBkcYsUOUaJMbcFRj/DCs/0G0QwDiSnmliwLhgOF9BSXPPDuG7Xdek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=BaKaH5If; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d751bc0c15so16127765ad.2 for ; Fri, 09 Feb 2024 23:10:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549015; x=1708153815; darn=vger.kernel.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=uRdeafd1oFQ133DVCweG1iG5WfY6aqYTpGOenc4j5OI=; b=BaKaH5IfZrHA1ZsmjwfFs6OC5FoDrnN1/2GFDQwhPW0jwF8YCVQODsATXJpkd0eEHN 5iHEuOnxr5NJq2YLoWom6ADvAUM1yKLgkcUe/0BeqfVZidQjfyYLE5FEWBlrEpGK32e1 qGxnhE0qeyM3RaXLG9QkwxxhtZGI186YmjBIM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549015; x=1708153815; 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=uRdeafd1oFQ133DVCweG1iG5WfY6aqYTpGOenc4j5OI=; b=Nxh6WI2iUGLHeFUS0gQoEjLYUHjUquj1PsqVvfRER2e0SF22VcU9NqQK1hMBQbpxkc kuRdAGEUG8tRor0+0jYtTUIRwH6Qdra4oehSfEtTol8c/mhFXYBSbQksjAC+gHLypG/l fxLa+eT3ZtaEQTCAwdZ89NRg7an6z1SoYjkPBypu84mxzkFtXoMjZlFT+AxlfkidZMoc iBfwqB8/tCETQvyfZX/AzNjcPHoUACebz+ifeh9VP3d4NhCPOheCAYzBnQT8yiK4n70J 9aFaoxBvK+IbAcyCTC0vEkCl9/6KVOGBy9JU3gMB7flIvnyyZ62rMDkLnOaQEVhPyH8J M3Gg== X-Gm-Message-State: AOJu0YyqjxH620Wdlrjz/GJE0bACtmsyi5wNARHUdHK3IReAQUa2intl IrumRttdHal33RLtTYs2JSuo1f74tkThy+i2WnC7MOqsHBh9QRlwSakbelmAjg== X-Received: by 2002:a17:903:1c3:b0:1d9:f5ef:a053 with SMTP id e3-20020a17090301c300b001d9f5efa053mr2125350plh.28.1707549015013; Fri, 09 Feb 2024 23:10:15 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWhvoFacBD758Jr2FAazJV9jtMATSRjM6lLTU+VryD1+MXyMlRL1JUn+pSH1X3C2lhy6Ff4fxx2yZCB8vupGbS6DRn0OfEczHy8cpXMWP5fxR/OSAFV60tnXCLb0nPrl8cPmN5ZFz8p2O0kuh3r1DcBwKJI2BXXA/VcLhQZ+u2ULK18qkk8AHHshWI2iNFS8e3ifKj3IU3kff15f0vfC16jg/drG/ON3QVqEHoemowPSD/o2ewg2OPp3QxenNh1y7nM8UC2oVTGjlvpGLJujkSOC0FKmI0pxQa0MpMBDQdTCdM1wFmfdYjHqSZ9Ry4XiEGfy9lJv12hUCNJfVI+GinDIzp+27LGI1EGGxHrcKOz5GVgvhT4FUWpxcpIwwYJCgKxjC1w67ZNCt+Tm/oq1bIzCnIRS0EP6tz6XOVtej26z1pYNfusp2NMDmPQqVL2w4JSyRqSTruv4QuqKd9q9dgz0TPest5ECnp3ZVb2/pMKUFav+pWx2UnG6en1gbZ/9avZaMYMGBoiog58yw== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id h9-20020a170902f2c900b001d921bcc621sm2478586plc.243.2024.02.09.23.10.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:14 -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 , cros-qcom-dts-watchers@chromium.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH 21/22] arm64: dts: qcom: sc7180-trogdor: Make clamshell/detachable fragments Date: Fri, 9 Feb 2024 23:09:32 -0800 Message-ID: <20240210070934.2549994-22-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495830223715366 X-GMAIL-MSGID: 1790495830223715366 At a high-level, detachable Trogdors (sometimes known as Strongbads) don't have a cros_ec keyboard, while all clamshell Trogdors (only known as Trogdors) always have a cros_ec keyboard. Looking closer though, all clamshells have a USB type-A connector and a hardwired USB camera. And all detachables replace the USB camera with a MIPI based one and swap the USB type-a connector for the detachable keyboard pogo pins. Split the detachable and clamshell bits into different files so we can describe these differences in one place instead of in each board that includes sc7180-trogdor.dtsi. For now this is just the keyboard part, but eventually this will include the type-a port and the pogo pins. Cc: Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd Reviewed-by: Dmitry Baryshkov Reviewed-by: Douglas Anderson --- .../boot/dts/qcom/sc7180-trogdor-clamshell.dtsi | 9 +++++++++ arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 5 +---- .../boot/dts/qcom/sc7180-trogdor-detachable.dtsi | 12 ++++++++++++ .../arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi | 7 +------ .../boot/dts/qcom/sc7180-trogdor-kingoftown.dts | 2 +- arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi | 3 +-- arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi | 2 +- arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi | 2 +- .../boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi | 7 +------ arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts | 2 +- .../boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi | 5 +---- 11 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi new file mode 100644 index 000000000000..bcf3df463f80 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Google Trogdor dts framgent for clamshells + * + * Copyright 2024 Google LLC. + */ + +/* This file must be included after sc7180-trogdor.dtsi */ +#include diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi index 7765c8f64905..6e6a4643c4dd 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi @@ -7,6 +7,7 @@ #include "sc7180-trogdor.dtsi" #include "sc7180-trogdor-ti-sn65dsi86.dtsi" +#include "sc7180-trogdor-detachable.dtsi" /* Deleted nodes from sc7180-trogdor.dtsi */ @@ -80,10 +81,6 @@ &camcc { }; &cros_ec { - keyboard-controller { - compatible = "google,cros-ec-keyb-switches"; - }; - cros_ec_proximity: proximity { compatible = "google,cros-ec-mkbp-proximity"; label = "proximity-wifi"; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi new file mode 100644 index 000000000000..ab0f30288871 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Google Trogdor dts framgent for detachables + * + * Copyright 2024 Google LLC. + */ + +&cros_ec { + keyboard-controller { + compatible = "google,cros-ec-keyb-switches"; + }; +}; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi index 2ba3bbf3b9ad..a86a6c5c3f67 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi @@ -8,6 +8,7 @@ /* This file must be included after sc7180-trogdor.dtsi */ #include "sc7180-trogdor-rt5682i-sku.dtsi" +#include "sc7180-trogdor-detachable.dtsi" / { /* BOARD-SPECIFIC TOP LEVEL NODES */ @@ -135,12 +136,6 @@ &camcc { status = "okay"; }; -&cros_ec { - keyboard-controller { - compatible = "google,cros-ec-keyb-switches"; - }; -}; - &panel { compatible = "samsung,atna33xc20"; enable-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts index d6db7d83adcf..655bea928e52 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts @@ -9,7 +9,7 @@ #include "sc7180-trogdor.dtsi" #include "sc7180-trogdor-parade-ps8640.dtsi" -#include +#include "sc7180-trogdor-clamshell.dtsi" #include "sc7180-trogdor-lte-sku.dtsi" #include "sc7180-trogdor-rt5682s-sku.dtsi" diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi index e9f213d27711..c3fd6760de7a 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi @@ -5,8 +5,7 @@ * Copyright 2020 Google LLC. */ -/* This file must be included after sc7180-trogdor.dtsi */ -#include +#include "sc7180-trogdor-clamshell.dtsi" &ap_sar_sensor { semtech,cs0-ground; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi index 73aa75621721..60ccd3abddfc 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi @@ -6,7 +6,7 @@ */ /* This file must be included after sc7180-trogdor.dtsi */ -#include +#include "sc7180-trogdor-clamshell.dtsi" &ap_sar_sensor { compatible = "semtech,sx9324"; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi index 0be62331f982..43b2583f0f26 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi @@ -7,7 +7,7 @@ #include "sc7180-trogdor.dtsi" /* Must come after sc7180-trogdor.dtsi to modify cros_ec */ -#include +#include "sc7180-trogdor-clamshell.dtsi" #include "sc7180-trogdor-rt5682i-sku.dtsi" #include "sc7180-trogdor-ti-sn65dsi86.dtsi" diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi index b7de9fd3fa20..00229b1515e6 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi @@ -9,6 +9,7 @@ #include "sc7180-trogdor.dtsi" #include "sc7180-trogdor-rt5682i-sku.dtsi" +#include "sc7180-trogdor-detachable.dtsi" / { ppvar_lcd: ppvar-lcd-regulator { @@ -44,12 +45,6 @@ &camcc { status = "okay"; }; -&cros_ec { - keyboard-controller { - compatible = "google,cros-ec-keyb-switches"; - }; -}; - &gpio_keys { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts index c9667751a990..4b43a9b273c0 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dts @@ -9,7 +9,7 @@ #include "sc7180-trogdor.dtsi" /* Must come after sc7180-trogdor.dtsi to modify cros_ec */ -#include +#include "sc7180-trogdor-clamshell.dtsi" #include "sc7180-trogdor-rt5682i-sku.dtsi" #include "sc7180-trogdor-ti-sn65dsi86.dtsi" diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi index 305ad127246e..1d9fc61b6550 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi @@ -8,6 +8,7 @@ /dts-v1/; #include "sc7180-trogdor.dtsi" +#include "sc7180-trogdor-detachable.dtsi" / { avdd_lcd: avdd-lcd-regulator { @@ -104,10 +105,6 @@ &cros_ec { base_detection: cbas { compatible = "google,cros-cbas"; }; - - keyboard-controller { - compatible = "google,cros-ec-keyb-switches"; - }; }; &i2c4 { From patchwork Sat Feb 10 07:09:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 199225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1340027dyd; Fri, 9 Feb 2024 23:24:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHPLHdTohnh45W8XGakpS4vTFo5hE1fJgJUHCcWCdsXIsjU3EwtixDZmOg5DM6S5aT3mp4s X-Received: by 2002:a17:902:d590:b0:1d9:30e3:ea84 with SMTP id k16-20020a170902d59000b001d930e3ea84mr2626470plh.2.1707549870633; Fri, 09 Feb 2024 23:24:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707549870; cv=pass; d=google.com; s=arc-20160816; b=1HLhJ1hhAMLhC2BROX2Z+esVW3haml7Gabxk2jVqzweFOSdHCZeZAyN4SdaRBzOkej +PQfCs1bAelwyHVDXPOWfgVsU7W070ps24Rh0JDx7AQuXQObr01SPBSci6I58cR9w2Uo 7Xq/ljDSaEA5jS7h3PIUXHHXoiFMtbSbkoRAYApt7Oq0OuTtDWMN9dGZuYLPln5InEXn h7P5kzMES8e+SDj7eHCby4RgDYSBuW4TwSL/+oLCWqCGgbcnHiKzXOspcxwF8lUe1R9m bb2t9HiaJ5YMC4wMkl2y5XpEVKbW55+5LPx9troZtvF5t+VRUHbVT6TwiTjSO2HdAJym dzQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=IYVNJQLOFo6Ade1iKtFESw8BRBL8sVWXNL9IvcUDicE=; fh=fOG3/8SU7pIeaMrYF74jh7nDxu3po/pCgDe3+YIJKlc=; b=DElqrrS549NzZ+jKi3Ca5GLPADg9hky24aUWtvgmhtyHd5z52iSJCJy0x18OuTXoX1 74iIiXWu/ZyqDtIIGNTgNYMi5K6UtitTGbhJUFd95lXpYekCD4dMPPCpMjUmIiq7ISjK o5WNMu1T9B5WysJYRb/qxjGHD7ReojJZZT9kuzFp4BEHhvyw6OkOsRlnzz3O/e7TrLG3 4j1lkoVQ4x0TU1LQOYCNaqwqq1u5eti4KiQ7f5Fu6109aPEjuNfBWGRWD3E1ZHj2BUiQ DfbsbdZU370oqloo0X1ufOWQ96VSwlk+u7uWjzdOJPKXgh6bSSJFXw4ASp+S9KQdBJMP wVqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Z/vIqtnF"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60328-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60328-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCVBclp/YByrcgIUPmOhnQEPSg01Gvv6cTUQlc5pUnJz9t3HyaDglZl/c1zIlpOv5D1fyGVwzLAGYxKQ1A/hFQ9nx3DsUg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z16-20020a170902d55000b001d9f4da0c21si3120680plf.120.2024.02.09.23.24.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 23:24:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60328-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Z/vIqtnF"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60328-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60328-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1A527B26A4E for ; Sat, 10 Feb 2024 07:17:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 060F53D968; Sat, 10 Feb 2024 07:10:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Z/vIqtnF" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC1B73D0A6 for ; Sat, 10 Feb 2024 07:10:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549020; cv=none; b=d0KSf/H3X4CIwCxlMQNgdBpFS8pzSKXCnuS+6n1v1/s1B+COngirqRtAwAkeRtoKhOPXos30HgyLOIx1D3k3FzuRs2wlKx867w5glu9A8/OG7zkBuBfkocb64Nb4dIfaLcXTjPAy0ZHYSKPpPxXmpcAA6yBXo0tXyoRCItO8Xik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549020; c=relaxed/simple; bh=H0NsPdNWM169T1yWm69PYm5MP513RfPgSq5A5nLj2mQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AR3truONYQfCQDUnzJXEBWDX9dxPOCoTzoB6ZxfJqFSjvGQlX6o2z5OYuaB/fzqxkem7BnCw9VR8FuR2SJQ00ZdmnYJHqSNSSiNmPYsikTN9lVQvX2czVimO3BzHWd2xoqPiifqc2e/TFNP2LA+CgEEzdpSTu3Tb65zuXBRpUGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Z/vIqtnF; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1da0cd9c0e5so13021395ad.0 for ; Fri, 09 Feb 2024 23:10:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549017; x=1708153817; darn=vger.kernel.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=IYVNJQLOFo6Ade1iKtFESw8BRBL8sVWXNL9IvcUDicE=; b=Z/vIqtnFFKqTNrSa1zj8OaV+IGv71C0KeOJ9/4JME3pQQbLQFgcc9TkEs0D4H+rWl/ I9t3VucS2UvxGLFVPfKTByKUgpf+pOKcj+7tfuFWkhqPfbhodMF6LGZyuQ3xXUfdRLeI 2jnyKzDFDTXtCjtAyBNsvCFo3mjd7vegAXigA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707549017; x=1708153817; 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=IYVNJQLOFo6Ade1iKtFESw8BRBL8sVWXNL9IvcUDicE=; b=vPTgc1XZ40tXc6h0ReJZbkgzzgQjNkiKdcRchv4paCbEAaj1QdonJB3j7Us+x9wcTc jkT1kqkE5DbPwOoNsmcWpz2gh3NeKb1Lktxg2+DydMJTT//LfHtTg1fL/u10jEZqvxcf Cehjrn01e8zwQkf7Pf2cZBgCOvB7GIRCh7AR1dEB7KkgGiwdipCGnNerhd9IbwAvmuJG +jtXyKeE2315enuZyct6kJSAMNOOeyFZ++lxVaHJiWBNrQty/GK5KvWubFQydew0/KT1 DmXEtY9ERM1EDc7dfbcljFX8XsoamVFEoAieBZWNbRAZen4FjZW5ujcaB+qKfDapevhT 2gqQ== X-Gm-Message-State: AOJu0YyKR/EuUlAaW2+y/YH4d8tZ2n0SL7faNXzmwUq6KAXLBF8Zycqk 0QLMexlTD3bPUbxDnISX4G5izFatrwKBJEXLk7GG7LgTwAhxznpoGLrxL89Vqg== X-Received: by 2002:a17:902:d3cd:b0:1d9:65e6:4af7 with SMTP id w13-20020a170902d3cd00b001d965e64af7mr1676051plb.30.1707549017056; Fri, 09 Feb 2024 23:10:17 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU0/qZXPH5mRYuI2OuvU8Doe9RbrDpkyAN3Ttf5hsYE5C6B46Lz8Eb7QAQrr2yB8pIGtt2/WETocK7zQAJ+v1kBoXrhlR6sON0WurqNUAYNLUiqNMouBOQicRBsg7DCvsIS5I/UKet+EUTxsT2gaa6OErpifZaiF/d3H21P19yN9LPfK2Q0m14BAcndXss/HCkbMNNFezqPpW7C6HGxc+ImFFNqCa/XrSg3S4LgVVgTeC1pUQSejbxafAKVGuRkG2vbpAju/Pw7ffxPQCOUWmqIAMMuT3lZLiwPriv8alsX1lMg7mjarcFwXViOespg/lNZlcTXpc0DNuYdVPQWdtNnBPaMb+x1hS5sebOvoyJyyeDB6dfFEZgLOzs3Cbq25o0SOknmOwFneso6UvCAWS9gu40bIZ/vzAAi6mHX5P5Mq2N8unvX/BMXrYdaEwd86Q9SM0wNCYGH8LcMghFoKbZ7lW71CUEliQMaM9/OA9etUqksIiJgJksa09Qe0Lqlg734QTHuQA5CfAAL1g== Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id jc9-20020a17090325c900b001d9f4c562b2sm2504374plb.23.2024.02.09.23.10.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:16 -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 , cros-qcom-dts-watchers@chromium.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH 22/22] arm64: dts: qcom: sc7180-trogdor: Wire up USB and DP to usb-c-connectors Date: Fri, 9 Feb 2024 23:09:33 -0800 Message-ID: <20240210070934.2549994-23-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790495813443460049 X-GMAIL-MSGID: 1790495813443460049 Fully describe the USB type-c and DP topology on sc7180 Trogdor devices. Most Trogdor devices have two USB type-c ports (i.e. usb-c-connector nodes), but quackingstick only has one. Also, clamshell devices such as Lazor have a USB webcam connected to the USB hub, while detachable devices such as Wormdingler don't have a webcam, or a USB type-a connector. Instead they have the pogo pins for the detachable keyboard. Fully describing the topology like this will let us expose information about what devices are connected to which physical USB connector (type-A or type-C) and which port is connected to an external display for DP. Cc: Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Cc: Cc: Cc: Pin-yen Lin Signed-off-by: Stephen Boyd --- .../dts/qcom/sc7180-trogdor-clamshell.dtsi | 21 +++ .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 47 +++++ .../dts/qcom/sc7180-trogdor-detachable.dtsi | 13 ++ .../dts/qcom/sc7180-trogdor-homestar.dtsi | 47 +++++ .../dts/qcom/sc7180-trogdor-kingoftown.dts | 55 ++++++ .../boot/dts/qcom/sc7180-trogdor-lazor.dtsi | 55 ++++++ .../boot/dts/qcom/sc7180-trogdor-pazquel.dtsi | 55 ++++++ .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi | 44 +++++ .../qcom/sc7180-trogdor-quackingstick.dtsi | 31 ++++ .../dts/qcom/sc7180-trogdor-wormdingler.dtsi | 47 +++++ arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 175 ++++++++++++++++++ 11 files changed, 590 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi index bcf3df463f80..96137202fc64 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-clamshell.dtsi @@ -7,3 +7,24 @@ /* This file must be included after sc7180-trogdor.dtsi */ #include + +/ { + usb-a-connector { + compatible = "usb-a-connector"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usb_a0_hs: endpoint@0 { + reg = <0>; + /* Remote endpoint filled in by board */ + }; + + usb_a0_ss: endpoint@1 { + reg = <1>; + /* Remote endpoint filled in by board */ + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi index 6e6a4643c4dd..4cf5b1e20b27 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi @@ -135,6 +135,17 @@ skin-temp-thermistor@1 { }; }; +&pogo_pins { + keyboard@4 { + compatible = "usb18d1,504c"; + reg = <4>; + }; +}; + +&pogo_pins_in { + remote-endpoint = <&usb_hub_dfp4_hs>; +}; + &pp1800_uf_cam { status = "okay"; }; @@ -176,6 +187,42 @@ &sound_multimedia0_codec { sound-dai = <&adau7002>; }; +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp1_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp1_ss>; +}; + +&usb_c1_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c1_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + +&usb_hub_dfp1_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp1_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c1_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c1_ss_rxtx>; +}; + +&usb_hub_dfp4_hs { + remote-endpoint = <&pogo_pins_in>; +}; + /* PINCTRL - modifications to sc7180-trogdor.dtsi */ &en_pp3300_dx_edp { diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi index ab0f30288871..b24a0213a477 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-detachable.dtsi @@ -5,6 +5,19 @@ * Copyright 2024 Google LLC. */ +/ { + pogo_pins: pogo-pin-connector { + compatible = "google,pogo-pin-connector"; + #address-cells = <1>; + #size-cells = <0>; + /* Detachable keyboard populated for each board */ + port { + pogo_pins_in: endpoint { + }; + }; + }; +}; + &cros_ec { keyboard-controller { compatible = "google,cros-ec-keyb-switches"; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi index a86a6c5c3f67..9e32c984ab32 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi @@ -162,6 +162,17 @@ skin-temp-thermistor@1 { }; }; +&pogo_pins { + keyboard@3 { + compatible = "usb18d1,5052"; + reg = <3>; + }; +}; + +&pogo_pins_in { + remote-endpoint = <&usb_hub_dfp3_hs>; +}; + &pp1800_uf_cam { status = "okay"; }; @@ -190,6 +201,42 @@ &sound_multimedia1_codec { sound-dai = <&max98360a>, <&max98360a_1>, <&max98360a_2>, <&max98360a_3> ; }; +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + +&usb_c1_hs { + remote-endpoint = <&usb_hub_dfp4_hs>; +}; + +&usb_c1_ss_rxtx { + remote-endpoint = <&usb_hub_dfp4_ss>; +}; + +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp3_hs { + remote-endpoint = <&pogo_pins_in>; +}; + +&usb_hub_dfp4_hs { + remote-endpoint = <&usb_c1_hs>; +}; + +&usb_hub_dfp4_ss { + remote-endpoint = <&usb_c1_ss_rxtx>; +}; + &wifi { qcom,ath10k-calibration-variant = "GO_HOMESTAR"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts b/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts index 655bea928e52..476c0a2f30da 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dts @@ -78,6 +78,61 @@ &pp3300_dx_edp { gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>; }; +&usb_a0_hs { + remote-endpoint = <&usb_hub_dfp3_hs>; +}; + +&usb_a0_ss { + remote-endpoint = <&usb_hub_dfp3_ss>; +}; + +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp1_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp1_ss>; +}; + +&usb_c1_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c1_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + +&usb_hub_2_x { + camera@4 { + compatible = "usb4f2,b75a"; + reg = <4>; + }; +}; + +&usb_hub_dfp1_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp1_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c1_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c1_ss_rxtx>; +}; + +&usb_hub_dfp3_hs { + remote-endpoint = <&usb_a0_hs>; +}; + +&usb_hub_dfp3_ss { + remote-endpoint = <&usb_a0_ss>; +}; + &wifi { qcom,ath10k-calibration-variant = "GO_KINGOFTOWN"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi index c3fd6760de7a..2603607ebd80 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi @@ -68,6 +68,61 @@ &trackpad { interrupts = <58 IRQ_TYPE_EDGE_FALLING>; }; +&usb_hub_2_x { + camera@1 { + compatible = "usb408,a092"; + reg = <1>; + }; +}; + +&usb_a0_hs { + remote-endpoint = <&usb_hub_dfp3_hs>; +}; + +&usb_a0_ss { + remote-endpoint = <&usb_hub_dfp3_ss>; +}; + +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + +&usb_c1_hs { + remote-endpoint = <&usb_hub_dfp4_hs>; +}; + +&usb_c1_ss_rxtx { + remote-endpoint = <&usb_hub_dfp4_ss>; +}; + +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp3_hs { + remote-endpoint = <&usb_a0_hs>; +}; + +&usb_hub_dfp3_ss { + remote-endpoint = <&usb_a0_ss>; +}; + +&usb_hub_dfp4_hs { + remote-endpoint = <&usb_c1_hs>; +}; + +&usb_hub_dfp4_ss { + remote-endpoint = <&usb_c1_ss_rxtx>; +}; + &wifi { qcom,ath10k-calibration-variant = "GO_LAZOR"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi index 60ccd3abddfc..dee06c64b59a 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel.dtsi @@ -83,6 +83,61 @@ &pp3300_dx_edp { gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>; }; +&usb_a0_hs { + remote-endpoint = <&usb_hub_dfp3_hs>; +}; + +&usb_a0_ss { + remote-endpoint = <&usb_hub_dfp3_ss>; +}; + +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp1_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp1_ss>; +}; + +&usb_c1_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c1_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + +&usb_hub_2_x { + camera@4 { + compatible = "usb5c8,b03"; + reg = <4>; + }; +}; + +&usb_hub_dfp1_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp1_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c1_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c1_ss_rxtx>; +}; + +&usb_hub_dfp3_hs { + remote-endpoint = <&usb_a0_hs>; +}; + +&usb_hub_dfp3_ss { + remote-endpoint = <&usb_a0_ss>; +}; + /* PINCTRL - modifications to sc7180-trogdor.dtsi */ &en_pp3300_dx_edp { diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi index 43b2583f0f26..88ffa2331cd2 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi @@ -180,10 +180,54 @@ &sound { dmic-gpios = <&tlmm 86 GPIO_ACTIVE_HIGH>; }; +&usb_a0_hs { + remote-endpoint = <&usb_hub_dfp4_hs>; +}; + +&usb_a0_ss { + remote-endpoint = <&usb_hub_dfp4_ss>; +}; + +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp3_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp3_ss>; +}; + &usb_c1 { status = "disabled"; }; +&usb_hub_2_x { + camera@1 { + compatible = "usb4f2,b718"; + reg = <1>; + }; + + camera@2 { + compatible = "usb13d3,56e9"; + reg = <2>; + }; +}; + +&usb_hub_dfp3_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp3_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp4_hs { + remote-endpoint = <&usb_a0_hs>; +}; + +&usb_hub_dfp4_ss { + remote-endpoint = <&usb_a0_ss>; +}; + &wifi { qcom,ath10k-calibration-variant = "GO_POMPOM"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi index 00229b1515e6..d0d9871b74cb 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi @@ -104,6 +104,17 @@ &sdhc_2 { status = "okay"; }; +&pogo_pins { + keyboard@1 { + compatible = "usb18d1,505b"; + reg = <1>; + }; +}; + +&pogo_pins_in { + remote-endpoint = <&usb_hub_dfp1_hs>; +}; + &pp1800_uf_cam { status = "okay"; }; @@ -128,11 +139,31 @@ pp3300_disp_on: &pp3300_dx_edp { gpio = <&tlmm 67 GPIO_ACTIVE_HIGH>; }; +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + /* This board only has 1 USB Type-C port. */ &usb_c1 { status = "disabled"; }; +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp1_hs { + remote-endpoint = <&pogo_pins_in>; +}; + /* PINCTRL - modifications to sc7180-trogdor.dtsi */ /* diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi index 1d9fc61b6550..409d332fbc13 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi @@ -180,6 +180,17 @@ skin-temp-thermistor@1 { }; }; +&pogo_pins { + keyboard@3 { + compatible = "usb18d1,5057"; + reg = <3>; + }; +}; + +&pogo_pins_in { + remote-endpoint = <&usb_hub_dfp3_hs>; +}; + &pp1800_uf_cam { status = "okay"; }; @@ -196,6 +207,42 @@ &pp2800_wf_cam { status = "okay"; }; +&usb_c0_hs { + remote-endpoint = <&usb_hub_dfp2_hs>; +}; + +&usb_c0_ss_rxtx { + remote-endpoint = <&usb_hub_dfp2_ss>; +}; + +&usb_c1_hs { + remote-endpoint = <&usb_hub_dfp4_hs>; +}; + +&usb_c1_ss_rxtx { + remote-endpoint = <&usb_hub_dfp3_ss>; +}; + +&usb_hub_dfp2_hs { + remote-endpoint = <&usb_c0_hs>; +}; + +&usb_hub_dfp2_ss { + remote-endpoint = <&usb_c0_ss_rxtx>; +}; + +&usb_hub_dfp4_hs { + remote-endpoint = <&usb_c1_hs>; +}; + +&usb_hub_dfp3_ss { + remote-endpoint = <&usb_c1_ss_rxtx>; +}; + +&usb_hub_dfp3_hs { + remote-endpoint = <&pogo_pins_in>; +}; + &wifi { qcom,ath10k-calibration-variant = "GO_WORMDINGLER"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi index 46aaeba28604..ee08a4ecade9 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -650,6 +650,12 @@ cros_ec: ec@0 { pinctrl-0 = <&ap_ec_int_l>; spi-max-frequency = <3000000>; + cros_ec_gpio: gpio { + compatible = "google,cros-ec-gpio"; + #gpio-cells = <2>; + gpio-controller; + }; + cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; #pwm-cells = <1>; @@ -662,6 +668,65 @@ i2c_tunnel: i2c-tunnel { #size-cells = <0>; }; + typec-switch { + compatible = "google,cros-ec-typec-switch"; + no-hpd; + mode-switch; + mux-gpios = <&cros_ec_gpio 42 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + dp_ml0_ml1: endpoint@0 { + reg = <0>; + remote-endpoint = <&mdss_dp_out>; + data-lanes = <0 1>; + }; + }; + + port@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + usb_c0_ss_rxtx: endpoint@0 { + reg = <0>; + /* Endpoint filled in by board */ + }; + + usb_c1_ss_rxtx: endpoint@1 { + reg = <1>; + /* Endpoint filled in by board */ + }; + }; + + port@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + + cros_typec_c0_ss: endpoint@0 { + reg = <0>; + remote-endpoint = <&usb_c0_ss>; + data-lanes = <0 1 2 3>; + }; + + cros_typec_c1_ss: endpoint@1 { + reg = <1>; + remote-endpoint = <&usb_c1_ss>; + data-lanes = <0 1 2 3>; + }; + }; + }; + + }; + typec { compatible = "google,cros-ec-typec"; #address-cells = <1>; @@ -674,6 +739,25 @@ usb_c0: connector@0 { power-role = "dual"; data-role = "host"; try-power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usb_c0_hs: endpoint { + /* Endpoint filled in by board */ + }; + }; + + port@1 { + reg = <1>; + usb_c0_ss: endpoint { + remote-endpoint = <&cros_typec_c0_ss>; + }; + }; + }; }; usb_c1: connector@1 { @@ -683,6 +767,25 @@ usb_c1: connector@1 { power-role = "dual"; data-role = "host"; try-power-role = "source"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usb_c1_hs: endpoint { + /* Endpoint filled in by board */ + }; + }; + + port@1 { + reg = <1>; + usb_c1_ss: endpoint { + remote-endpoint = <&cros_typec_c1_ss>; + }; + }; + }; }; }; }; @@ -794,6 +897,7 @@ &mdss_dp { &mdss_dp_out { data-lanes = <0 1>; link-frequencies = /bits/ 64 <1620000000 2700000000 5400000000>; + remote-endpoint = <&dp_ml0_ml1>; }; &mdss_dsi0 { @@ -965,6 +1069,41 @@ usb_hub_2_x: hub@1 { reg = <1>; vdd-supply = <&pp3300_hub>; peer-hub = <&usb_hub_3_x>; + + #address-cells = <1>; + #size-cells = <0>; + + usb_hub_2_x_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + usb_hub_dfp1_hs: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + port@2 { + reg = <2>; + usb_hub_dfp2_hs: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + + port@3 { + reg = <3>; + usb_hub_dfp3_hs: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + + port@4 { + reg = <4>; + usb_hub_dfp4_hs: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + }; }; /* 3.x hub on port 2 */ @@ -973,6 +1112,42 @@ usb_hub_3_x: hub@2 { reg = <2>; vdd-supply = <&pp3300_hub>; peer-hub = <&usb_hub_2_x>; + + #address-cells = <1>; + #size-cells = <0>; + + usb_hub_3_x_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + usb_hub_dfp1_ss: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + + port@2 { + reg = <2>; + usb_hub_dfp2_ss: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + + port@3 { + reg = <3>; + usb_hub_dfp3_ss: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + + port@4 { + reg = <4>; + usb_hub_dfp4_ss: endpoint { + /* Remote endpoint filled in by board */ + }; + }; + }; }; };