Re: [PATCH 5/6] platform/chrome: cros_ec_lpc: Correct ACPI name for Framework Laptop

From: Tzung-Bi Shih
Date: Thu May 23 2024 - 22:26:48 EST


On Thu, May 23, 2024 at 07:42:00PM +0100, Ben Walsh wrote:
> 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.

>From the context you provided, instead of matching "PNP0C09" in the driver,
it makes more sense to me (for Framework EC):

* Mainly use DMI match.
* Add a quirk for looking up (acpi_get_devices()?) and binding
(e.g. ACPI_COMPANION_SET()) the `adev` in cros_ec_lpc_probe().