From: Lukas Wunner <lukas@wunner.de>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Leif Liddy <leif.linux@gmail.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-acpi@vger.kernel.org, jarkko.nikula@linux.intel.com,
linux-spi@vger.kernel.org
Subject: Re: ACPI SPI slave device
Date: Thu, 3 Mar 2016 19:55:53 +0100 [thread overview]
Message-ID: <20160303185553.GA24603@wunner.de> (raw)
In-Reply-To: <20160303174806.GB11728@srcf.ucam.org> <20160303174535.GA11728@srcf.ucam.org>
Hi Matthew,
On Thu, Mar 03, 2016 at 05:45:35PM +0000, Matthew Garrett wrote:
> On Thu, Mar 03, 2016 at 12:47:40PM +0100, Lukas Wunner wrote:
>
> > I think you want to add a quirk to spi.c:acpi_spi_add_device()
> > which checks if acpi_dev_get_resources() returned nothing and
> > the HID of the acpi_device is APP000D: Search the namespace below
> > the acpi_device's handle for _CRS.UBUF (using acpi_get_handle()).
> > If this exists, call acpi_walk_resource_buffer() on it (with the
> > acpi_spi_add_resource callback). You need to somehow convert the
> > acpi_handle to an acpi_buffer, maybe that just involves filling in
> > acpi_buffer->pointer = acpi_handle and somehow determining the
> > length of the resource settings from the handle. Someone more
> > intimately familiar with the layout of the namespace in memory
> > should be able to answer this. Hopefully this will already get
> > you started, if not just ask questions.
>
> If Apple are consistently using this mechanism to define resources, do
> we want to extend acpi_dev_get_resources to attempt to call the _DSM
> method as well?
What Apple is doing with their _DSM is functionally equivalent to the
_DSD (Device Specific Data) method in the ACPI spec. (Apple isn't using
_DSD at all.)
We could extend drivers/acpi/property.c:acpi_init_properties() to
check if dmi_match(DMI_BOARD_VENDOR, "Apple Inc."), and instead of
calling _DSD, call _DSM with Apple's UUID and populate adev->data
with that. Or add the properties to the existing data, if any.
Then whenever we feel the need we could just retrieve Apple's
properties with acpi_dev_get_property().
E.g. in the case of this SPI slave we need to fill in five values
of struct spi_device and we would add a quirk for APP000D which
retrieves each value via acpi_dev_get_property() instead of
acpi_dev_get_resources().
Alternatively we could evaluate the _DSM individually from the
quirk and obtain the values we need from the returned package.
But being able to get them with acpi_dev_get_property() might
be more generic, it's not unlikely that we need to retrieve
Apple's properties from other quirks as well.
The suggestion I made in my previous e-mail (to fetch UBUF) was
probably not so great in terms of maintainability since Apple
might change the name of the variable in a future version of the
DSDT, or on other machines.
Best regards,
Lukas
next prev parent reply other threads:[~2016-03-03 18:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAAbRKOu+s=OZw8vw2kfWs=JCQB1YcVg+51N5Yh_dCJOuytR2zA@mail.gmail.com>
[not found] ` <20160229082114.GC1770@lahna.fi.intel.com>
[not found] ` <CAAbRKOt=CDOqD1FESZkxv4fdYSDm6qoi4J0wYn=e5mvN-NLpCA@mail.gmail.com>
[not found] ` <CAAbRKOscDyYaUqBTFVFZ2Fe81a_Kkx9oeNXHrttm3Qs_27fAzQ@mail.gmail.com>
[not found] ` <20160301160726.GA23371@wunner.de>
[not found] ` <CAAbRKOuESP+_65cmeCPNtO5HzN1+ct7bDv1stbE+a8u=KEwDKw@mail.gmail.com>
[not found] ` <CAAbRKOsNxsu4CYq=EByck997RWRO3fQ-+LAAS5AbSL3XNRSh7A@mail.gmail.com>
[not found] ` <20160302114250.GA23487@wunner.de>
[not found] ` <CAAbRKOvP9yudKbzu_GquPUzhz2VQBtuKYmJbqLpt1jFcB6U1kQ@mail.gmail.com>
[not found] ` <CAAbRKOs=ySAtqn71Mf5tyHvjqOGGRs5xsO6oU5YPYWgOSXqehA@mail.gmail.com>
2016-03-03 11:47 ` ACPI SPI slave device Lukas Wunner
[not found] ` <20160303114740.GA24132-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-03-03 17:45 ` Matthew Garrett
2016-03-03 18:55 ` Lukas Wunner [this message]
2016-03-03 19:12 ` Matthew Garrett
2016-03-08 14:40 ` Leif Liddy
[not found] ` <CAAbRKOu8UWrn5bhxjrHx5cykFWOChyxr_ZCWK=R4nYCc11cvsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-09 12:36 ` Lukas Wunner
[not found] ` <20160309123625.GA26143-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-03-10 18:12 ` Leif Liddy
2016-03-03 17:48 ` Matthew Garrett
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=20160303185553.GA24603@wunner.de \
--to=lukas@wunner.de \
--cc=jarkko.nikula@linux.intel.com \
--cc=leif.linux@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=mjg59@srcf.ucam.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).