linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Mochel <mochel@osdl.org>
To: Russell King <rmk@arm.linux.org.uk>
Cc: kernel list <linux-kernel@vger.kernel.org>
Subject: Platform Devices
Date: Thu, 28 Aug 2003 08:38:36 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0308280813130.4140-100000@cherise> (raw)
In-Reply-To: <20030825172737.E16790@flint.arm.linux.org.uk>


Sorry it's taken so long to reply, this has needed a chance to sink in 
(and for other things to be resolved). 

> I think we need to expand the platform device support to include the
> notion of platform drivers.  For example:
> 
> 	struct platform_driver {
> 		int (*probe)(struct platform_device *);
> 		int (*remove)(struct platform_device *);
> 		int (*suspend)(struct platform_device *, u32);
> 		int (*resume)(struct platform_device *);
> 		struct device_driver drv;
> 	};

I see two ways of supporting platform devices that will have a variable 
number of logical interfaces -- depending on the platform -- per physical 
device, and support power management on them. 

The first: put power management methods in struct class. 

As we suspend each physical device, we would loop over each class device 
that is associated with the physical device, and call its class's 
->suspend() method for it. The class would be responsible for stopping the 
device and taking that view of the device offline. The class-specific 
portion of the driver may optionally have suspend()/resume() methods that 
the class could call to save those bits of device state. 

This would leave the bus-specific power management calls to only power 
down the device and save config-space-like register state of the device.
(Especially if there were per-driver class-specific suspend/resume 
methods, as they would be responsible for saving/restoring the interesting 
parts of the device.)


The second: Allow mulitple drivers to bind to platform devices. 

We would use a similar structure as you have above, with a struct
list_head in it to allow us to chain them together. When we suspended a
platform device, the platform bus would iterate through each driver that's
bound to a device and call ->suspend(). 

Simple enough, though we'd have to create some sort of notion of a 
'platform_class' for each device type, as there could theoretically be 
multiple instances of a device type, and a chain of drivers could only 
bind to one without dynamically allocating each instance of the driver. It 
would be similar to the way system devices are handled, but without 
breaking away from the unified device hierarchy. 

Either way is relatively easy to implement, and I'm ambivalent about which 
to choose this morning. The former may have much added benefit by reducing 
the amount of work that needs to be done in each driver of each type, 
while the latter focuses on just resolving your issue.. 


	Pat



  parent reply	other threads:[~2003-08-28 15:32 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-22 21:08 [PM] Patrick: which part of "maintainer" and "peer review" needs explaining to you? Pavel Machek
2003-08-22 21:25 ` Patrick Mochel
2003-08-22 21:53   ` Pavel Machek
2003-08-22 22:05     ` Patrick Mochel
2003-08-23  1:03       ` Nigel Cunningham
2003-08-23 16:22       ` Benjamin Herrenschmidt
2003-08-25 19:05         ` [PM] powering down special devices Patrick Mochel
2003-08-25 19:53           ` Benjamin Herrenschmidt
2003-08-25  9:52       ` [PM] Patrick: which part of "maintainer" and "peer review" needs explaining to you? Pavel Machek
2003-08-22 22:10   ` Pavel Machek
2003-08-22 22:13     ` Patrick Mochel
2003-08-22 22:17       ` Patrick Mochel
2003-08-22 22:36   ` Pavel Machek
2003-08-23 10:47   ` Russell King
2003-08-24 11:54     ` Russell King
2003-08-26 15:39       ` [PM] Config Options Patrick Mochel
2003-08-24 12:08     ` [PM] Patrick: which part of "maintainer" and "peer review" needs explaining to you? Russell King
2003-08-25 15:47     ` Patrick Mochel
2003-08-25 16:27       ` Russell King
2003-08-25 16:57         ` Matt Porter
2003-08-25 17:14           ` Russell King
2003-08-25 17:34             ` Matt Porter
2003-08-28 15:38         ` Patrick Mochel [this message]
2003-09-01 12:02         ` Pavel Machek
2003-09-02 17:41           ` Jens Axboe
2003-09-09 20:19             ` Benjamin Herrenschmidt
2003-09-09 20:24               ` Jens Axboe
2003-09-09 21:43               ` Patrick Mochel
2003-09-09 22:54                 ` Pavel Machek
2003-09-09 23:07                   ` Patrick Mochel
2003-09-09 23:07                     ` [PM] Passing suspend level down to drivers Pavel Machek
2003-09-09 23:23                       ` Patrick Mochel
2003-09-10  0:06                         ` Pavel Machek
2003-09-10  6:12                       ` Stephen Rothwell
2003-09-10 11:48                         ` Alan Cox
2003-09-09 23:15                     ` [PM] Patrick: which part of "maintainer" and "peer review" needs explaining to you? Alan Cox
2003-09-09 22:56               ` Pavel Machek
2003-08-25 17:16       ` Russell King
2003-08-22 22:04 ` Timothy Miller

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=Pine.LNX.4.44.0308280813130.4140-100000@cherise \
    --to=mochel@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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).