linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: bcm2835aux: Convert to use GPIO descriptors
@ 2022-01-21 22:41 Linus Walleij
  2022-01-31 14:09 ` Mark Brown
  2022-02-01 17:18 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2022-01-21 22:41 UTC (permalink / raw)
  To: Mark Brown, linux-spi; +Cc: Linus Walleij, Lukas Wunner, Martin Sperl

This one is pretty straight forward to switch over, the driver
already relies on inspecting cs_gpio just check cs_gpiod instead
and stop the special handling of requesting the GPIO and stuff
the core will take care of.

Cc: Lukas Wunner <lukas@wunner.de>
Cc: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/spi/spi-bcm2835aux.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
index 7d709a8c833b..af795700e31a 100644
--- a/drivers/spi/spi-bcm2835aux.c
+++ b/drivers/spi/spi-bcm2835aux.c
@@ -22,7 +22,6 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_device.h>
-#include <linux/of_gpio.h>
 #include <linux/of_irq.h>
 #include <linux/regmap.h>
 #include <linux/spi/spi.h>
@@ -450,20 +449,9 @@ static int bcm2835aux_spi_setup(struct spi_device *spi)
 	/* sanity check for native cs */
 	if (spi->mode & SPI_NO_CS)
 		return 0;
-	if (gpio_is_valid(spi->cs_gpio)) {
-		/* with gpio-cs set the GPIO to the correct level
-		 * and as output (in case the dt has the gpio not configured
-		 * as output but native cs)
-		 */
-		ret = gpio_direction_output(spi->cs_gpio,
-					    (spi->mode & SPI_CS_HIGH) ? 0 : 1);
-		if (ret)
-			dev_err(&spi->dev,
-				"could not set gpio %i as output: %i\n",
-				spi->cs_gpio, ret);
-
-		return ret;
-	}
+
+	if (spi->cs_gpiod)
+		return 0;
 
 	/* for dt-backwards compatibility: only support native on CS0
 	 * known things not supported with broken native CS:
@@ -519,6 +507,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
 	master->prepare_message = bcm2835aux_spi_prepare_message;
 	master->unprepare_message = bcm2835aux_spi_unprepare_message;
 	master->dev.of_node = pdev->dev.of_node;
+	master->use_gpio_descriptors = true;
 
 	bs = spi_master_get_devdata(master);
 
-- 
2.34.1


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

* Re: [PATCH] spi: bcm2835aux: Convert to use GPIO descriptors
  2022-01-21 22:41 [PATCH] spi: bcm2835aux: Convert to use GPIO descriptors Linus Walleij
@ 2022-01-31 14:09 ` Mark Brown
  2022-02-01 17:18 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-01-31 14:09 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-spi, Lukas Wunner, Martin Sperl

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

On Fri, Jan 21, 2022 at 11:41:26PM +0100, Linus Walleij wrote:
> This one is pretty straight forward to switch over, the driver
> already relies on inspecting cs_gpio just check cs_gpiod instead
> and stop the special handling of requesting the GPIO and stuff
> the core will take care of.

This breaks an x86 allmodconfig build:

/mnt/kernel/drivers/spi/spi-bcm2835aux.c: In function 'bcm2835aux_spi_setup':
/mnt/kernel/drivers/spi/spi-bcm2835aux.c:447:6: error: unused variable 'ret' [-Werror=unused-variable]

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

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

* Re: [PATCH] spi: bcm2835aux: Convert to use GPIO descriptors
  2022-01-21 22:41 [PATCH] spi: bcm2835aux: Convert to use GPIO descriptors Linus Walleij
  2022-01-31 14:09 ` Mark Brown
@ 2022-02-01 17:18 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-02-01 17:18 UTC (permalink / raw)
  To: linux-spi, Linus Walleij; +Cc: Martin Sperl, Lukas Wunner

On Fri, 21 Jan 2022 23:41:26 +0100, Linus Walleij wrote:
> This one is pretty straight forward to switch over, the driver
> already relies on inspecting cs_gpio just check cs_gpiod instead
> and stop the special handling of requesting the GPIO and stuff
> the core will take care of.
> 
> 

Applied to

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

Thanks!

[1/1] spi: bcm2835aux: Convert to use GPIO descriptors
      commit: b651d1da86aa525c5a5b2bd61f528353c28d589d

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:[~2022-02-01 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 22:41 [PATCH] spi: bcm2835aux: Convert to use GPIO descriptors Linus Walleij
2022-01-31 14:09 ` Mark Brown
2022-02-01 17:18 ` 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).