summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorandy.hu <andy.hu@starfivetech.com>2023-01-11 14:02:42 +0300
committerandy.hu <andy.hu@starfivetech.com>2023-01-11 14:02:42 +0300
commit2f173c021522cd8bb2d3aa29f77e068468f6749b (patch)
treeeb6c1554bd3c93dbc0a7d3c6c07fd4ba2dba9442 /sound
parent520ea1dc7d1b24719b52f90bbf989d0b9cb2eec4 (diff)
parent2a7ee68f738b08378defa6922f8d6d2968fdd7b7 (diff)
downloadlinux-2f173c021522cd8bb2d3aa29f77e068468f6749b.tar.xz
Merge branch 'CR_2964_hibernation_spdif_Xingyu.Wu' into 'jh7110-5.15.y-devel'
CR_2964_hibernation_spdif_Xingyu.Wu See merge request sdk/linux!664
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/starfive/starfive_spdif.c25
-rw-r--r--sound/soc/starfive/starfive_spdif.h4
-rw-r--r--sound/soc/starfive/starfive_spdif_pcm.c4
3 files changed, 29 insertions, 4 deletions
diff --git a/sound/soc/starfive/starfive_spdif.c b/sound/soc/starfive/starfive_spdif.c
index ee97627507bf..d7886d3639ed 100644
--- a/sound/soc/starfive/starfive_spdif.c
+++ b/sound/soc/starfive/starfive_spdif.c
@@ -423,12 +423,34 @@ static const struct snd_soc_dai_ops sf_spdif_dai_ops = {
#ifdef CONFIG_PM_SLEEP
static int spdif_system_suspend(struct device *dev)
{
+ struct sf_spdif_dev *spdif = dev_get_drvdata(dev);
+
+ /* save the register value */
+ regmap_read(spdif->regmap, SPDIF_CTRL, &spdif->reg_spdif_ctrl);
+ regmap_read(spdif->regmap, SPDIF_INT_REG, &spdif->reg_spdif_int);
+ regmap_read(spdif->regmap, SPDIF_FIFO_CTRL, &spdif->reg_spdif_fifo_ctrl);
+
return pm_runtime_force_suspend(dev);
}
static int spdif_system_resume(struct device *dev)
{
- return pm_runtime_force_resume(dev);
+ struct sf_spdif_dev *spdif = dev_get_drvdata(dev);
+ int ret;
+
+ ret = pm_runtime_force_resume(dev);
+ if (ret)
+ return ret;
+
+ /* restore the register value */
+ regmap_update_bits(spdif->regmap, SPDIF_CTRL,
+ ALLBITMASK, spdif->reg_spdif_ctrl);
+ regmap_update_bits(spdif->regmap, SPDIF_INT_REG,
+ ALLBITMASK, spdif->reg_spdif_int);
+ regmap_update_bits(spdif->regmap, SPDIF_FIFO_CTRL,
+ ALLBITMASK, spdif->reg_spdif_fifo_ctrl);
+
+ return 0;
}
#endif
@@ -453,7 +475,6 @@ static const struct dev_pm_ops spdif_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(spdif_system_suspend, spdif_system_resume)
};
-
#define SF_PCM_RATE_44100_192000 (SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000 | \
SNDRV_PCM_RATE_96000 | \
diff --git a/sound/soc/starfive/starfive_spdif.h b/sound/soc/starfive/starfive_spdif.h
index bc1cc9631c75..a0c91ae804d6 100644
--- a/sound/soc/starfive/starfive_spdif.h
+++ b/sound/soc/starfive/starfive_spdif.h
@@ -156,6 +156,9 @@ struct sf_spdif_dev {
struct clk *mclk;
struct clk *mclk_ext;
struct reset_control *rst_apb;
+ unsigned int reg_spdif_ctrl;
+ unsigned int reg_spdif_int;
+ unsigned int reg_spdif_fifo_ctrl;
struct snd_dmaengine_dai_dma_data dma_data;
};
@@ -173,5 +176,4 @@ int sf_spdif_pcm_register(struct platform_device *pdev)
}
#endif
-
#endif /* __SND_SOC_STARFIVE_SPDIF_H */
diff --git a/sound/soc/starfive/starfive_spdif_pcm.c b/sound/soc/starfive/starfive_spdif_pcm.c
index 582383765a5d..78ed55a046aa 100644
--- a/sound/soc/starfive/starfive_spdif_pcm.c
+++ b/sound/soc/starfive/starfive_spdif_pcm.c
@@ -149,7 +149,9 @@ static const struct snd_pcm_hardware sf_pcm_hardware = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
- SNDRV_PCM_INFO_BLOCK_TRANSFER,
+ SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_PAUSE |
+ SNDRV_PCM_INFO_RESUME,
.rates = SNDRV_PCM_RATE_8000 |
SNDRV_PCM_RATE_11025 |
SNDRV_PCM_RATE_16000 |