ASoC: Merge dropped fixes from v5.18
authorMark Brown <broonie@kernel.org>
Thu, 24 Nov 2022 13:19:02 +0000 (13:19 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 24 Nov 2022 13:19:02 +0000 (13:19 +0000)
These fixes were queued for v5.18 but due to me changing my scripting
they never actually got merged - pulling them up now.

1  2 
sound/soc/codecs/tlv320adc3xxx.c
sound/soc/fsl/fsl_micfil.c
sound/soc/soc-ops.c

Simple merge
@@@ -184,16 -173,43 +184,35 @@@ static int fsl_micfil_reset(struct devi
        struct fsl_micfil *micfil = dev_get_drvdata(dev);
        int ret;
  
 -      ret = regmap_update_bits(micfil->regmap,
 -                               REG_MICFIL_CTRL1,
 -                               MICFIL_CTRL1_MDIS_MASK,
 -                               0);
 -      if (ret) {
 -              dev_err(dev, "failed to clear MDIS bit %d\n", ret);
 +      ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
 +                              MICFIL_CTRL1_MDIS);
 +      if (ret)
                return ret;
 -      }
  
 -      ret = regmap_update_bits(micfil->regmap,
 -                               REG_MICFIL_CTRL1,
 -                               MICFIL_CTRL1_SRES_MASK,
 -                               MICFIL_CTRL1_SRES);
 -      if (ret) {
 -              dev_err(dev, "failed to reset MICFIL: %d\n", ret);
 +      ret = regmap_set_bits(micfil->regmap, REG_MICFIL_CTRL1,
 +                            MICFIL_CTRL1_SRES);
 +      if (ret)
                return ret;
 -      }
  
+       /*
+        * SRES is self-cleared bit, but REG_MICFIL_CTRL1 is defined
+        * as non-volatile register, so SRES still remain in regmap
+        * cache after set, that every update of REG_MICFIL_CTRL1,
+        * software reset happens. so clear it explicitly.
+        */
+       ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
+                               MICFIL_CTRL1_SRES);
+       if (ret)
+               return ret;
+       /*
+        * Set SRES should clear CHnF flags, But even add delay here
+        * the CHnF may not be cleared sometimes, so clear CHnF explicitly.
+        */
+       ret = regmap_write_bits(micfil->regmap, REG_MICFIL_STAT, 0xFF, 0xFF);
+       if (ret)
+               return ret;
        return 0;
  }
  
Simple merge