Skip to content

Commit e3a3777

Browse files
committed
spi: bcm2835aux: Convert to use GPIO descriptors
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071848 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2122415 commit b651d1d Author: Linus Walleij <linus.walleij@linaro.org> Date: Tue, 1 Feb 2022 02:29:56 +0100 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> Link: https://lore.kernel.org/r/20220201012956.563272-1-linus.walleij@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Mark Salter <msalter@redhat.com>
1 parent c37f411 commit e3a3777

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

drivers/spi/spi-bcm2835aux.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <linux/of.h>
2323
#include <linux/of_address.h>
2424
#include <linux/of_device.h>
25-
#include <linux/of_gpio.h>
2625
#include <linux/of_irq.h>
2726
#include <linux/regmap.h>
2827
#include <linux/spi/spi.h>
@@ -445,25 +444,12 @@ static void bcm2835aux_spi_handle_err(struct spi_master *master,
445444

446445
static int bcm2835aux_spi_setup(struct spi_device *spi)
447446
{
448-
int ret;
449-
450447
/* sanity check for native cs */
451448
if (spi->mode & SPI_NO_CS)
452449
return 0;
453-
if (gpio_is_valid(spi->cs_gpio)) {
454-
/* with gpio-cs set the GPIO to the correct level
455-
* and as output (in case the dt has the gpio not configured
456-
* as output but native cs)
457-
*/
458-
ret = gpio_direction_output(spi->cs_gpio,
459-
(spi->mode & SPI_CS_HIGH) ? 0 : 1);
460-
if (ret)
461-
dev_err(&spi->dev,
462-
"could not set gpio %i as output: %i\n",
463-
spi->cs_gpio, ret);
464-
465-
return ret;
466-
}
450+
451+
if (spi->cs_gpiod)
452+
return 0;
467453

468454
/* for dt-backwards compatibility: only support native on CS0
469455
* known things not supported with broken native CS:
@@ -519,6 +505,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
519505
master->prepare_message = bcm2835aux_spi_prepare_message;
520506
master->unprepare_message = bcm2835aux_spi_unprepare_message;
521507
master->dev.of_node = pdev->dev.of_node;
508+
master->use_gpio_descriptors = true;
522509

523510
bs = spi_master_get_devdata(master);
524511

0 commit comments

Comments
 (0)