mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
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>
This commit is contained in:
parent
2818824ced
commit
99407f11b5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user