Re: [PATCH 5/6] platform/chrome: cros_ec_lpc: Correct ACPI name for Framework Laptop
From: Ben Walsh
Date: Thu May 23 2024 - 14:51:16 EST
Tzung-Bi Shih <tzungbi@xxxxxxxxxx> writes:
> On Wed, May 15, 2024 at 06:56:30AM +0100, Ben Walsh wrote:
>> Framework Laptops' ACPI exposes the EC as name "PNP0C09". Use this to
>> find the device. This makes it easy to find the AML mutex via the
>> ACPI_COMPANION device.
>>
>> The name "PNP0C09" is part of the ACPI standard, not Chrome-specific,
>> so only recognise the device if the DMI data is recognised too.
>
> I don't quite understand the statement. Why it needs DMI data?
There are lots of computers with EC chips with ACPI name "PNP0C09"
because it's part of the ACPI standard (for example I have an Intel NUC
with one of these). Most of them don't support the cros_ec protocol, so
the cros_ec driver should ignore these chips. The Framework EC is
unusual in that it's called "PNP0C09" and supports the cros_ec protocol.
Before these patches, the cros_ec code just ignored PNP0C09 because it
wasn't in the match table. The cros_ec_lpc_init logic looked like:
* dmi_match => ok
* acpi_name == "GOOG0004" => ok
* otherwise fail.
After the patch, cros_ec_lpc_init still has this behaviour. We have
"PNP0C09" in the match table so the driver gets hooked up correctly
with the right "ACPI_COMPANION" device, but we don't allow the match
to proceed unless we have the DMI data indicating it's a Framework EC.
>> - } else if (!cros_ec_lpc_acpi_device_found) {
>> + } else if (cros_ec_lpc_acpi_device_found <= 0) {
>> + /* Standard EC "PNP0C09" not supported without DMI data */
>
> Also the way is a bit confusing as "PNP0C09" must be at index 0 in the
> acpi_device_id.
I need some way of saying "will we match PNP0C09?" The table index seems
a simple way of doing it. I could use a strcmp on the table match
instead?
Regarding your other emails, I agree with all your suggestions. Thanks
for reviewing!