From: Mark Brown Date: Thu, 24 Nov 2022 13:19:02 +0000 (+0000) Subject: ASoC: Merge dropped fixes from v5.18 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=81cb291eaf56a2b4aebd2aeb4070d6f049da4343;p=linux.git ASoC: Merge dropped fixes from v5.18 These fixes were queued for v5.18 but due to me changing my scripting they never actually got merged - pulling them up now. --- 81cb291eaf56a2b4aebd2aeb4070d6f049da4343 diff --cc sound/soc/fsl/fsl_micfil.c index 79ef4e269bc95,d1cd104f85847..4b86ef82fd930 --- a/sound/soc/fsl/fsl_micfil.c +++ b/sound/soc/fsl/fsl_micfil.c @@@ -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; }