All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.