From nobody Sun Feb 8 20:29:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 528A9EB64DC for ; Fri, 21 Jul 2023 15:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229719AbjGUPUF (ORCPT ); Fri, 21 Jul 2023 11:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231920AbjGUPTY (ORCPT ); Fri, 21 Jul 2023 11:19:24 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CB7635B3 for ; Fri, 21 Jul 2023 08:18:57 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36LDls9j007648; Fri, 21 Jul 2023 10:18:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=SouSdl0krn87qnxGImLLbDeHt3AjI3/2rWOxCps/3Ts=; b= JBFOT77wvEyGBul+425Mr/5xNGlG+DEJ++A7/7isthKS5IWFyaxzst5nbvSS1ZkA klW3kVCHrqg5Z/3ee9RQgHIgRXvXuQ2mnxzQ2qvp6ydSXJwvSvT43e5gdfNDextI g+MKooWfwGyg5G8yNj0vDWM73H4+yG4cqgwrwqlkieKZ3o9+ouE2XoEDsqoKLDqD OpDVoRK2ZvCthoGqeLtIvgSi4CxObJsGTnAZDJNf2pSiy8OaSyI6zaZHyW1ELec4 h6vIkPF+ACx6hRQJN+vdgjmQDyZTDXMsY4ZI93vum1b1kO0coXK4BEy2bvIk5rFc vnSJLhXnJHVqWG17l28j8g== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3rus62y8g9-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jul 2023 10:18:32 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Fri, 21 Jul 2023 16:18:28 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.30 via Frontend Transport; Fri, 21 Jul 2023 16:18:28 +0100 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.219]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 43FA13572; Fri, 21 Jul 2023 15:18:28 +0000 (UTC) From: Stefan Binding To: Mark Brown , Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH v2 11/11] ALSA: hda: cs35l41: Ensure amp is only unmuted during playback Date: Fri, 21 Jul 2023 16:18:16 +0100 Message-ID: <20230721151816.2080453-12-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230721151816.2080453-1-sbinding@opensource.cirrus.com> References: <20230721151816.2080453-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: GPi2fnfKoH70Rkb5qb8qmAL5rrPBZ-02 X-Proofpoint-ORIG-GUID: GPi2fnfKoH70Rkb5qb8qmAL5rrPBZ-02 X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently we only mute after playback has finished, and unmute prior to setting global enable. To prevent any possible pops and clicks, mute at probe, and then only unmute after global enable is set. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 175378cdf9dfa..98feb5ccd5866 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -58,8 +58,6 @@ static const struct reg_sequence cs35l41_hda_config[] =3D= { { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC =3D VMON { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC =3D IMON { CS35L41_DSP1_RX5_SRC, 0x00000020 }, // DSP1RX5 SRC =3D ERRVOL - { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN =3D 1, AMP_VO= L_PCM 0.0 dB - { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB }; =20 static const struct reg_sequence cs35l41_hda_config_dsp[] =3D { @@ -82,6 +80,14 @@ static const struct reg_sequence cs35l41_hda_config_dsp[= ] =3D { { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC =3D VMON { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC =3D IMON { CS35L41_DSP1_RX5_SRC, 0x00000029 }, // DSP1RX5 SRC =3D VBSTMON +}; + +static const struct reg_sequence cs35l41_hda_unmute[] =3D { + { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN =3D 1, AMP_VO= L_PCM 0.0 dB + { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB +}; + +static const struct reg_sequence cs35l41_hda_unmute_dsp[] =3D { { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN =3D 1, AMP_VO= L_PCM 0.0 dB { CS35L41_AMP_GAIN_CTRL, 0x00000233 }, // AMP_GAIN_PCM =3D 17.5dB AMP_GAI= N_PDM =3D 19.5dB }; @@ -522,6 +528,13 @@ static void cs35l41_hda_play_done(struct device *dev) =20 cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1, NULL, cs35l41->firmware_running); + if (cs35l41->firmware_running) { + regmap_multi_reg_write(reg, cs35l41_hda_unmute_dsp, + ARRAY_SIZE(cs35l41_hda_unmute_dsp)); + } else { + regmap_multi_reg_write(reg, cs35l41_hda_unmute, + ARRAY_SIZE(cs35l41_hda_unmute)); + } } =20 static void cs35l41_hda_pause_start(struct device *dev) @@ -1616,6 +1629,11 @@ int cs35l41_hda_probe(struct device *dev, const char= *device_name, int id, int i if (ret) goto err; =20 + ret =3D regmap_multi_reg_write(cs35l41->regmap, cs35l41_hda_mute, + ARRAY_SIZE(cs35l41_hda_mute)); + if (ret) + goto err; + INIT_WORK(&cs35l41->fw_load_work, cs35l41_fw_load_work); mutex_init(&cs35l41->fw_mutex); =20 --=20 2.34.1