platform/chrome: cros_ec_typec: Check for EC device
PATCH v2 1/1 platform/chrome: cros_ec_typec: Check for EC device
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
---
Hi Alyssa, could you kindly test this with your existing setup? Thanks!
Changes in v2:
- Added newlines as suggested by reviewers.
- Added Reviewed-by tag from Tzung-Bi.
drivers/platform/chrome/cros_ec_typec.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/platform/chrome/cros_ec_typec.c +6 -0
@@ -1075,7 +1075,13 @@ static int cros_typec_probe(struct platform_device *pdev)return -ENOMEM ; typec->dev = dev; + typec->ec =dev_get_drvdata (pdev->dev.parent); +if (!typec->ec) { +dev_err (dev,"couldn't find parent EC device\n" ); +return -ENODEV ; + } +platform_set_drvdata (pdev, typec); ret =cros_typec_get_cmd_version (typec);
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
Quoted 9 lines · Prashant Malani
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
Quoted 6 lines
Fixes fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")Reported-by Alyssa Ross <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Signed-off-by Prashant Malani <[email protected]>---
Hi Alyssa, could you kindly test this with your existing setup? Thanks!
Hi Prashant, I'm happy to test, but I'm on vacation until the end of the week so probably won't get a chance before Monday.
I'm guessing I should be testing with latest upstream coreboot (now that your fix there has been applied)?
Quoted 28 lines
Changes in v2:
- Added newlines as suggested by reviewers.
- Added Reviewed-by tag from Tzung-Bi.drivers/platform/chrome/cros_ec_typec.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/platform/chrome/cros_ec_typec.c +6
-1@@ -1075,7 +1075,13 @@ static int cros_typec_probe(struct platform_device *pdev)return -ENOMEM ; typec->dev = dev; + typec->ec =dev_get_drvdata (pdev->dev.parent); +if (!typec->ec) { +dev_err (dev,"couldn't find parent EC device\n" ); +return -ENODEV ; + } +platform_set_drvdata (pdev, typec); ret =cros_typec_get_cmd_version (typec); --2.35.0.rc0.227.g00780c9af4-goog
Hi Alyssa,
Quoted 17 lines · Alyssa Ross
Quoted 9 lines · Prashant Malani
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
Quoted 6 lines
Fixes fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")Reported-by Alyssa Ross <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Signed-off-by Prashant Malani <[email protected]>---
Hi Alyssa, could you kindly test this with your existing setup? Thanks!
Quoted 2 lines
Hi Prashant, I'm happy to test, but I'm on vacation until the end of the week so probably won't get a chance before Monday.
No worries, whenever you get the chance is fine.
Quoted 3 lines
I'm guessing I should be testing with latest upstream coreboot (now that your fix there has been applied)?
You should use the coreboot with which you discovered the crash, so the one which *doesn't* contain the fix.
Thanks again!
-Prashant
Hi Prashant,
Quoted 23 lines · Prashant Malani
Hi Alyssa,
Quoted 17 lines · Alyssa Ross
Quoted 9 lines · Prashant Malani
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
Quoted 6 lines
Fixes fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")Reported-by Alyssa Ross <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Signed-off-by Prashant Malani <[email protected]>---
Hi Alyssa, could you kindly test this with your existing setup? Thanks!Quoted 2 lines
Hi Prashant, I'm happy to test, but I'm on vacation until the end of the week so probably won't get a chance before Monday.
Quoted 8 lines
No worries, whenever you get the chance is fine.
Quoted 3 lines
I'm guessing I should be testing with latest upstream coreboot (now that your fix there has been applied)?
You should use the coreboot with which you discovered the crash, so the one which *doesn't* contain the fix.
I applied this patch to Linux 5.17-rc2 and tested with the coreboot_tiano-eve-mrchromebox-20210806.rom firmware.
The Oops has been replaced with
"cros-ec-typec: GOOG0014:00: couldn't find parent EC device". My laptop now reboots correctly — the hang on reboot is gone.
The cros_ec_typec driver ends up being loaded, but no devices are bound to it. This differs from the behaviour with upstream coreboot (cabf9e33a7), where cros_ec_typec does not end up being loaded.
Assuming all that's the intended behaviour:
BTW: if you need anything else tested on an eve running upstream Linux and Coreboot in future, I'm happy to be CCed. :)
Quoted 3 lines
Thanks again!
-Prashant
Hi Alyssa,
Quoted 43 lines · Alyssa Ross
Hi Prashant,
Quoted 23 lines · Prashant Malani
Hi Alyssa,
Quoted 17 lines · Alyssa Ross
Quoted 9 lines · Prashant Malani
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
Quoted 6 lines
Fixes fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")Reported-by Alyssa Ross <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Signed-off-by Prashant Malani <[email protected]>---
Hi Alyssa, could you kindly test this with your existing setup? Thanks!Quoted 2 lines
Hi Prashant, I'm happy to test, but I'm on vacation until the end of the week so probably won't get a chance before Monday.
Quoted 8 lines
No worries, whenever you get the chance is fine.
Quoted 3 lines
I'm guessing I should be testing with latest upstream coreboot (now that your fix there has been applied)?
You should use the coreboot with which you discovered the crash, so the one which *doesn't* contain the fix.
I applied this patch to Linux 5.17-rc2 and tested with the coreboot_tiano-eve-mrchromebox-20210806.rom firmware.
The Oops has been replaced with
"cros-ec-typec: GOOG0014:00: couldn't find parent EC device". My laptop now reboots correctly — the hang on reboot is gone.
Quoted 5 lines
The
cros_ec_typecdriver ends up being loaded, but no devices are bound to it. This differs from the behaviour with upstream coreboot (cabf9e33a7), wherecros_ec_typecdoes not end up being loaded.Assuming all that's the intended behaviour:
Yep, that's WAI. Thanks a lot for testing this, and yes, we'll be sure to reach out
for future help with validating changes.
Best regards,
Quoted 6 lines · Prashant Malani
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
Quoted 7 lines
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
Fixes fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")Reported-by Alyssa Ross <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Signed-off-by Prashant Malani <[email protected]>
FWIW:
Quoted 30 lines
---
Hi Alyssa, could you kindly test this with your existing setup? Thanks!Changes in v2:
- Added newlines as suggested by reviewers.
- Added Reviewed-by tag from Tzung-Bi.drivers/platform/chrome/cros_ec_typec.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/platform/chrome/cros_ec_typec.c +6
-0@@ -1075,7 +1075,13 @@ static int cros_typec_probe(struct platform_device *pdev)return -ENOMEM ; typec->dev = dev; + typec->ec =dev_get_drvdata (pdev->dev.parent); +if (!typec->ec) { +dev_err (dev,"couldn't find parent EC device\n" ); +return -ENODEV ; + } +platform_set_drvdata (pdev, typec); ret =cros_typec_get_cmd_version (typec);Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
Signature · 1 line
heikki
Benson Leung
AppliedQuoted 8 lines · Prashant Malani
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
Applied, thanks!
[1/1] platform/chrome: cros_ec_typec: Check for EC device
commit: ffebd90532728086007038986900426544e3df4e
Best regards,
Signature · 7 lines
Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. [email protected] Chromium OS Project [email protected]