summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorAlison Wang <b18965@freescale.com>2014-10-27 07:20:45 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:40:00 (GMT)
commit2d0309396d98661a929c81145dbe00d15b54c332 (patch)
tree6f987cbad6e67e6b292adfed025e6237b7c3e649 /sound
parentcee34118b14fc991855095aea08748ed041ebe01 (diff)
downloadlinux-fsl-qoriq-2d0309396d98661a929c81145dbe00d15b54c332.tar.xz
audio: sai: Add Power Management support
This patch adds Power Management support for SAI. Activate regmap cache with REGCACHE_RBTREE, 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> --- This patch has been sent to upstream for review: https://patchwork.kernel.org/patch/5183621/. Change-Id: I46a53b91fa005d9833e289d06430e26569897b2d Reviewed-on: http://git.am.freescale.net:8181/22361 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jingchang Lu <jingchang.lu@freescale.com> Reviewed-by: Dongsheng Wang <dongsheng.wang@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_sai.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index ff86daf..3653b25 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -441,9 +441,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:
@@ -485,6 +487,7 @@ static 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_RBTREE,
};
static bool fsl_sai_filter(struct dma_chan *chan, void *param)
@@ -587,6 +590,33 @@ static int fsl_sai_remove(struct platform_device *pdev)
return 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 const struct dev_pm_ops fsl_sai_pm = {
+ SET_SYSTEM_SLEEP_PM_OPS(fsl_sai_suspend, fsl_sai_resume)
+};
+
static const struct of_device_id fsl_sai_ids[] = {
{ .compatible = "fsl,vf610-sai", },
{ /* sentinel */ }
@@ -599,6 +629,7 @@ static struct platform_driver fsl_sai_driver = {
.name = "fsl-sai",
.owner = THIS_MODULE,
.of_match_table = fsl_sai_ids,
+ .pm = &fsl_sai_pm,
},
};
module_platform_driver(fsl_sai_driver);