From nobody Thu Oct 2 01:01:41 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 AC9991E520C for ; Tue, 30 Sep 2025 01:24:25 +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=1759195467; cv=none; b=pG0Ekerw30bfpuPdsPN1izQm4RHQVxdmtbp54i/PJBTW8SVCFYJPYWxhE30ylbTqdh8zvBFXcnNQhYB6+W0GEPj2u10SaAcLseRrKMtuTGpVrzm3cSwhb2418vLog1fppqZECM/A4scXN8LVkLie96fOqc0PfUd7OQrvhDv6bQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759195467; c=relaxed/simple; bh=K/Ast7zI4CBJT0EMM1Wyl6eslOV+td2jx96m2YIfAWY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NwC3XMMzvkr1V2+VX/EFyv5jVTnRWCMqymlkWGe0U6t+0Rxt5Lr+9qHzNGJxgSIm0CyZrv6mLNMf/KIhHqp8PuhRixCQhBHkcQzGa0mxPoanv2WAeJcNIudg/NgU3ErQHnluhDunSgOKbXfefL6bHduaNZmOx/EdjjJ/7+MI9kA= 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=PKeCj5zf; 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="PKeCj5zf" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-269880a7bd9so64595155ad.3 for ; Mon, 29 Sep 2025 18:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1759195465; x=1759800265; 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=aqKmfga5+DprzT5XPy4gegnRDxSvFLR2QAkxrjqmzq8=; b=PKeCj5zfV81HFeM393ae+j4rCl3jO+e9wzbbJ83x5Yr7Vx0EIwmmAInTNaPhIKYpT0 vYYNV0tszXNrqBKiCNavFdjP4A0FrnWWzTK0/E7GPPqSNy0Led7kJmp65L7TDgTd3Zp9 1ckFlz3k5P3lvUnwV7NxwiSChni3iGDGRrzHDnE+pZ59pGkftveox03l7AnVEB8Llna5 VEZrgHGnZOdKrCDrwPmKqX6c02Go9AiPV7w3Clxfq1tuRT+sXwjiw9eApMTwuFw9NZOD uKZtLSxAlBogfakpC+zhqu5jkz5vZZqNH8QlPpXjHKmCRVdXCVp1UlClGb0GV4KdKHN/ WjGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759195465; x=1759800265; 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=aqKmfga5+DprzT5XPy4gegnRDxSvFLR2QAkxrjqmzq8=; b=tmIQAXzXQIHILp+UmszznaO6nlIG0nsasw4hV2Tm/wd+4MEXcgZfyylFjXbDBtD6Tl Qsn/oRhKNH530ph6js2z/a27cERRCsLx7/g+Nj9hZbPQUhCEMh3sMbeEAnZwOE9Uj/08 5miYTZ+3wq/aPE7zeIeaC63kc/VGZ/WcEdYFjIEFXs+Rnbsa3WzeftIbVfJOYJGIst7o WxFHe3fXKs/C2qf+CGygr1/F3TvlQYeuz8H09Z05jm0LXwVdLq7kLFwZjYaUkJiGV/q5 MGDf3swERDV9+fidjF0DA8OsGC60f2R+4IaACXgJf8snwvi1295l/brZ5MaeBel+P43q 43fg== X-Forwarded-Encrypted: i=1; AJvYcCVb3JFf4S47g1JwzJG9409PFBbF8+jhWAZqdHqjbE61HucZ7XplAuFDq3LSYXx2QV5AOtFmEnQUtDVepA4=@vger.kernel.org X-Gm-Message-State: AOJu0YyyUx6lSKrtpGYbQAk1Tg2uVVBxP4axhOioGyNQz6Rw6Tvitd8O FmgoTqGOGWqUJ7HjPg3MmLflh5q7yz4FM3oMCVvw86XHIIGPFB+TueRCngzcB49jMfLuKxhOgUi Pz3jcew== X-Google-Smtp-Source: AGHT+IEp3ni/J2850XF1SC8Da4jAYRKJ8zaTUNw+gIGy76wXxB5yLFx3I78wqin08hufNLQBk+qUDJPhQio= X-Received: from plpk18.prod.google.com ([2002:a17:903:3db2:b0:261:6462:787]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e945:b0:27e:f018:d2fb with SMTP id d9443c01a7336-27ef018d516mr153000195ad.6.1759195464977; Mon, 29 Sep 2025 18:24:24 -0700 (PDT) Date: Tue, 30 Sep 2025 01:23:46 +0000 In-Reply-To: <20250930012352.413066-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: <20250930012352.413066-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.570.gb178f27e6d-goog Message-ID: <20250930012352.413066-2-jthies@google.com> Subject: [PATCH v1 1/3] dt-bindings: chrome: Add Cros EC UCSI driver From: Jameson Thies To: 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 PDCs allow the host to read port status and control port behavior with UCSI commands sent to the embedded controller (EC). Add documentation for cros-ec-ucsi node which loads the Chrome OS UCSI driver. Signed-off-by: Jameson Thies --- .../bindings/chrome/google,cros-ec-ucsi.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/chrome/google,cros-ec= -ucsi.yaml diff --git a/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.y= aml b/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml new file mode 100644 index 000000000000..2121776e3ff0 --- /dev/null +++ b/Documentation/devicetree/bindings/chrome/google,cros-ec-ucsi.yaml @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/chrome/google,cros-ec-ucsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Google Chrome OS EC(Embedded Controller) UCSI driver. + +maintainers: + - Abhishek Pandit-Subedi + - Andrei Kuchynski + - Benson Leung + - Jameson Thies + - =C5=81ukasz Bartosik + +description: + Chrome OS devices with PDC-based USB-C ports expose a UCSI interface + from the Embedded Controller (EC) which allows the host to request + port state and control limited port behavior (DR/PR swap). This node + allows the host UCSI driver to send and receive UCSI commands to a + Chrome OS EC. The node for this device should be under a cros-ec node + like google,cros-ec-spi. + +properties: + compatible: + const: google,cros-ec-ucsi + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + +patternProperties: + '^connector@[0-9a-f]+$': + $ref: /schemas/connector/usb-connector.yaml# + required: + - reg + +required: + - compatible + +additionalProperties: false + +examples: + - |+ + spi { + #address-cells =3D <1>; + #size-cells =3D <0>; + + cros_ec: ec@0 { + compatible =3D "google,cros-ec-spi"; + reg =3D <0>; + interrupts =3D <35 0>; + + typec { + compatible =3D "google,cros-ec-ucsi"; + + #address-cells =3D <1>; + #size-cells =3D <0>; + + connector@0 { + compatible =3D "usb-c-connector"; + reg =3D <0>; + power-role =3D "dual"; + data-role =3D "dual"; + try-power-role =3D "source"; + }; + }; + }; + }; --=20 2.51.0.570.gb178f27e6d-goog From nobody Thu Oct 2 01:01:41 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 8124A1E520C for ; Tue, 30 Sep 2025 01:24:30 +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=1759195472; cv=none; b=J8LFnqmrAen6opcDy5aHn9xPVCOvtYLdZiRcOU5u80vJ/KPvrl0Y8YJi4DUZLXm3oJVPQKSUNeSP+Df0mYa0jlrpnweEO7w3grFFZF2U7feeoiVhMff8bO5VX3Wi32Ggf6PemSB/QL6J35s/6jsB1SGffCn9o6Ry/SLFiu7Gol8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759195472; c=relaxed/simple; bh=N4kLniQHDskmFQXBLT0LHBLGRHO/htZMq5n45mo5spA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Yt9u3RG2i0jih36J8jGDNtpIGiZhPxfdaIzF4itnPDzIcmmtKoxc/dDmUXdQmmLo0vaQrJwhQ2yKqX+/uo8Xx5WuLAU2tbcjPAbVQfZy2vVTYo1wjIlWhTqng3koiruq7Nbwj7AWvRkH477geL+wurvxA3yL6+fc5IpCtXL2alE= 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=eRjpqdnw; 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="eRjpqdnw" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-745c3f7e569so48210247b3.1 for ; Mon, 29 Sep 2025 18:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1759195469; x=1759800269; 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=atjRbq2Ix0kpQpih72xPV1a5tslbrY8BWtKFpnViPQs=; b=eRjpqdnwHov7uNjNBAxtduOkE+1rKzXROltB2OCVb939/djWaAKDuhgTpAFNxmt5h0 O8SC5/KK5s3Vxgj96nEpX2yRHVRDMswpx1bvGrHc0nEJtQaMz2MeDrYap4uw72Ttlki8 xsKJ/5hdH6n1KrrOLHgpAbKx0D2NkAnsjKtAIF7Yxr6/plhF/XF/24i1J2sh82K+wADb wvj957d+TO+/iFLrJa1OIzm9W5vsHVfDanq618uD5gXMrZKpk6xum0vK3SC+K5Oc2RMT DVQ74L0ikOOegAb/MC1SSva3mnBerJBvAkoQ5DzXl7tDpCsKaHnKmVFSKO3HBLsuDW4K aFaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759195469; x=1759800269; 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=atjRbq2Ix0kpQpih72xPV1a5tslbrY8BWtKFpnViPQs=; b=usdJKBlxIRil0w1icAE4sdFTH3AIlgPaQCd1EJxkSUpv9M2wsV5dwNbJ75FGTMrhtR dbZRoipp3Iws4DwoPJOSdAvv8elfq6Dun80JUibhPH9bf0PHI4PFGd6Qsodyn76vK+G+ iHTBTruHtSXrnBXjU8Ju5nZ9plbLfZPSlm4lEOB4w7o1/Ha/6L9tZmNbupfxB2UGb1R8 ITkeOKU8lCWpZslLW1Mkh1M8fkb27hO4s7G49Duc++E1fxladhhY8kZtgwZZC5JcZE/S cLzAs8weFgFw9FxdX3dyVJyy2AERIswbR8dvD6mVBO9h/6Ud6xhgnfplBSnSEik7QCEL 4JLw== X-Forwarded-Encrypted: i=1; AJvYcCVYKdb/TpLkFYXEgrPKtweIkfFhsnIvniE+Jouu1XrLXqSdbHykAmXqMoukCbI0AaqYQr9bmP/d4z7Y42E=@vger.kernel.org X-Gm-Message-State: AOJu0Ywg5b1gZv/dkyTQ3ulI3fdh2Gv4V3RgOiOi+prAWwsvSOikMqvr AermGT8TqO2c8MTpouA5ypLwjzru4Z9WCjs7LqG6nnC3hWfEwlqVsmiHTQl5O5/MTsynUDr2qCr CGyiqcw== X-Google-Smtp-Source: AGHT+IF0AUjaRoUFbB9ad+iQ92cEe5cg6xNX0XH44Xe7Y4Ue8xeSsrOu4IjOY25U6TTP0/J2T1TylPh/qAM= X-Received: from ywbnh10.prod.google.com ([2002:a05:690c:5c0a:b0:735:7cbc:a939]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a05:690c:3608:b0:766:6507:686b with SMTP id 00721157ae682-7666507767bmr165283147b3.8.1759195469484; Mon, 29 Sep 2025 18:24:29 -0700 (PDT) Date: Tue, 30 Sep 2025 01:23:47 +0000 In-Reply-To: <20250930012352.413066-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: <20250930012352.413066-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.570.gb178f27e6d-goog Message-ID: <20250930012352.413066-3-jthies@google.com> Subject: [PATCH v1 2/3] usb: typec: cros_ec_ucsi: Load driver from OF and ACPI definitions From: Jameson Thies To: 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 --- drivers/usb/typec/ucsi/cros_ec_ucsi.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 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..3d19560bbaa7 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,7 @@ 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_ec_dev *ec_data; struct cros_ucsi_data *udata; int ret; =20 @@ -244,8 +246,13 @@ static int cros_ucsi_probe(struct platform_device *pde= v) return -ENOMEM; =20 udata->dev =3D dev; + if (is_acpi_device_node(dev->fwnode) || is_of_node(dev->fwnode)) { + udata->ec =3D dev_get_drvdata(pdev->dev.parent); + } else { + ec_data =3D dev_get_drvdata(dev->parent); + udata->ec =3D ec_data->ec_dev; + } =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 +333,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.570.gb178f27e6d-goog From nobody Thu Oct 2 01:01:41 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 B79F91FF5E3 for ; Tue, 30 Sep 2025 01:24:33 +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=1759195475; cv=none; b=joG6ZGSoxXZmQ7WOY5nPgyPGet+SkW60XGcsxtWJqIPTkozb9ArQN2LkkB0SWJDwHGaaNEjCpjG9FeY9f+myQCTutHWqPv5jE+AikbFOrF1HBU9hvSt/+gFZpgZkC8XjpvSryHTAkKGRjwOWDdmsqFf7tiElfbVjgY7Gqe69UXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759195475; c=relaxed/simple; bh=n5cziPQ61KRp5AtyPFgy8VJF4Lqvc2a81X5suV1ETHU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DUs2tJbyTVMcPrxE/7gIGaS4FJHsN8+kCfR76gYyp5CvSPRFNeP/TX3uKtnMh1YWoghCO6h1xVmqw9EL8RRdrwQajOS02T115t+rbkvvCi4Dxp815ptLVRvDTd/njuQ5pUIttvCQc/WSsqdXRhfcuLGqQOQ3C4xd4eN9kKEGlYA= 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=upmmxI4E; 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="upmmxI4E" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-28a5b8b12bbso39642055ad.2 for ; Mon, 29 Sep 2025 18:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1759195473; x=1759800273; 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=kogf9tvbfBCb39vdLAEVilZDn5JXEZ0lPob5kpAtHeE=; b=upmmxI4ETaz3upbs8OaweRTJP7ZvxBkAr7RbCJ1ApUn5UsLh1C8iQ/V7h8NBEhNc02 Nr7Vv4zRGfOTdlwm1M2Rjw2sG6OriH3SQEO4mTlXB4FWosLspGSO7qreCfA4VYpx+CQX ouDIDksvIBcWlwq4Bpt0OBsFfg+CdywSken9RsI74VTlfyVilSLv3ZR1yK3D0FgkN/ZU UuD0Mk5OSqfHwzaamzdbGsxVkLv4Y/70h9iPMtRj/q3UN2e3shJGpXR91O1XD0SyLiCW 03t+ebt63JvzlSzNaF4nacXAUXwj0DQ4H70MSCWPbuktQkZIDpl9U02Jop1Nk3vbuSZT +5KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759195473; x=1759800273; 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=kogf9tvbfBCb39vdLAEVilZDn5JXEZ0lPob5kpAtHeE=; b=baVRaOrWu1GGqttrd0YZ3EsfmYrEjRvbcyOUeOZnbO7DZKgdxFEpwpb8BYeeVASIUO 1OhGSYG2F5xLUWgEnIvcee9hNYwVq6RgxZmA+DJrbLSHQCxgo/pvViro/Vc5Bt3MUQMt sVQTKivnl4AT3PHgDnKHpHhlG6rLZkdFy/dGMXBFco2vD5g1RVrOOFJ2JAahUKqgFxsv w2Wadk+80UhiV8gModmWvgMYVEY6Im49j4uuYOhXYda31ygGxIxuLahpLlwvueYLbkWk ZQd2FTqF5TmI9dV+XZudpjRWVJDF8fF+OU3fwpeqCXnHSqEasgEkYbGadewZnU8sVWHb MOdA== X-Forwarded-Encrypted: i=1; AJvYcCX8GIn+g6+KG5d9iUeWkbV8bhtPHl/elD3fi3zYa9KV+ovxfgI3v7tB1XMTUuMm5TWSN+/G7X8BNJBve6M=@vger.kernel.org X-Gm-Message-State: AOJu0Yxr+CMXdht1FXdd5ROVAmTBh2JD0ixuWxlgqqcFE6pBQhB8PX+b 07V/pBToj2pt5NziwJ6zaMOUoPGX0r/2XzcnNEoHKiS93qsAhij6OWTyB9LjE51hnifn0BsdQmb 8hIPsfQ== X-Google-Smtp-Source: AGHT+IHrgMj/I7ewzUlfQ+tAFdK6lsLgX95aSaFSACakL6kqrbRRIQLYFBi7WQqIgbhinM2CjM73dUzXSCk= X-Received: from plblk8.prod.google.com ([2002:a17:903:8c8:b0:269:96fe:32ad]) (user=jthies job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e88d:b0:272:f9c3:31f7 with SMTP id d9443c01a7336-27ed4a5e907mr193803585ad.50.1759195473033; Mon, 29 Sep 2025 18:24:33 -0700 (PDT) Date: Tue, 30 Sep 2025 01:23:48 +0000 In-Reply-To: <20250930012352.413066-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: <20250930012352.413066-1-jthies@google.com> X-Mailer: git-send-email 2.51.0.570.gb178f27e6d-goog Message-ID: <20250930012352.413066-4-jthies@google.com> Subject: [PATCH v1 3/3] mfd: cros_ec: Don't add cros_ec_ucsi if it is defined in OF or ACPI From: Jameson Thies To: 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. Signed-off-by: Jameson Thies --- drivers/mfd/cros_ec_dev.c | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index dc80a272726b..b0523f6541d2 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, @@ -177,6 +173,16 @@ static const struct mfd_cell cros_ec_vbc_cells[] =3D { { .name =3D "cros-ec-vbc", } }; =20 +static int ucsi_acpi_match(struct device *dev, const void *data) +{ + struct acpi_device_id ucsi_acpi_device_ids[] =3D { + { "GOOG0021", 0 }, + {"", 0}, + }; + return !!acpi_match_device(ucsi_acpi_device_ids, dev); +} + + static void cros_ec_class_release(struct device *dev) { kfree(to_cros_ec_dev(dev)); @@ -264,6 +270,30 @@ 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)) { + struct device *acpi_dev =3D device_find_child(ec->ec_dev->dev, + NULL, + ucsi_acpi_match); + + if (!!acpi_dev) { + put_device(acpi_dev); + } else if (!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.570.gb178f27e6d-goog