blob: 0038a983d981911828ec17fd15e5b1ae036c1d09 [file] [log] [blame]
From 73c9e268b0b92d3dcf2fc8647adf19f5524b2f61 Mon Sep 17 00:00:00 2001
From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Date: Tue, 11 Jun 2024 17:32:40 -0700
Subject: [PATCH] CHROMIUM: mfd: cros_ec: Don't load charger with UCSI
When UCSI is enabled, don't load cros_usbpd_charger and
cros_usbpd_logger. Charger functionality is provided by the UCSI driver
already and logging will need to be added.
BUG=b:319125287
TEST=emerge-brox chromeos-kernel-6_6
UPSTREAM-TASK=b:335338337
Change-Id: I3935ec2996f0898c7a7a23975f4841dc94a92aa9
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5626892
Tested-by: Abhishek Pandit-Subedi <abhishekpandit@google.com>
Commit-Queue: Abhishek Pandit-Subedi <abhishekpandit@google.com>
Reviewed-by: Jameson Thies <jthies@google.com>
---
drivers/mfd/cros_ec_dev.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 7d5a5e34e87223c9c8214252da68f12a3cad8a19..eccbd2a763a9e86c50f42fa80c82890ba2f46d7e 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -120,11 +120,6 @@ static const struct cros_feature_to_cells cros_subdevices[] = {
.mfd_cells = cros_ec_rtc_cells,
.num_cells = ARRAY_SIZE(cros_ec_rtc_cells),
},
- {
- .id = EC_FEATURE_USB_PD,
- .mfd_cells = cros_usbpd_charger_cells,
- .num_cells = ARRAY_SIZE(cros_usbpd_charger_cells),
- },
{
.id = EC_FEATURE_UCSI_PPM,
.mfd_cells = cros_ec_ucsi_cells,
@@ -242,6 +237,21 @@ static int ec_device_probe(struct platform_device *pdev)
}
}
+ /*
+ * UCSI provides power supply information so we don't need to separately
+ * load the cros_usbpd_charger driver.
+ */
+ if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) &&
+ !cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM)) {
+ retval = mfd_add_hotplug_devices(ec->dev,
+ cros_usbpd_charger_cells,
+ ARRAY_SIZE(cros_usbpd_charger_cells));
+
+ if (retval)
+ dev_warn(ec->dev, "failed to add usbpd-charger: %d\n",
+ retval);
+ }
+
/*
* Lightbar is a special case. Newer devices support autodetection,
* but older ones do not.
--
2.45.2.803.g4e1b14247a-goog