linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message()
@ 2022-08-29 12:32 patrice.chotard
  2022-08-29 12:51 ` Mark Brown
  2022-08-29 16:50 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: patrice.chotard @ 2022-08-29 12:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel,
	christophe.kerello, patrice.chotard

From: Patrice Chotard <patrice.chotard@foss.st.com>

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>
---
 drivers/spi/spi-stm32-qspi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl,
 	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;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message()
  2022-08-29 12:32 [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message() patrice.chotard
@ 2022-08-29 12:51 ` Mark Brown
  2022-08-29 13:07   ` Patrice CHOTARD
  2022-08-29 16:50 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2022-08-29 12:51 UTC (permalink / raw)
  To: patrice.chotard
  Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel,
	christophe.kerello

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

On Mon, Aug 29, 2022 at 02:32:50PM +0200, patrice.chotard@foss.st.com wrote:
> From: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> 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.

This doesn't apply against current code (the for-6.0 branch) -
please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message()
  2022-08-29 12:51 ` Mark Brown
@ 2022-08-29 13:07   ` Patrice CHOTARD
  0 siblings, 0 replies; 4+ messages in thread
From: Patrice CHOTARD @ 2022-08-29 13:07 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel,
	christophe.kerello

Hi Mark

On 8/29/22 14:51, Mark Brown wrote:
> On Mon, Aug 29, 2022 at 02:32:50PM +0200, patrice.chotard@foss.st.com wrote:
>> From: Patrice Chotard <patrice.chotard@foss.st.com>
>>
>> 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.
> 
> This doesn't apply against current code (the for-6.0 branch) -
> please check and resend.

This patch is not dedicated for the spi/for-6.0 branch but for the spi/for-6.1 one,
as this patch is fixing commit a557fca630cc which is merged in spi/for-6.1.

Thanks
Patrice

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message()
  2022-08-29 12:32 [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message() patrice.chotard
  2022-08-29 12:51 ` Mark Brown
@ 2022-08-29 16:50 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-08-29 16:50 UTC (permalink / raw)
  To: patrice.chotard
  Cc: linux-kernel, christophe.kerello, linux-spi, linux-arm-kernel,
	linux-stm32

On Mon, 29 Aug 2022 14:32:50 +0200, patrice.chotard@foss.st.com wrote:
> From: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> 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.
> 
> [...]

Applied to

   broonie/spi.git for-next

Thanks!

[1/1] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message()
      commit: 47c32b2b7fcfa97f7224df222f439fc0ccf94ffe

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-29 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 12:32 [PATCH] spi: stm32-qspi: Fix pm_runtime management in stm32_qspi_transfer_one_message() patrice.chotard
2022-08-29 12:51 ` Mark Brown
2022-08-29 13:07   ` Patrice CHOTARD
2022-08-29 16:50 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).