2022-05-09 02:12:35

by Shengjiu Wang

[permalink] [raw]
Subject: [PATCH 1/2] ASoc: fsl_micfil: explicitly clear software reset bit

SRES is self-cleared bit, but REG_MICFIL_CTRL1 is defined as
non volatile register, it still remain in regmap cache after set,
then every update of REG_MICFIL_CTRL1, software reset happens.
to avoid this, clear it explicitly.

Signed-off-by: Shengjiu Wang <[email protected]>
---
sound/soc/fsl/fsl_micfil.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index cd85c8714f97..2149fac0dcc6 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -179,6 +179,17 @@ static int fsl_micfil_reset(struct device *dev)
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;
+
return 0;
}

--
2.17.1



2022-05-09 05:39:18

by Shengjiu Wang

[permalink] [raw]
Subject: [PATCH 2/2] ASoc: fsl_micfil: explicitly clear CHnF flags

There may be failure when start 1 channel recording after
8 channels recording. The reason is that the CHnF
flags are not cleared successfully by software reset.

This issue is triggerred by the change of clearing
software reset bit.

CHnF flags are write 1 clear bits. Clear them by force
write.

Signed-off-by: Shengjiu Wang <[email protected]>
---
sound/soc/fsl/fsl_micfil.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index 2149fac0dcc6..e4d1da55293e 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -190,6 +190,14 @@ static int fsl_micfil_reset(struct device *dev)
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;
}

--
2.17.1


2022-05-13 04:29:09

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/2] ASoc: fsl_micfil: explicitly clear software reset bit

On Sat, 7 May 2022 20:14:13 +0800, Shengjiu Wang wrote:
> SRES is self-cleared bit, but REG_MICFIL_CTRL1 is defined as
> non volatile register, it still remain in regmap cache after set,
> then every update of REG_MICFIL_CTRL1, software reset happens.
> to avoid this, clear it explicitly.
>
>

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoc: fsl_micfil: explicitly clear software reset bit
commit: 292709b9cf3ba470af94b62c9bb60284cc581b79
[2/2] ASoc: fsl_micfil: explicitly clear CHnF flags
commit: b776c4a4618ec1b5219d494c423dc142f23c4e8f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark