Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp164754imw; Wed, 13 Jul 2022 22:02:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t3P2Cwee062z6yDzzRAkktWVDi+PAUWTluG2Nk0yIUnvuCsDY4B1nAS3bPftF3j2F8FT1l X-Received: by 2002:a17:90b:1a81:b0:1ef:9e9d:a08a with SMTP id ng1-20020a17090b1a8100b001ef9e9da08amr7744788pjb.58.1657774948713; Wed, 13 Jul 2022 22:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657774948; cv=none; d=google.com; s=arc-20160816; b=DGZvMleVPaM7ZeWlCddbhN2FeMUc9gFhW6WRPxhHXNxB8/en+qDD/YSe8KZFeoLPFP PBI4w+bhzFMOr5dlt7nCNU7Xs6wUh8Vv8yeIPjvlFTqOqEV5ShWpwoYYg661ccoZzAxm Nu0sMTsMvJQHwFm/hiWB24BJcKzNj954SUREilSeots7M3N5L0jdjhGfk7GA+tp+uP4k dXGAMk5ubydzrhBm68KWSXv9FufyANr1VqR69ZaVssF53tH349VY+YmEyYB+9vknNoal 3EMSysc3EyWrAm4Zey4t/s7TD/4bSSVc5QG0Q7/nutFTwBcwVe++6mG5Tv31lTMvVHvg WNQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BPrtyvb0ULBDTzmPbOTRJaCPTQhCaPXBfw9AYs5mkE0=; b=zd+kvs5a5Ze1gNaQUrEXVc3FpNn650aCtRL8r5whp/rnle1wUaOt5PdGUnCWv71qlN nXndJZCMnU592bxKVTawm0cQCY081KctVGaG+w3XkMUjHVFRuUTphdjvVEIXkHn9mjdD po6DydFzp+HoivaFV7HDyz1IRG2aQKl/ePTr0srvu6EY7ZSp1ggxjdZQ3A7Mn0lMBm1U k/PCISwXge+1makeO7bPlDl4uVyDj9kvs5G6G76GCvN4hNL3hv4Z2cOkxF+XucZ8QKZo mEhLPgFKdgu4EFyqLLg5Tlvvk38ZWFUiKYD588xYU3c1sYjEwV5LmPlSbAanV2xHhMkJ vD7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n2DDHHF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a170902ef5200b00153b2d16667si756885plx.623.2022.07.13.22.02.15; Wed, 13 Jul 2022 22:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n2DDHHF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237389AbiGNEbN (ORCPT + 99 others); Thu, 14 Jul 2022 00:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237233AbiGNE3y (ORCPT ); Thu, 14 Jul 2022 00:29:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B89D432046; Wed, 13 Jul 2022 21:25:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ABC8B61E4E; Thu, 14 Jul 2022 04:25:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23DA5C385A2; Thu, 14 Jul 2022 04:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657772707; bh=ejnKotZB6Y2TMNzJtjiQwLLGKsKmTL1udkyokr7DcUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2DDHHF6DCZIgkV3fmFo28HzgmokMQZRYSFC1pPbfBPSMxkQKe0a8bC5msrHK28ao ZL6RMS94pKx+R7MlgB5e6Xc8wjBDHi+0o1nSW1P5Ds65URxcStulqrbqesF+UL6Twr jKqUg7pFXRJRrBSghYzQQsgk8PI8MtxVidMkFW4tNMoLdn3eqpxYWuy/jSixEQCsqZ lBbBNohbRKtZoY3C2EIG+O7QO2xblYC45RaMxBbLDadXzdry3PoK/+F6FwIpacrMhe Kj5rbMP3UsCBTDsP8lBAE2HeWZhhuc7zN+34xjioq2LmAKagkvXryoum4FddNSTL+6 10qwUKZY8lKcw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Charles Keepax , Mark Brown , Sasha Levin , lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.15 15/28] ASoC: dapm: Initialise kcontrol data for mux/demux controls Date: Thu, 14 Jul 2022 00:24:16 -0400 Message-Id: <20220714042429.281816-15-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220714042429.281816-1-sashal@kernel.org> References: <20220714042429.281816-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Charles Keepax [ Upstream commit 11d7a12f7f50baa5af9090b131c9b03af59503e7 ] DAPM keeps a copy of the current value of mux/demux controls, however this value is only initialised in the case of autodisable controls. This leads to false notification events when first modifying a DAPM kcontrol that has a non-zero default. Autodisable controls are left as they are, since they already initialise the value, and there would be more work required to support autodisable muxes where the first option isn't disabled and/or that isn't the default. Technically this issue could affect mixer/switch elements as well, although not on any of the devices I am currently running. There is also a little more work to do to address the issue there due to that side supporting stereo controls, so that has not been tackled in this patch. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220623105120.1981154-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-dapm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 47b85ba5b7d6..b957049bae33 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -62,6 +62,8 @@ struct snd_soc_dapm_widget * snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_widget *widget); +static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg); + /* dapm power sequences - make this per codec in the future */ static int dapm_up_seq[] = { [snd_soc_dapm_pre] = 1, @@ -442,6 +444,9 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, snd_soc_dapm_add_path(widget->dapm, data->widget, widget, NULL, NULL); + } else if (e->reg != SND_SOC_NOPM) { + data->value = soc_dapm_read(widget->dapm, e->reg) & + (e->mask << e->shift_l); } break; default: -- 2.35.1