linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi/s3c64xx: Convert to dev_pm_ops
@ 2011-12-05 16:50 Mark Brown
  2011-12-05 16:50 ` [PATCH 2/2] spi/s3c64xx: Implement runtime PM support Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-12-05 16:50 UTC (permalink / raw)
  To: Kukjin Kim, Grant Likely; +Cc: linux-samsung-soc, spi-devel-general, Mark Brown

In preparation for the addition of runtime PM ops.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/spi/spi-s3c64xx.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 9b16406..fef1c90 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1226,9 +1226,9 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
+static int s3c64xx_spi_suspend(struct device *dev)
 {
-	struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
+	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
 	unsigned long flags;
 
@@ -1248,9 +1248,10 @@ static int s3c64xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
 	return 0;
 }
 
-static int s3c64xx_spi_resume(struct platform_device *pdev)
+static int s3c64xx_spi_resume(struct device *dev)
 {
-	struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
+	struct platform_device *pdev = to_platform_device(dev);
+	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
 	struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
 	unsigned long flags;
@@ -1269,19 +1270,19 @@ static int s3c64xx_spi_resume(struct platform_device *pdev)
 
 	return 0;
 }
-#else
-#define s3c64xx_spi_suspend	NULL
-#define s3c64xx_spi_resume	NULL
 #endif /* CONFIG_PM */
 
+static struct dev_pm_ops s3c64xx_spi_pm = {
+	SET_SYSTEM_SLEEP_PM_OPS(s3c64xx_spi_suspend, s3c64xx_spi_resume)
+};
+
 static struct platform_driver s3c64xx_spi_driver = {
 	.driver = {
 		.name	= "s3c64xx-spi",
 		.owner = THIS_MODULE,
+		.pm = &s3c64xx_spi_pm,
 	},
 	.remove = s3c64xx_spi_remove,
-	.suspend = s3c64xx_spi_suspend,
-	.resume = s3c64xx_spi_resume,
 };
 MODULE_ALIAS("platform:s3c64xx-spi");
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] spi/s3c64xx: Implement runtime PM support
  2011-12-05 16:50 [PATCH 1/2] spi/s3c64xx: Convert to dev_pm_ops Mark Brown
@ 2011-12-05 16:50 ` Mark Brown
  2011-12-05 21:41   ` Linus Walleij
  2011-12-13 14:49   ` Heiko Stübner
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2011-12-05 16:50 UTC (permalink / raw)
  To: Kukjin Kim, Grant Likely; +Cc: linux-samsung-soc, spi-devel-general, Mark Brown

Enable and disable the clocks to the SPI controller using runtime PM. This
serves the dual purpose of reducing power consumption a little and letting
the core know when the device is idle.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/spi/spi-s3c64xx.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index fef1c90..9031783 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -25,6 +25,7 @@
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/spi/spi.h>
 
 #include <mach/dma.h>
@@ -782,6 +783,8 @@ static void s3c64xx_spi_work(struct work_struct *work)
 	while (!acquire_dma(sdd))
 		msleep(10);
 
+	pm_runtime_get_sync(&sdd->pdev->dev);
+
 	spin_lock_irqsave(&sdd->lock, flags);
 
 	while (!list_empty(&sdd->queue)
@@ -810,6 +813,8 @@ static void s3c64xx_spi_work(struct work_struct *work)
 	/* Free DMA channels */
 	sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client);
 	sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client);
+
+	pm_runtime_put(&sdd->pdev->dev);
 }
 
 static int s3c64xx_spi_transfer(struct spi_device *spi,
@@ -892,6 +897,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 		goto setup_exit;
 	}
 
+	pm_runtime_get_sync(&sdd->pdev->dev);
+
 	/* Check if we can provide the requested rate */
 	if (!sci->clk_from_cmu) {
 		u32 psr, speed;
@@ -924,6 +931,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 			err = -EINVAL;
 	}
 
+	pm_runtime_put(&sdd->pdev->dev);
+
 setup_exit:
 
 	/* setup() returns with device de-selected */
@@ -1159,6 +1168,8 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 					mem_res->end, mem_res->start,
 					sdd->rx_dma.dmach, sdd->tx_dma.dmach);
 
+	pm_runtime_enable(&pdev->dev);
+
 	return 0;
 
 err9:
@@ -1192,6 +1203,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 	struct resource	*mem_res;
 	unsigned long flags;
 
+	pm_runtime_disable(&pdev->dev);
+
 	spin_lock_irqsave(&sdd->lock, flags);
 	sdd->state |= SUSPND;
 	spin_unlock_irqrestore(&sdd->lock, flags);
@@ -1272,8 +1285,34 @@ static int s3c64xx_spi_resume(struct device *dev)
 }
 #endif /* CONFIG_PM */
 
+#ifdef CONFIG_PM_RUNTIME
+static int s3c64xx_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
+
+	clk_disable(sdd->clk);
+	clk_disable(sdd->src_clk);
+
+	return 0;
+}
+
+static int s3c64xx_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
+
+	clk_enable(sdd->src_clk);
+	clk_enable(sdd->clk);
+
+	return 0;
+}
+#endif /* CONFIG_PM_RUNTIME */
+
 static struct dev_pm_ops s3c64xx_spi_pm = {
 	SET_SYSTEM_SLEEP_PM_OPS(s3c64xx_spi_suspend, s3c64xx_spi_resume)
+	SET_RUNTIME_PM_OPS(s3c64xx_spi_runtime_suspend,
+			   s3c64xx_spi_runtime_resume, NULL)
 };
 
 static struct platform_driver s3c64xx_spi_driver = {
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] spi/s3c64xx: Implement runtime PM support
  2011-12-05 16:50 ` [PATCH 2/2] spi/s3c64xx: Implement runtime PM support Mark Brown
@ 2011-12-05 21:41   ` Linus Walleij
  2011-12-05 23:16     ` Mark Brown
  2011-12-13 14:49   ` Heiko Stübner
  1 sibling, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2011-12-05 21:41 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kukjin Kim, Grant Likely, spi-devel-general, linux-samsung-soc,
	Magnus Damm

On Mon, Dec 5, 2011 at 5:50 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:

> Enable and disable the clocks to the SPI controller using runtime PM. This
> serves the dual purpose of reducing power consumption a little and letting
> the core know when the device is idle.
(...)
> +#ifdef CONFIG_PM_RUNTIME
> +static int s3c64xx_spi_runtime_suspend(struct device *dev)
> +{
> +       struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> +       struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> +
> +       clk_disable(sdd->clk);
> +       clk_disable(sdd->src_clk);
> +
> +       return 0;
> +}
> +
> +static int s3c64xx_spi_runtime_resume(struct device *dev)
> +{
> +       struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> +       struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> +
> +       clk_enable(sdd->src_clk);
> +       clk_enable(sdd->clk);
> +
> +       return 0;
> +}
> +#endif /* CONFIG_PM_RUNTIME */

This is similar to how I'm doing things in my drivers so this looks
good to me, Acked-by.

Just wanted to mention that I had this discussion with Magnus Damm
about how they do this in shmobile: in there their central runtime PM
policy in arch/arm/mach-shmobile/pm_runtime.c adds in the
pm_clk_notifier from drivers/base/power/clock_ops.c to gate/ungate
the clocks centrally acting on bus notifiers without any per-driver
hooks like these.

I clearly see that in this platform it's *not* going to work since
for this one driver atleast, there are two clocks, not just one,
that need to be managed for the device.

So I guess that some platforms will do central clock
management and some will do driver-local management.

I fear for the day one of these devices turn up in two platforms:
one using central clock management and one using
distributed clock management ...

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] spi/s3c64xx: Implement runtime PM support
  2011-12-05 21:41   ` Linus Walleij
@ 2011-12-05 23:16     ` Mark Brown
       [not found]       ` <20111205231647.GA21083-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-12-05 23:16 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Kukjin Kim, Grant Likely, spi-devel-general, linux-samsung-soc,
	Magnus Damm

On Mon, Dec 05, 2011 at 10:41:21PM +0100, Linus Walleij wrote:

> Just wanted to mention that I had this discussion with Magnus Damm
> about how they do this in shmobile: in there their central runtime PM
> policy in arch/arm/mach-shmobile/pm_runtime.c adds in the
> pm_clk_notifier from drivers/base/power/clock_ops.c to gate/ungate
> the clocks centrally acting on bus notifiers without any per-driver
> hooks like these.

Yeah, I'm familiar with that - some other platforms were looking into a
similar scheme I think.

> I clearly see that in this platform it's *not* going to work since
> for this one driver atleast, there are two clocks, not just one,
> that need to be managed for the device.

Well, that's not something that's a blocker to central management - the
core can always work with two clocks.  What's more of an issue is when
devices need to work with their clocks independantly of the core, but
that's not insurmountable.

I do also think that if we do decide to move more platforms to central
management it's going to be easier to first transition all their drivers
to a repetitive style of clock management and then do a big factor out
once the pattern is clearly visible.  It's a big undertaking for things
like the Samsung family of processors where you've got a huge set of
chips to work with going all the way back to s3c24xx so anything we can
do to make it easier is going to be a win.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] spi/s3c64xx: Implement runtime PM support
       [not found]       ` <20111205231647.GA21083-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2011-12-06 14:05         ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2011-12-06 14:05 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Kukjin Kim,
	Magnus Damm, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA

On Tue, Dec 6, 2011 at 12:16 AM, Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> wrote:

> I do also think that if we do decide to move more platforms to central
> management it's going to be easier to first transition all their drivers
> to a repetitive style of clock management and then do a big factor out
> once the pattern is clearly visible.

I agree with this. I will go forward in the same manner with
Ux500 for the time being.

Thanks,
Linus Walleij

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] spi/s3c64xx: Implement runtime PM support
  2011-12-05 16:50 ` [PATCH 2/2] spi/s3c64xx: Implement runtime PM support Mark Brown
  2011-12-05 21:41   ` Linus Walleij
@ 2011-12-13 14:49   ` Heiko Stübner
  2011-12-13 15:02     ` Heiko Stübner
  1 sibling, 1 reply; 7+ messages in thread
From: Heiko Stübner @ 2011-12-13 14:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kukjin Kim, Grant Likely, linux-samsung-soc, spi-devel-general

Am Montag, 5. Dezember 2011, 17:50:13 schrieb Mark Brown:
> Enable and disable the clocks to the SPI controller using runtime PM. This
> serves the dual purpose of reducing power consumption a little and letting
> the core know when the device is idle.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Heiko Stuebner <heiko@sntech.de

Kgene and/or Grant: could we move this forward, as I would like to profit from 
this change later on too :-)


Thanks
Heiko

> ---
>  drivers/spi/spi-s3c64xx.c |   39 +++++++++++++++++++++++++++++++++++++++
>  1 files changed, 39 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index fef1c90..9031783 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -25,6 +25,7 @@
>  #include <linux/clk.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/spi/spi.h>
> 
>  #include <mach/dma.h>
> @@ -782,6 +783,8 @@ static void s3c64xx_spi_work(struct work_struct *work)
>  	while (!acquire_dma(sdd))
>  		msleep(10);
> 
> +	pm_runtime_get_sync(&sdd->pdev->dev);
> +
>  	spin_lock_irqsave(&sdd->lock, flags);
> 
>  	while (!list_empty(&sdd->queue)
> @@ -810,6 +813,8 @@ static void s3c64xx_spi_work(struct work_struct *work)
>  	/* Free DMA channels */
>  	sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client);
>  	sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client);
> +
> +	pm_runtime_put(&sdd->pdev->dev);
>  }
> 
>  static int s3c64xx_spi_transfer(struct spi_device *spi,
> @@ -892,6 +897,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  		goto setup_exit;
>  	}
> 
> +	pm_runtime_get_sync(&sdd->pdev->dev);
> +
>  	/* Check if we can provide the requested rate */
>  	if (!sci->clk_from_cmu) {
>  		u32 psr, speed;
> @@ -924,6 +931,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  			err = -EINVAL;
>  	}
> 
> +	pm_runtime_put(&sdd->pdev->dev);
> +
>  setup_exit:
> 
>  	/* setup() returns with device de-selected */
> @@ -1159,6 +1168,8 @@ static int __init s3c64xx_spi_probe(struct
> platform_device *pdev) mem_res->end, mem_res->start,
>  					sdd->rx_dma.dmach, sdd->tx_dma.dmach);
> 
> +	pm_runtime_enable(&pdev->dev);
> +
>  	return 0;
> 
>  err9:
> @@ -1192,6 +1203,8 @@ static int s3c64xx_spi_remove(struct platform_device
> *pdev) struct resource	*mem_res;
>  	unsigned long flags;
> 
> +	pm_runtime_disable(&pdev->dev);
> +
>  	spin_lock_irqsave(&sdd->lock, flags);
>  	sdd->state |= SUSPND;
>  	spin_unlock_irqrestore(&sdd->lock, flags);
> @@ -1272,8 +1285,34 @@ static int s3c64xx_spi_resume(struct device *dev)
>  }
>  #endif /* CONFIG_PM */
> 
> +#ifdef CONFIG_PM_RUNTIME
> +static int s3c64xx_spi_runtime_suspend(struct device *dev)
> +{
> +	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> +	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> +
> +	clk_disable(sdd->clk);
> +	clk_disable(sdd->src_clk);
> +
> +	return 0;
> +}
> +
> +static int s3c64xx_spi_runtime_resume(struct device *dev)
> +{
> +	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> +	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> +
> +	clk_enable(sdd->src_clk);
> +	clk_enable(sdd->clk);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_PM_RUNTIME */
> +
>  static struct dev_pm_ops s3c64xx_spi_pm = {
>  	SET_SYSTEM_SLEEP_PM_OPS(s3c64xx_spi_suspend, s3c64xx_spi_resume)
> +	SET_RUNTIME_PM_OPS(s3c64xx_spi_runtime_suspend,
> +			   s3c64xx_spi_runtime_resume, NULL)
>  };
> 
>  static struct platform_driver s3c64xx_spi_driver = {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] spi/s3c64xx: Implement runtime PM support
  2011-12-13 14:49   ` Heiko Stübner
@ 2011-12-13 15:02     ` Heiko Stübner
  0 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2011-12-13 15:02 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kukjin Kim, Grant Likely, linux-samsung-soc, spi-devel-general

Am Dienstag, 13. Dezember 2011, 15:49:44 schrieb Heiko Stübner:
> Am Montag, 5. Dezember 2011, 17:50:13 schrieb Mark Brown:
> > Enable and disable the clocks to the SPI controller using runtime PM.
> > This serves the dual purpose of reducing power consumption a little and
> > letting the core know when the device is idle.
> > 
> > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> 
> Acked-by: Heiko Stuebner <heiko@sntech.de
> 
> Kgene and/or Grant: could we move this forward, as I would like to profit
> from this change later on too :-)

it seems I got the wrong patch and the one from 2011-12-05 21:01 +0000
	[PATCH 3/3] spi/s3c64xx: Implement runtime PM support
which seems to have the same content would have been the correct one to ack 
and ping.


Sorry for the confusion
Heiko

> Thanks
> Heiko
> 
> > ---
> > 
> >  drivers/spi/spi-s3c64xx.c |   39 +++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 39 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> > index fef1c90..9031783 100644
> > --- a/drivers/spi/spi-s3c64xx.c
> > +++ b/drivers/spi/spi-s3c64xx.c
> > @@ -25,6 +25,7 @@
> > 
> >  #include <linux/clk.h>
> >  #include <linux/dma-mapping.h>
> >  #include <linux/platform_device.h>
> > 
> > +#include <linux/pm_runtime.h>
> > 
> >  #include <linux/spi/spi.h>
> >  
> >  #include <mach/dma.h>
> > 
> > @@ -782,6 +783,8 @@ static void s3c64xx_spi_work(struct work_struct
> > *work)
> > 
> >  	while (!acquire_dma(sdd))
> >  	
> >  		msleep(10);
> > 
> > +	pm_runtime_get_sync(&sdd->pdev->dev);
> > +
> > 
> >  	spin_lock_irqsave(&sdd->lock, flags);
> >  	
> >  	while (!list_empty(&sdd->queue)
> > 
> > @@ -810,6 +813,8 @@ static void s3c64xx_spi_work(struct work_struct
> > *work)
> > 
> >  	/* Free DMA channels */
> >  	sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client);
> >  	sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client);
> > 
> > +
> > +	pm_runtime_put(&sdd->pdev->dev);
> > 
> >  }
> >  
> >  static int s3c64xx_spi_transfer(struct spi_device *spi,
> > 
> > @@ -892,6 +897,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
> > 
> >  		goto setup_exit;
> >  	
> >  	}
> > 
> > +	pm_runtime_get_sync(&sdd->pdev->dev);
> > +
> > 
> >  	/* Check if we can provide the requested rate */
> >  	if (!sci->clk_from_cmu) {
> >  	
> >  		u32 psr, speed;
> > 
> > @@ -924,6 +931,8 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
> > 
> >  			err = -EINVAL;
> >  	
> >  	}
> > 
> > +	pm_runtime_put(&sdd->pdev->dev);
> > +
> > 
> >  setup_exit:
> >  	/* setup() returns with device de-selected */
> > 
> > @@ -1159,6 +1168,8 @@ static int __init s3c64xx_spi_probe(struct
> > platform_device *pdev) mem_res->end, mem_res->start,
> > 
> >  					sdd->rx_dma.dmach, sdd->tx_dma.dmach);
> > 
> > +	pm_runtime_enable(&pdev->dev);
> > +
> > 
> >  	return 0;
> >  
> >  err9:
> > @@ -1192,6 +1203,8 @@ static int s3c64xx_spi_remove(struct
> > platform_device *pdev) struct resource	*mem_res;
> > 
> >  	unsigned long flags;
> > 
> > +	pm_runtime_disable(&pdev->dev);
> > +
> > 
> >  	spin_lock_irqsave(&sdd->lock, flags);
> >  	sdd->state |= SUSPND;
> >  	spin_unlock_irqrestore(&sdd->lock, flags);
> > 
> > @@ -1272,8 +1285,34 @@ static int s3c64xx_spi_resume(struct device *dev)
> > 
> >  }
> >  #endif /* CONFIG_PM */
> > 
> > +#ifdef CONFIG_PM_RUNTIME
> > +static int s3c64xx_spi_runtime_suspend(struct device *dev)
> > +{
> > +	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> > +	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> > +
> > +	clk_disable(sdd->clk);
> > +	clk_disable(sdd->src_clk);
> > +
> > +	return 0;
> > +}
> > +
> > +static int s3c64xx_spi_runtime_resume(struct device *dev)
> > +{
> > +	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> > +	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> > +
> > +	clk_enable(sdd->src_clk);
> > +	clk_enable(sdd->clk);
> > +
> > +	return 0;
> > +}
> > +#endif /* CONFIG_PM_RUNTIME */
> > +
> > 
> >  static struct dev_pm_ops s3c64xx_spi_pm = {
> >  
> >  	SET_SYSTEM_SLEEP_PM_OPS(s3c64xx_spi_suspend, s3c64xx_spi_resume)
> > 
> > +	SET_RUNTIME_PM_OPS(s3c64xx_spi_runtime_suspend,
> > +			   s3c64xx_spi_runtime_resume, NULL)
> > 
> >  };
> >  
> >  static struct platform_driver s3c64xx_spi_driver = {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-13 15:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 16:50 [PATCH 1/2] spi/s3c64xx: Convert to dev_pm_ops Mark Brown
2011-12-05 16:50 ` [PATCH 2/2] spi/s3c64xx: Implement runtime PM support Mark Brown
2011-12-05 21:41   ` Linus Walleij
2011-12-05 23:16     ` Mark Brown
     [not found]       ` <20111205231647.GA21083-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-12-06 14:05         ` Linus Walleij
2011-12-13 14:49   ` Heiko Stübner
2011-12-13 15:02     ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).