summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorNicolin Chen <Guangyu.Chen@freescale.com>2014-05-15 18:51:56 +0800
committerNitin Garg <nitin.garg@freescale.com>2015-01-15 21:17:59 -0600
commitd23863e5262e5402b8302db836739600bb76d311 (patch)
tree64f675f7222be7eba613a1b75cca1846e57f70a6 /sound
parent3d08af0b7a0ce9412b8bfe09f3c97e7cad207b95 (diff)
ENGR00318773-9 ASoC: fsl_ssi: Add driver suspend and resume to support MEGA Fast
For i.MX6 SoloX, there is a mode of the SoC to shutdown all power source of modules during system suspend and resume procedure. Thus, SSI needs to save all the values of registers before the system suspend and restore them after the system resume. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com> (cherry picked from commit 34c50abd9df28580b367070bc20b8bca6cd7655c)
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_ssi.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 44035f640f29..c22afd04a39c 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -115,12 +115,98 @@ struct fsl_ssi_rxtx_reg_val {
struct fsl_ssi_reg_val rx;
struct fsl_ssi_reg_val tx;
};
+
+static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case CCSR_SSI_STX0:
+ case CCSR_SSI_STX1:
+ case CCSR_SSI_SRX0:
+ case CCSR_SSI_SRX1:
+ case CCSR_SSI_SCR:
+ case CCSR_SSI_SISR:
+ case CCSR_SSI_SIER:
+ case CCSR_SSI_STCR:
+ case CCSR_SSI_SRCR:
+ case CCSR_SSI_STCCR:
+ case CCSR_SSI_SRCCR:
+ case CCSR_SSI_SFCSR:
+ case CCSR_SSI_STR:
+ case CCSR_SSI_SOR:
+ case CCSR_SSI_SACNT:
+ case CCSR_SSI_SACADD:
+ case CCSR_SSI_SACDAT:
+ case CCSR_SSI_SATAG:
+ case CCSR_SSI_STMSK:
+ case CCSR_SSI_SRMSK:
+ case CCSR_SSI_SACCST:
+ case CCSR_SSI_SACCEN:
+ case CCSR_SSI_SACCDIS:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool fsl_ssi_volatile_reg(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case CCSR_SSI_STX0:
+ case CCSR_SSI_STX1:
+ case CCSR_SSI_SRX0:
+ case CCSR_SSI_SRX1:
+ case CCSR_SSI_SISR:
+ case CCSR_SSI_SFCSR:
+ case CCSR_SSI_SACADD:
+ case CCSR_SSI_SACDAT:
+ case CCSR_SSI_SATAG:
+ case CCSR_SSI_SACCST:
+ return true;
+ default:
+ return false;
+ }
+
+}
+
+static bool fsl_ssi_writeable_reg(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case CCSR_SSI_STX0:
+ case CCSR_SSI_STX1:
+ case CCSR_SSI_SCR:
+ case CCSR_SSI_SISR:
+ case CCSR_SSI_SIER:
+ case CCSR_SSI_STCR:
+ case CCSR_SSI_SRCR:
+ case CCSR_SSI_STCCR:
+ case CCSR_SSI_SRCCR:
+ case CCSR_SSI_SFCSR:
+ case CCSR_SSI_STR:
+ case CCSR_SSI_SOR:
+ case CCSR_SSI_SACNT:
+ case CCSR_SSI_SACADD:
+ case CCSR_SSI_SACDAT:
+ case CCSR_SSI_SATAG:
+ case CCSR_SSI_STMSK:
+ case CCSR_SSI_SRMSK:
+ case CCSR_SSI_SACCEN:
+ case CCSR_SSI_SACCDIS:
+ return true;
+ default:
+ return false;
+ }
+}
+
static const struct regmap_config fsl_ssi_regconfig = {
.max_register = CCSR_SSI_SACCDIS,
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
.val_format_endian = REGMAP_ENDIAN_NATIVE,
+ .readable_reg = fsl_ssi_readable_reg,
+ .volatile_reg = fsl_ssi_volatile_reg,
+ .writeable_reg = fsl_ssi_writeable_reg,
+ .cache_type = REGCACHE_RBTREE,
};
struct fsl_ssi_soc_data {
@@ -1486,10 +1572,33 @@ static int fsl_ssi_runtime_suspend(struct device *dev)
}
#endif
+#ifdef CONFIG_PM_SLEEP
+static int fsl_ssi_suspend(struct device *dev)
+{
+ struct fsl_ssi_private *ssi_private = dev_get_drvdata(dev);
+ struct regmap *regs = ssi_private->regs;
+
+ regcache_cache_only(regs, true);
+ regcache_mark_dirty(regs);
+
+ return 0;
+}
+
+static int fsl_ssi_resume(struct device *dev)
+{
+ struct fsl_ssi_private *ssi_private = dev_get_drvdata(dev);
+ struct regmap *regs = ssi_private->regs;
+
+ regcache_cache_only(regs, false);
+ return regcache_sync(regs);
+}
+#endif /* CONFIG_PM_SLEEP */
+
static const struct dev_pm_ops fsl_ssi_pm = {
SET_RUNTIME_PM_OPS(fsl_ssi_runtime_suspend,
fsl_ssi_runtime_resume,
NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(fsl_ssi_suspend, fsl_ssi_resume)
};
static struct platform_driver fsl_ssi_driver = {