From: Wenyou Yang Date: Wed, 5 Mar 2014 01:58:49 +0000 (+0800) Subject: spi: atmel: adopt pinctrl support X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5bdfd491a01955727a6b2382534ec7760174863e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git spi: atmel: adopt pinctrl support Amend the spi atmel pin controller to optionally take a pin control handle and set the state of the pins to: - "default" on boot, resume and before performing an spitransfer - "sleep" on suspend() This should make it possible to optimize energy usage for the pins both for the suspend/resume cycle Signed-off-by: Wenyou Yang Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 4804586edd29..c83b0c620fa1 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -26,6 +26,7 @@ #include #include +#include /* SPI register offsets */ #define SPI_CR 0x0000 @@ -1292,6 +1293,9 @@ static int atmel_spi_probe(struct platform_device *pdev) struct spi_master *master; struct atmel_spi *as; + /* Select default pin state */ + pinctrl_pm_select_default_state(&pdev->dev); + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) return -ENXIO; @@ -1446,6 +1450,9 @@ static int atmel_spi_suspend(struct device *dev) struct atmel_spi *as = spi_master_get_devdata(master); clk_disable_unprepare(as->clk); + + pinctrl_pm_select_sleep_state(dev); + return 0; } @@ -1454,6 +1461,8 @@ static int atmel_spi_resume(struct device *dev) struct spi_master *master = dev_get_drvdata(dev); struct atmel_spi *as = spi_master_get_devdata(master); + pinctrl_pm_select_default_state(dev); + clk_prepare_enable(as->clk); return 0; }