All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>
To: Linus WALLEIJ <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Cc: Christopher BLAIR
	<chris.blair-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Shiraz HASHIM <shiraz.hashim-qxv4g6HH51o@public.gmane.org>,
	"spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
	<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH 6/6] spi/pl022: add support for pm_runtime autosuspend
Date: Wed, 9 Nov 2011 16:30:57 +0530	[thread overview]
Message-ID: <4EBA5D69.8010404@st.com> (raw)
In-Reply-To: <1320835170-31370-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>

On 11/9/2011 4:09 PM, Linus WALLEIJ wrote:
> From: Chris Blair <chris.blair-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> 
> 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.
> 
> Signed-off-by: Chris Blair <chris.blair-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/spi/spi-pl022.c    |   20 ++++++++++++++++++--
>  include/linux/amba/pl022.h |    4 ++++
>  2 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
> index 2e3522d..d3d6521 100644
> --- a/drivers/spi/spi-pl022.c
> +++ b/drivers/spi/spi-pl022.c
> @@ -1515,7 +1515,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);
> @@ -2245,7 +2251,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/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
> index 4ce98f5..572f637 100644
> --- a/include/linux/amba/pl022.h
> +++ b/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;
>  };
>  
>  /**

Reviewed-by: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>

-- 
viresh

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1

WARNING: multiple messages have this Message-ID (diff)
From: viresh.kumar@st.com (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] spi/pl022: add support for pm_runtime autosuspend
Date: Wed, 9 Nov 2011 16:30:57 +0530	[thread overview]
Message-ID: <4EBA5D69.8010404@st.com> (raw)
In-Reply-To: <1320835170-31370-1-git-send-email-linus.walleij@stericsson.com>

On 11/9/2011 4:09 PM, Linus WALLEIJ wrote:
> From: Chris Blair <chris.blair@stericsson.com>
> 
> 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.
> 
> Signed-off-by: Chris Blair <chris.blair@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/spi/spi-pl022.c    |   20 ++++++++++++++++++--
>  include/linux/amba/pl022.h |    4 ++++
>  2 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
> index 2e3522d..d3d6521 100644
> --- a/drivers/spi/spi-pl022.c
> +++ b/drivers/spi/spi-pl022.c
> @@ -1515,7 +1515,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);
> @@ -2245,7 +2251,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/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
> index 4ce98f5..572f637 100644
> --- a/include/linux/amba/pl022.h
> +++ b/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;
>  };
>  
>  /**

Reviewed-by: Viresh Kumar <viresh.kumar@st.com>

-- 
viresh

  parent reply	other threads:[~2011-11-09 11:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 10:39 [PATCH 6/6] spi/pl022: add support for pm_runtime autosuspend Linus Walleij
2011-11-09 10:39 ` Linus Walleij
     [not found] ` <1320835170-31370-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2011-11-09 11:00   ` Viresh Kumar [this message]
2011-11-09 11:00     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EBA5D69.8010404@st.com \
    --to=viresh.kumar-qxv4g6hh51o@public.gmane.org \
    --cc=chris.blair-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org \
    --cc=linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=shiraz.hashim-qxv4g6HH51o@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.