aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Blair <chris.blair@stericsson.com>2011-11-08 03:54:46 -0500
committerLinus Walleij <linus.walleij@linaro.org>2011-12-01 11:16:08 -0500
commit53e4acea0e819a6a8513e10a0773f2259ede0481 (patch)
tree621636e14849593e0d2381ee20124309ac624713
parent0ad2deeab5d3fc80fc7cd85638f805830254ef1d (diff)
spi/pl022: add support for pm_runtime autosuspend
Adds support for configuring the spi bus to 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, the call to resume the device can return immediately rather than needing to risk sleeping in order to resume the device. Reviewed-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Chris Blair <chris.blair@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/spi/spi-pl022.c20
-rw-r--r--include/linux/amba/pl022.h4
2 files changed, 22 insertions, 2 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 82a929f916fd..13988a3024bb 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -1516,7 +1516,13 @@ static void pump_messages(struct work_struct *work)
1516 /* nothing more to do - disable spi/ssp and power off */ 1516 /* nothing more to do - disable spi/ssp and power off */
1517 writew((readw(SSP_CR1(pl022->virtbase)) & 1517 writew((readw(SSP_CR1(pl022->virtbase)) &
1518 (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); 1518 (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));
1519 pm_runtime_put(&pl022->adev->dev); 1519
1520 if (pl022->master_info->autosuspend_delay > 0) {
1521 pm_runtime_mark_last_busy(&pl022->adev->dev);
1522 pm_runtime_put_autosuspend(&pl022->adev->dev);
1523 } else {
1524 pm_runtime_put(&pl022->adev->dev);
1525 }
1520 } 1526 }
1521 pl022->busy = false; 1527 pl022->busy = false;
1522 spin_unlock_irqrestore(&pl022->queue_lock, flags); 1528 spin_unlock_irqrestore(&pl022->queue_lock, flags);
@@ -2247,7 +2253,17 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id)
2247 dev_dbg(dev, "probe succeeded\n"); 2253 dev_dbg(dev, "probe succeeded\n");
2248 2254
2249 /* let runtime pm put suspend */ 2255 /* let runtime pm put suspend */
2250 pm_runtime_put(dev); 2256 if (platform_info->autosuspend_delay > 0) {
2257 dev_info(&adev->dev,
2258 "will use autosuspend for runtime pm, delay %dms\n",
2259 platform_info->autosuspend_delay);
2260 pm_runtime_set_autosuspend_delay(dev,
2261 platform_info->autosuspend_delay);
2262 pm_runtime_use_autosuspend(dev);
2263 pm_runtime_put_autosuspend(dev);
2264 } else {
2265 pm_runtime_put(dev);
2266 }
2251 return 0; 2267 return 0;
2252 2268
2253 err_spi_register: 2269 err_spi_register:
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index 4ce98f54186b..572f637299c9 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -238,6 +238,9 @@ struct dma_chan;
238 * @enable_dma: if true enables DMA driven transfers. 238 * @enable_dma: if true enables DMA driven transfers.
239 * @dma_rx_param: parameter to locate an RX DMA channel. 239 * @dma_rx_param: parameter to locate an RX DMA channel.
240 * @dma_tx_param: parameter to locate a TX DMA channel. 240 * @dma_tx_param: parameter to locate a TX DMA channel.
241 * @autosuspend_delay: delay in ms following transfer completion before the
242 * runtime power management system suspends the device. A setting of 0
243 * indicates no delay and the device will be suspended immediately.
241 */ 244 */
242struct pl022_ssp_controller { 245struct pl022_ssp_controller {
243 u16 bus_id; 246 u16 bus_id;
@@ -246,6 +249,7 @@ struct pl022_ssp_controller {
246 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 249 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
247 void *dma_rx_param; 250 void *dma_rx_param;
248 void *dma_tx_param; 251 void *dma_tx_param;
252 int autosuspend_delay;
249}; 253};
250 254
251/** 255/**