* [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready
@ 2025-09-26 20:22 Jameson Thies
2025-09-26 21:34 ` Benson Leung
2025-10-02 11:32 ` Tzung-Bi Shih
0 siblings, 2 replies; 6+ messages in thread
From: Jameson Thies @ 2025-09-26 20:22 UTC (permalink / raw)
To: akuchynski, bleung, abhishekpandit, tzungbi
Cc: jthies, chrome-platform, linux-kernel
The cros-usbpd-notify-acpi probe currently does not exit when it fails
to get a pointer to the ChromeOS EC device. It is expected behavior on
older devices, where GOOG0004 is not a parent of GOOG0003.
Update the cros-usbpd-notify-acpi probe to check for a GOOG0004 parent
fwnode. If the device has correct device hierarchy and fails to get an
EC device pointer, defer the probe function.
Signed-off-by: Jameson Thies <jthies@google.com>
---
drivers/platform/chrome/cros_usbpd_notify.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c
index 313d2bcd577b..2681bf9d0159 100644
--- a/drivers/platform/chrome/cros_usbpd_notify.c
+++ b/drivers/platform/chrome/cros_usbpd_notify.c
@@ -6,6 +6,7 @@
*/
#include <linux/acpi.h>
+#include <linux/fwnode.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_proto.h>
@@ -15,6 +16,7 @@
#define DRV_NAME "cros-usbpd-notify"
#define DRV_NAME_PLAT_ACPI "cros-usbpd-notify-acpi"
#define ACPI_DRV_NAME "GOOG0003"
+#define CREC_DRV_NAME "GOOG0004"
static BLOCKING_NOTIFIER_HEAD(cros_usbpd_notifier_list);
@@ -98,8 +100,9 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
{
struct cros_usbpd_notify_data *pdnotify;
struct device *dev = &pdev->dev;
- struct acpi_device *adev;
+ struct acpi_device *adev, *parent_adev;
struct cros_ec_device *ec_dev;
+ struct fwnode_handle *parent_fwnode;
acpi_status status;
adev = ACPI_COMPANION(dev);
@@ -114,8 +117,18 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
/*
* We continue even for older devices which don't have the
* correct device heirarchy, namely, GOOG0003 is a child
- * of GOOG0004.
+ * of GOOG0004. If GOOG0003 is a child of GOOG0004 and we
+ * can't get a pointer to the Chrome EC device, defer the
+ * probe function.
*/
+ parent_fwnode = fwnode_call_ptr_op(dev->fwnode, get_parent);
+ if (parent_fwnode) {
+ parent_adev = to_acpi_device_node(parent_fwnode);
+ if (parent_adev &&
+ acpi_dev_hid_match(parent_adev, CREC_DRV_NAME)) {
+ return -EPROBE_DEFER;
+ }
+ }
dev_warn(dev, "Couldn't get Chrome EC device pointer.\n");
}
base-commit: 48633acccf38d706d7b368400647bb9db9caf1ae
--
2.51.0.618.g983fd99d29-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready
2025-09-26 20:22 [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready Jameson Thies
@ 2025-09-26 21:34 ` Benson Leung
2025-10-02 11:32 ` Tzung-Bi Shih
1 sibling, 0 replies; 6+ messages in thread
From: Benson Leung @ 2025-09-26 21:34 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, bleung, abhishekpandit, tzungbi, chrome-platform,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2743 bytes --]
Hi Jameson,
On Fri, Sep 26, 2025 at 08:22:34PM +0000, Jameson Thies wrote:
> The cros-usbpd-notify-acpi probe currently does not exit when it fails
> to get a pointer to the ChromeOS EC device. It is expected behavior on
> older devices, where GOOG0004 is not a parent of GOOG0003.
>
> Update the cros-usbpd-notify-acpi probe to check for a GOOG0004 parent
> fwnode. If the device has correct device hierarchy and fails to get an
> EC device pointer, defer the probe function.
>
> Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
> ---
> drivers/platform/chrome/cros_usbpd_notify.c | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_usbpd_notify.c b/drivers/platform/chrome/cros_usbpd_notify.c
> index 313d2bcd577b..2681bf9d0159 100644
> --- a/drivers/platform/chrome/cros_usbpd_notify.c
> +++ b/drivers/platform/chrome/cros_usbpd_notify.c
> @@ -6,6 +6,7 @@
> */
>
> #include <linux/acpi.h>
> +#include <linux/fwnode.h>
> #include <linux/mod_devicetable.h>
> #include <linux/module.h>
> #include <linux/platform_data/cros_ec_proto.h>
> @@ -15,6 +16,7 @@
> #define DRV_NAME "cros-usbpd-notify"
> #define DRV_NAME_PLAT_ACPI "cros-usbpd-notify-acpi"
> #define ACPI_DRV_NAME "GOOG0003"
> +#define CREC_DRV_NAME "GOOG0004"
>
> static BLOCKING_NOTIFIER_HEAD(cros_usbpd_notifier_list);
>
> @@ -98,8 +100,9 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
> {
> struct cros_usbpd_notify_data *pdnotify;
> struct device *dev = &pdev->dev;
> - struct acpi_device *adev;
> + struct acpi_device *adev, *parent_adev;
> struct cros_ec_device *ec_dev;
> + struct fwnode_handle *parent_fwnode;
> acpi_status status;
>
> adev = ACPI_COMPANION(dev);
> @@ -114,8 +117,18 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
> /*
> * We continue even for older devices which don't have the
> * correct device heirarchy, namely, GOOG0003 is a child
> - * of GOOG0004.
> + * of GOOG0004. If GOOG0003 is a child of GOOG0004 and we
> + * can't get a pointer to the Chrome EC device, defer the
> + * probe function.
> */
> + parent_fwnode = fwnode_call_ptr_op(dev->fwnode, get_parent);
> + if (parent_fwnode) {
> + parent_adev = to_acpi_device_node(parent_fwnode);
> + if (parent_adev &&
> + acpi_dev_hid_match(parent_adev, CREC_DRV_NAME)) {
> + return -EPROBE_DEFER;
> + }
> + }
> dev_warn(dev, "Couldn't get Chrome EC device pointer.\n");
> }
>
>
> base-commit: 48633acccf38d706d7b368400647bb9db9caf1ae
> --
> 2.51.0.618.g983fd99d29-goog
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready
2025-09-26 20:22 [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready Jameson Thies
2025-09-26 21:34 ` Benson Leung
@ 2025-10-02 11:32 ` Tzung-Bi Shih
2025-10-02 19:42 ` Jameson Thies
1 sibling, 1 reply; 6+ messages in thread
From: Tzung-Bi Shih @ 2025-10-02 11:32 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, bleung, abhishekpandit, chrome-platform, linux-kernel
On Fri, Sep 26, 2025 at 08:22:34PM +0000, Jameson Thies wrote:
> @@ -15,6 +16,7 @@
> #define DRV_NAME "cros-usbpd-notify"
> #define DRV_NAME_PLAT_ACPI "cros-usbpd-notify-acpi"
> #define ACPI_DRV_NAME "GOOG0003"
> +#define CREC_DRV_NAME "GOOG0004"
What does CREC stand for?
> @@ -114,8 +117,18 @@ static int cros_usbpd_notify_probe_acpi(struct platform_device *pdev)
> /*
> * We continue even for older devices which don't have the
> * correct device heirarchy, namely, GOOG0003 is a child
> - * of GOOG0004.
> + * of GOOG0004. If GOOG0003 is a child of GOOG0004 and we
> + * can't get a pointer to the Chrome EC device, defer the
> + * probe function.
> */
> + parent_fwnode = fwnode_call_ptr_op(dev->fwnode, get_parent);
Does it make more sense to use fwnode_get_parent()?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready
2025-10-02 11:32 ` Tzung-Bi Shih
@ 2025-10-02 19:42 ` Jameson Thies
2025-10-03 2:25 ` Tzung-Bi Shih
0 siblings, 1 reply; 6+ messages in thread
From: Jameson Thies @ 2025-10-02 19:42 UTC (permalink / raw)
To: Tzung-Bi Shih
Cc: akuchynski, bleung, abhishekpandit, chrome-platform, linux-kernel
> > +#define CREC_DRV_NAME "GOOG0004"
>
> What does CREC stand for?
CrOS EC. "CREC" is the device name used in the ACPI definition for GOOG0004.
>
> Does it make more sense to use fwnode_get_parent()?
I was initially planning to use fwnode_get_parent(), but calling that
from cros_usbpd_notify.c would require an ABI update to build for
android.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready
2025-10-02 19:42 ` Jameson Thies
@ 2025-10-03 2:25 ` Tzung-Bi Shih
2025-10-07 0:02 ` Jameson Thies
0 siblings, 1 reply; 6+ messages in thread
From: Tzung-Bi Shih @ 2025-10-03 2:25 UTC (permalink / raw)
To: Jameson Thies
Cc: akuchynski, bleung, abhishekpandit, chrome-platform, linux-kernel
On Thu, Oct 02, 2025 at 12:42:09PM -0700, Jameson Thies wrote:
> >
> > Does it make more sense to use fwnode_get_parent()?
>
> I was initially planning to use fwnode_get_parent(), but calling that
> from cros_usbpd_notify.c would require an ABI update to build for
> android.
It doesn't change the ABI but extend the dependencies.
I think fwnode_get_parent() should be preferred to use from maintenance
aspect.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-07 0:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 20:22 [PATCH v1] platform/chrome: cros_usbpd_notify: defer probe when parent EC driver isn't ready Jameson Thies
2025-09-26 21:34 ` Benson Leung
2025-10-02 11:32 ` Tzung-Bi Shih
2025-10-02 19:42 ` Jameson Thies
2025-10-03 2:25 ` Tzung-Bi Shih
2025-10-07 0:02 ` Jameson Thies
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox