From nobody Thu Dec 18 18:03:49 2025 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 B5CF830AD06 for ; Mon, 13 Oct 2025 20:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387660; cv=none; b=lcqqt220qnDiOKdvQbRYfSv6YcapW2HoBA4YFMXQp2q+s7byR9BevwHr0sxnGMM4G6GlNLgMT+Pf1Ptl+kN34US1AXW0ETl6jgnzXIt2EOz1lNcvPI8itlgrJhhc9OPtJP2mZmXS5190vJVgUdsN4aH1hAo+nzUMdn2ljAYymBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387660; c=relaxed/simple; bh=FpQkjfU4TuUbSHTPuiOa8TR8ZPo23HNXZuZYxBTIe80=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=I7GBOC7S7vOOzZgs87MmtW6dBh6/sVIp86o+pgBx6Pr2m7t5HDKIo1aR/O6ydIuOYZ8zwDJArW1sjgVBUh5ekMiT/O0Gu6Vmn1bYyaaAEv7YC+thRInAJdzBbdcgb0FUHHAp8AfXWaEy2CCQVhlRAfDpkVSCrEcWqzDf9G1UAyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XfK6C81h; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XfK6C81h" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-7900f597d08so7053565b3a.1 for ; Mon, 13 Oct 2025 13:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760387657; x=1760992457; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=geE3ZI6aoZMvu7ZVVGVVhjF0W7bw8fld1I5WFjkcmTg=; b=XfK6C81hw0EYPYh3X87wP9r82G7dDcF9zVkUI2I4JLWbPiIkUFhxFqR7GfQH1NH/B5 Dj3Ta54TtAKrWFk/u5kcT5B1QIHohy+fp8XuJHvhxVO+udWGFAplSvtL667W7I7jzjL5 SqcVxKNvW1yNdGHuulKg4u0uo1PH4f/8wa6wij2Oig8CgxiLUVVSAGFveiFfHseoG7+K A4FZgFYAMBu01DoUKOkEMmt/8a9XtVSPG+W3X63dekS2cSyautRfDfOJBTsPrUNI7mew bJu2U5OAShDT2aSopFN1IDuM8Zal9czdNBTZLj8QZms/aTh6iVR86O/SEWRBeUXZw5PN 80uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760387657; x=1760992457; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=geE3ZI6aoZMvu7ZVVGVVhjF0W7bw8fld1I5WFjkcmTg=; b=WslDuSgVT7iNo4rT3tdjnuK1aQwVkb5xaAwYdvZPCDbvkNANBXCsnZYt/z/6WfFv36 cy65fR80x9uXVAAJ+Y3Zk25RQs11BJ6lzgZ55cfOda6C9+7C/7poA2B2ouzpY5KDVhjl HqLjNIud3G48b5qNiUspTTSZylLht/Hf6h8I0sH2PcXxX4U7I0eWZR2ep0zho7UEIrwy folOAr7Y7aQpKH9m9HM8dbW2Fg6U4mGTl0vpybYhnagoUq7Uizk311+IuBclHxaJ/sRE kkZIhEViGxZQdpnizQ+PjG3IkYHvUAoTj+C8kp+PhciR0irYgBjoUykcalOdIxjdS41D bjow== X-Forwarded-Encrypted: i=1; AJvYcCXpC/SnQHu7lt8SesHQ75ho7JPk1QXDeVyuDWSQbo48f8fDq5z6K7xVNBAU8xU2WC1ewDy4g+5vRbpbQE0=@vger.kernel.org X-Gm-Message-State: AOJu0YwY+SE2BwGvsg+85wd907fo+vNRgylYU1RokGTt7d+XuhZQJMvY brp/Ia6AHaJVwesr3Bow5QlR5ulaRAHR7/OasqF7KEU8Oc1cv5Lq7B6ABf5OwEczvgiWU7Sk9/5 JLBwXBw== X-Google-Smtp-Source: AGHT+IHSLcx2FbFw92aCVE51awsTSRArhdzaa9CLJzwE77OrgMK6NHBiBJW/QdJrdMrrMLKc0figVP0Nh8E= X-Received: from pjbsv7.prod.google.com ([2002:a17:90b:5387:b0:33b:51fe:1a7e]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:3d90:b0:2b7:e136:1f07 with SMTP id adf61e73a8af0-32da7e23a9amr27740290637.0.1760387656845; Mon, 13 Oct 2025 13:34:16 -0700 (PDT) Date: Mon, 13 Oct 2025 20:33:25 +0000 In-Reply-To: <20251013203331.398517-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251013203331.398517-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251013203331.398517-2-jthies@google.com> Subject: [PATCH v4 1/3] dt-bindings: chrome: Add cros-ec-ucsi compatibility to typec binding From: Jameson Thies To: dmitry.baryshkov@oss.qualcomm.com, akuchynski@chromium.org, abhishekpandit@chromium.org, krzk+dt@kernel.org, robh@kernel.org, bleung@chromium.org, heikki.krogerus@linux.intel.com, ukaszb@chromium.org, tzungbi@kernel.org Cc: devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Chrome OS devices with discrete power delivery controllers (PDCs) allow the host to read port status and control port behavior through a USB Type-C Connector System Software (UCSI) interface with the embedded controller (EC). This uses a separate interface driver than other Chrome OS devices with a Type-C port manager in the EC FW. Those use a host command interface supported by cros-ec-typec. Add a cros-ec-ucsi compatibility string to the existing cros-ec-typec binding. Additionally, update maintainer list to reflect cros-ec-ucsi and cros-ec-typec driver maintainers. Signed-off-by: Jameson Thies Reviewed-by: Rob Herring (Arm) Reviewed-by: Abhishek Pandit-Subedi Reviewed-by: Benson Leung --- .../bindings/chrome/google,cros-ec-typec.yaml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.= yaml b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml index 9f9816fbecbc..fd1a459879bd 100644 --- a/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml +++ b/Documentation/devicetree/bindings/chrome/google,cros-ec-typec.yaml @@ -8,17 +8,28 @@ title: Google Chrome OS EC(Embedded Controller) Type C po= rt driver. =20 maintainers: - Benson Leung - - Prashant Malani + - Abhishek Pandit-Subedi + - Andrei Kuchynski + - =C5=81ukasz Bartosik + - Jameson Thies =20 description: Chrome OS devices have an Embedded Controller(EC) which has access to Type C port state. This node is intended to allow the host to read and - control the Type C ports. The node for this device should be under a - cros-ec node like google,cros-ec-spi. + control the Type C ports. This binding is compatible with both the + cros-ec-typec and cros-ec-ucsi drivers. The cros-ec-typec driver + supports the host command interface used by the Chrome OS EC with a + built-in Type-C port manager and external Type-C Port Controller + (TCPC). The cros-ec-ucsi driver supports the USB Type-C Connector + System Software (UCSI) interface used by the Chrome OS EC when the + platform has a separate power delivery controller (PDC). The node for + this device should be under a cros-ec node like google,cros-ec-spi. =20 properties: compatible: - const: google,cros-ec-typec + enum: + - google,cros-ec-typec + - google,cros-ec-ucsi =20 '#address-cells': const: 1 --=20 2.51.0.858.gf9c4a03a3a-goog From nobody Thu Dec 18 18:03:49 2025 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 6AACB30E83B for ; Mon, 13 Oct 2025 20:34:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387661; cv=none; b=dG90Rhb2P+jgALJxCqvpPlCCAU4qu5avJbRdmvsssyP6IPjq0x/HIwPOA9sCYgQiXgMjtBPBozgiQJ1CjY+Oo8Fuu9gVy7SwWdn08eEGh9CZiLs5THybg3iZkXvO3WmKdgEGnUwTm02403rJ1Qy6mAfr78FCM5wjkHZV+1OInhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387661; c=relaxed/simple; bh=AW0V5P1Mf/cKqSJ4kn7YwKqdZhOe9eDE0D37bytSyik=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ga2O4bt1Z5m7plHSUwiW16WqndBVH1eqlJFg0xur6HenJNT3tX/Nd1aeZaMial7LtjqfNJCmq/yLnSq/pnpeEXnfkiCxw1ZHDCdclFbagzhnf5O8t83r3VpkenRHR1WwAY1fJxkRg0Vst29t63kP+ainRvSWmjFlDQokocsfMTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PIgx4e2Y; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PIgx4e2Y" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-286a252bfbfso209807855ad.3 for ; Mon, 13 Oct 2025 13:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760387659; x=1760992459; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fRIxa/UzZYfGbKZJakrsYtqcVLritJ5Q3FH0o00R8uo=; b=PIgx4e2YeR6Rb0vn199+LNsaV0OzkQKfT/U2gwqFmeitQEDR2Y/oaORC82PCHFbwvd fgfcTGVXnKajA+/GVMIJ5BK5kiXT2pxVzXM1NuCCLhswGkPgZqzelWC4qOP9sPtwd0AG jESMxNob5JL4h9HBLHfDuYC/QKngmHZCLJfOtKTdT2BBnmKG6xriUmqzO/mOCK1rxBzi hJHkQM4g0ypCQRm5V5tOAET78IH1foHdjAaji9XFq8xVgeUTC5akEKtrgqjNb5iq5FHd JN+4I5xJeUlJfrLRCZZARVK62Y4obU4Fd+p7qkDMQRsJZh4FKT4K9/8neAm6DaPClQxY wxnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760387659; x=1760992459; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fRIxa/UzZYfGbKZJakrsYtqcVLritJ5Q3FH0o00R8uo=; b=oxio2N6rDkY5lqmb2khIKEUwo46cSiYpPGkVx8m+/OCo1VfyoetmVCKNt7flNggsiu ziptzQGIHsAiNMElygHCftM5Mn2gVzZp4mAeXiORgk4n50Kky5TEo7sGhgmzSOsP9G9w z42soFJRD9sY8spc+anI/g12gv4DbB6Jip4O0MSqJNJLhBqKDsTW0FV1OXBhAdOW9y27 DnbJIlMlevqqJkovZDaZZeui60kulUQGlb2T/GZzcDNnFHV3Gz29ANgDeIKW2bLQoUIG hRRIkRmbQRBnWL7QsmuwK46LRFCcyVN21G0MEHm1Y/TtLaOALz71M5oRLz3Ni+8uY6d1 HqLg== X-Forwarded-Encrypted: i=1; AJvYcCVwP8Z81p3yNK68Nfy0Tt8qACGNNq5X1jAGxRLvtV3cnK0vNW5aQagNAt1Jji5iJJGbMG6FI4+APt7Mbuo=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf7zZiZJST8KfkCQReqhkC4pAP8sOuNWkVuayyFUrzZWtgmJc9 MAKN9iW6tDPbHtP+ggVK47+3tSMXKo5IsSEduAelSIKQUbFe7BfwOx7xScH3JbyyG7kDTFMR5WW RjxxEmg== X-Google-Smtp-Source: AGHT+IGfxe1pre0Ru6WgDcMEJLC2GoGSa7ujgL6qXJIB7Yn79ai4Bf73VFPBxmxv5ikoVklpodNHzkq0LDc= X-Received: from plvv9.prod.google.com ([2002:a17:902:d089:b0:28e:804c:cc96]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e786:b0:26e:7468:8a99 with SMTP id d9443c01a7336-290272c18e1mr271502235ad.36.1760387658511; Mon, 13 Oct 2025 13:34:18 -0700 (PDT) Date: Mon, 13 Oct 2025 20:33:26 +0000 In-Reply-To: <20251013203331.398517-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251013203331.398517-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251013203331.398517-3-jthies@google.com> Subject: [PATCH v4 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions From: Jameson Thies To: dmitry.baryshkov@oss.qualcomm.com, akuchynski@chromium.org, abhishekpandit@chromium.org, krzk+dt@kernel.org, robh@kernel.org, bleung@chromium.org, heikki.krogerus@linux.intel.com, ukaszb@chromium.org, tzungbi@kernel.org Cc: devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for cros_ec_ucsi to load based on "google,cros-ec-ucsi" compatible devices and "GOOG0021" ACPI nodes. Signed-off-by: Jameson Thies Reviewed-by: Heikki Krogerus Reviewed-by: Benson Leung Reviewed-by: Abhishek Pandit-Subedi --- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi= /cros_ec_ucsi.c index eed2a7d0ebc6..0c19ba84d11c 100644 --- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c +++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c @@ -5,11 +5,13 @@ * Copyright 2024 Google LLC. */ =20 +#include #include #include #include #include #include +#include #include #include #include @@ -235,7 +237,6 @@ static void cros_ucsi_destroy(struct cros_ucsi_data *ud= ata) static int cros_ucsi_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; - struct cros_ec_dev *ec_data =3D dev_get_drvdata(dev->parent); struct cros_ucsi_data *udata; int ret; =20 @@ -243,9 +244,16 @@ static int cros_ucsi_probe(struct platform_device *pde= v) if (!udata) return -ENOMEM; =20 + /* ACPI and OF FW nodes for cros_ec_ucsi are children of the ChromeOS EC.= If the + * cros_ec_ucsi device has an ACPI or OF FW node, its parent is the Chrom= eOS EC device. + * Platforms without a FW node for cros_ec_ucsi may add it as a subdevice= of cros_ec_dev. + */ udata->dev =3D dev; + if (is_acpi_device_node(dev->fwnode) || is_of_node(dev->fwnode)) + udata->ec =3D dev_get_drvdata(dev->parent); + else + udata->ec =3D ((struct cros_ec_dev *)dev_get_drvdata(dev->parent))->ec_d= ev; =20 - udata->ec =3D ec_data->ec_dev; if (!udata->ec) return dev_err_probe(dev, -ENODEV, "couldn't find parent EC device\n"); =20 @@ -326,10 +334,24 @@ static const struct platform_device_id cros_ucsi_id[]= =3D { }; MODULE_DEVICE_TABLE(platform, cros_ucsi_id); =20 +static const struct acpi_device_id cros_ec_ucsi_acpi_device_ids[] =3D { + { "GOOG0021", 0 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, cros_ec_ucsi_acpi_device_ids); + +static const struct of_device_id cros_ucsi_of_match[] =3D { + { .compatible =3D "google,cros-ec-ucsi", }, + {} +}; +MODULE_DEVICE_TABLE(of, cros_ucsi_of_match); + static struct platform_driver cros_ucsi_driver =3D { .driver =3D { .name =3D KBUILD_MODNAME, .pm =3D &cros_ucsi_pm_ops, + .acpi_match_table =3D cros_ec_ucsi_acpi_device_ids, + .of_match_table =3D cros_ucsi_of_match, }, .id_table =3D cros_ucsi_id, .probe =3D cros_ucsi_probe, --=20 2.51.0.858.gf9c4a03a3a-goog From nobody Thu Dec 18 18:03:49 2025 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 3456430EF80 for ; Mon, 13 Oct 2025 20:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387663; cv=none; b=OTnpiHuAkUNKD0noXvl9hsWJciZYyXVEBUR7lEJRZmKV4R5cSPDxgGT9xrEVnUogiSYMGC0QekdBAwHO4dG1mL+gp0egMgc7TVem5cgrj1D9t5lDRhEBQaC1GR1XGuZkDl2nDiDOwLqk+kZoA5jctS0bOY5S+56GgoLHajD+uNU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760387663; c=relaxed/simple; bh=R1YnFh8aXUGKuVVtnPClepvt/LVUGJ/UtnMqEulZIYo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dUFwHb6GPtDWxiW4cSGWH83XoGLQx+kpy60zRVKn3U6qN3UD7tiFBI7uUMpySaT2tey78u33q0psgn7JVMX3GnI3WlilJS6ifs9j2Oa0J7MC9uqpAQnpDJgocswqeMQpKDEktLmO9BjtFJT+jQvqEsPqWIFw/mii02resk4l0y8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bMO52PQz; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bMO52PQz" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-7811685b417so43821207b3.1 for ; Mon, 13 Oct 2025 13:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1760387660; x=1760992460; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=GFnB74J1pAvDm1nl6YVxkFp2KLUlGXZiPBf1NrkOorI=; b=bMO52PQzI4F9dPx84r//NPWVXxaBOt65XYRWH9LDhdRM7bXFtZStQCFKaejRJhfSlS OQr9g6hDIBxLYdnioYiARYTbaxVzMeBwdhU7ELfWZMgScGo2JrGUCwXWky8qDrcDaBPU SnCMo5/9alVda50NLSfhgeblc94Nb4NkQSO8rzGm+CZ5gldUd04tQp/WMU4+hYyC9Rha MoWgdQsvzv6eEzhFeqahauHedOUl9E8y/T7WtB2jbbYcUpqo92hJssxkD6zG2ZnfXccf YuUH5Q98qKN6joDtJ3EwZ3w/f5xDidnCDT40rTwBvJ6nrP5mYhT6rDbPYqrkF99cJvhU YbFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760387660; x=1760992460; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GFnB74J1pAvDm1nl6YVxkFp2KLUlGXZiPBf1NrkOorI=; b=pkAwkvRBL8VFDtbs+1WVIwFVLIdbQhTabYpxX4qcvb2Z3GHD5cypa0Fgx6nsYuvASM UwtR9457rQSHiWuyzRoDxyMZXJwqjinAZWqu+aI87qSR41q55eexPn/vG8bkbVXlN/CO 8l66uDPvYJo6Hm/Y+7XVuqVZ2o3q2Ogv5nhFDtTfoQp15WXHKfKc+wcRJxcnvuOYYsOM jgy9HgGtoeM2YR57mmkAOg4wtlMMIUwKWLZjJMj4aJUVAzqqeKLzZxcPEXL+X1y2ryz8 MvgF50mdD84Cyrog9sGRWNEEagAYv6s/1B2bTrxRNpyijVf4fjAsWJBH3XSw3CTpZQKa i3qw== X-Forwarded-Encrypted: i=1; AJvYcCWIdcsyh+4alldssSSRCArMKI1rt8NNGm7VwGduq+Wal5DjcDASh2HzQB6ofkIWBtot4vOIK/hha7+L/Sw=@vger.kernel.org X-Gm-Message-State: AOJu0YxU/FriNkWIz0m5LGWcM8O56au/yZt35vGD71bSaK8dsXflijkH akD4hENVuwLNcwIELPYPy80lqY/UcWkS4xJDibfriK09+EjEVUkVaG97PJfpTQxMwaJakGcaGrR rEbOvtw== X-Google-Smtp-Source: AGHT+IEjUm82raEjN7d+M3tvikmOo78EaMWdJ4VaMRN5Im1/+9AxanQNq/18YLWj74gbMAzsjUUto92DYFo= X-Received: from ywbjh10.prod.google.com ([2002:a05:690c:710a:b0:780:e432:6fc7]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a05:690c:7487:b0:781:64f:3145 with SMTP id 00721157ae682-781064f72ecmr131650497b3.67.1760387660244; Mon, 13 Oct 2025 13:34:20 -0700 (PDT) Date: Mon, 13 Oct 2025 20:33:27 +0000 In-Reply-To: <20251013203331.398517-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251013203331.398517-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.858.gf9c4a03a3a-goog Message-ID: <20251013203331.398517-4-jthies@google.com> Subject: [PATCH v4 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI From: Jameson Thies To: dmitry.baryshkov@oss.qualcomm.com, akuchynski@chromium.org, abhishekpandit@chromium.org, krzk+dt@kernel.org, robh@kernel.org, bleung@chromium.org, heikki.krogerus@linux.intel.com, ukaszb@chromium.org, tzungbi@kernel.org Cc: devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jameson Thies Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On devices with a UCSI PPM in the EC, check for cros_ec_ucsi to be defined in the OF device tree or an ACPI node. If it is defined by either OF or ACPI, it does not need to be added as a subdevice of cros_ec_dev mfd. cros_ec_ucsi will load from the OF or ACPI node. Signed-off-by: Jameson Thies Reviewed-by: Benson Leung Reviewed-by: Abhishek Pandit-Subedi --- drivers/mfd/cros_ec_dev.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index dc80a272726b..1928c2ea2b8f 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -5,6 +5,7 @@ * Copyright (C) 2014 Google, Inc. */ =20 +#include #include #include #include @@ -131,11 +132,6 @@ static const struct cros_feature_to_cells cros_subdevi= ces[] =3D { .mfd_cells =3D cros_ec_rtc_cells, .num_cells =3D ARRAY_SIZE(cros_ec_rtc_cells), }, - { - .id =3D EC_FEATURE_UCSI_PPM, - .mfd_cells =3D cros_ec_ucsi_cells, - .num_cells =3D ARRAY_SIZE(cros_ec_ucsi_cells), - }, { .id =3D EC_FEATURE_HANG_DETECT, .mfd_cells =3D cros_ec_wdt_cells, @@ -264,6 +260,23 @@ static int ec_device_probe(struct platform_device *pde= v) } } =20 + /* + * FW nodes can load cros_ec_ucsi, but early PDC devices did not define + * the required nodes. On PDC systems without FW nodes for cros_ec_ucsi, + * the driver should be added as an mfd subdevice. + */ + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) && + cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM) && + !acpi_dev_found("GOOG0021") && + !of_find_compatible_node(NULL, NULL, "google,cros-ec-ucsi")) { + retval =3D mfd_add_hotplug_devices(ec->dev, + cros_ec_ucsi_cells, + ARRAY_SIZE(cros_ec_ucsi_cells)); + + if (retval) + dev_warn(ec->dev, "failed to add cros_ec_ucsi: %d\n", retval); + } + /* * UCSI provides power supply information so we don't need to separately * load the cros_usbpd_charger driver. --=20 2.51.0.858.gf9c4a03a3a-goog