linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal
@ 2012-09-28  7:37 Zhang Rui
       [not found] ` <1348817863.10877.320.camel-fuY85erJQUO75v1z/vFq2g@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2012-09-28  7:37 UTC (permalink / raw)
  To: LKML
  Cc: Grant Likely, linux-acpi@vger.kernel.org, linux-i2c,
	Dirk Brandewie, linux-pm

Hi, all,

I'm working on ACPI device enumeration support recently, and here is the
proposal I made to enumerate devices via ACPI namespace.

the main idea is that, for Serial Buses like I2C and SPI, we enumerate
the controller as a platform device, and then enumerate the slaves via
i2c/spi_register_board_info. And then, when the controller is really
probed and enabled in the platform driver, the SPI/I2C bus code will
enumerate I2C/SPI slaves automatically.
And for the other devices, we will enumerate all of them as platform
devices, which is not covered in this patch set yet.

Patch 1 & 2 Introduce ACPI style device match method in platform_match.
this is because an ACPI device may have multiple hardware ID (_HID) and
Compatible IDs, aka, _CID, but in platform device code, only pdev->name
is used to match the driver id_table currently.
Patch 3 introduces a new API acpi_get_generic_resources().
this API is used to convert ACPI style resources to the generic struct
resource.
Patch 4 changes i2c_register_board_info from __init to __devinit.
This is needed because I want to enumerate the slave devices in ACPI I2C
control Driver, which supports hotplug in theory.
Patch 5 introduces the ACPI I2C controller enumeration drive.
it enumerate the ACPI I2C controller to a platform device and then
enumerate the I2C slaves as I2C_board_info.
Patch 6 is an example driver for an ACPI enuemrated I2C controller.

Note that this is just prototype patch set, which just passes build
test. Because I'd like to get your ideas about this before going on.
any comments are welcome.

thanks,
rui

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal
       [not found] ` <1348817863.10877.320.camel-fuY85erJQUO75v1z/vFq2g@public.gmane.org>
@ 2012-10-01  6:44   ` Mika Westerberg
  2012-10-01 14:30     ` Zhang, Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Mika Westerberg @ 2012-10-01  6:44 UTC (permalink / raw)
  To: Zhang Rui
  Cc: LKML, linux-pm, linux-i2c,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Len, Brown,
	Rafael J. Wysocki, Grant Likely, Dirk Brandewie

On Fri, Sep 28, 2012 at 03:37:43PM +0800, Zhang Rui wrote:
> 
> the main idea is that, for Serial Buses like I2C and SPI, we enumerate
> the controller as a platform device, and then enumerate the slaves via
> i2c/spi_register_board_info. And then, when the controller is really
> probed and enabled in the platform driver, the SPI/I2C bus code will
> enumerate I2C/SPI slaves automatically.
> And for the other devices, we will enumerate all of them as platform
> devices, which is not covered in this patch set yet.

Can you show some example how we could use this new code for example with
an existing I2C/SPI slave driver? Let's say the device uses few GPIOs, one
for interrupt and other for triggering firmware download. In addition to
that it needs a special parameters that can be extracted running the "_DSM"
method of the device.

Normally the driver would get this stuff from the platform data or from
Device Tree but how it is done with these patches?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal
  2012-10-01  6:44   ` Mika Westerberg
@ 2012-10-01 14:30     ` Zhang, Rui
       [not found]       ` <744357E9AAD1214791ACBA4B0B90926322D989-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Rui @ 2012-10-01 14:30 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: LKML, linux-pm, linux-i2c, linux-acpi@vger.kernel.org, Len, Brown,
	Rafael J. Wysocki, Grant Likely, Dirk Brandewie



> -----Original Message-----
> From: Mika Westerberg [mailto:mika.westerberg@linux.intel.com]
> Sent: Monday, October 01, 2012 2:45 PM
> To: Zhang, Rui
> Cc: LKML; linux-pm; linux-i2c; linux-acpi@vger.kernel.org; Len, Brown;
> Rafael J. Wysocki; Grant Likely; Dirk Brandewie
> Subject: Re: [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal
> Importance: High
> 
> On Fri, Sep 28, 2012 at 03:37:43PM +0800, Zhang Rui wrote:
> >
> > the main idea is that, for Serial Buses like I2C and SPI, we
> enumerate
> > the controller as a platform device, and then enumerate the slaves
> via
> > i2c/spi_register_board_info. And then, when the controller is really
> > probed and enabled in the platform driver, the SPI/I2C bus code will
> > enumerate I2C/SPI slaves automatically.
> > And for the other devices, we will enumerate all of them as platform
> > devices, which is not covered in this patch set yet.
> 
> Can you show some example how we could use this new code for example
> with an existing I2C/SPI slave driver?

This is just prototype patch set that I want to illustrate my idea
on ACPI device enumeration, to get more thoughts on this.
So no example driver so far.

> Let's say the device uses few
> GPIOs, one for interrupt and other for triggering firmware download. In
> addition to that it needs a special parameters that can be extracted
> running the "_DSM" method of the device.
> 
> Normally the driver would get this stuff from the platform data or from
> Device Tree but how it is done with these patches?

Can you show me an example driver that gets the special parameters from Device Tree?

Thanks,
rui

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal
       [not found]       ` <744357E9AAD1214791ACBA4B0B90926322D989-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2012-10-02  6:19         ` Mika Westerberg
  0 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2012-10-02  6:19 UTC (permalink / raw)
  To: Zhang, Rui
  Cc: LKML, linux-pm, linux-i2c,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Len, Brown,
	Rafael J. Wysocki, Grant Likely, Dirk Brandewie

On Mon, Oct 01, 2012 at 02:30:00PM +0000, Zhang, Rui wrote:
> 
> 
> > -----Original Message-----
> > From: Mika Westerberg [mailto:mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org]
> > Sent: Monday, October 01, 2012 2:45 PM
> > To: Zhang, Rui
> > Cc: LKML; linux-pm; linux-i2c; linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Len, Brown;
> > Rafael J. Wysocki; Grant Likely; Dirk Brandewie
> > Subject: Re: [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal
> > Importance: High
> > 
> > On Fri, Sep 28, 2012 at 03:37:43PM +0800, Zhang Rui wrote:
> > >
> > > the main idea is that, for Serial Buses like I2C and SPI, we
> > enumerate
> > > the controller as a platform device, and then enumerate the slaves
> > via
> > > i2c/spi_register_board_info. And then, when the controller is really
> > > probed and enabled in the platform driver, the SPI/I2C bus code will
> > > enumerate I2C/SPI slaves automatically.
> > > And for the other devices, we will enumerate all of them as platform
> > > devices, which is not covered in this patch set yet.
> > 
> > Can you show some example how we could use this new code for example
> > with an existing I2C/SPI slave driver?
> 
> This is just prototype patch set that I want to illustrate my idea
> on ACPI device enumeration, to get more thoughts on this.
> So no example driver so far.

But surely you have thought how this should be done? Otherwise we only see
a part of the solution here. What if this enumeration you introduce here
doesn't play well when I2C/SPI are added?

> 
> > Let's say the device uses few
> > GPIOs, one for interrupt and other for triggering firmware download. In
> > addition to that it needs a special parameters that can be extracted
> > running the "_DSM" method of the device.
> > 
> > Normally the driver would get this stuff from the platform data or from
> > Device Tree but how it is done with these patches?
> 
> Can you show me an example driver that gets the special parameters from Device Tree?

drivers/misc/eeprom/at25.c but there are much more if you search for DT
enabled drivers.

Now, I don't know what is the proper way to pass parameters in ACPI but
"_DSM" seems to be one that is being used.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-02  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28  7:37 [RFC PATCH 0/6] ACPI: ACPI 5.0 device enumeration proposal Zhang Rui
     [not found] ` <1348817863.10877.320.camel-fuY85erJQUO75v1z/vFq2g@public.gmane.org>
2012-10-01  6:44   ` Mika Westerberg
2012-10-01 14:30     ` Zhang, Rui
     [not found]       ` <744357E9AAD1214791ACBA4B0B90926322D989-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-10-02  6:19         ` Mika Westerberg

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).