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: 13552149 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 8823D288DB for ; Sat, 10 Feb 2024 07:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548984; cv=none; b=OQ/xmR0dvlPJdJTqg0mZFH+gBybJfDaL5jojJe+ucdwXh81S7dbwLjhIYL/3FVaKhG1+bO2x4B0B0Oz27Di6KRYNuIvuuLwUziPv9mPP1hFgcWb5az4nIlSkbhXrB1J31rY81wMupBoniJqXJFuKq6OoUmO9bRcauAGLHybUJZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548984; c=relaxed/simple; bh=WXij6tQJVWGfA0jVq1TwtVWpf8MLUZF7maDtetHyCq8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N0wINQOZDv9QaPXGmJ9P+tEBEdfJijH7+Hjn1qSjMXfFuO0mQ0lpQoyXAgRX75zHfwI/OrIvaGzLXXka3YmbvcRoH6vaEfwQMW+1HzNjyy6+qGTxLU7XrkoWrsID8s+6EiOm/foMCW7mMXfdQlW8b/auzH2drYo5KL7sAC1896w= 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=LMPrEgot; arc=none smtp.client-ip=209.85.210.182 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LMPrEgot" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6e0ad87eb70so142b3a.1 for ; Fri, 09 Feb 2024 23:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548981; x=1708153781; darn=lists.linux.dev; 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=LMPrEgot0hzR6Wo7K+MEBn+3TNsFNuBfxRm/XNqcnnK2Spt11/jIwrcuCDEAp+dOJN JNxdejuIoiRAPB1eUKBKhhwUZDJeWawiCZNs+/EG98/r1N8OfwRnef0tGCd5zvp0q8/m wfvSW6Z+uw9yt26XfAqXFWr5RYbe5XcCqBMhE= 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=f5yfzhvyMFRTAcYpHfnSweL8EafUrUf3qsQsV4T+Jn7aL25cm0MFrST6FZpfr82eGc TyrLuDXWNB52n0mKC+HBUK6zyHOuPMcS58ocrEeeQUGQWtLEO4ok5bSH/RmfON5S+kYB bBBoM4hklUIxoDtvqzbzqFcDvCg4gZAyscwmL+31VP71fpHfrx6iQ6XIREflNREw1TyF g6wIjCkSXUq3S8aWsk0LnoAeaGsG3BEdj6u/pc+HzNdFx7K6WvZ9SMBoOpg6DSMcLql2 nEJuWxpycB31Ehhc7m01jol+/S21mV19cmw7LaM400TMBq0iTLtY4CaAqsSUmQuy8Btd 7diA== X-Gm-Message-State: AOJu0YxtGMbiBPAJ5h1v9SyC8NpZdqvr5q+xrNp2M3/Bdd8ekKg7nTVh E1k+WwRVVn7nDFARLpDnzgvVy/oSj6r2jHNJhEqlERjjLR0Px7fi2X1gzimJeRB+KDD97grJAPo = X-Google-Smtp-Source: AGHT+IGJpsGseEF23OonuLcKGtLB9bLVO6H9DZbcYv6zzMtyY1WMMmBxT79RXg/o+l1OjBFEjT7+5g== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552150 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 399D431758 for ; Sat, 10 Feb 2024 07:09:44 +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=1707548986; cv=none; b=PNf354gJuFfHNhM9VcAiVLU6F9K/EhCe77hsRXttn1ar8gdluOto/9KK1fXCKvAS+FKSiuKWH5puzCjkE2PHzFMBEBX/DoROzKW253xfj+9uHU1oU5b6pUl4AildvA9uMoWXGofsqFwPYlvT5pMigvypUSfPa//Rfx0bqzDVekY= 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=YeRji6Ty; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YeRji6Ty" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d7431e702dso15755205ad.1 for ; Fri, 09 Feb 2024 23:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548983; x=1708153783; darn=lists.linux.dev; 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=YeRji6Ty00jpeQaQC5kRwvLTL08DQthGpqhQD6oSgwtO/vxJIHh9Von/AoN4mt4De4 CpIMnm5x9GefpisWyaJRaFn+Wp5yQs7Tie/R+kcEryVazOd/kYX/qAFTHMKfXLtXqMm3 zKKBv4SmSyPEDiuM8kf4S8Kj0yu8xl8Wlzk10= 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=AddR2OsQFZ6fb0nYbKbLof8H5eAh1R1DkO4mMLG/CDIHfU1MXzz2al8fIDtP04E2/3 2RjWzNlT/WMvDNjUu7dqjLYOwOeD0f9NU/Uto0X69t3pISi3SwyPwh1xcAuQOBsOSueb jq3pGWPwd5H4ag70eMTcbr6fARmmdWSICp+ALaC9vrbTMgX0DO6bPl+P0s2vFcShWvKr 2Qy9lgIOADGje0MBTPvoRCj2DjrXOnF67S+qTf+nafiHld2RHtyr0NsGMspGz9P2jGht /vPXwXbtLKckSmWDVDMd4/PIJ5BSSc8UDPPPMwwpzopvYqnyrPC1VHoOV76dz8i0nUop r3aQ== X-Gm-Message-State: AOJu0YxnH/7lEtZjWd75AClqtoeHDboSlRfPLm/IKBEhI5YIDwe4uJxY 1VUeDBYVlrjDGv56z1PdpivvD6CebJ0HgJQLLrGaEL5Z7Y5PKRk3CQGK1Cz+e7qem2AGqWOlry8 = X-Google-Smtp-Source: AGHT+IHQqPyQHPEDIlCHc7C1mC3g8p62zaSNCMkmWlBGHZZZW1BGkyGvlV2yTQuTXgKLPHa+ekutbw== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552151 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 4DA2A31758 for ; Sat, 10 Feb 2024 07:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548988; cv=none; b=eHeBXLJD8mZ0ZRkVk/5YZUCdnUabbYUsXrseEVrR0YPELHgQluoiN9eggmB3EFir5DTeqcyuNKNrvP4vpikuOU1t4KEfynbTp/XZ4bp5/ev3ERsNuKKIDvgcGKzP+URMOY6vNweFIr3e7uo8sSVDX5Lr9+hkLLBgHGgeLVYYnZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548988; c=relaxed/simple; bh=PeDZQIpv2F0nTTHxmAelufZ+9YaQdvo2eTiG/pHOI/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DuA509gER812+EfZbK+ZE2cDayH9Yb1t0XHmyoiP/1nZaqbR7YvC+GHiG3JPr4tiOqhzeATm0kM+5HJwGTTo4DIZbzFy//+sGGmj8rkni94McKANpAw7lNCHTCwWz7tRRBmpNo2/CpWtJDl7G9jbsqcmkSWuxvVkyfK5iHZaK+Y= 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=TKUMLqOa; arc=none smtp.client-ip=209.85.214.179 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TKUMLqOa" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d7431e702dso15755385ad.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=1707548985; x=1708153785; darn=lists.linux.dev; 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=TKUMLqOaPIXZB2jBBALeKYYlN14P1/xcOanFExuR2k9pOubJzk42YZ66PQelQNsJvv 5YLmgDFC9q+3ZY7odHof6s71HgGKMwEMMRL7WYel/XBkS+uWJK2fvkhl1NpdP0zil4QA S78kp9tNUiVerAVYVV1Z7MkpYfLV9awvJQV6g= 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=dwezUFM4Do8Vb9NvOPWx94BjkhOo2LD+87t2q2i3cZOC/xhIQQlANK2AkO4Ylch0IV r7M6/GuE4NJoiOf2jS27dNFuC8cvxbw+h3xIM8pIXqQmu6j9j2iKYBDO3pFFjSe/cJVm wYt01S+cnrrTPt1MAIjZOUW3jm7Yjp+BpiyrLIFCJmjRzgNYUXvervGZtmcFtJreugei TKPIH/Yt6kAmMdg8E8331ERrjSDALThZ7Tie85qEGbjjmbO97nULbl4q1F5utzAXR8Jv 4/SAr379FEV8FEsrFuuAQfuU2iBEvTbRqIv5Qrve4/KUwVmhgW2HPaVAeKh1oetAP3Cg NHpQ== X-Gm-Message-State: AOJu0YzZv2PHkvFXl+vr/yrLDDOUo9FkFTnwF7q/nIvMgVIHLsnfrUla XsWi4SRehCKzcPWStHeEHtN/+oTEVVcfpM0Lvw0u4BnXgFIMdEto40q4ICApxl5XF2hehL7mt3Y = X-Google-Smtp-Source: AGHT+IGeYAK8ekxYXXY78qIHAecfdEKLr4g2+PQLKllAtw8+dhESn/vcq+039wpruZ/mWbRUYcdc5Q== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552152 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 5D385364CF for ; Sat, 10 Feb 2024 07:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548989; cv=none; b=qZS7CkWVvI+LDtAshjTm+m7SPiEU9uO8GPJEreIjg/6glcBftSF+MpJTNPdg059LBVl7mQNqVnKFuLZw6t0Br/3dsWTubyG/lAsdSZ/zq61MnWMnDpTPCIfCnOB15egdBdMAqSENrhW+UpBtNOBC+cSClyRLzeDZZ97OdGxjQ0E= 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=SkUgn/W0; arc=none smtp.client-ip=209.85.214.179 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="SkUgn/W0" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d7354ba334so14818125ad.1 for ; Fri, 09 Feb 2024 23:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548986; x=1708153786; darn=lists.linux.dev; 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=SkUgn/W0ErBZfmbIDAnzRJzE1zuXvW/KpoT2YG7HgUMnUBxtXYUUP6fsYnXb/xDe68 iguzOHnP7ixENkh5iRkOJltVx4nNOURZekcxgipNAIh+Qr1cNCtrtbVqiy8CsOcv0Uzw McYPQEtYkDcO69Y7s0RJedd1XOnvBxtWj0fqk= 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=j2MbPogFes/u4HlUeANrGt9o3xvwQJOimRw/sWN9gVgiZvIjWd/G1/zJt9fBZc+eeo ctdUBmBZBb/3uc/JYikSulgC4G6rIyacwKMt54CL0qcrpNClQRMtDjd+3F6NuhrNJ7VI rLJb51ZJILDnL5JgyGwst4jHZkPdpYkiR4Xmymxdjz9UnCYvFLXmqSZ8nDsflBpPY0R5 73AOxmuCAnDOM1g+2Q+esCvWRlxa2uq48O1gEneonKV6FUwyzruoJLS4VF6x2DSgIch9 CLC3Y5PWG2twQ6/7WJTT1z7w6wR1/HC+XKwvcyWgaaC93gtaTD9VWxaaLD864RRkjph1 M+MQ== X-Gm-Message-State: AOJu0YxHXXNPAed/FGh1zYJ6wdSha8ku7Y88v9W1JsgQoUMXQVHet3qP QijravOSBzB0PxmJcAl/wP3IUxwnUr3P0hkV2EIfXVQX4aF7SIvzUJRae3s898o0KnxYie0rgaA = X-Google-Smtp-Source: AGHT+IE/c8pAa5MU1KCu70BaKjPYC9gLrHaGU87OjcL/070j/D4osq6hs+au4elV+2dq4cOgocJ5RA== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552153 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.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 F1F5D381A1 for ; Sat, 10 Feb 2024 07:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548992; cv=none; b=UDjAGaZ30ybrFPZGuiIIiS3q2XVTvfppC69e4dIFGxYyq2WFMEvj5k+a2DuLzSVq4z5y0tbaFaA4080S+xfZobuRg+7xofXp9B0Ii84zkW09FxZN/Vix5wfut9ddiGbmpRjojEUwZh6mo7FUvL2stYQzi+cTbf+rcm6VJbjE2zQ= 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=TJ3QZaJQ; arc=none smtp.client-ip=209.85.167.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TJ3QZaJQ" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3bba50cd318so1220211b6e.0 for ; Fri, 09 Feb 2024 23:09:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548988; x=1708153788; darn=lists.linux.dev; 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=TJ3QZaJQ1IiqyR5pcOGqMMIMykx4leXQcwjLEiOIsDGVQBOhXzNN9ZCLyHZtXgHKXS KfQnYngjpzSWD4YgCPY9oildfgBvNxBuWmr6yJg3yRbwNbEejYV3H3dTfbQMmbC+ZuWo rBvZqtIeFb3n0EG1lxKzT5bucaRKhhvFA6pwE= 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=KvbwzGBvsG0AmhY0I5n4FsHmcEw3u8xugOlyyLoqmXz3bgvo3UvuCU4VP1BmjCMvyp HruvI+wZy5verlK/b56zk3DG8v5Es6sN5cLOUz5iGK4cLnWaJGrdlZrtkho17/AhPOOu vyAgYsGmuWiJZ1tW1Mr65vQKkFtadtJaUPpkf/I6kgk8EoC2UU/1u6sKkBErbmYycXUw YwvUlD0LVdeZ8jTHcH/Z6NrMsldaMp5i/MeC4sIqXKXa1qAnDPPCD1VC7UqsPogwfwK5 /ec5sj1X6aIrDlViQ2mO1jYYTybV3avxxPU1xJvsgcB+TXBUNZx8Pxg0tblQwdhm180Z /EEQ== X-Gm-Message-State: AOJu0YwU2CIGD/V8nrGJ3na9CSUg4+7vgakdW6q4wSbuA0SCmv0oRNDC fmsYSbqTOMftUSRTPaCnpheW4F9bNEUxrGgK26oSf9n50YJuZLWiklaBVUkQQRKq2rvV4LhcSbY = X-Google-Smtp-Source: AGHT+IFV/sFlW8qKgy47k/Il/yfb6VFTvd6pIr0PTj8o+WR+abJvSKAIoFNUNzLDpAyLa4aVU2Wrwg== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552154 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.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 71ADB38DD5 for ; Sat, 10 Feb 2024 07:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548993; cv=none; b=hDN8+vYEWYOxDuz/9tnUZyjgk0/BEPMr13GBH7v5LOw2boZktWC6FbQik4zUu/IiqtcOe+t28Lzobqnqnc1wOoPtKaHgsh/Hfy/hr5tJoQcOjz52EYEMeja/UFCppHTBa0qr2sdNvLxFNTyYnUdwFuxR+fzy6LT1y69upykIad8= 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=Q9sqgmCs; arc=none smtp.client-ip=209.85.210.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Q9sqgmCs" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e05d958b61so1451808b3a.2 for ; Fri, 09 Feb 2024 23:09:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548990; x=1708153790; darn=lists.linux.dev; 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=Q9sqgmCsU8rn/5WcuzxW7NBuAJYvPJxoXfqtwgQRAtGDqrFhrl0wEtF/75dZlsHNEP pdaHAA4wSEJKf+4QidRgOUNzf6ZxufYDLZIWbNSgSUoV4IjmqEwZjTc24YVzyLWBN9TM U2uiLS+WmNyVD4QlXt6KaPTcLPTWOyja8igr4= 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=DGvczUlDuKxENX5jLmX4Og/yASynDclJlwQqBVttaPhcuS14mdU6opF1gZGFwqhgdq 1TVhiq3qv5r9uAyagD6M+2wRJaekC72GShoR6UEgEiTHGo4yJa/3HWD8w7fcbz2sKUgV 0SoqtUs7K9/PP2yW+pIHK+hJk2za38y000j8TlQq9qnjEliA8v4lwkSRIqliyj7j0RH9 jU2GDQWpQRk3lGZvgUq5Jj42bCWfTqAlA0FmrwgmLcaMEDdz4Pj1m+F3TLKTn6ualz55 yK3H9WfOk2xWzGDIhHyq7xgF5zdyZihfe5lDFdYRvrFK5V/M8kmWmwwgb/hyKwaLjBx0 qTlQ== X-Gm-Message-State: AOJu0Yy5wVLKLxxdZiDKu+NOS1lmwX4G0hklar5LiXHnm8JAh5Rpug/E 2S2ajKSRtPqq9pGthNF++ZJNKKvMopUAU5WLJmSda5/ToodAO/O1M4a/WaMGKKcUQ93bWwTVry0 = X-Google-Smtp-Source: AGHT+IF0OfRh9qwjMJ8nkTI/1ytBpIHZQTbHm7hF9TOgR4QlJF/faR+Z7kP8TgEPZBH4Qz9yiy4X3Q== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552155 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (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 B718638DD5 for ; Sat, 10 Feb 2024 07:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548995; cv=none; b=rrA52SUlTg0xGp7HLF2/VHZKyNQ4pijr/BnZapx0SqcswEhBpDWJSHoV3m1etJIzEHMCbqrRSGSSc1YpbLhB54pkiBJrCZVnE9/QiYxzjxTtdWfwjjehmy1bicQ6sx+KALlvImKvFi+Ke568oLjRViBjlONEIp0jeyGE0GLSuss= 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=VFApjieU; arc=none smtp.client-ip=209.85.210.51 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VFApjieU" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6e2bd54b7f6so940617a34.3 for ; Fri, 09 Feb 2024 23:09:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548992; x=1708153792; darn=lists.linux.dev; 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=VFApjieUWYpnIdyWC6/jCIFQuajiEII2TxM4kKxmnLMv35Dd03o7zknUA5rrHzbiFD CuB7TnBbJ4tlqnVrZWOU0M/lE4VO0Q+fO8BIPyJrAh70vTML7rJfVabZhd+yrkdj2H4I vP9JVPHm1qhpL0fC1UxfzJ1RYADVndN9ZomN8= 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=h3OX1wsBr7cVdiX25fXv1eaRWO6ADXGzBvjJyq2uY59IsPJjkPkU1Nq9Rfjqz+1zsn dFlvEBamAf4A5JBmqRGcbo2BQEmHtXE7cUPfuCnTivLy1pSD3bfKkILtdV3VZHM+TI1x 9Wql9tu2KDpfH+XNxf37noXVoC/R833v/M4dCT1RY5I7RUyxATIDicg0N7XUMlBo+iCq TGKNbxN5hJf3z1GyR94CgRpsz335ZSRJgQw9BV26gIksnGDTd3imd7wurOEZ++V3TiJV OAruXX6RGbJjw54ojHccFfoEAmiZ5UQpG11KBN+bHZwhO36/K7bRL8Bx+72YNN9252mk pHsQ== X-Gm-Message-State: AOJu0Yw9/FsLotWAmu7YUJ/eBLZRyE4V8lVAJq2HJCU4UpL+by8KUisN jkT4uaaAjjnWNB4HTtWGq9kcs98/WHPrXnRqEObpBNnJxTyvlz9MleWShy5PlRXFG1eUFOqWEYU = X-Google-Smtp-Source: AGHT+IGycCUB3DMpwmXjgXOSlrrSzr1olN6zo2Ub4XCvqi0LH8LyLdUzUKkoFY+1tflxHElqI+m7OA== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552156 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.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 EFD6B39852 for ; Sat, 10 Feb 2024 07:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548997; cv=none; b=stPXvYtGA8l2a24PaWuy2DznLv3Ceaih7Yv2lvtLyv9t0Ye4xmqyuMv/Nl1Xmdx1jBDybaDBhKlaoxCarVEaQ9amIA55y3NFgPQEe5umvIKbuLa+lVXF91bFyWzR5O0R+N0zRRJlv51bPDq5P4BgYXeMRAOLrS6pgKeJ/0BB6gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548997; c=relaxed/simple; bh=ZrfWbNRvVHxNeML0mxoQMrfj5rYIPsgYNkk8cvKEzno=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E0dP98KU/p+yQkkaHrMO3sZR9c2u6P2egXv/xit6E2ykYrTMIKPBxXT/woOHBJ5RKOFE1RLFYCXB9hoCQtGBr3vMakAZV05GUadppjQlWst197rL23rSr1A/I3TLbFg3W0f4TPG+TLrSwYj33o/UruEEBfhzb201Q6nv9Lp6WIU= 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=DSws7Cty; arc=none smtp.client-ip=209.85.215.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DSws7Cty" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-5c66b093b86so1934196a12.0 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=lists.linux.dev; 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=DSws7CtyjAF0hF742siFkaKnD2jmyTxdhQjurMipyR9fGVZLryX+9NpGAXmVulNT0i Ng5/b7RjR04bbgLbv4mzJM7uIDzot656QaT+6loYJMRWSj3nvfpgYPYLpKWxWpfr0/Bo csYINScA5K7ebFJnZhe4qYpNOGYXABvtoKWg8= 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=mzIfyR8r+sz3fqKTGjRz6/UUmODXZm+czOSzIlUoWtItgPtEx5N42D4kDoR3/pRXZx g/HDPz6ikFypDQ9RPkmfZ4KiFA/3fnSIgBJ10neyifBc+CYfwtHwAi7bVFz2iNocIY5a nksGfikA41DZAd1nxhnUnStcsdrQc5HfCGs8A/IAwuwmMoDnF3/0dJPv7tGzenAoAeH6 +4WpaJnyNub4NUbLg7VuP4lt87cAFvRMaUHfv8VsOWKPku+xiClh47b+1Gz+NbpDCxaR pjUFfgVfJ5CurcUobCFjuxNOURIKZiV83uW5NUIr1PZF284eJJWf3oeKUm4x+9yqG/xd gzKw== X-Gm-Message-State: AOJu0Yx6Mj8bMNK6iwCBtk9JucEwMb4LVYcqF17d5n5lZE5xustREJhO ADQ+2gKAawzRcjeJL+nLzyxwSLDGiiNVojv4AwCjzspfR5NfETdZzGfPQkGAzH1tZq8n8FzfuX8 = X-Google-Smtp-Source: AGHT+IE74shzX34A4XJ2sswnIPnBB2cAtBVGC7VAOSCbWKlPiKiVqbqmig4A0vzOlWVgJfSyoFJIVQ== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552157 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 AB147376FD for ; Sat, 10 Feb 2024 07:09:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548998; cv=none; b=ImyBPLjEV+rMx9qavdsx30Uou1ETKHGx/m1bLz9w4O4acn4k7u3s6aLUGarG3D0I1IVoD4Bcb57ZmqrCsOdB1oMc6yrIXM020Fpvnmz7o5/2WggcH1tNxShLPDZVveWcxQHfxbHBkOSSSz+tA/FLUReskt4wzE0viDbFwiW09xk= 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=JAJ+eq4+; arc=none smtp.client-ip=209.85.216.44 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JAJ+eq4+" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-296717ccc2aso2000384a91.1 for ; Fri, 09 Feb 2024 23:09:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548995; x=1708153795; darn=lists.linux.dev; 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=JAJ+eq4+PomWqBi15KnOrBkZmAy30cYcCFB5ivNNxjxxOZMm8o48QBZsUbpC5HrTAZ 57PKzIrylZY10wWPfieEc6V9jGW1ADQavZEdllbv3h8XTQt8ytnh73O94NJScQsWD7GA RX/SLIniwahDyL++X1YPRGpr92msofrzfW8sQ= 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=g0aJkDPdVTUU3dGgpjct2/zVbgxkajwdnffnEXL5YcG7HQQbKkeltzQpYpRXB4kilY BsBBCj16GmVj58C19Wtii/Wd35IoBQbuppyWDnzUYeGQgY2dhynAr2KeHDgtSTXaMJ9O M6SGcZys//AEatiH4ifi7MtfVucaR1f0mGNOR6eaxYF7RUuEVzu2hhPe1urKhdSs5lPF AuMyaEGUEI18T3p8m2uNiU2llneLu0N1jHkXDl95fW9AUU/8yfqEE1PDvYgV7FfLFDK9 IyopWDszj1NFGrHL924w2bWWRbbNFIt9jHyFrn5n8V6SJQv3HP1sOhi5YuLyIWr0MnqS OMeQ== X-Gm-Message-State: AOJu0YwO/FohMV9zcUP3nQVq+piptl7FKU57Ff1Tst/CeK5JwIKLVW/L RKGIoEs5ostacu67KM+5rLTPdXgUQD35dpVc/OK5CALockMmlMHqDAsO8c/Oc8kryXXpCeb2sB8 = X-Google-Smtp-Source: AGHT+IHMkhHNa0ZG+OIplO1cmtR6bvKFs84rw5E2biQpiJzOSRE7LnelgiFtjJYp99/EbnlOI57YdQ== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552158 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 BB5663985A for ; Sat, 10 Feb 2024 07:09:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707548999; cv=none; b=T3rWHSvFOOq59EeG/eCT0j25Xctu4h6MhEm7P/ENtHYblILd2bGe/H4u4yginj6NV5AQOAdwS/eKG79KOUvJxlB67cyhDTD7YMRaRGnFMjkkcDX6oCZaWbCOb6LuZgUT/v1lYo5eu5VAfvqPcSs2pOhf12sMM19e0Vio/6jcQ3A= 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=oLV87Be9; arc=none smtp.client-ip=209.85.214.177 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="oLV87Be9" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1da0cd9c0e5so13020535ad.0 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=lists.linux.dev; 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=oLV87Be9CpI4Pq3nT6G1aN2PQMKjdZU0E7UxB2p1N9/+MB/dTlmiUsAx4axnH9mwhb tvh5lP203DxDL4fm3VuJUsD5GcU3nYa285UPaRnkbAc81u0jzQobP3Pby8V+v3h7JRad 6vOuWPFKjFXYEwdm8uC8WYv75Q4kk4SteNl+M= 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=L22F4PdJocp22vM10JxvywuZYsr0RSD0ke7Cjxgxkq46npj1ktXwb7EzNqegHpimrw lwgILGAnUygLa9qeYUal9uCd65fZk6nyVi/Opr0z4lgxY3QtlYTSzlnWBBZcs6Q9vRE6 QLk51fKGVrT6I+5YAn40bF/iDJnDBkHQRv7PjaXJaaKOJYTLmTg0B82D3gObf+5Ld+I4 7/bkq07qAwr5nQBhMtkfXbQFi2IA5rL9LIq9vkrm3jpTTcz/ogP/fvR/bGdMSdU8uIbg erfbxDDQnLPXfj30TKG4FRzPGBiRE2lSc5SRktv//h0oTV8mK0w4hTPg8F5pbIAQFKYq KmkA== X-Gm-Message-State: AOJu0Yxth6uOhvqSIwqiyIG+MwBkxrZajjALi7xAKQONH42PF3/NFLFP 3XnrDBx/vXCAFGqU3y0J9q0mCXyLJIatPrf1ll0EqGzE2zeuTzhsTjZyQrj+lp+1gvnlsUWdMjI = X-Google-Smtp-Source: AGHT+IF6Obhfaezt84euwognmHLhoystIjlBnFk4gq1ZlYgduARMLgwtIe7tncABPqYe8saWNFsTHA== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552159 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.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 E82D83A1B9 for ; Sat, 10 Feb 2024 07:09:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549001; cv=none; b=sF7SZv5Vz7DccS8pnbzph8e6l/1fUkzUFz9rJPRJ2XBtG1mdK/r9KVwMcHDv8dqwg9ieGLO2uZ25f6SCLRvJi+e5HQhP33aazAhvZnEgOsq+LWnwqfizcm6fYif43hd3k26tiI55P85eh3IkoMssuuAZp2eHoPhZvrTQgOglei4= 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=GJgCVg/0; arc=none smtp.client-ip=209.85.214.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GJgCVg/0" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d746856d85so13476905ad.0 for ; Fri, 09 Feb 2024 23:09:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707548998; x=1708153798; darn=lists.linux.dev; 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=GJgCVg/0UrxfqTgwEsQ/GPubTjGP8BTWGS+3/3KTMo2ve4srktI2/iDB8J3nqXBKk0 rXrKFvSWSIbJ+913F9o1b71PCIn0fdNDM90XGxdtkMKVztFOhGHCqx3aaKSKJ832xOUy I1IwZXhHP87pLhv53UU5Yg5upkdixPqQEyDN4= 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=NzDp6GLwAB0cOvDslmH+sLoZox3VSb3r61j6FUZXmgJaK7Jk8KFSZiwJuVTVOKKAqQ orDBGuxVyeBTy4MtyA0nYKDhof5HCzy/wbRquiiQXGwc1x2xOFcAEDYfG7lHLW25i11v YZHbO4sWQ2umNWNH1PHdm9dHwaN6REPvQaWwmpXqj0NKuIqqdb8lenxgKFw5eQeOZBSE szuLc745V70fjbgshWwV2zzNJEtMpLLEkgO+PS3EiIY8OCtxoKYbib1TKH93UVhF2JdM EsFUqq0nn3veItXGixAR9ld1qz5WRG5I1c7NE+4rf+qKGHX8rX0y5RV8ErlY1BY1JWUk iRUw== X-Gm-Message-State: AOJu0YxZdF4zZ1niWQtEFjc8MuUkrdkQBP9TUvHZtEXgD6XbOTlvhKX6 sySF2RifJHn4Oa0gvAqIbhqwv9voqvHdU7iDc5kRzQpP2zmUaka+pvBPtzdOD3cxWG158Wu937s = X-Google-Smtp-Source: AGHT+IEYMDvJ19psXILcI/rjPccRT75MfLSEUT5ycmz+0EKZhRshLPkzC+4vjEV2TS1VZWwHwwlxCA== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552160 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.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 8AB3239FFC for ; Sat, 10 Feb 2024 07:10:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549003; cv=none; b=EWSdVuicUzriW7zZ68FdVJdPP60TV2aIDSfo68M9vG2vSelCfixi7gc0lm3C4Urw1R1a//CL284vR1JJKmDWkKri5M5TXd6d40Muw1iJQcMHOI9Y21oEKkW5V4kP6XWXYI5XbrcSnRePms5fBYcg4ylQz6bbFV6tlVdmvrQB2Po= 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=S3cUE1W/; arc=none smtp.client-ip=209.85.215.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S3cUE1W/" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5ce9555d42eso1316568a12.2 for ; Fri, 09 Feb 2024 23:10:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549000; x=1708153800; darn=lists.linux.dev; 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=S3cUE1W/EHO+Z2YJn0FxLFzONKwb23eZf79y4NZrNvFjivm78S7FwUxg2rblKmmGt4 BsFrrS07MWVE+ff0ROSQb6sufNtUTNmc2gyFDrBoiykynavWJW1Oo2umR2uSgkHclF5J mFLuDtn8BlYQBT12BxPCNjTxacIdq09yz9mnM= 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=NSInYvXjA2FzBRjvpAWS78mkj7su6KR1WmRz8zS/Z5eL5FvSMoyBbC8ihzLX1+fFqB rvIBKfdZa7Hlw1VGx5H8PNRZop+iTfjt0YQY2BHIIseYoy9OszMiQsCsn1LJDdpt52Ea roWN4F14QHgeLk7KLGWOCCYsWa0wdcWeFYqgzXnTDbEu+rwx4m2Nt2Gi9k3SyZKu/ItM 2RqHwj7YdkoGVEmPYJPKJhUF8qiXQ99HUcjsOsWIfoTfE9S5E2Cvhj/SehNCU4vIqQKa TyXRNsbtVsAHvfXBKrCN/L1ZBUuqBR36F141DFh4AdOXML6WOQr01txZhL755/DZij0T oa6Q== X-Gm-Message-State: AOJu0YyV2fbhrc6I7SQBPnwJx5U5XHVEey6xDYjpMPVB8T31lhM4NvQS emTHYagWx6jKBRRof/1GWxce/45RiF7ne/z5qRGH3adai1dIMUhbmomHffVcEe248QhzzgUZAgM = X-Google-Smtp-Source: AGHT+IH18BL+v1/eWB00jAhbCH1MDFkNv9w/KlvOVehkJbrbvpOewOqpcto8HNZ+VsYssctW+PUIzg== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552161 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.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 14EA93A8F8 for ; Sat, 10 Feb 2024 07:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549005; cv=none; b=hqGYU5DZY8fsgqADe6eqF9MYMw7wuYfvtRj8G4vKsoqRdX7yqQNpTJkvDXCY/w2Bglzx4B+o7jXO0dDU0mge8UCWSFH13zKsLqiIRG0pBqc7Hf5x7+mx7H0WyRKUEjYablWIoaoBX3dlMxYmmhdgTcu88az3bEWnFHshKBJDjiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549005; c=relaxed/simple; bh=KWg4agLN18znoG2Iygxv4/gRG3/yzkv60PQlSKgj+cA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DoBHUl57NRpIhXxloewZIuNgQ8sRH+3/vC3CgkaL60vagiMMU9a3VW4ZPohv3wKWgcAlwcNiWmRPK96LyiOihxfXNpc3hVpjwMFcDyINnP78Q6A874NvkDGrAKYa6VLJaQ8KsYnTWCHOm78b+vZX2VT5oEW+g7AoctCX/dDNjBk= 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=fwCyrzkP; arc=none smtp.client-ip=209.85.167.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="fwCyrzkP" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3bd4e6a7cb0so1127535b6e.3 for ; Fri, 09 Feb 2024 23:10:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549002; x=1708153802; darn=lists.linux.dev; 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=fwCyrzkPnCNJ0KgI8/QChRc2mL1Mw9WoekpZxm1gTPwRYCo1AdaNasSw5RBIBhy+ls Gn7Ibpf4vU+e7bZs182ykuScPMnm1gkEVBrJibr9DTeHz3tt703xP+zZ8+044fIDvBAI Wm0bOK7SltbTeiHz97xhF+8yXN9zpTmGB0NV8= 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=IgUSUX4bDGE7+S00qjVxSaNWhQfsmYwuhp/pQBMHbA5/9oSVifZCULBWHEJee7oCXq iRrfhnccTvwzLl6Ldt6TqdhKqEB78+UrDZowdutgWUZOgmFuz6R+GGNFr/qhhjp/qREN sJ8KciuqGpnUxrlsRwXBaypSIxNaDWSkPtNf9KhN+ap6/34NR060x6I1pTEeRBdpj4fK 8/03RnKay7Rg8BY0XmnmSEDXNj5A1i+bOaLafYYIuvvm27AQDfiij1uGX9kOiPtwookX vsiDOpuixdGuPeBzcMKwpfYaciD+ykAqscSyFYin0LXnOzwcYc+jn/rhcp0IJyskOrYB wXig== X-Gm-Message-State: AOJu0Yx1RJBXfA+SF59nwHHn4Gr1vyeoLxcFCJxHV7/OLGj4X5uthUyX mFQYpd9xZG5wWR5jNJ8bYc0crVdff/g9ZVF1oixudXUCw9xlJc46FHiOEW0PuzMdMDVBk9HRr9I = X-Google-Smtp-Source: AGHT+IHfhNbINEK47mtM27Xc5vDyW74i+uZgmEoJwD3UJ6z8ChV5NU+V1lHowi8SgTL6HxzPAHmg2g== X-Received: by 2002:a05:6808:1988:b0:3bf:f0a8:cb2 with SMTP id bj8-20020a056808198800b003bff0a80cb2mr1400608oib.37.1707549001771; Fri, 09 Feb 2024 23:10:01 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW2HrdVmLOcw4Sf/frtnmvY4PJIlX3jT5jll7lFNna1Fpso9xTbdH9rvhiDq6GKPHHy1tZP4nw+5TDy7xMM/ogtsU1SgxEzFe0tDscca19xhkYhiPP6/KxaZgNxED4kb45lZugMR1ueAcwlz73PlvoNVig+xlqg15ALJbOr24kaaMtk0JYVNbP2Bjh74jvcp/MQW8OqL3U+PxPXPx2XWt6f/aCwTpSDDSWlQlg+n5HEMAjSkyX1cXYupkVHBkqGYIE2xV0/cRdSfMTVX7W+S8Y9q1iB4OFy4BcyqIJrxmvu3X2zbPyXxtBBCYeid94cWjS+Jx2IRX/YwbEBBPTNgro10RnVy6XEswrD/FgV2RoWFpccIW2m76rNfVu31Pndn7Vr6pBD244bFKBBWVx8nh/0pEXtzYyqbKkyzItyMaiM5hMJEGV+f8+/O7FuWJzi3bCVO5qE3cASR9QgC6wGqN+KFRKFwh05svoB8WAvy9WayFj+Bv8z7BUa/G6m1m7BbjrMSg7np2qG Received: from localhost (175.199.125.34.bc.googleusercontent.com. [34.125.199.175]) by smtp.gmail.com with UTF8SMTPSA id b18-20020aa78712000000b006dfbecb5027sm1687313pfo.171.2024.02.09.23.10.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Feb 2024 23:10:01 -0800 (PST) From: Stephen Boyd To: chrome-platform@lists.linux.dev Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Douglas Anderson , Pin-yen Lin , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Benson Leung , Guenter Roeck , Prashant Malani , Tzung-Bi Shih Subject: [PATCH 13/22] dt-bindings: chrome: Add google,cros-ec-typec-switch binding Date: Fri, 9 Feb 2024 23:09:24 -0800 Message-ID: <20240210070934.2549994-14-swboyd@chromium.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240210070934.2549994-1-swboyd@chromium.org> References: <20240210070934.2549994-1-swboyd@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552162 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 DED933B1AB for ; Sat, 10 Feb 2024 07:10:04 +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=1707549007; cv=none; b=Rq+rsURfI6pf7S5u9Y45g3kThWdGa36RtMMM9dG6U2pyuOfS8CtAgGyzn9stiqDoFVlPjtlFi3BZPMODH6ll5XavXlb9YOLdvVXRZnvbXy32LYxs+9uaFuxgFWi8uaal0qeST+8FZUqX2GbQUjofPyLFPeo8h8IR2kBV57Gla00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549007; c=relaxed/simple; bh=0JMdaneE7MUmkdmG9Zc7uuk62ednVzN489PI+iGdkKE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PpdXdtGftID6zJ1zqu8ikANrRR5LIzZAGc6sqndm4HVQvTjHk0lPx2p1ie7fgFeuAmIOw6ZGLmc2+q/y7LAsOgwMmzBFjl7YcXONRgxZm53VGnoLbi3DuKTv1GmhFvhy5zM4cZwhf3n8eKeiJfEdnTMlVeDyeDRNA9aUuRRiT1s= 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=IZkkZ7Ii; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="IZkkZ7Ii" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-59d3a7e6b05so220132eaf.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=lists.linux.dev; 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=IZkkZ7Iit9SPJIzvvv3gv8qKeNyKtmHGTDnXiMkQmyODbxxMu1we1mlIA/RJ4axlZ+ 1I4fwut1GFJbTUH+ukuNXUsnO6VYWQe5tB0mTL3niltttYDcXgDV/61UNaAmxj9RQmr5 dBeckRZS9qz8lyLqyYhsXQ1Yy3C0uL1K34g9E= 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=QmjUfirCm95d3ThkyO0Qvnp/SR4c6mFgPtMHmHO22UF4yzAYtAA6VI+HtpgiqoMFiW 9b8vx4Gg2ZgB4MofW5PRfC5PgoS08x5Gx1RsqcqCbRLSPU/DSPqATrauIRnc3lv8EZVs yhPCgNVB2wwiozliuQY63c3/TDe7t1zLLS5fqky0PB2R+jk8xlvGbDL6AK4jzyrGxyrq kzC91dbkUDwwvCRLDFv2if3+U2TSHgvzMQPBt33AICIpyBGMIK2UBfn8uQaLKjeZgDgw ggFTDIP6Rr+G1ODMXS54Sr+/Ruwhbw49m38DRCAiLceIq1Mc2mToZaaj7pnzhQrW85eH fizw== X-Gm-Message-State: AOJu0YzEXSUWaPxlaY5V2aIo1bRzjsaSGQSrx2WWgm4DgxMdpU9a5GCu KWmBvAKm2XQi7Oq4FO/hU0J3Vej2gLmVNYfeac/oKXS4DKN1F7XwaEk3XUYrHnINUHZYNfE+uGk = X-Google-Smtp-Source: AGHT+IGlG/LX6qDwmjLkuH9UMQbaPLDSPDz8B5eHO4jCVNUf15pQFmYhZo3/HZsokvYK8unfvEr+xQ== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552163 Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (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 A670A3B781 for ; Sat, 10 Feb 2024 07:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549008; cv=none; b=rC3vdI5sjfNZjhzInmepKvAQEBmNXaq3soB1VHF/CS2CrZ0U6czCqqltvfoC35cdYmQ/1NY9YbpIuPG+5Wuq57LkDccKrIPQ5bWWtdysa9IwFx0oagwnl2/h/xd3oePzFJe62dWSlrljicuC2xIfUotW+ltgtRMiBqFl+jxlW/E= 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=WYcMXWcx; arc=none smtp.client-ip=209.85.161.47 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WYcMXWcx" Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-599fc25071bso1095018eaf.3 for ; Fri, 09 Feb 2024 23:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549005; x=1708153805; darn=lists.linux.dev; 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=WYcMXWcxe69NArMqADEuCy66Ycu7YoWPyVFW/59J8UFVfUZJ780SpdjlivSJ8KSqx3 5b3ZssBquKofhvd06lLHncohOfIplH9QJDEkx2LhlTI77VpMlEymIFPmkgrK3FaspNHy h0vHwgNvEpL0latJyoCbBnowiXGtaNh9HvPlo= 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=tKN9PeOwV5F5/loSP8CCKQZCwr9GxCNIY/d5dyNqGg1sm6vLnBt27+hg+ewqoO5Q7o zuEmp+y/nEBNJbcgBR2kZwEZ8Qv9M4xIOosWyB/BmRjQZntv/Ivi3YyKz5PjNSc6pLpg 7J3eZgJdBBaHZNDPaO1YAdjw835IuLH5B+9UrYLnGhiSr0cHdmk0JBNzUjFHhtaSLn4b +C7Z0R7DWOOuG/jUgahQcb0C6BjD2R1dwS8t9ApmMOxJwSyAuwi5ZVlYtPTsITzIQQGw D2/f+aoQAileL1Qf4omsAP7V2WMzRIhCUEt3LVd8vsw2aOvmwdrlV9DeamwzAwqpNlwO t2SA== X-Gm-Message-State: AOJu0YwZ0Qw4vLpCJ4XOgeqEtYwNyY/rXvkgUu9GyEvEpTKdzFdKYXTz 4GJmZSL7N1MzzHZx9fQf5ARBgoatDFo4k60A8XwGMcefbB8pP2Bl560Ui/TJyXW8B+pZN5zwd5A = X-Google-Smtp-Source: AGHT+IFocyLptCHQu7cD93yC9LBb4sMmackx5/kVRGn/AZS0OVtF+h66UCQRfJiJiNXH0PNn702ejg== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552164 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.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 154CC3BB2A for ; Sat, 10 Feb 2024 07:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549010; cv=none; b=bvkd+2jmVVl8V/eCdRQvG72bJ+0+pj6v+cCS9WkoT2Y7aKVs+c17iPyb+tRz1bSivQNaQbP5pIB4qZd4C+msT34E9wdvc0i+0ecRR4o2aQZSpENtd32soDe08icwFbP8CEo9ZrP/3EeQMcwBPiTSO8iG8c8YB7Ly+DTuo0CLQY8= 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=eH2sbbo+; arc=none smtp.client-ip=209.85.167.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="eH2sbbo+" Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3bfd40ff56fso739114b6e.2 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=lists.linux.dev; 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=eH2sbbo+hZa4QiTP3vIUnb0On5to+DpmDIgbs8UezwceYVXTIGU/HBe+UELynZRLqy jEFzBejenP8cAl0B6MTi3w+BEC0xD/TLrsxAZKuuk6+CvZW83CUoyVwYt7Bo8HEmDk6K e8YQHJiS+R9uUhw8CVGi5/zzN9n0lWLz0C1wo= 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=IA40GQNUe9mCA+8LvkoFrCZI37GxiZi3LqkiJelLS6B77nvyL/jov4yt5Ef2cRqF+1 Zw3Y2r0JwGL5lMf0aFrT9F79zetO8/C2PHwTRtB9xKL9SSVyCEXB4ADnLsUSmstkPGOu vv91gC1jGPvKjnRwD+qDekofktt8BlRyMN1xgsG29XuCvf2hDTs4qvusDl3d44tVkqIj UYW2L2ybrklmghKCd4ULLGUdYi2TrkfdBz/r0IxHUomHqGN1h8LjxJ5a15DVDrDKlBXA BVbzSszoNM6UjscewN0KIcETSSUKLVWR7gvZslRbR24Jd3t5Yi2doX32MTjzdj2PauwN rwkg== X-Gm-Message-State: AOJu0YyQ7gkuToJLV8yBgtI4lJbot5A9499l8nFEVkNsmqmFVugwUWb0 2mDLZhKeoIdIk0n0Zydmu9MkbHrC970mqfLJRXucAxzehVVQqIPBtOPSoJQiiCDUkRjpWbaEwe4 = X-Google-Smtp-Source: AGHT+IEPZGcB81339CtNUM+V5udmB8I/bETFsZaMWv7WGBJDSGtks0RnM4TRys6niXWr5tY5R4dkQA== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552165 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 AB2163BB4D for ; Sat, 10 Feb 2024 07:10:09 +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=1707549011; cv=none; b=HGN+FkXIA7LxeSbA09CgWvRRBdpf25/5ChVibXeykymiyDJkfTT+bdZk3OHNmA4dmZz7qhBMgjBBl76+Pqn1nX7J9lTU04FXsZaZiTYLOojXsUSh735VQODndF3qRCjKPuek3BKeJrj84jRc1PupgQutHKGoZiTVmWfxhWoooQM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549011; c=relaxed/simple; bh=7ychZbXxS1s4pMACM5Sr3Sm2rydqrFGfJ5B9SLKGry0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AUNrsIFeXI1YQlm3UDZ1rmNIx1rFhwlP4fLkmW8n/gwojVcWsbekx+/WmNj0QEKtc8MM8xB5aZTXiWjEa5Y88HC7tR/dfHWYgbYoJHd0PaCL4PTodb4fAjAtq5Y9gLdUHNftz+TsuztEgxbdyyvWoCzKedWg7Tm2vv3L4pWZZpI= 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=DuopWbXr; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DuopWbXr" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-5dc4a487b1eso1225975a12.1 for ; Fri, 09 Feb 2024 23:10:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549008; x=1708153808; darn=lists.linux.dev; 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=DuopWbXrBfNaXnXIIMBv1AtMeHeI88md5Pa9NhmE8qOQSb2mbqjDul1OUHuccEFJ7z +dhcEQv1yBjXf2NyOeBotI9K0KXPVYWv2xGz+IttKe/IWzNjqr/htruCWS4ogTUjwyTe IOBon8QXoFGjIJCuZQPXAwiHkaNcxDKwfxvtw= 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=h4Ri4wFTNDc1IpylaR2qY9FbN4baqlfxfJXKFJYuZufuTvVFmK9xJJyvEURbgKujat zIXGnXGaCxcsEtUrPvF4gjWE6ul/B3l9k0bN0bUs+eONNrdkVhzPiSQ1zsN5SNUYSWYs jzy5Pr0b/2j1EgTDsCZCCmesJoFsw7KHdTjEPlE5KUIAXsinv/mXb9rWxznv1bowAuy0 uAF9BA2HXZyEeWnhgvGKNm9rWC/F8fzxkvUukHS4rQrdl8UEwpqnHgJ+PeTz6WSTW0m9 GRKmTl0251BcJvIwofVfSJLFZo7unft/TT1Ak2+LB4rGgP4KImjAYFxErvY2cWEWVrrk LdPA== X-Gm-Message-State: AOJu0YzIZO6ler3spUsrxvqFux2ORw2d+ALvV5HJT1ow/l4/zpn1ylA7 0UDMvtdYqJG5UOGZQR/uIoPcQqFh93y4I8fFKFT+4WDhVS0uu7g0NAV6cc5KgNILhJKgbyfl3Hg = X-Google-Smtp-Source: AGHT+IGsl/kRZRKlL+ejLfDG0H8w/xBbFJW8H2mG4Dnohi5PwiltDDRP/NGDaoxKd6S2A6sYjsRajA== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552166 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) (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 81D063C486 for ; Sat, 10 Feb 2024 07:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549013; cv=none; b=E1QvaFvtQEh/js87+ot8+yAdemacqR/naqW3x9veSd+0qiES5n5xOsJ5C7rn+tOK/e2tl2EnrS+JXzmi1ySk7u/6hSoHzo1IztE+FLZrGArsffJ98hmz10b0AX6P43i6UUEUUjC6oA7k4T8qbLy2OOGTyVV7B2egrtzkUPE5og4= 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=UgKDRhay; arc=none smtp.client-ip=209.85.166.54 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UgKDRhay" Received: by mail-io1-f54.google.com with SMTP id ca18e2360f4ac-7c4205020c4so74260939f.1 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=1707549010; x=1708153810; darn=lists.linux.dev; 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=UgKDRhayi1TGRqmcafUCJispz9Ne28t4S5d8EJpkH0rj2c5+B7mgvjAGQx6rCg8PDN w7eg6dsRZ88Rdj+vbmEz5LzXBwhpPq6Lw54l3cgCAE8IjNwd9g9r4b3P/VV38AmWJrd9 SrtnxT1C/Tu6D6Wle+9+mkMSnayXvxYXbse0E= 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=krfiQvfCcO4rQUrFqWsx7jgVElVUjTmu4HStCYyLEoN8YY6EsKigk+jumPpulPwyNj kb9/Qvib8eIMDhzMW4zPg4ZZvPNyd80gVM+LPxyP5bPetFnvsqqt1MyVcMO3aXdRGtlL GE5pOA+cnhf3CQnT9iPQ7/mQl/1zfh1x51Sd7z4Xx83iuYrWED7i2vcLosHSCPAzRu7o n6DQNvBEmmAsRQkGlqgcg8VH4Z+2CrL70A8vHzbXC2wXNqU+behWTnrQF5t+GDmc2Dly gbrnIDUHNJ7qwnx4JwigtG1EEBCP5GhFqgle1HquKZiYdap1e1QUA2VQ42jIgaqTkufB nxiA== X-Gm-Message-State: AOJu0Yx3xIN7dLAHAf3creMUhCMcuIgkF0pzoMN1oDgUFlhDR4NIX6p8 ea23KtCiNEsHb0B36dJ1b0jESrfbUGMD0IknaglCokzkwXAvQZRqNGt+xG/cNaS/8bNvsDUs0iU = X-Google-Smtp-Source: AGHT+IHs/c8PKyjVEScyFRbE6bgu7Z0/4J8m591pv2LP5Byv5N2xK8dgo6/QivpRemKJGxe0uIu3Cw== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552167 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 DBDEC3C6BA for ; Sat, 10 Feb 2024 07:10:12 +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=1707549014; cv=none; b=TIbO0/7jT/9LmzcSyJlTXNOS2gIUTCdlsrkyeHRfS2PcSvhPM45qHO/J7su1ZruGH8ZCs4EBw7mG40WIbcCeEERclIV71oXyPISkdLnqnyNdVIEJgYCSRvYZ4VnDF94TNG569pl6t9h88xpOdhQF4htLMEmobni0HNPjDq75iZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549014; c=relaxed/simple; bh=19FF8ca0psROBDhCh44aKdtr1cwpixcB8/tkmi6ULFc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Idc1/MAX/9s6+ThdnvpNqPxqI6ob+tvls1SNETYgloa+9MhW97HoG33dnOd1y4H8lNKRcoJg/ImeK5UGK9T7dI0bEaXInduuGPIZsL6WCh2nFhqnmJ+F8qPO4wTok4MygbwbDUlbTQET7/XLrKZUvJwDBrvzRniikkhKTyKXbjw= 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=E/GVnS3J; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="E/GVnS3J" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d751bc0c15so16127515ad.2 for ; Fri, 09 Feb 2024 23:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549011; x=1708153811; darn=lists.linux.dev; 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=E/GVnS3JznOGZ//WkqAaxGb98JILgD4ZuLXs0lBPSIOTqpxKjUXH+BK2PJz6UdfiYV 2XtAZInqY9dtdAirE58YgmgNrV7FiLlB02q19+g9UKBL1ptMSncl2hBrwDP5JCqXM2sq AOYKDTe5lmcp2ThCMmyDxs0xfAipN6yjH0LZ8= 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=hIpzobLoJh9eb36H76cD1Sew2HweGrMSvcw9zXtBiE8YQNwsbNwWhPtnh5MnqFjJTh GofSjqlKfBJL97GJ6CfY3Ypj+O+M/7H3s/NTbQshTeRR7BrAJNNWbDNYQsgP0R0PyS9n 7zX8katI5rVVhqXN4bUxIExh3JpClLEeZ8AkIcNk2yTtmCSsBiZLYAVgEOMskwqYdToN QKRtlh9tbJosjTA7hxMuecfwbfwMNxS2OJMMIfVy7aQXWxVu3X/qu7tX5edpgTfpp9wM vrnivO6RpPPyC3mYmQ0bO4AUuJqylumAHTgD/LPvfh/HKFdtTNsYqPUgqUVNBx2of6DL osgg== X-Gm-Message-State: AOJu0YyZsFaxMjbM1H6qvPUYfv3Ur4MQIxnzJHzgNGOFR5+KrEZ/EWpu AFU8LJkSeRpJQMIsFyjt8t41mbGE6PQ/dxk0VHHCMRH8IcdQH4BrBTVlc6kdxNX25ApV6nhgrxg = X-Google-Smtp-Source: AGHT+IHWJLApuRQ5BePXcW4WqrCZgf8Be0TOix5YKj4LAjWDn3gKZ8A8xoT43vDoes94/ubgzoyuyg== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552168 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (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 0DE5C3D0C4 for ; Sat, 10 Feb 2024 07:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549016; cv=none; b=L/8U3BATcOdCncEfB/Hkfv1A53nuN4E7W3vkO4ugfzaC4OdykdRDlWMVzcSPADg+ojJxeLjiKsT/aW7hCdeBOQN0G0LOiSbY8y/dixl740AEEvdY6bfCNG2YE0xGCfmwFNcR0P9fL3JecVcIbS2Kw/yt3KOHkOQeDaeJebK10SA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549016; c=relaxed/simple; bh=uNtg6CNmd9g6D1sTnVrmmBjdLymre6S2FvTNdICMapI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BA1Wyd4ql1YoFlnenl11bOd5NLtiq/m7MdiDPr9KDOnQVdKm6EvGQSmt3ohyGn4rzPqugTVQZFtIUCJqU8LWGmuCR7DbLJVsq3GhN1cbeHlxFwKTD4gR+rJW1swxu8xNrERE2X/coyVF6obqpPWNvnUbU/8TYv7NTUsaYhu+F+4= 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=KmDz5QO5; arc=none smtp.client-ip=209.85.161.42 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="KmDz5QO5" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5986d902ae6so927850eaf.3 for ; Fri, 09 Feb 2024 23:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549013; x=1708153813; darn=lists.linux.dev; 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=KmDz5QO561inVJZR+4Za664g5nMOA8rMuFKwA/uZLfFp+EnTwIR5ylMXgusqk6MgAs F2ga6NUjYKDlqdwrDOBG9Pq6TFpRnQ96kmRboojhMEZbWixdkk+TuQ+tWrdogHNhxxTP Y5efnrnshfrY1Euy1vspRnv4gAw98I4Y7NZlg= 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=PbL0hsHm1jhEgLNXKoXjXoJ3kyKHLHWbqXOdbN3FEXgiGD16rZjiNSiypWkM9U9dyp CVXRZSKPnv1gUqbmb3dUUJW25/Ka1NrXZNEh1SciMpLdtibqlBKH3wnJnPIx+H24xvZI MmNrGR9Vl4QA5Du2oVbCKxCWSYNf1h72tfMDiTpe328CXvbVtjNH1sc/xIF5/CZYaF/j 6SUma77NWh6KbqyK8exP/hdy++bpW3BQl4qDGEnhrE67xjPvUqEtJplOm++tQGpX2WKj dHd3bv8SBmqr2dwdgudeVny195BkTQilBaiQ06CQWH8Czv0W6z26Q7FzNeHAZ+eOraIo pvZQ== X-Gm-Message-State: AOJu0YzT3O83PrYoUSaHQkIvaOanv7AD7gGnpGmb4xTsL/QS97c/zrok YKceR4Zj77gowaOmFXt1u5nHCFOmprbpEJ/ptT8rGmtGVMQXUDLmJOwpHAGPWErJNCAz22BJQGE = X-Google-Smtp-Source: AGHT+IHmIBXR3wTN+fnMxCGP+XCwXJqcs2DSyOB+AQ0XxDnDr1ftAkvP1E8Ip81n7RTMzc7ueUQ+5Q== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552169 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.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 CB00E3D384 for ; Sat, 10 Feb 2024 07:10:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549017; cv=none; b=KSbIP0vv8h4Kz6GsGhJxScoKZ8m/gTrl54/B0o7BIXmdJKqQHdiWl9JBCEbIrPWw8GYFSFTMAGx5aLJaYEZ3ISesXjppOVZKVKOSa4DrAOHV4wdJeLiStX+Wk+qAp2UB9JQkISX5YuOqAXptH6clXw/DHNuUnf54lhStesnFA60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549017; c=relaxed/simple; bh=Gr/cjYsEPFS9YtkIRTTBs4NFAZVd1rZbQ149cefKuGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fOxarKbP7HHp4BXh8aEOGiUlPbE5XIFDGyrCB38LItv7wHcSZNfqpLdI8wm8Spbe/1xBIyQW1UnOWEyIffz+emwF/41m2ct7YMvetxEU1emsFRTYhOJHMlfoOMRJgr0eR93jbCjfuJv0wKAdA4006CyeH3K4GZikmf7WZXBjpVg= 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=fzrkDROA; arc=none smtp.client-ip=209.85.214.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="fzrkDROA" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d751bc0c15so16127805ad.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=lists.linux.dev; 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=fzrkDROAZgZNLeoWmT/FgGekwREZ5YwpRnVEspV7dvVCIx81eNJyHfkrvD9k2dKEbu JfArYhZPnyObX7Ru45WwqwJeP70AvcWw/RgU+TSR9OGFQCbhgbqxj6u3XPlyO9dJxzRR tTDgitCbY88OgcjSH35Gx4XlqJ0R8UmxeVayA= 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=bW9a50yFlexR2lfPD5kuRF67qLFBjpLuu4i7ZQVqgcA6RgH1/txff9X/CdjUmC9V1Q 8IW16y6Y42OUEzgawyBKiap7ESEbj7XU9FBztyGHdiF6UgJegKt9QbEXjdqgupuyNIyG Kdrfxlnx0u85rjj0ngVAr0alCHxI7u/zh5CZ1NlwmC5l5Dg0AsUxb/xiCaxrDYx8ulQ6 n2BZfU2MdmcoCYXeU9IaHb3slPsdMHpKMq+78iv27IBuvOLESM8BBIwYWSJ3cE6o00se KTx5/Vz6F6fz9c0kZGtJPQIB0B9RGLjtgl+2Xyk3Y0EeABaXzLc1hHz5+Zlov68BcyPm XQlA== X-Gm-Message-State: AOJu0YwHgya19q5eo3GXJdEJG0qgIAwJC2bEZ0y3RFQWGInwPYSzPhOR 3jok3JASJws/qvQrcATjvgaQlOOU2XRqdZktrESE1O/63b0ZSxnfK+bdnoTOxrViurdkRhgyQ8I = X-Google-Smtp-Source: AGHT+IEPebBATSj4xLUJJxKqaWO05lkMH0b2sVPfG4NHB+qrjNTT6Gm4CBU6EDUiPGoN1DCdFsgbxg== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13552170 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 3946B3D54B for ; Sat, 10 Feb 2024 07:10:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707549020; cv=none; b=IJN4Yfl9B0nzLyeDiqE8Nu9LgbUXuBwZIYuNASJGbcC66CMsWgkfhet+LxQMTYQzTwflAVXkhN+13uAig3dbvLUscCv2YRAAAAtJG0z5Xha4Bc/oXFwKi1tLXO3i+hZUVVVACy4Svu0ojQbRz7/TSrOqtk7pGmZJP+tqJ/4ib4Q= 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=MLUVjnSG; arc=none smtp.client-ip=209.85.214.170 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MLUVjnSG" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1da0cd9c0e5so13021425ad.0 for ; Fri, 09 Feb 2024 23:10:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707549017; x=1708153817; darn=lists.linux.dev; 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=MLUVjnSGnSxe58MgRBRDWlQtQeSVPVejUaYFeY4lVNNx5K0gacsQWHS9cb/IZ2p1mj EGBgZeYtbIc+sHTeNb8SQoe5TZNHLi7NTizufMPYanmotOUpacYprgkuDzbiS8NwCBtD 9FeJbEtGhFj5zuElGCaf8tWpY1angIppBWlrY= 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=U6dJmP1qeLSxN1MiIaCYT1rUigtX5BMI60Hzc2pi7XFxUj7rgVIncm+EdHkYxWWbmw YPPpgmDBFkCo/hizwo5HAtjt8+2WaQA/Ng8CUQzqq6uwgxLsjrjAMloi7k19l6nXYnkP APGI8o8IMABnep7lLgnHr2DYTqd+T7LP9E9o2o4GXio7PLy9XOkE4EC27I7EWzvns4hj 22kGNfX7vOuwXQkTakKWLbMU2LCg8xXiMwpcxIKT49yu7sYRXrIeymBEOlQ4UneNk0j8 5YNIaHUiTh/7e9ehtnPSNRz89vPKkdUfZXLGGlKq5VHO6EZn2Ya0vLTWJg1QiW4rd6+G ks2A== X-Gm-Message-State: AOJu0YzRP9B02p44n6oNwCSWiidC2Zh8AmxhT7ZQ5PH5anHP/4KkMaHe Hf1iphCC1vcYE2wSy7H53VXMRylPdVeOuQ0WhkpKC5vIqTBKFx8aDVSlDF1uAhGcHt7HVy/93FY = X-Google-Smtp-Source: AGHT+IGLVICRvn56WUY63ePsz4VHQpDwKXW4WcDvin4MKKJ3B8XPhTBV0QpchGE67tTNFQMtAtjOJQ== 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: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 */ + }; + }; + }; }; };