Subject: Re: PNP power management API for drivers
To: Joerg Sonnenberger <joerg@britannica.bec.de>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 10/05/2007 23:07:55
joerg@britannica.bec.de said:
> bool pnp_device_register(dev_t, bool (*suspend)(dev_t),
>     bool (*resume)(dev_t)); 

At a first glance, this looks pretty much like an oversimplification
to me. The amount of device state to save or restore depends on
bus specifics. And it is not obvious what the sementics of "suspend"
and "resume" are at all. Obviously, maximal power saving to prepare
for laptop hibernation is a goal, but there is a lot in between --
there are different levels of hibernation, and device/driver support
is likely varying, so it needs some negotiation to get at least
the "best effort".

Sorry that I didn't have time to look at the pm branch lately,
so I might miss some details.
When I played with USB power management a while ago I found
that a device driver should support at least two more cases:
-some notification that the device was selected as a possible
 source of a wakeup event, from toplevel to the driver, and
 from the driver upwards the bus hierarchy
-some way for the driver to notify upper layers whether it is in
 use by some user application (or network connection, or disk
 mount, or whatever) so that some "best effort" power saving
 can be applied

Also, inho the "pnp" term is too overloaded. In its common
meaning it is also not connected to power management. I'd
choose a more meaningful name.

best regards
Matthias




-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDirig'in Baerbel Brumme-Bothe
Vorstand: Prof. Dr. Achim Bachem (Vorsitzender), Dr. Ulrich Krafft (stellv. 
Vorsitzender)
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------