Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4375492imw; Tue, 19 Jul 2022 05:36:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1se15eT+9FqbkrYRPMSrodpHVKZCdT3Fx2R8MEd/dBqkrNyZd7LJ7KXoLZ/prfTATmty6Jr X-Received: by 2002:a05:6a00:1941:b0:50d:807d:530b with SMTP id s1-20020a056a00194100b0050d807d530bmr33057327pfk.17.1658234211546; Tue, 19 Jul 2022 05:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234211; cv=none; d=google.com; s=arc-20160816; b=CkYTs8RPgfK+jK5vWNmOjF23wXyBZPXE1hrDygAjEPP36NWK9XevE53t0z89Oyinpq lS3nrAyXG1T8ByuvVWtS6zTHazrJ3y9Bb1ADgJsWAP1tebXIqlqdSMqeyQ9MawLiP36Z NgBMF8/JGlDLTvRhbQWToBXcGHMsk0x+qPElzZrq/Fz4okybK1B97GBRtWDsyaCDovZE u0x5cW9QE9DosQEK1VtnNCK52sbvfNR1C2Jgl0LBoQ4je/dcogDP6Feg6R2wn8CxhYuE w8kxgzKhGMT0G5LAmQj7kD4ZCwJLTbnjSAdBCE2iZ1qc7N9TidKy7B3N+sGfrFhb2Tw4 8L6Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9ufxgy3iSf/s46nZ/WuEAFtRdFHQEtXQ5q5l68u0+JE=; b=DBuD5MLqf7Xb2HbA4secS4pcFzbOUkes9rkcbXvseKmPNCwbkkBCJIo2l0Zg0OiJ+f npB36Pxng5zsZMWSVEu+3GGT8PNbXLUpB6joU3Z8m1gJoqAKfr3KNl3kgHsFXpDsMgp0 GpY1omsgi4c9YUj+64dIpfkh3GHm7DxYiiFmdNIV0cJQ8NoxdxII9vaToADh7S5+2bZ0 L0cwx+3mY/hRAtW8CPGtVA9esnBWiD/P6ofpayBfYztQIfnYwryHjtCL/I8PvTftJqFo pb/ajzSzJS4CjuU9upQp3iRHsPb0cjRgqXEs0zhE91ee8LsP/pLJuKortz9MD/QUrIY3 kBKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uvzbWeY1; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a170902db0700b0015881788556si1960290plx.530.2022.07.19.05.36.31; Tue, 19 Jul 2022 05:36:51 -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=@linuxfoundation.org header.s=korg header.b=uvzbWeY1; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240163AbiGSM2Y (ORCPT + 99 others); Tue, 19 Jul 2022 08:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237054AbiGSM2D (ORCPT ); Tue, 19 Jul 2022 08:28:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7205070B; Tue, 19 Jul 2022 05:10:25 -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 ams.source.kernel.org (Postfix) with ESMTPS id A4AA1B81B32; Tue, 19 Jul 2022 12:10:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CF25C341C6; Tue, 19 Jul 2022 12:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232622; bh=NS6Ip8n5acsijBVdlEeG+w91FXwLAGrzmxhdKFH/fpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uvzbWeY1QRaZQDcvTXxUZ463FyxoFfhZvKtmoktRNACIptPblMCO3sMTcRKWWslqT WgCre5mqGs4F/u41YEnC2poYZzy8CASWc23dvbbFpPSPV5ZlnxUuMMiWsjuQ6Uiwyy HMvt1lO2NeW0s6r1SOJ7V21/VOhN98LdDfE1Ctao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.10 092/112] ASoC: dapm: Initialise kcontrol data for mux/demux controls Date: Tue, 19 Jul 2022 13:54:25 +0200 Message-Id: <20220719114635.653780671@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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 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 f2f7f2dde93c..754c1f16ee83 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