linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Restore delays for non-GPIO chip select
@ 2024-03-11 22:53 Janne Grunau via B4 Relay
  2024-03-12 14:47 ` Greg KH
  2024-03-12 16:57 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Janne Grunau via B4 Relay @ 2024-03-11 22:53 UTC (permalink / raw)
  To: Mark Brown, Amit Kumar Mahapatra
  Cc: linux-spi, linux-kernel, asahi, regressions, Janne Grunau

From: Janne Grunau <j@jannau.net>

SPI controller with integrated chip select handling still need to adhere
to SPI device's CS setup, hold and inactive delays. For controller
without set_cs_timing spi core shall handle the delays to avoid
duplicated delay handling in each controller driver.
Fixes a regression for the out of tree SPI controller and SPI HID
transport on Apple M1/M1 Pro/Max notebooks.

Fixes: 4d8ff6b0991d ("spi: Add multi-cs memories support in SPI core")
Signed-off-by: Janne Grunau <j@jannau.net>
---
#regzbot ^introduced 4d8ff6b0991d5e86b17b235fc46ec62e9195cb9
---
 drivers/spi/spi.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f2170f4b5077..71be2ba8402f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1042,10 +1042,14 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
 	if (spi->mode & SPI_CS_HIGH)
 		enable = !enable;
 
-	if (spi_is_csgpiod(spi)) {
-		if (!spi->controller->set_cs_timing && !activate)
-			spi_delay_exec(&spi->cs_hold, NULL);
+	/*
+	 * Handle chip select delays for GPIO based CS or controllers without
+	 * programmable chip select timing.
+	 */
+	if ((spi_is_csgpiod(spi) || !spi->controller->set_cs_timing) && !activate)
+		spi_delay_exec(&spi->cs_hold, NULL);
 
+	if (spi_is_csgpiod(spi)) {
 		if (!(spi->mode & SPI_NO_CS)) {
 			/*
 			 * Historically ACPI has no means of the GPIO polarity and
@@ -1079,16 +1083,16 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
 		if ((spi->controller->flags & SPI_CONTROLLER_GPIO_SS) &&
 		    spi->controller->set_cs)
 			spi->controller->set_cs(spi, !enable);
-
-		if (!spi->controller->set_cs_timing) {
-			if (activate)
-				spi_delay_exec(&spi->cs_setup, NULL);
-			else
-				spi_delay_exec(&spi->cs_inactive, NULL);
-		}
 	} else if (spi->controller->set_cs) {
 		spi->controller->set_cs(spi, !enable);
 	}
+
+	if (spi_is_csgpiod(spi) || !spi->controller->set_cs_timing) {
+		if (activate)
+			spi_delay_exec(&spi->cs_setup, NULL);
+		else
+			spi_delay_exec(&spi->cs_inactive, NULL);
+	}
 }
 
 #ifdef CONFIG_HAS_DMA

---
base-commit: e8f897f4afef0031fe618a8e94127a0934896aba
change-id: 20240311-spi-cs-delays-regression-fd7309fc0eff

Best regards,
-- 
Janne Grunau <j@jannau.net>


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

* Re: [PATCH] spi: Restore delays for non-GPIO chip select
  2024-03-11 22:53 [PATCH] spi: Restore delays for non-GPIO chip select Janne Grunau via B4 Relay
@ 2024-03-12 14:47 ` Greg KH
  2024-03-12 16:57 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-03-12 14:47 UTC (permalink / raw)
  To: j
  Cc: Mark Brown, Amit Kumar Mahapatra, linux-spi, linux-kernel, asahi,
	regressions

On Mon, Mar 11, 2024 at 11:53:17PM +0100, Janne Grunau via B4 Relay wrote:
> From: Janne Grunau <j@jannau.net>
> 
> SPI controller with integrated chip select handling still need to adhere
> to SPI device's CS setup, hold and inactive delays. For controller
> without set_cs_timing spi core shall handle the delays to avoid
> duplicated delay handling in each controller driver.
> Fixes a regression for the out of tree SPI controller and SPI HID
> transport on Apple M1/M1 Pro/Max notebooks.
> 
> Fixes: 4d8ff6b0991d ("spi: Add multi-cs memories support in SPI core")
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> #regzbot ^introduced 4d8ff6b0991d5e86b17b235fc46ec62e9195cb9
> ---
>  drivers/spi/spi.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index f2170f4b5077..71be2ba8402f 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1042,10 +1042,14 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
>  	if (spi->mode & SPI_CS_HIGH)
>  		enable = !enable;
>  
> -	if (spi_is_csgpiod(spi)) {
> -		if (!spi->controller->set_cs_timing && !activate)
> -			spi_delay_exec(&spi->cs_hold, NULL);
> +	/*
> +	 * Handle chip select delays for GPIO based CS or controllers without
> +	 * programmable chip select timing.
> +	 */
> +	if ((spi_is_csgpiod(spi) || !spi->controller->set_cs_timing) && !activate)
> +		spi_delay_exec(&spi->cs_hold, NULL);
>  
> +	if (spi_is_csgpiod(spi)) {
>  		if (!(spi->mode & SPI_NO_CS)) {
>  			/*
>  			 * Historically ACPI has no means of the GPIO polarity and
> @@ -1079,16 +1083,16 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
>  		if ((spi->controller->flags & SPI_CONTROLLER_GPIO_SS) &&
>  		    spi->controller->set_cs)
>  			spi->controller->set_cs(spi, !enable);
> -
> -		if (!spi->controller->set_cs_timing) {
> -			if (activate)
> -				spi_delay_exec(&spi->cs_setup, NULL);
> -			else
> -				spi_delay_exec(&spi->cs_inactive, NULL);
> -		}
>  	} else if (spi->controller->set_cs) {
>  		spi->controller->set_cs(spi, !enable);
>  	}
> +
> +	if (spi_is_csgpiod(spi) || !spi->controller->set_cs_timing) {
> +		if (activate)
> +			spi_delay_exec(&spi->cs_setup, NULL);
> +		else
> +			spi_delay_exec(&spi->cs_inactive, NULL);
> +	}
>  }
>  
>  #ifdef CONFIG_HAS_DMA
> 
> ---
> base-commit: e8f897f4afef0031fe618a8e94127a0934896aba
> change-id: 20240311-spi-cs-delays-regression-fd7309fc0eff
> 
> Best regards,
> -- 
> Janne Grunau <j@jannau.net>
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* Re: [PATCH] spi: Restore delays for non-GPIO chip select
  2024-03-11 22:53 [PATCH] spi: Restore delays for non-GPIO chip select Janne Grunau via B4 Relay
  2024-03-12 14:47 ` Greg KH
@ 2024-03-12 16:57 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-03-12 16:57 UTC (permalink / raw)
  To: Amit Kumar Mahapatra, Janne Grunau
  Cc: linux-spi, linux-kernel, asahi, regressions

On Mon, 11 Mar 2024 23:53:17 +0100, Janne Grunau wrote:
> SPI controller with integrated chip select handling still need to adhere
> to SPI device's CS setup, hold and inactive delays. For controller
> without set_cs_timing spi core shall handle the delays to avoid
> duplicated delay handling in each controller driver.
> Fixes a regression for the out of tree SPI controller and SPI HID
> transport on Apple M1/M1 Pro/Max notebooks.
> 
> [...]

Applied to

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

Thanks!

[1/1] spi: Restore delays for non-GPIO chip select
      commit: aa0162dc0dd95c3bf248e3c78068760094e8f64b

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:[~2024-03-12 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 22:53 [PATCH] spi: Restore delays for non-GPIO chip select Janne Grunau via B4 Relay
2024-03-12 14:47 ` Greg KH
2024-03-12 16:57 ` 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).