Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Patrice Chotard and committed by
Mark Brown
47c32b2b 56ec4562

+7 -1
+7 -1
drivers/spi/spi-stm32-qspi.c
··· 567 567 if (!spi->cs_gpiod) 568 568 return -EOPNOTSUPP; 569 569 570 + ret = pm_runtime_resume_and_get(qspi->dev); 571 + if (ret < 0) 572 + return ret; 573 + 570 574 mutex_lock(&qspi->lock); 571 575 572 576 gpiod_set_value_cansleep(spi->cs_gpiod, true); ··· 632 628 633 629 msg->status = ret; 634 630 spi_finalize_current_message(ctrl); 631 + 632 + pm_runtime_mark_last_busy(qspi->dev); 633 + pm_runtime_put_autosuspend(qspi->dev); 635 634 636 635 return ret; 637 636 } ··· 854 847 ctrl->mem_ops = &stm32_qspi_mem_ops; 855 848 ctrl->use_gpio_descriptors = true; 856 849 ctrl->transfer_one_message = stm32_qspi_transfer_one_message; 857 - ctrl->auto_runtime_pm = true; 858 850 ctrl->num_chipselect = STM32_QSPI_MAX_NORCHIP; 859 851 ctrl->dev.of_node = dev->of_node; 860 852