Re: [PATCH 2/3] spi / ACPI: add ACPI enumeration support

From: Mika Westerberg
Date: Thu Nov 08 2012 - 15:17:40 EST


On Thu, Nov 08, 2012 at 01:46:24AM +0100, Rafael J. Wysocki wrote:
> On Wednesday, November 07, 2012 03:05:48 PM Mika Westerberg wrote:
> > On Wed, Nov 07, 2012 at 12:14:31PM +0100, Rafael J. Wysocki wrote:
> > > > So is the idea now that the ACPI core parses the resources and passes them
> > > > forward via struct acpi_device? I'm just wondering how to proceed with
> > > > these I2C and SPI enumeration patches.
> > >
> > > Well, we definitely don't want to duplicate what drivers/pnp/pnpacpi/rsparser.c
> > > does, so the idea is to move the code from there to the core in such a way that
> > > both the SPI/I2C patches and the PNP layer can use it.
> >
> > Ok.
> >
> > > I'll have some prototype code ready shortly, hopefully, and I'll post it
> > > in that form for comments (and so that you know what to expect).
> >
> > Sounds good. Thanks!
>
> There you go.
>
> I haven't even try to compile it, so most likely it breaks things left, right
> and in between, but I hope it shows the idea.

Thanks Rafael!

I'll try this tomorrow (we had problems with the HW today so I wasn't able
to do any testing).

I'll convert the SPI and I2C enumeration patches to use this method.

> It does a couple of things at the same time, so it should be split into a few
> simpler patches. First, it moves some code from drivers/pnp/pnpacpi/rsparser.c
> to a new file drivers/acpi/resource.c and makes pnpacpi use functions from
> there. Second, it changes acpi_platform.c to use those functions too.
> Finally, it adds a list of ACPI resources to struct acpi_device and
> makes acpi_platform.c use that list intead of evaluating _CRS and parsing its
> output with acpi_walk_resources().
>
> While changing acpi_platform.c I noticed that we had a bug in there, because
> GSIs were registered for the struct acpi_device object, although they should be
> registered for the struct platform_device one created by that code. I didn't
> try to fix that in the patch below, but it generally needs fixing.

Good point.

I wonder if the acpi_register_gsi() wants a device that is registered to
the Linux device framework? At least with the SPI and I2C we generally
don't have such until we call i2c_new_device() or spi_add_device() and they
are getting passed the IRQ number which should be translated to the Linux
IRQ before that...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/