ALSA: hda: cs35l41: Mute the device before shutdown
authorLucas Tanure <tanureal@opensource.cirrus.com>
Wed, 13 Apr 2022 08:37:20 +0000 (09:37 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 13 Apr 2022 08:42:33 +0000 (10:42 +0200)
Mute the device before shutdown to avoid pops and clicks for all types
of boost.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220413083728.10730-9-tanureal@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/cs35l41_hda.c

index 46e920ec30002eb182438685833f2ea26597dbfb..0709d09f4e1364337417944c4da77a06815ffee5 100644 (file)
@@ -28,6 +28,11 @@ static const struct reg_sequence cs35l41_hda_config[] = {
        { CS35L41_PWR_CTRL2,            0x00000001 }, // AMP_EN = 1
 };
 
+static const struct reg_sequence cs35l41_hda_mute[] = {
+       { CS35L41_AMP_GAIN_CTRL,        0x00000000 }, // AMP_GAIN_PCM 0.5 dB
+       { CS35L41_AMP_DIG_VOL_CTRL,     0x0000A678 }, // AMP_VOL_PCM Mute
+};
+
 static const struct reg_sequence cs35l41_hda_start_bst[] = {
        { CS35L41_PWR_CTRL2,            0x00000021 }, // BST_EN = 10, AMP_EN = 1
        { CS35L41_PWR_CTRL1,            0x00000001, 3000}, // set GLOBAL_EN = 1
@@ -89,7 +94,6 @@ static const struct reg_sequence cs35l41_active_to_safe[] = {
        { 0x00000040,                   0x00000055 },
        { 0x00000040,                   0x000000AA },
        { 0x00007438,                   0x00585941 },
-       { CS35L41_AMP_DIG_VOL_CTRL,     0x0000A678 }, // AMP_VOL_PCM Mute
        { CS35L41_PWR_CTRL2,            0x00000000 }, // AMP_EN = 0
        { CS35L41_PWR_CTRL1,            0x00000000 },
        { 0x0000742C,                   0x00000009, 2000 },
@@ -146,6 +150,7 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action)
                        ret = regmap_multi_reg_write(reg, reg_seq->prepare, reg_seq->num_prepare);
                break;
        case HDA_GEN_PCM_ACT_CLEANUP:
+               regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
                if (reg_seq->cleanup)
                        ret = regmap_multi_reg_write(reg, reg_seq->cleanup, reg_seq->num_cleanup);
                break;