2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-05-27 07:12:15 -04:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
PM / Wakeirq: Add automated device wake IRQ handling
Turns out we can automate the handling for the device_may_wakeup()
quite a bit by using the kernel wakeup source list as suggested
by Rafael J. Wysocki <rjw@rjwysocki.net>.
And as some hardware has separate dedicated wake-up interrupt
in addition to the IO interrupt, we can automate the handling by
adding a generic threaded interrupt handler that just calls the
device PM runtime to wake up the device.
This allows dropping code from device drivers as we currently
are doing it in multiple ways, and often wrong.
For most drivers, we should be able to drop the following
boilerplate code from runtime_suspend and runtime_resume
functions:
...
device_init_wakeup(dev, true);
...
if (device_may_wakeup(dev))
enable_irq_wake(irq);
...
if (device_may_wakeup(dev))
disable_irq_wake(irq);
...
device_init_wakeup(dev, false);
...
We can replace it with just the following init and exit
time code:
...
device_init_wakeup(dev, true);
dev_pm_set_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
And for hardware with dedicated wake-up interrupts:
...
device_init_wakeup(dev, true);
dev_pm_set_dedicated_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-18 15:40:29 -07:00
|
|
|
|
2011-09-27 22:54:41 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2014-03-01 11:56:04 +01:00
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2014-03-01 11:56:04 +01:00
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-01 11:56:04 +01:00
|
|
|
|
|
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
|
|
|
|
|
2014-03-01 11:56:04 +01:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:34:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-03 10:12:14 +01:00
|
|
|
|
2010-09-25 23:34:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-22 16:34:11 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-01 22:29:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-29 15:29:55 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 21:32:04 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-27 21:54:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
2013-10-15 22:25:08 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
2016-04-26 13:03:51 -07:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PM / Runtime: Rework the "runtime idle" helper routine
The "runtime idle" helper routine, rpm_idle(), currently ignores
return values from .runtime_idle() callbacks executed by it.
However, it turns out that many subsystems use
pm_generic_runtime_idle() which checks the return value of the
driver's callback and executes pm_runtime_suspend() for the device
unless that value is not 0. If that logic is moved to rpm_idle()
instead, pm_generic_runtime_idle() can be dropped and its users
will not need any .runtime_idle() callbacks any more.
Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle()
routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and
ata_port_runtime_idle(), respectively, as well as a few drivers'
ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has
been returned by the .runtime_idle() callback executed by it.
To reduce overall code bloat, make the changes described above.
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
2013-06-03 21:49:52 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2016-04-26 13:03:51 -07:00
|
|
|
|
PM / Runtime: Rework the "runtime idle" helper routine
The "runtime idle" helper routine, rpm_idle(), currently ignores
return values from .runtime_idle() callbacks executed by it.
However, it turns out that many subsystems use
pm_generic_runtime_idle() which checks the return value of the
driver's callback and executes pm_runtime_suspend() for the device
unless that value is not 0. If that logic is moved to rpm_idle()
instead, pm_generic_runtime_idle() can be dropped and its users
will not need any .runtime_idle() callbacks any more.
Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle()
routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and
ata_port_runtime_idle(), respectively, as well as a few drivers'
ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has
been returned by the .runtime_idle() callback executed by it.
To reduce overall code bloat, make the changes described above.
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
2013-06-03 21:49:52 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2011-12-18 00:34:13 +01:00
|
|
|
|
2011-09-27 21:54:52 +02:00
|
|
|
|
PM / Runtime: Rework the "runtime idle" helper routine
The "runtime idle" helper routine, rpm_idle(), currently ignores
return values from .runtime_idle() callbacks executed by it.
However, it turns out that many subsystems use
pm_generic_runtime_idle() which checks the return value of the
driver's callback and executes pm_runtime_suspend() for the device
unless that value is not 0. If that logic is moved to rpm_idle()
instead, pm_generic_runtime_idle() can be dropped and its users
will not need any .runtime_idle() callbacks any more.
Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle()
routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and
ata_port_runtime_idle(), respectively, as well as a few drivers'
ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has
been returned by the .runtime_idle() callback executed by it.
To reduce overall code bloat, make the changes described above.
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
2013-06-03 21:49:52 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-26 13:03:51 -07:00
|
|
|
|
2013-10-15 22:25:08 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-22 16:34:19 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
|
|
|
|
|
2011-07-01 22:29:15 +02:00
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:34:54 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-10-12 11:53:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-12 22:59:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-03 23:39:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-09-27 22:54:41 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-27 21:54:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-19 02:01:06 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2011-12-18 00:34:13 +01:00
|
|
|
|
PM / Wakeirq: Add automated device wake IRQ handling
Turns out we can automate the handling for the device_may_wakeup()
quite a bit by using the kernel wakeup source list as suggested
by Rafael J. Wysocki <rjw@rjwysocki.net>.
And as some hardware has separate dedicated wake-up interrupt
in addition to the IO interrupt, we can automate the handling by
adding a generic threaded interrupt handler that just calls the
device PM runtime to wake up the device.
This allows dropping code from device drivers as we currently
are doing it in multiple ways, and often wrong.
For most drivers, we should be able to drop the following
boilerplate code from runtime_suspend and runtime_resume
functions:
...
device_init_wakeup(dev, true);
...
if (device_may_wakeup(dev))
enable_irq_wake(irq);
...
if (device_may_wakeup(dev))
disable_irq_wake(irq);
...
device_init_wakeup(dev, false);
...
We can replace it with just the following init and exit
time code:
...
device_init_wakeup(dev, true);
dev_pm_set_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
And for hardware with dedicated wake-up interrupts:
...
device_init_wakeup(dev, true);
dev_pm_set_dedicated_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-18 15:40:29 -07:00
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
2011-12-01 00:01:31 +01:00
|
|
|
|
|
|
|
|
|
2011-11-03 23:39:18 +01:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
2011-10-12 22:59:33 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-10-12 22:59:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 21:31:55 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-25 20:50:07 +01:00
|
|
|
|
2010-12-01 00:14:42 +01:00
|
|
|
|
2011-01-25 20:50:07 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-01-25 20:50:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-01-25 20:50:07 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-27 22:54:41 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2011-12-01 00:01:31 +01:00
|
|
|
|
|
|
|
|
|
PM / Wakeirq: Add automated device wake IRQ handling
Turns out we can automate the handling for the device_may_wakeup()
quite a bit by using the kernel wakeup source list as suggested
by Rafael J. Wysocki <rjw@rjwysocki.net>.
And as some hardware has separate dedicated wake-up interrupt
in addition to the IO interrupt, we can automate the handling by
adding a generic threaded interrupt handler that just calls the
device PM runtime to wake up the device.
This allows dropping code from device drivers as we currently
are doing it in multiple ways, and often wrong.
For most drivers, we should be able to drop the following
boilerplate code from runtime_suspend and runtime_resume
functions:
...
device_init_wakeup(dev, true);
...
if (device_may_wakeup(dev))
enable_irq_wake(irq);
...
if (device_may_wakeup(dev))
disable_irq_wake(irq);
...
device_init_wakeup(dev, false);
...
We can replace it with just the following init and exit
time code:
...
device_init_wakeup(dev, true);
dev_pm_set_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
And for hardware with dedicated wake-up interrupts:
...
device_init_wakeup(dev, true);
dev_pm_set_dedicated_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-18 15:40:29 -07:00
|
|
|
|
2011-12-01 00:01:31 +01:00
|
|
|
|
|
|
|
|
|
2012-03-26 22:46:52 +02:00
|
|
|
|
|
|
|
|
|
2011-12-01 00:01:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:34:54 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2011-03-30 22:57:33 -03:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-26 13:38:55 -07:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
PM / Runtime: let rpm_resume() succeed if RPM_ACTIVE, even when disabled, v2
There are several drivers where the return value of
pm_runtime_get_sync() is used to decide whether or not it is safe to
access hardware and that don't provide .suspend() callbacks for system
suspend (but may use late/noirq callbacks.) If such a driver happens
to call pm_runtime_get_sync() during system suspend, after the core
has disabled runtime PM, it will get the error code and will decide
that the hardware should not be accessed, although this may be a wrong
conclusion, depending on the state of the device when runtime PM was
disabled.
Drivers might work around this problem by using a test like:
ret = pm_runtime_get_sync(dev);
if (!ret || (ret == -EACCES && driver_private_data(dev)->suspended)) {
/* access hardware */
}
where driver_private_data(dev)->suspended is a flag set by the
driver's .suspend() method (that would have to be added for this
purpose). However, that potentially would need to be done by multiple
drivers which means quite a lot of duplicated code and bloat.
To avoid that we can use the observation that the core sets
dev->power.is_suspended before disabling runtime PM and use that
instead of the driver's private flag. Still, potentially many drivers
would need to repeat that same check in quite a few places, so it's
better to let the core do it.
Then we can be a bit smarter and check whether or not runtime PM was
disabled by the core only (disable_depth == 1) or by someone else in
addition to the core (disable_depth > 1). In the former case
rpm_resume() can return 1 if the runtime PM status is RPM_ACTIVE,
because it means the device was active when the core disabled runtime
PM. In the latter case it should still return -EACCES, because it
isn't clear why runtime PM has been disabled.
Tested on AM3730/Beagle-xM where a wakeup IRQ firing during the late
suspend phase triggers runtime PM activity in the I2C driver since the
wakeup IRQ is on an I2C-connected PMIC.
[rjw: Modified whitespace to follow the file's convention.]
Signed-off-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-09-21 22:47:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-01 22:29:15 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-27 21:54:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-10-22 23:48:14 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 21:31:45 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-12-01 00:14:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-12-01 00:14:42 +01:00
|
|
|
|
|
|
|
|
|
2009-11-25 01:06:37 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-25 01:06:37 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-25 01:06:37 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2009-11-25 01:06:37 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-12-01 00:14:42 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-19 02:01:06 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2011-12-18 00:34:13 +01:00
|
|
|
|
PM / Wakeirq: Add automated device wake IRQ handling
Turns out we can automate the handling for the device_may_wakeup()
quite a bit by using the kernel wakeup source list as suggested
by Rafael J. Wysocki <rjw@rjwysocki.net>.
And as some hardware has separate dedicated wake-up interrupt
in addition to the IO interrupt, we can automate the handling by
adding a generic threaded interrupt handler that just calls the
device PM runtime to wake up the device.
This allows dropping code from device drivers as we currently
are doing it in multiple ways, and often wrong.
For most drivers, we should be able to drop the following
boilerplate code from runtime_suspend and runtime_resume
functions:
...
device_init_wakeup(dev, true);
...
if (device_may_wakeup(dev))
enable_irq_wake(irq);
...
if (device_may_wakeup(dev))
disable_irq_wake(irq);
...
device_init_wakeup(dev, false);
...
We can replace it with just the following init and exit
time code:
...
device_init_wakeup(dev, true);
dev_pm_set_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
And for hardware with dedicated wake-up interrupts:
...
device_init_wakeup(dev, true);
dev_pm_set_dedicated_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-18 15:40:29 -07:00
|
|
|
|
2010-10-04 22:08:01 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-07-19 02:01:06 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
PM / Wakeirq: Add automated device wake IRQ handling
Turns out we can automate the handling for the device_may_wakeup()
quite a bit by using the kernel wakeup source list as suggested
by Rafael J. Wysocki <rjw@rjwysocki.net>.
And as some hardware has separate dedicated wake-up interrupt
in addition to the IO interrupt, we can automate the handling by
adding a generic threaded interrupt handler that just calls the
device PM runtime to wake up the device.
This allows dropping code from device drivers as we currently
are doing it in multiple ways, and often wrong.
For most drivers, we should be able to drop the following
boilerplate code from runtime_suspend and runtime_resume
functions:
...
device_init_wakeup(dev, true);
...
if (device_may_wakeup(dev))
enable_irq_wake(irq);
...
if (device_may_wakeup(dev))
disable_irq_wake(irq);
...
device_init_wakeup(dev, false);
...
We can replace it with just the following init and exit
time code:
...
device_init_wakeup(dev, true);
dev_pm_set_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
And for hardware with dedicated wake-up interrupts:
...
device_init_wakeup(dev, true);
dev_pm_set_dedicated_wake_irq(dev, irq);
...
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
...
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-18 15:40:29 -07:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
2010-07-19 02:01:06 +02:00
|
|
|
|
2015-05-13 16:36:32 -07:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 21:31:45 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-12-01 00:14:42 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-26 13:38:55 -07:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:00 +02:00
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-08 23:39:36 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-08 23:39:36 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2011-08-08 23:39:36 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-08 23:39:36 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2010-09-25 23:34:54 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-08-08 23:39:36 +02:00
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-12-13 20:28:30 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-08-08 23:39:36 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2015-12-17 02:54:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-03 20:21:21 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-20 11:14:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2016-06-20 11:14:26 +02:00
|
|
|
|
2009-12-03 21:04:41 +01:00
|
|
|
|
2016-06-20 11:14:26 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2009-11-25 01:06:37 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-19 02:01:06 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-11 11:23:40 +01:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-23 22:02:51 +01:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-01-23 22:02:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:07 +02:00
|
|
|
|
2010-01-23 22:02:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-01-23 22:02:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-29 02:53:48 +02:00
|
|
|
|
2010-01-23 22:02:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-12-01 00:14:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
|
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2010-09-25 23:35:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2011-07-06 10:52:13 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-23 22:02:51 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-19 02:01:06 +02:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PM / runtime: Re-init runtime PM states at probe error and driver unbind
There are two common expectations among several subsystems/drivers that
deploys runtime PM support, but which isn't met by the driver core.
Expectation 1)
At ->probe() the subsystem/driver expects the runtime PM status of the
device to be RPM_SUSPENDED, which is the initial status being assigned at
device registration.
This expectation is especially common among some of those subsystems/
drivers that manages devices with an attached PM domain, as those requires
the ->runtime_resume() callback at the PM domain level to be invoked
during ->probe().
Moreover these subsystems/drivers entirely relies on runtime PM resources
being managed at the PM domain level, thus don't implement their own set
of runtime PM callbacks.
These are two scenarios that suffers from this unmet expectation.
i) A failed ->probe() sequence requests probe deferral:
->probe()
...
pm_runtime_enable()
pm_runtime_get_sync()
...
err:
pm_runtime_put()
pm_runtime_disable()
...
As there are no guarantees that such sequence turns the runtime PM status
of the device into RPM_SUSPENDED, the re-trying ->probe() may start with
the status in RPM_ACTIVE.
In such case the runtime PM core won't invoke the ->runtime_resume()
callback because of a pm_runtime_get_sync(), as it considers the device to
be already runtime resumed.
ii) A driver re-bind sequence:
At driver unbind, the subsystem/driver's >remove() callback invokes a
sequence of runtime PM APIs, to undo actions during ->probe() and to put
the device into low power state.
->remove()
...
pm_runtime_put()
pm_runtime_disable()
...
Similar as in the failing ->probe() case, this sequence don't guarantee
the runtime PM status of the device to turn into RPM_SUSPENDED.
Trying to re-bind the driver thus causes the same issue as when re-trying
->probe(), in the probe deferral scenario.
Expectation 2)
Drivers that invokes the pm_runtime_irq_safe() API during ->probe(),
triggers the runtime PM core to increase the usage count for the device's
parent and permanently make it runtime resumed.
The usage count is only dropped at device removal, which also allows it to
be runtime suspended again.
A re-trying ->probe() repeats the call to pm_runtime_irq_safe() and thus
once more triggers the usage count of the device's parent to be increased.
This leads to not only an imbalance issue of the usage count of the
device's parent, but also to keep it runtime resumed permanently even if
->probe() fails.
To address these issues, let's change the policy of the driver core to
meet these expectations. More precisely, at ->probe() failures and driver
unbind, restore the initial states of runtime PM.
Although to still allow subsystem's to control PM for devices that doesn't
->probe() successfully, don't restore the initial states unless runtime PM
is disabled.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-18 11:48:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PM / runtime: Re-init runtime PM states at probe error and driver unbind
There are two common expectations among several subsystems/drivers that
deploys runtime PM support, but which isn't met by the driver core.
Expectation 1)
At ->probe() the subsystem/driver expects the runtime PM status of the
device to be RPM_SUSPENDED, which is the initial status being assigned at
device registration.
This expectation is especially common among some of those subsystems/
drivers that manages devices with an attached PM domain, as those requires
the ->runtime_resume() callback at the PM domain level to be invoked
during ->probe().
Moreover these subsystems/drivers entirely relies on runtime PM resources
being managed at the PM domain level, thus don't implement their own set
of runtime PM callbacks.
These are two scenarios that suffers from this unmet expectation.
i) A failed ->probe() sequence requests probe deferral:
->probe()
...
pm_runtime_enable()
pm_runtime_get_sync()
...
err:
pm_runtime_put()
pm_runtime_disable()
...
As there are no guarantees that such sequence turns the runtime PM status
of the device into RPM_SUSPENDED, the re-trying ->probe() may start with
the status in RPM_ACTIVE.
In such case the runtime PM core won't invoke the ->runtime_resume()
callback because of a pm_runtime_get_sync(), as it considers the device to
be already runtime resumed.
ii) A driver re-bind sequence:
At driver unbind, the subsystem/driver's >remove() callback invokes a
sequence of runtime PM APIs, to undo actions during ->probe() and to put
the device into low power state.
->remove()
...
pm_runtime_put()
pm_runtime_disable()
...
Similar as in the failing ->probe() case, this sequence don't guarantee
the runtime PM status of the device to turn into RPM_SUSPENDED.
Trying to re-bind the driver thus causes the same issue as when re-trying
->probe(), in the probe deferral scenario.
Expectation 2)
Drivers that invokes the pm_runtime_irq_safe() API during ->probe(),
triggers the runtime PM core to increase the usage count for the device's
parent and permanently make it runtime resumed.
The usage count is only dropped at device removal, which also allows it to
be runtime suspended again.
A re-trying ->probe() repeats the call to pm_runtime_irq_safe() and thus
once more triggers the usage count of the device's parent to be increased.
This leads to not only an imbalance issue of the usage count of the
device's parent, but also to keep it runtime resumed permanently even if
->probe() fails.
To address these issues, let's change the policy of the driver core to
meet these expectations. More precisely, at ->probe() failures and driver
unbind, restore the initial states of runtime PM.
Although to still allow subsystem's to control PM for devices that doesn't
->probe() successfully, don't restore the initial states unless runtime PM
is disabled.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-18 11:48:39 +01:00
|
|
|
|
2009-08-18 23:38:32 +02:00
|
|
|
|
2014-03-01 11:56:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2014-03-01 11:56:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-17 12:58:02 +02:00
|
|
|
|
2014-03-01 11:56:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-30 11:33:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-08 13:10:23 +02:00
|
|
|
|
2014-03-01 11:56:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-08 13:10:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-01 11:56:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|