* [PATCH] platform/chrome: cros_usbpd_logger: fail probe if HC not supported
@ 2025-02-20 2:34 Daniel Schaefer
2025-02-20 9:48 ` Tzung-Bi Shih
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Schaefer @ 2025-02-20 2:34 UTC (permalink / raw)
To: chrome-platform
Cc: Daniel Schaefer, Benson Leung, Tzung-Bi Shih, Dustin L . Howett,
linux
If the EC_CMD_PD_GET_LOG_ENTRY does not exist, the driver does not need
to stay active.
Framework Computer systems don't use the PD infrastructure in the chrome
EC firmware, so it does not support this host command.
Previously the driver probe would always succeed and periodically keep
trying to use this host command, resulting in unnecessary EC traffic and
EC log error messages.
Cc: Benson Leung <bleung@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Dustin L. Howett <dustin@howett.net>
Cc: <linux@frame.work>
Signed-off-by: Daniel Schaefer <dhs@frame.work>
---
With this patch the following dmesg log appears on Framework systems.
[ 25.171086] cros-usbpd-logger cros-usbpd-logger.8.auto: host command not supported.
drivers/platform/chrome/cros_usbpd_logger.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c
index 7ce75e2e039e..df6b1d97589a 100644
--- a/drivers/platform/chrome/cros_usbpd_logger.c
+++ b/drivers/platform/chrome/cros_usbpd_logger.c
@@ -207,6 +207,11 @@ static int cros_usbpd_logger_probe(struct platform_device *pd)
logger->dev = dev;
logger->ec_dev = ec_dev;
+ if (-EOPNOTSUPP == PTR_ERR(ec_get_log_entry(logger))) {
+ dev_info(dev, "host command not supported.\n");
+ return -ENODEV;
+ }
+
platform_set_drvdata(pd, logger);
/* Retrieve PD event logs periodically */
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] platform/chrome: cros_usbpd_logger: fail probe if HC not supported
2025-02-20 2:34 [PATCH] platform/chrome: cros_usbpd_logger: fail probe if HC not supported Daniel Schaefer
@ 2025-02-20 9:48 ` Tzung-Bi Shih
2025-03-03 7:07 ` Daniel Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Tzung-Bi Shih @ 2025-02-20 9:48 UTC (permalink / raw)
To: Daniel Schaefer; +Cc: chrome-platform, Benson Leung, Dustin L . Howett, linux
On Thu, Feb 20, 2025 at 10:34:41AM +0800, Daniel Schaefer wrote:
> If the EC_CMD_PD_GET_LOG_ENTRY does not exist, the driver does not need
> to stay active.
>
> Framework Computer systems don't use the PD infrastructure in the chrome
> EC firmware, so it does not support this host command.
Does the firmware still report `EC_FEATURE_USB_PD` feature [1]? Similarly,
do "cros-charge-control" and "cros-usbpd-charger" need to stay active [2]?
[1]: https://elixir.bootlin.com/linux/v6.13/source/drivers/mfd/cros_ec_dev.c#L263
[2]: https://elixir.bootlin.com/linux/v6.13/source/drivers/mfd/cros_ec_dev.c#L89
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/chrome: cros_usbpd_logger: fail probe if HC not supported
2025-02-20 9:48 ` Tzung-Bi Shih
@ 2025-03-03 7:07 ` Daniel Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Schaefer @ 2025-03-03 7:07 UTC (permalink / raw)
To: Tzung-Bi Shih; +Cc: chrome-platform, Benson Leung, Dustin L . Howett, linux
You are right, if we remove this feature, the driver won't load. So we
don't need this kernel patch.
We found there's a bug in Chrome EC where it enables this feature,
even when the Kconfig is turned off.
We're including this patch in our future Framework EC builds:
https://github.com/FrameworkComputer/EmbeddedController/commit/57030a466bb7e130313cf2b2a305a753e9c9a55e
On Thu, Feb 20, 2025 at 5:48 PM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> On Thu, Feb 20, 2025 at 10:34:41AM +0800, Daniel Schaefer wrote:
> > If the EC_CMD_PD_GET_LOG_ENTRY does not exist, the driver does not need
> > to stay active.
> >
> > Framework Computer systems don't use the PD infrastructure in the chrome
> > EC firmware, so it does not support this host command.
>
> Does the firmware still report `EC_FEATURE_USB_PD` feature [1]? Similarly,
> do "cros-charge-control" and "cros-usbpd-charger" need to stay active [2]?
>
> [1]: https://elixir.bootlin.com/linux/v6.13/source/drivers/mfd/cros_ec_dev.c#L263
> [2]: https://elixir.bootlin.com/linux/v6.13/source/drivers/mfd/cros_ec_dev.c#L89
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-03 7:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 2:34 [PATCH] platform/chrome: cros_usbpd_logger: fail probe if HC not supported Daniel Schaefer
2025-02-20 9:48 ` Tzung-Bi Shih
2025-03-03 7:07 ` Daniel Schaefer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.