]> rtime.felk.cvut.cz Git - zynq/linux.git/commit
spi: cadence: Correct initialisation of runtime PM
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Thu, 25 Apr 2019 12:59:49 +0000 (18:29 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 25 Apr 2019 21:43:39 +0000 (14:43 -0700)
commit770501fc9f26736581b1193718938684b80193de
tree1114dc74bc449f9493ac9e477c62053e70cc8587
parentb84c2bd18930196d739a5237823a3dd3a5df8cad
spi: cadence: Correct initialisation of runtime PM

Currently the driver calls pm_runtime_put_autosuspend but without ever
having done a pm_runtime_get, this causes the reference count in the pm
runtime core to become -1. The bad reference count causes the core to
sometimes suspend whilst an active SPI transfer is in progress.

arizona spi0.1: SPI transfer timed out
spi_master spi0: failed to transfer one message from queue

The correct proceedure is to do all the initialisation that requires the
hardware to be powered up before enabling the PM runtime, then enable
the PM runtime having called pm_runtime_set_active to inform it that the
hardware is currently powered up. The core will then power it down at
it's leisure and no explicit pm_runtime_put is required.

Fixes: d36ccd9 ("spi: cadence: Runtime pm adaptation")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/spi/spi-cadence.c