diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2022-01-22 01:48:46 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-01-31 15:17:30 +0000 |
commit | 99407f11b5657cd66625c6b55a73d38b67803a8c (patch) | |
tree | a45433fbf6fd593dcb6b7c2288c9b80df42ea353 /drivers/spi | |
parent | 2818824ced4be5abc22c450340d548702f166d9a (diff) | |
download | linux-stable-99407f11b5657cd66625c6b55a73d38b67803a8c.tar.gz linux-stable-99407f11b5657cd66625c6b55a73d38b67803a8c.tar.bz2 linux-stable-99407f11b5657cd66625c6b55a73d38b67803a8c.zip |
spi: pic32: Convert to use GPIO descriptors
The driver already relies on the core looking up GPIO lines
from the core, so this is trivial to switch over to using
GPIO descriptors.
Cc: Purna Chandra Mandal <purna.mandal@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220122004846.374930-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-pic32.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c index f86433b29260..7e5c09a7d489 100644 --- a/drivers/spi/spi-pic32.c +++ b/drivers/spi/spi-pic32.c @@ -591,18 +591,16 @@ static int pic32_spi_setup(struct spi_device *spi) * unreliable/erroneous SPI transactions. * To avoid that we will always handle /CS by toggling GPIO. */ - if (!gpio_is_valid(spi->cs_gpio)) + if (!spi->cs_gpiod) return -EINVAL; - gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); - return 0; } static void pic32_spi_cleanup(struct spi_device *spi) { - /* de-activate cs-gpio */ - gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); + /* de-activate cs-gpio, gpiolib will handle inversion */ + gpiod_direction_output(spi->cs_gpiod, 0); } static int pic32_spi_dma_prep(struct pic32_spi *pic32s, struct device *dev) @@ -784,6 +782,7 @@ static int pic32_spi_probe(struct platform_device *pdev) master->unprepare_message = pic32_spi_unprepare_message; master->prepare_transfer_hardware = pic32_spi_prepare_hardware; master->unprepare_transfer_hardware = pic32_spi_unprepare_hardware; + master->use_gpio_descriptors = true; /* optional DMA support */ ret = pic32_spi_dma_prep(pic32s, &pdev->dev); |