From e452b7f6b73badb836dc85314874399467537a63 Mon Sep 17 00:00:00 2001 From: Chris Blair Date: Tue, 8 Nov 2011 08:54:46 +0000 Subject: [PATCH] --- yaml --- r: 280111 b: refs/heads/master c: 53e4acea0e819a6a8513e10a0773f2259ede0481 h: refs/heads/master i: 280109: ce35dc2e4f0a22b5e8e06d6ffa226d928a4cb4b4 280107: 2234228bbbd74300e82b48c32b5a0e545310b8b2 280103: 91e854e8c78d4963522b98472bc23cd4eea7e710 280095: 2d576aadbfbc5a7471a5cd874f3310f6284b5c1b v: v3 --- [refs] | 2 +- trunk/drivers/spi/spi-pl022.c | 20 ++++++++++++++++++-- trunk/include/linux/amba/pl022.h | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 661943810d28..8eb86ec802fc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0ad2deeab5d3fc80fc7cd85638f805830254ef1d +refs/heads/master: 53e4acea0e819a6a8513e10a0773f2259ede0481 diff --git a/trunk/drivers/spi/spi-pl022.c b/trunk/drivers/spi/spi-pl022.c index 82a929f916fd..13988a3024bb 100644 --- a/trunk/drivers/spi/spi-pl022.c +++ b/trunk/drivers/spi/spi-pl022.c @@ -1516,7 +1516,13 @@ static void pump_messages(struct work_struct *work) /* nothing more to do - disable spi/ssp and power off */ writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); - pm_runtime_put(&pl022->adev->dev); + + if (pl022->master_info->autosuspend_delay > 0) { + pm_runtime_mark_last_busy(&pl022->adev->dev); + pm_runtime_put_autosuspend(&pl022->adev->dev); + } else { + pm_runtime_put(&pl022->adev->dev); + } } pl022->busy = false; spin_unlock_irqrestore(&pl022->queue_lock, flags); @@ -2247,7 +2253,17 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) dev_dbg(dev, "probe succeeded\n"); /* let runtime pm put suspend */ - pm_runtime_put(dev); + if (platform_info->autosuspend_delay > 0) { + dev_info(&adev->dev, + "will use autosuspend for runtime pm, delay %dms\n", + platform_info->autosuspend_delay); + pm_runtime_set_autosuspend_delay(dev, + platform_info->autosuspend_delay); + pm_runtime_use_autosuspend(dev); + pm_runtime_put_autosuspend(dev); + } else { + pm_runtime_put(dev); + } return 0; err_spi_register: diff --git a/trunk/include/linux/amba/pl022.h b/trunk/include/linux/amba/pl022.h index 4ce98f54186b..572f637299c9 100644 --- a/trunk/include/linux/amba/pl022.h +++ b/trunk/include/linux/amba/pl022.h @@ -238,6 +238,9 @@ struct dma_chan; * @enable_dma: if true enables DMA driven transfers. * @dma_rx_param: parameter to locate an RX DMA channel. * @dma_tx_param: parameter to locate a TX DMA channel. + * @autosuspend_delay: delay in ms following transfer completion before the + * runtime power management system suspends the device. A setting of 0 + * indicates no delay and the device will be suspended immediately. */ struct pl022_ssp_controller { u16 bus_id; @@ -246,6 +249,7 @@ struct pl022_ssp_controller { bool (*dma_filter)(struct dma_chan *chan, void *filter_param); void *dma_rx_param; void *dma_tx_param; + int autosuspend_delay; }; /**