From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Raul Rangel <rrangel@chromium.org>
Cc: Mark Hasemeyer <markhas@chromium.org>,
LKML <linux-kernel@vger.kernel.org>,
Bhanu Prakash Maiya <bhanumaiya@chromium.org>,
Benson Leung <bleung@chromium.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Guenter Roeck <groeck@chromium.org>,
chrome-platform@lists.linux.dev
Subject: Re: [PATCH v7 3/3] platform/chrome: cros_ec_uart: Add DT enumeration support
Date: Thu, 1 Dec 2022 11:07:17 +0800 [thread overview]
Message-ID: <Y4gaZeqLj4RgLv6W@google.com> (raw)
In-Reply-To: <CAHQZ30Dm1XbcQXjKXAfWUimL7NzYS8tkfwANpnB8kVRORsAjzw@mail.gmail.com>
On Wed, Nov 30, 2022 at 09:52:29AM -0700, Raul Rangel wrote:
> On Wed, Nov 30, 2022 at 12:10 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
> >
> > On Tue, Nov 29, 2022 at 11:13:04AM -0700, Mark Hasemeyer wrote:
> > > > > @@ -392,6 +393,12 @@ static int __maybe_unused cros_ec_uart_resume(struct device *dev)
> > > > > static SIMPLE_DEV_PM_OPS(cros_ec_uart_pm_ops, cros_ec_uart_suspend,
> > > > > cros_ec_uart_resume);
> > > > >
> > > > > +static const struct of_device_id cros_ec_uart_of_match[] = {
> > > > > + { .compatible = "google,cros-ec-uart" },
> > > > > + {}
> > > > > +};
> > > > > +MODULE_DEVICE_TABLE(of, cros_ec_uart_of_match);
> > > >
> > > > It would need a guard for checking CONFIG_OF. Similar to what
> > > > `cros_ec_uart_acpi_id` does.
> > > >
> > > > > @@ -405,6 +412,7 @@ static struct serdev_device_driver cros_ec_uart_driver = {
> > > > > .driver = {
> > > > > .name = "cros-ec-uart",
> > > > > .acpi_match_table = ACPI_PTR(cros_ec_uart_acpi_id),
> > > > > + .of_match_table = cros_ec_uart_of_match,
> > > >
> > > > It would need be wrapped by `of_match_ptr()`. Similar to what
> > > > `ACPI_PTR()` does.
> > >
> > > I'm not sure we want a guard in this case because we compile the kernel without
> > > CONFIG_OF enabled for (most?) x86 platforms. Yet we still need the device
> > > tree code to enumerate using the PRP0001 _HID method.
> >
>
> > I'm not familiar to ACPI. However, I thought it should add the compatible
> > string in the _DSD instead of using of_match for the case. See example
> > in [1].
> >
> > [1]: https://www.kernel.org/doc/html/latest/firmware-guide/acpi/enumeration.html#device-tree-namespace-link-device-id
>
> Correct, we need to add the compatible string inside the _DSD. This is
> what we currently do for all of our released devices:
> ```
> Device (CRFP)
> {
> Name (_HID, "PRP0001") // _HID: Hardware ID
> Name (_UID, Zero) // _UID: Unique ID
> Name (_DDN, "Fingerprint Reader") // _DDN: DOS Device Name
> Name (_DSD, Package (0x02) // _DSD: Device-Specific Data
> {
> ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device
> Properties for _DSD */,
> Package (0x03)
> {
> Package (0x02)
> {
> "compatible",
> "google,cros-ec-uart"
> },
> ...
> }
> }
> }
> ```
>
> Since we define our `_HID` as `PRP0001` we need the `of_match_table`
> so the ACPI node can bind.
I see. I also found some more examples:
- 3c3969a0c99b ("iio:adc:ti-adc12138: Switch to generic firmware properties
and drop of_match_ptr")
- a70bbbe387d0 ("nfc: pn533: drop of_match_ptr from device ID table")
next prev parent reply other threads:[~2022-12-01 3:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 18:48 [PATCH v7 1/3] platform/chrome: cros_ec_uart: Add cros-ec-uart transport layer Mark Hasemeyer
2022-11-17 18:48 ` [PATCH v7 2/3] dt-bindings: mfd: Add DT compatible string "google,cros_ec_uart" Mark Hasemeyer
2022-11-18 5:44 ` Tzung-Bi Shih
2022-11-18 8:59 ` Lee Jones
2022-11-18 9:19 ` Tzung-Bi Shih
2022-11-18 12:47 ` Krzysztof Kozlowski
2022-11-18 12:42 ` Guenter Roeck
2022-11-18 14:28 ` Lee Jones
2022-11-18 12:49 ` Krzysztof Kozlowski
2022-11-17 18:48 ` [PATCH v7 3/3] platform/chrome: cros_ec_uart: Add DT enumeration support Mark Hasemeyer
2022-11-18 5:44 ` Tzung-Bi Shih
2022-11-29 18:13 ` Mark Hasemeyer
2022-11-30 7:09 ` Tzung-Bi Shih
2022-11-30 16:52 ` Raul Rangel
2022-12-01 3:07 ` Tzung-Bi Shih [this message]
2022-11-18 5:43 ` [PATCH v7 1/3] platform/chrome: cros_ec_uart: Add cros-ec-uart transport layer Tzung-Bi Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y4gaZeqLj4RgLv6W@google.com \
--to=tzungbi@kernel.org \
--cc=bhanumaiya@chromium.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markhas@chromium.org \
--cc=rrangel@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.