25 lines
870 B
Diff
25 lines
870 B
Diff
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
|
|
index 5e4c453..028ef66 100644
|
|
--- a/drivers/spi/spi.c
|
|
+++ b/drivers/spi/spi.c
|
|
@@ -3262,6 +3262,19 @@ int spi_setup(struct spi_device *spi)
|
|
if (spi->controller->setup)
|
|
status = spi->controller->setup(spi);
|
|
|
|
+ if (gpio_is_valid(spi->cs_gpio)) {
|
|
+ dev_info(&spi->dev, "spi_setup / gpio_is_valid(%d) ... doing gpio_request ...\n", spi->cs_gpio);
|
|
+ int ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
|
|
+ if (ret) {
|
|
+ dev_err(&spi->dev, "failed to request gpio\n");
|
|
+ }
|
|
+ else {
|
|
+ gpio_direction_output(spi->cs_gpio,
|
|
+ !(spi->mode & SPI_CS_HIGH));
|
|
+ dev_info(&spi->dev, "spi_setup / gpio_direction_output(%d) done !\n", spi->cs_gpio);
|
|
+ }
|
|
+ }
|
|
+
|
|
if (spi->controller->auto_runtime_pm && spi->controller->set_cs) {
|
|
status = pm_runtime_get_sync(spi->controller->dev.parent);
|
|
if (status < 0) {
|