ASoC: fsl_asrc: sound is wrong after suspend/resume
diff mbox

Message ID 1449745370-18960-1-git-send-email-zidan.wang@freescale.com
State New
Headers show

Commit Message

Zidan Wang Dec. 10, 2015, 11:02 a.m. UTC
The register ASRCFG is volatile, but some bits need to be recovered
after suspend/resume.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/fsl/fsl_asrc.c | 6 ++++++
 sound/soc/fsl/fsl_asrc.h | 2 ++
 2 files changed, 8 insertions(+)

Comments

Nicolin Chen Dec. 12, 2015, 5:30 a.m. UTC | #1
On Thu, Dec 10, 2015 at 07:02:48PM +0800, Zidan Wang wrote:

> diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
> index 3e404ba..942e74bc 100644
> --- a/sound/soc/fsl/fsl_asrc.c
> +++ b/sound/soc/fsl/fsl_asrc.c
> @@ -990,6 +990,9 @@ static int fsl_asrc_suspend(struct device *dev)
>  {
>  	struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
>  
> +	regmap_read(asrc_priv->regmap, REG_ASRCFG,
> +				&asrc_priv->regcache_cfg);

Indentation.

> +
>  	regcache_cache_only(asrc_priv->regmap, true);
>  	regcache_mark_dirty(asrc_priv->regmap);
>  
> @@ -1010,6 +1013,9 @@ static int fsl_asrc_resume(struct device *dev)
>  	regcache_cache_only(asrc_priv->regmap, false);
>  	regcache_sync(asrc_priv->regmap);
>  
> +	regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
> +				0x1FFFC0, asrc_priv->regcache_cfg);

Either add a macro or a comment for the magic number.

> +
>  	/* Restart enabled pairs */
>  	regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
>  			   ASRCTR_ASRCEi_ALL_MASK, asrctr);
> diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h
> index 68802cd..3695ca9 100644
> --- a/sound/soc/fsl/fsl_asrc.h
> +++ b/sound/soc/fsl/fsl_asrc.h
> @@ -453,6 +453,8 @@ struct fsl_asrc {
>  
>  	int asrc_rate;
>  	int asrc_width;
> +
> +	u32 regcache_cfg;
>  };
>  
>  extern struct snd_soc_platform_driver fsl_asrc_platform;
> -- 
> 1.9.1
>

Patch
diff mbox

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 3e404ba..942e74bc 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -990,6 +990,9 @@  static int fsl_asrc_suspend(struct device *dev)
 {
 	struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
 
+	regmap_read(asrc_priv->regmap, REG_ASRCFG,
+				&asrc_priv->regcache_cfg);
+
 	regcache_cache_only(asrc_priv->regmap, true);
 	regcache_mark_dirty(asrc_priv->regmap);
 
@@ -1010,6 +1013,9 @@  static int fsl_asrc_resume(struct device *dev)
 	regcache_cache_only(asrc_priv->regmap, false);
 	regcache_sync(asrc_priv->regmap);
 
+	regmap_update_bits(asrc_priv->regmap, REG_ASRCFG,
+				0x1FFFC0, asrc_priv->regcache_cfg);
+
 	/* Restart enabled pairs */
 	regmap_update_bits(asrc_priv->regmap, REG_ASRCTR,
 			   ASRCTR_ASRCEi_ALL_MASK, asrctr);
diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h
index 68802cd..3695ca9 100644
--- a/sound/soc/fsl/fsl_asrc.h
+++ b/sound/soc/fsl/fsl_asrc.h
@@ -453,6 +453,8 @@  struct fsl_asrc {
 
 	int asrc_rate;
 	int asrc_width;
+
+	u32 regcache_cfg;
 };
 
 extern struct snd_soc_platform_driver fsl_asrc_platform;