Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27b5284c authored by Shubhrajyoti D's avatar Shubhrajyoti D Committed by Grant Likely
Browse files

spi: omap2-mcspi: add support for pm_runtime autosuspend



Adds support for configuring the omap2-mcspi driver use autosuspend for
runtime power management. This can reduce the latency in starting an
spi transfer by not suspending the device immediately following
completion of a transfer. If another transfer then takes place before
the autosuspend timeout (2 secs), the call to resume the device can
return immediately saving some save/ restore cycles.

Acked-by: default avatarGovindraj.R <govindraj.raja@ti.com>
Signed-off-by: default avatarShubhrajyoti D <shubhrajyoti@ti.com>
parent 1bd897f8
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include <plat/mcspi.h>

#define OMAP2_MCSPI_MAX_FREQ		48000000
#define SPI_AUTOSUSPEND_TIMEOUT		2000

#define OMAP2_MCSPI_REVISION		0x00
#define OMAP2_MCSPI_SYSSTATUS		0x14
@@ -265,7 +266,8 @@ static void omap2_mcspi_restore_ctx(struct omap2_mcspi *mcspi)
}
static void omap2_mcspi_disable_clocks(struct omap2_mcspi *mcspi)
{
	pm_runtime_put_sync(mcspi->dev);
	pm_runtime_mark_last_busy(mcspi->dev);
	pm_runtime_put_autosuspend(mcspi->dev);
}

static int omap2_mcspi_enable_clocks(struct omap2_mcspi *mcspi)
@@ -1212,6 +1214,8 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
	if (status < 0)
		goto dma_chnl_free;

	pm_runtime_use_autosuspend(&pdev->dev);
	pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
	pm_runtime_enable(&pdev->dev);

	if (status || omap2_mcspi_master_setup(mcspi) < 0)