linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()
@ 2025-08-05  1:54 Tianyu Xu
  2025-08-05  7:41 ` Miquel Raynal
  2025-08-06 13:55 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Tianyu Xu @ 2025-08-05  1:54 UTC (permalink / raw)
  To: broonie; +Cc: linux-spi, miquel.raynal, Tianyu Xu

The function spi_mem_adjust_op_freq() within spi_mem_exec_op() adjusts
the op->max_freq, which will informs the SPI controller of the maximum
frequency for each operation. This adjustment is based on combined
information from the SPI device and the board's wiring conditions.
Similarly, spi_mem_supports_op() will check the capabilities of the SPI
controller. It also requires the combined information before it can
accurately determine whether the SPI controller supports a given operation.

Signed-off-by: Tianyu Xu <tianyxu@cisco.com>
---
 drivers/spi/spi-mem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 5db0639d3..753dbade8 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -265,6 +265,9 @@ static bool spi_mem_internal_supports_op(struct spi_mem *mem,
  */
 bool spi_mem_supports_op(struct spi_mem *mem, const struct spi_mem_op *op)
 {
+	/* Make sure the operation frequency is correct before going futher */
+	spi_mem_adjust_op_freq(mem, (struct spi_mem_op *)op);
+
 	if (spi_mem_check_op(op))
 		return false;
 
-- 
2.39.5 (Apple Git-154)


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

* Re: [PATCH] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()
  2025-08-05  1:54 [PATCH] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op() Tianyu Xu
@ 2025-08-05  7:41 ` Miquel Raynal
  2025-08-06 13:55 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-08-05  7:41 UTC (permalink / raw)
  To: Tianyu Xu; +Cc: broonie, linux-spi, Tianyu Xu

Hello,

On 05/08/2025 at 09:54:03 +08, Tianyu Xu <xtydtc@gmail.com> wrote:

> The function spi_mem_adjust_op_freq() within spi_mem_exec_op() adjusts
> the op->max_freq, which will informs the SPI controller of the maximum
> frequency for each operation. This adjustment is based on combined
> information from the SPI device and the board's wiring conditions.
> Similarly, spi_mem_supports_op() will check the capabilities of the SPI
> controller. It also requires the combined information before it can
> accurately determine whether the SPI controller supports a given operation.
>
> Signed-off-by: Tianyu Xu <tianyxu@cisco.com>

That's correct.

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

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

* Re: [PATCH] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()
  2025-08-05  1:54 [PATCH] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op() Tianyu Xu
  2025-08-05  7:41 ` Miquel Raynal
@ 2025-08-06 13:55 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-08-06 13:55 UTC (permalink / raw)
  To: Tianyu Xu; +Cc: linux-spi, miquel.raynal, Tianyu Xu

On Tue, 05 Aug 2025 09:54:03 +0800, Tianyu Xu wrote:
> The function spi_mem_adjust_op_freq() within spi_mem_exec_op() adjusts
> the op->max_freq, which will informs the SPI controller of the maximum
> frequency for each operation. This adjustment is based on combined
> information from the SPI device and the board's wiring conditions.
> Similarly, spi_mem_supports_op() will check the capabilities of the SPI
> controller. It also requires the combined information before it can
> accurately determine whether the SPI controller supports a given operation.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()
      commit: a4f8e70d75dd11ab1a01894893e0b03f1d0b61fd

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] 3+ messages in thread

end of thread, other threads:[~2025-08-06 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-05  1:54 [PATCH] spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op() Tianyu Xu
2025-08-05  7:41 ` Miquel Raynal
2025-08-06 13:55 ` 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).