aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-09-17 23:09:10 -0400
committerMark Brown <broonie@kernel.org>2015-10-05 12:26:16 -0400
commit1fde5e83a17acbcfcce27f68be46a6da4344efbd (patch)
treeeb5870717fa77d2ffa4d00900392bd7ac8f90358 /sound/soc/fsl
parent6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff)
ASoC: fsl_sai: 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, SAI needs to save all the values of registers before the system suspend and restore them after the system resume. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_sai.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index a18fd92c4a85..5c737f167c5d 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -637,6 +637,8 @@ static bool fsl_sai_readable_reg(struct device *dev, unsigned int reg)
637static bool fsl_sai_volatile_reg(struct device *dev, unsigned int reg) 637static bool fsl_sai_volatile_reg(struct device *dev, unsigned int reg)
638{ 638{
639 switch (reg) { 639 switch (reg) {
640 case FSL_SAI_TCSR:
641 case FSL_SAI_RCSR:
640 case FSL_SAI_TFR: 642 case FSL_SAI_TFR:
641 case FSL_SAI_RFR: 643 case FSL_SAI_RFR:
642 case FSL_SAI_TDR: 644 case FSL_SAI_TDR:
@@ -681,6 +683,7 @@ static const struct regmap_config fsl_sai_regmap_config = {
681 .readable_reg = fsl_sai_readable_reg, 683 .readable_reg = fsl_sai_readable_reg,
682 .volatile_reg = fsl_sai_volatile_reg, 684 .volatile_reg = fsl_sai_volatile_reg,
683 .writeable_reg = fsl_sai_writeable_reg, 685 .writeable_reg = fsl_sai_writeable_reg,
686 .cache_type = REGCACHE_FLAT,
684}; 687};
685 688
686static int fsl_sai_probe(struct platform_device *pdev) 689static int fsl_sai_probe(struct platform_device *pdev)
@@ -802,10 +805,40 @@ static const struct of_device_id fsl_sai_ids[] = {
802 { /* sentinel */ } 805 { /* sentinel */ }
803}; 806};
804 807
808#if CONFIG_PM_SLEEP
809static int fsl_sai_suspend(struct device *dev)
810{
811 struct fsl_sai *sai = dev_get_drvdata(dev);
812
813 regcache_cache_only(sai->regmap, true);
814 regcache_mark_dirty(sai->regmap);
815
816 return 0;
817}
818
819static int fsl_sai_resume(struct device *dev)
820{
821 struct fsl_sai *sai = dev_get_drvdata(dev);
822
823 regcache_cache_only(sai->regmap, false);
824 regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
825 regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR);
826 msleep(1);
827 regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
828 regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
829 return regcache_sync(sai->regmap);
830}
831#endif /* CONFIG_PM_SLEEP */
832
833static const struct dev_pm_ops fsl_sai_pm_ops = {
834 SET_SYSTEM_SLEEP_PM_OPS(fsl_sai_suspend, fsl_sai_resume)
835};
836
805static struct platform_driver fsl_sai_driver = { 837static struct platform_driver fsl_sai_driver = {
806 .probe = fsl_sai_probe, 838 .probe = fsl_sai_probe,
807 .driver = { 839 .driver = {
808 .name = "fsl-sai", 840 .name = "fsl-sai",
841 .pm = &fsl_sai_pm_ops,
809 .of_match_table = fsl_sai_ids, 842 .of_match_table = fsl_sai_ids,
810 }, 843 },
811}; 844};