summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-stm32-qspi.c
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@foss.st.com>2022-08-29 14:32:50 +0200
committerMark Brown <broonie@kernel.org>2022-08-29 16:39:24 +0100
commit47c32b2b7fcfa97f7224df222f439fc0ccf94ffe (patch)
tree4a87d71274667c92ffccf44d39388e2d6acb1f08 /drivers/spi/spi-stm32-qspi.c
parent56ec456293239b3c5dfb0e4dcf22972b1b8c571d (diff)
downloadlinux-stable-47c32b2b7fcfa97f7224df222f439fc0ccf94ffe.tar.gz
linux-stable-47c32b2b7fcfa97f7224df222f439fc0ccf94ffe.tar.bz2
linux-stable-47c32b2b7fcfa97f7224df222f439fc0ccf94ffe.zip
spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message()
ctrl->auto_runtime_pm was wrongly set to true when adding transfer_one_message() callback. As explained in commit 6e6ccb3d4cdc ("spi: stm32-qspi: Add pm_runtime support") the expected behavior is to prevent runtime suspends between each transfer. Add needed pm_runtime API calls in stm32_qspi_transfer_one_message(). Fixes: a557fca630cc ("spi: stm32_qspi: Add transfer_one_message() spi callback") Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://lore.kernel.org/r/20220829123250.2170562-1-patrice.chotard@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-stm32-qspi.c')
-rw-r--r--drivers/spi/spi-stm32-qspi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index 679fd1c34f7e..227f450aa5f0 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -567,6 +567,10 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl,
if (!spi->cs_gpiod)
return -EOPNOTSUPP;
+ ret = pm_runtime_resume_and_get(qspi->dev);
+ if (ret < 0)
+ return ret;
+
mutex_lock(&qspi->lock);
gpiod_set_value_cansleep(spi->cs_gpiod, true);
@@ -629,6 +633,9 @@ end_of_transfer:
msg->status = ret;
spi_finalize_current_message(ctrl);
+ pm_runtime_mark_last_busy(qspi->dev);
+ pm_runtime_put_autosuspend(qspi->dev);
+
return ret;
}
@@ -847,7 +854,6 @@ static int stm32_qspi_probe(struct platform_device *pdev)
ctrl->mem_ops = &stm32_qspi_mem_ops;
ctrl->use_gpio_descriptors = true;
ctrl->transfer_one_message = stm32_qspi_transfer_one_message;
- ctrl->auto_runtime_pm = true;
ctrl->num_chipselect = STM32_QSPI_MAX_NORCHIP;
ctrl->dev.of_node = dev->of_node;