kernel_optimize_test/arch/arm
Nishanth Menon 3522bf7bfa ARM: OMAP2+: omap_device: maintain sane runtime pm status around suspend/resume
OMAP device hooks around suspend|resume_noirq ensures that hwmod
devices are forced to idle using omap_device_idle/enable as part of
the last stage of suspend activity.

For a device such as i2c who uses autosuspend, it is possible to enter
the suspend path with dev->power.runtime_status = RPM_ACTIVE.

As part of the suspend flow, the generic runtime logic would increment
it's dev->power.disable_depth to 1. This should prevent further
pm_runtime_get_sync from succeeding once the runtime_status has been
set to RPM_SUSPENDED.

Now, as part of the suspend_noirq handler in omap_device, we force the
following: if the device status is !suspended, we force the device
to idle using omap_device_idle (clocks are cut etc..). This ensures
that from a hardware perspective, the device is "suspended". However,
runtime_status is left to be active.

*if* an operation is attempted after this point to
pm_runtime_get_sync, runtime framework depends on runtime_status to
indicate accurately the device status, and since it sees it to be
ACTIVE, it assumes the module is functional and returns a non-error
value. As a result the user will see pm_runtime_get succeed, however a
register access will crash due to the lack of clocks.

To prevent this from happening, we should ensure that runtime_status
exactly indicates the device status. As a result of this change
any further calls to pm_runtime_get* would return -EACCES (since
disable_depth is 1). On resume, we restore the clocks and runtime
status exactly as we suspended with. These operations are not expected
to fail as we update the states after the core runtime framework has
suspended itself and restore before the core runtime framework has
resumed.

Cc: stable@vger.kernel.org # v3.4+
Reported-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Rajendra Nayak <rnayak@ti.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2013-11-15 07:38:14 -08:00
..
boot DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
common ARM: SoC cleanups for 3.13 2013-11-11 16:42:43 +09:00
configs ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
crypto
include DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
kernel DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
kvm
lib
mach-at91 ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
mach-bcm BCM changes for 3.13/soc. A number of cleanup related changes. 2013-10-30 14:03:39 -07:00
mach-bcm2835 Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-11-12 10:02:59 +09:00
mach-clps711x
mach-cns3xxx
mach-davinci ARM: driver updates for 3.13 2013-11-11 17:05:37 +09:00
mach-dove ARM: driver updates for 3.13 2013-11-11 17:05:37 +09:00
mach-ebsa110
mach-ep93xx usb: ohci: remove ep93xx bus glue platform driver 2013-10-29 16:43:37 -07:00
mach-exynos ARM: SoC cleanups for 3.13 2013-11-11 16:42:43 +09:00
mach-footbridge
mach-gemini GPIO bulk changes for the v3.13 development cycle 2013-11-12 15:50:46 +09:00
mach-highbank ARM: SoC platform changes for 3.13 2013-11-11 16:49:45 +09:00
mach-imx ARM: SoC platform changes for 3.13 2013-11-11 16:49:45 +09:00
mach-integrator DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
mach-kirkwood ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
mach-ks8695
mach-lpc32xx
mach-mmp
mach-msm Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-11-12 10:36:00 +09:00
mach-mv78xx0
mach-mvebu
mach-mxs ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
mach-netx
mach-nomadik
mach-nspire
mach-omap1
mach-omap2 ARM: OMAP2+: omap_device: maintain sane runtime pm status around suspend/resume 2013-11-15 07:38:14 -08:00
mach-orion5x
mach-picoxcell
mach-prima2
mach-pxa
mach-realview
mach-rockchip ARM: SoC board updates for 3.13 2013-11-11 16:57:16 +09:00
mach-rpc
mach-s3c24xx
mach-s3c64xx regulator: Updates for v3.13 2013-11-12 14:55:17 +09:00
mach-s5p64x0
mach-s5pc100
mach-s5pv210
mach-sa1100
mach-shmobile ARM: SoC board updates for 3.13 2013-11-11 16:57:16 +09:00
mach-socfpga
mach-spear
mach-sti
mach-sunxi ARM: sunxi: remove .init_time hooks 2013-10-28 10:19:45 -07:00
mach-tegra ARM: SoC platform changes for 3.13 2013-11-11 16:49:45 +09:00
mach-u300 DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
mach-ux500 ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
mach-versatile
mach-vexpress Via Paul Walmsley <paul@pwsan.com>: 2013-10-28 14:39:03 -07:00
mach-virt
mach-vt8500
mach-w90x900
mach-zynq
mm DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung ARM: SoC DT updates for 3.13 2013-11-11 17:34:56 +09:00
plat-versatile
tools
vfp
xen
Kconfig GPIO bulk changes for the v3.13 development cycle 2013-11-12 15:50:46 +09:00
Kconfig-nommu
Kconfig.debug
Makefile ARM: SoC cleanups for 3.13 2013-11-11 16:42:43 +09:00