Patch "ASoC: cs42l51: manage mclk shutdown delay" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: cs42l51: manage mclk shutdown delay

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-cs42l51-manage-mclk-shutdown-delay.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8d538fd7b812a88fb925bd6d597ad3e22dfdcc65
Author: Olivier Moysan <olivier.moysan@xxxxxx>
Date:   Tue Oct 20 17:01:09 2020 +0200

    ASoC: cs42l51: manage mclk shutdown delay
    
    [ Upstream commit 20afe581c9b980848ad097c4d54dde9bec7593ef ]
    
    A delay must be introduced before the shutdown down of the mclk,
    as stated in CS42L51 datasheet. Otherwise the codec may
    produce some noise after the end of DAPM power down sequence.
    The delay between DAC and CLOCK_SUPPLY widgets is too short.
    Add a delay in mclk shutdown request to manage the shutdown delay
    explicitly. From experiments, at least 10ms delay is necessary.
    Set delay to 20ms as recommended in Documentation/timers/timers-howto.rst
    when using msleep().
    
    Signed-off-by: Olivier Moysan <olivier.moysan@xxxxxx>
    Link: https://lore.kernel.org/r/20201020150109.482-1-olivier.moysan@xxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 55408c8fcb4e3..cdd7ae90c2b59 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -247,8 +247,28 @@ static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = {
 		&cs42l51_adcr_mux_controls),
 };
 
+static int mclk_event(struct snd_soc_dapm_widget *w,
+		      struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm);
+	struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		return clk_prepare_enable(cs42l51->mclk_handle);
+	case SND_SOC_DAPM_POST_PMD:
+		/* Delay mclk shutdown to fulfill power-down sequence requirements */
+		msleep(20);
+		clk_disable_unprepare(cs42l51->mclk_handle);
+		break;
+	}
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = {
-	SND_SOC_DAPM_CLOCK_SUPPLY("MCLK")
+	SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, mclk_event,
+			    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 };
 
 static const struct snd_soc_dapm_route cs42l51_routes[] = {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux