aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorNicolin Chen <Guangyu.Chen@freescale.com>2014-05-14 06:54:27 -0400
committerNicolin Chen <Guangyu.Chen@freescale.com>2014-06-19 05:07:53 -0400
commitfd7d2c1a137c1b9d7adb58aaf06b90938172b964 (patch)
tree16c557f2ff56e7448917afec462b12a6179572b6 /sound/soc/fsl
parentfc69de0b0cc1d9a85ad7f7363da6dec02945964a (diff)
ENGR00318773-8 ASoC: fsl_spdif: 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, SPDIF 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>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_spdif.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index b47c436e03a9..8df108966155 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -285,6 +285,8 @@ static int spdif_softreset(struct fsl_spdif_priv *spdif_priv)
285 struct regmap *regmap = spdif_priv->regmap; 285 struct regmap *regmap = spdif_priv->regmap;
286 u32 val, cycle = 1000; 286 u32 val, cycle = 1000;
287 287
288 regcache_cache_bypass(regmap, true);
289
288 regmap_write(regmap, REG_SPDIF_SCR, SCR_SOFT_RESET); 290 regmap_write(regmap, REG_SPDIF_SCR, SCR_SOFT_RESET);
289 291
290 /* 292 /*
@@ -295,6 +297,10 @@ static int spdif_softreset(struct fsl_spdif_priv *spdif_priv)
295 regmap_read(regmap, REG_SPDIF_SCR, &val); 297 regmap_read(regmap, REG_SPDIF_SCR, &val);
296 } while ((val & SCR_SOFT_RESET) && cycle--); 298 } while ((val & SCR_SOFT_RESET) && cycle--);
297 299
300 regcache_cache_bypass(regmap, false);
301 regcache_mark_dirty(regmap);
302 regcache_sync(regmap);
303
298 if (cycle) 304 if (cycle)
299 return 0; 305 return 0;
300 else 306 else
@@ -977,6 +983,17 @@ static bool fsl_spdif_readable_reg(struct device *dev, unsigned int reg)
977 } 983 }
978} 984}
979 985
986static bool fsl_spdif_volatile_reg(struct device *dev, unsigned int reg)
987{
988 switch (reg) {
989 case REG_SPDIF_SIS:
990 return true;
991 default:
992 return false;
993 }
994
995}
996
980static bool fsl_spdif_writeable_reg(struct device *dev, unsigned int reg) 997static bool fsl_spdif_writeable_reg(struct device *dev, unsigned int reg)
981{ 998{
982 switch (reg) { 999 switch (reg) {
@@ -1003,7 +1020,9 @@ static const struct regmap_config fsl_spdif_regmap_config = {
1003 1020
1004 .max_register = REG_SPDIF_STC, 1021 .max_register = REG_SPDIF_STC,
1005 .readable_reg = fsl_spdif_readable_reg, 1022 .readable_reg = fsl_spdif_readable_reg,
1023 .volatile_reg = fsl_spdif_volatile_reg,
1006 .writeable_reg = fsl_spdif_writeable_reg, 1024 .writeable_reg = fsl_spdif_writeable_reg,
1025 .cache_type = REGCACHE_RBTREE,
1007}; 1026};
1008 1027
1009static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, 1028static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
@@ -1271,10 +1290,31 @@ static int fsl_spdif_runtime_suspend(struct device *dev)
1271} 1290}
1272#endif 1291#endif
1273 1292
1293#ifdef CONFIG_PM_SLEEP
1294static int fsl_spdif_suspend(struct device *dev)
1295{
1296 struct fsl_spdif_priv *spdif_priv = dev_get_drvdata(dev);
1297
1298 regcache_cache_only(spdif_priv->regmap, true);
1299 regcache_mark_dirty(spdif_priv->regmap);
1300
1301 return 0;
1302}
1303
1304static int fsl_spdif_resume(struct device *dev)
1305{
1306 struct fsl_spdif_priv *spdif_priv = dev_get_drvdata(dev);
1307
1308 regcache_cache_only(spdif_priv->regmap, false);
1309 return regcache_sync(spdif_priv->regmap);
1310}
1311#endif /* CONFIG_PM_SLEEP */
1312
1274static const struct dev_pm_ops fsl_spdif_pm = { 1313static const struct dev_pm_ops fsl_spdif_pm = {
1275 SET_RUNTIME_PM_OPS(fsl_spdif_runtime_suspend, 1314 SET_RUNTIME_PM_OPS(fsl_spdif_runtime_suspend,
1276 fsl_spdif_runtime_resume, 1315 fsl_spdif_runtime_resume,
1277 NULL) 1316 NULL)
1317 SET_SYSTEM_SLEEP_PM_OPS(fsl_spdif_suspend, fsl_spdif_resume)
1278}; 1318};
1279 1319
1280static const struct of_device_id fsl_spdif_dt_ids[] = { 1320static const struct of_device_id fsl_spdif_dt_ids[] = {