From mboxrd@z Thu Jan 1 00:00:00 1970 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 477B3C433EF for ; Wed, 20 Jul 2022 01:20:25 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8F36A17A3; Wed, 20 Jul 2022 03:19:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8F36A17A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658280023; bh=OowdkDdPCbBdsFIG64cEnTlLcbowu5gdmdnAQAbTwzw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=PXSSDusPnmUE0L2TbgKz1/QvDAi+pgzUWAbPVEuYDab4fdD/keBT03JWGhTECUs1L BT0eUysRDxsMF1qSiSS0fmocSnaVEXyBIGvuZA96LS/mbLZsDha0fv74AyNxhgvzey rSSXwhLkw6Jm6k7gZ7FEH3zHxjpeL7Sg2jL19+/A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D1C0BF8051E; Wed, 20 Jul 2022 03:18:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 06DECF80558; Wed, 20 Jul 2022 03:18:45 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D448EF80125 for ; Wed, 20 Jul 2022 03:18:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D448EF80125 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lxS65wNl" 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 C9B9161730; Wed, 20 Jul 2022 01:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 320D4C341C6; Wed, 20 Jul 2022 01:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658279913; bh=OowdkDdPCbBdsFIG64cEnTlLcbowu5gdmdnAQAbTwzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lxS65wNltcMbpDXMjVJL0PWmDwwe2nTwqEAo55OyFJe/LVpMxcueno4waJF3s9Tb8 Ddp/XvsrrA52mk/GHdc97JDMolifD1kmWUY68CM0U3hX5qQ1APtZy61usy4QYwYVQz LiQu846lw90Ydg2Isxy7U8WiRgq0EfbFBYgOKupyTyRBRkMq6uZax1dPlyRNlDaO9O CR77mI1B3nIPI8uT/ACiJYaPXSuTVRVCt/HX+S0lqGC6OiHl//lRl0Jq2TFsZd+9QC dqRv0qfaDPMuO5dtXy3vgGm5QNTgpxEvRAga1R8F4bKcemWq7IZx8WXXOH9Jo2BV1H ey/XECVpSekRw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 6/8] ASoC: wm8998: Fix event generation for input mux Date: Tue, 19 Jul 2022 21:18:08 -0400 Message-Id: <20220720011810.1025308-6-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220720011810.1025308-1-sashal@kernel.org> References: <20220720011810.1025308-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Cc: Sasha Levin , alsa-devel@alsa-project.org, Charles Keepax , patches@opensource.cirrus.com, tiwai@suse.com, lgirdwood@gmail.com, Mark Brown X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Charles Keepax [ Upstream commit 15b2e5d10ccf32a1a1ae7c636511e2f51320fdb5 ] wm8998_inmux_put returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220628153409.3266932-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8998.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c index 17dc5780ab68..3b278435b0aa 100644 --- a/sound/soc/codecs/wm8998.c +++ b/sound/soc/codecs/wm8998.c @@ -111,6 +111,7 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned int mode_reg, mode_index; unsigned int mux, inmode, src_val, mode_val; + int change, ret; mux = ucontrol->value.enumerated.item[0]; if (mux > 1) @@ -140,14 +141,20 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, snd_soc_component_update_bits(component, mode_reg, ARIZONA_IN1_MODE_MASK, mode_val); - snd_soc_component_update_bits(component, e->reg, - ARIZONA_IN1L_SRC_MASK | - ARIZONA_IN1L_SRC_SE_MASK, - src_val); + change = snd_soc_component_update_bits(component, e->reg, + ARIZONA_IN1L_SRC_MASK | + ARIZONA_IN1L_SRC_SE_MASK, + src_val); - return snd_soc_dapm_mux_update_power(dapm, kcontrol, - ucontrol->value.enumerated.item[0], - e, NULL); + ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, + ucontrol->value.enumerated.item[0], + e, NULL); + if (ret < 0) { + dev_err(arizona->dev, "Failed to update demux power state: %d\n", ret); + return ret; + } + + return change; } static const char * const wm8998_inmux_texts[] = { -- 2.35.1