public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] audio: sai: Add Power Management support
@ 2015-09-14  9:03 Alison Wang
  2015-09-17  6:57 ` Nicolin Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Alison Wang @ 2015-09-14  9:03 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds Power Management support for SAI.
Activate regmap cache with REGCACHE_FLAT, and use
regmap cache code to save and restore registers in
suspend and resume. The Transmit Control Register
(TCSR) and Receive Control Register(RCSR) should
be volatile registers.

Signed-off-by: Alison Wang <alison.wang@freescale.com>
---
Changes since v1:
- Use REGCACHE_FLAT instead of REGCACHE_RBTREE.
- Use SIMPLE_DEV_PM_OPS to simplify the code. 

 sound/soc/fsl/fsl_sai.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index a18fd92..030f71e 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -637,9 +637,11 @@ static bool fsl_sai_readable_reg(struct device *dev, unsigned int reg)
 static bool fsl_sai_volatile_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
+	case FSL_SAI_TCSR:
 	case FSL_SAI_TFR:
-	case FSL_SAI_RFR:
 	case FSL_SAI_TDR:
+	case FSL_SAI_RCSR:
+	case FSL_SAI_RFR:
 	case FSL_SAI_RDR:
 		return true;
 	default:
@@ -681,6 +683,7 @@ static const struct regmap_config fsl_sai_regmap_config = {
 	.readable_reg = fsl_sai_readable_reg,
 	.volatile_reg = fsl_sai_volatile_reg,
 	.writeable_reg = fsl_sai_writeable_reg,
+	.cache_type = REGCACHE_FLAT,
 };
 
 static int fsl_sai_probe(struct platform_device *pdev)
@@ -796,6 +799,31 @@ static int fsl_sai_probe(struct platform_device *pdev)
 		return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int fsl_sai_suspend(struct device *dev)
+{
+	struct fsl_sai *sai = dev_get_drvdata(dev);
+
+	regcache_cache_only(sai->regmap, true);
+	regcache_mark_dirty(sai->regmap);
+
+	return 0;
+}
+
+static int fsl_sai_resume(struct device *dev)
+{
+	struct fsl_sai *sai = dev_get_drvdata(dev);
+
+	/* Restore all registers */
+	regcache_cache_only(sai->regmap, false);
+	regcache_sync(sai->regmap);
+
+	return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static SIMPLE_DEV_PM_OPS(fsl_sai_pm, fsl_sai_suspend, fsl_sai_resume);
+
 static const struct of_device_id fsl_sai_ids[] = {
 	{ .compatible = "fsl,vf610-sai", },
 	{ .compatible = "fsl,imx6sx-sai", },
@@ -807,6 +835,7 @@ static struct platform_driver fsl_sai_driver = {
 	.driver = {
 		.name = "fsl-sai",
 		.of_match_table = fsl_sai_ids,
+		.pm = &fsl_sai_pm,
 	},
 };
 module_platform_driver(fsl_sai_driver);
-- 
2.1.0.27.g96db324

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

* [PATCH v2] audio: sai: Add Power Management support
  2015-09-14  9:03 [PATCH v2] audio: sai: Add Power Management support Alison Wang
@ 2015-09-17  6:57 ` Nicolin Chen
  2015-09-17  9:53   ` Huan Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolin Chen @ 2015-09-17  6:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 14, 2015 at 05:03:24PM +0800, Alison Wang wrote:
> This patch adds Power Management support for SAI.
> Activate regmap cache with REGCACHE_FLAT, and use
> regmap cache code to save and restore registers in
> suspend and resume. The Transmit Control Register
> (TCSR) and Receive Control Register(RCSR) should
> be volatile registers.
> 
> Signed-off-by: Alison Wang <alison.wang@freescale.com>

Just to remind that there was a similar patch in review that I just
acked. Please send your improvements as an incremental patch after
that one gets applied.

Please also pay attention to the patch subject which should follow
the pattern of previous patches of the driver: ASoC: fsl_sai: xxxx

Thanks
Nicolin

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

* [PATCH v2] audio: sai: Add Power Management support
  2015-09-17  6:57 ` Nicolin Chen
@ 2015-09-17  9:53   ` Huan Wang
  2015-09-17 11:31     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Huan Wang @ 2015-09-17  9:53 UTC (permalink / raw)
  To: linux-arm-kernel


> On Mon, Sep 14, 2015 at 05:03:24PM +0800, Alison Wang wrote:
> > This patch adds Power Management support for SAI.
> > Activate regmap cache with REGCACHE_FLAT, and use regmap cache code
> to
> > save and restore registers in suspend and resume. The Transmit
> Control
> > Register
> > (TCSR) and Receive Control Register(RCSR) should be volatile
> > registers.
> >
> > Signed-off-by: Alison Wang <alison.wang@freescale.com>
> 
> Just to remind that there was a similar patch in review that I just
> acked. Please send your improvements as an incremental patch after that
> one gets applied.
[Alison Wang] Ok, I missed that patch.
> 
> Please also pay attention to the patch subject which should follow the
> pattern of previous patches of the driver: ASoC: fsl_sai: xxxx
[Alison Wang] Ok, thanks.


Best Regards,
Alison Wang

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

* [PATCH v2] audio: sai: Add Power Management support
  2015-09-17  9:53   ` Huan Wang
@ 2015-09-17 11:31     ` Mark Brown
  2015-09-17 18:10       ` Nicolin Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2015-09-17 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 17, 2015 at 09:53:57AM +0000, Huan Wang wrote:
> > On Mon, Sep 14, 2015 at 05:03:24PM +0800, Alison Wang wrote:

> > Just to remind that there was a similar patch in review that I just
> > acked. Please send your improvements as an incremental patch after that
> > one gets applied.

> [Alison Wang] Ok, I missed that patch.

Unless that patch has already been applied I'm not sure what it is but I
don't seem to have anything pending in my inbox.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150917/7d1a22bc/attachment-0001.sig>

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

* [PATCH v2] audio: sai: Add Power Management support
  2015-09-17 11:31     ` Mark Brown
@ 2015-09-17 18:10       ` Nicolin Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolin Chen @ 2015-09-17 18:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 17, 2015 at 12:31:23PM +0100, Mark Brown wrote:
> On Thu, Sep 17, 2015 at 09:53:57AM +0000, Huan Wang wrote:
> > > On Mon, Sep 14, 2015 at 05:03:24PM +0800, Alison Wang wrote:
> 
> > > Just to remind that there was a similar patch in review that I just
> > > acked. Please send your improvements as an incremental patch after that
> > > one gets applied.
> 
> > [Alison Wang] Ok, I missed that patch.
> 
> Unless that patch has already been applied I'm not sure what it is but I
> don't seem to have anything pending in my inbox.

Zidan can later re-send his patch with my ack to the maillist.

Thanks
Nicolin

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

end of thread, other threads:[~2015-09-17 18:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14  9:03 [PATCH v2] audio: sai: Add Power Management support Alison Wang
2015-09-17  6:57 ` Nicolin Chen
2015-09-17  9:53   ` Huan Wang
2015-09-17 11:31     ` Mark Brown
2015-09-17 18:10       ` Nicolin Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox