Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5707521iog; Thu, 23 Jun 2022 03:53:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tqtF/yqjySGBPeL/pZcJmQG+b+lh8bRePPUUet1tzo9a3d8GQ9fLn4Q0Fd2MlK6H/ENyL2 X-Received: by 2002:a05:6402:27d4:b0:435:9f15:a6d6 with SMTP id c20-20020a05640227d400b004359f15a6d6mr10029998ede.311.1655981590227; Thu, 23 Jun 2022 03:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655981590; cv=none; d=google.com; s=arc-20160816; b=xl94iCEhtYZvdKOfbcsFM7nT2BhLfd/5p0XB3gwo+WFfq92Nd3MMVt3I4VGin+M2tv imxAoWSGteBbMJp533L9/BZHd2h+VptB2cc7++vnbbZklz6aBeRZEXMEd4PuhgIu6lML gTUxtdqAGAO3U2+34Atu7SyFUcva/SYerVv7HKneMSYD01DfrMaouXuKBMvilhwfTRly p730VdHbqgqOyICHO7DH6hksfa2NVtsoFacYaPusvfoG17hyB5oel1EgUuGChbc0Jkrg vYvc01BAeJxkdyeFUNPEbhlYm8QcnDaD1n5RSGN37IVTVplCxSWqmUPiAwWRuzbdxnUf ETfQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Yc/c1yumefCJ4LX+6KTEfk9eNhDXY/b2YTGdnEZv32I=; b=K2ZflB/eKJssmiKhZav5nagsepqeQygbnSAPcxbfbRbvFuggBpIGCUJ5DMfp1ui9NW IMvC4hdQd76j+dcA13JTByOeLM2kCDqRAvGGzI4yuNlrLf68N/PFvJsl7gH1mclKHaXp qFBrDgUDjJNblieRl5DrttlOuGaDjhKZxhAi8k3/vfMVo8KgFBOQG9iakXnuiFv1e471 KGm8cgdwo3y6gOzOv0T5AGrAAqRieS5Nuy+5/f/LgwZlM185q1ZYLlIJYvB2rSxN+EvN +6uRSvgyNlJ+1rpShcep822qnSBoUU0Uk43Ex7QFdjkGwVWd01UXvrpAsfv15G2Tv5Mq dw+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=d2oMzTum; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa13-20020a1709076d0d00b00711ce996a07si8752586ejc.877.2022.06.23.03.52.40; Thu, 23 Jun 2022 03:53:10 -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=@cirrus.com header.s=PODMain02222019 header.b=d2oMzTum; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231335AbiFWKve (ORCPT + 99 others); Thu, 23 Jun 2022 06:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbiFWKv3 (ORCPT ); Thu, 23 Jun 2022 06:51:29 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F464B416 for ; Thu, 23 Jun 2022 03:51:28 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25N5GHiA005483; Thu, 23 Jun 2022 05:51:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=Yc/c1yumefCJ4LX+6KTEfk9eNhDXY/b2YTGdnEZv32I=; b=d2oMzTumXsEV2dgRMP/oVf21Xbd+YV2fG3LR9EECr5u+DPxjqvCtPCFGnvPqq9u6u6J5 rOYbA24urdy2TGoMMtcWQ5ZqE5MBbwHanUBwJ09Imf0qc/70Y1PFro8P0jHnYmjPt9VU aIeXjd9c3TG0GrpugcJdwC4zjpZVY0ZXUG9gjVIJhKgwENXwfM1TEHwUsOk6ube1+jWb YNTQeIGzZApfAYETYFNXAja7cOeSaOGjrYOmNUWNfr9cDO7ieDXT1Z5QIWJj1Umynous MCxOuwEOdQuFG7Xlho+gDij7WLWH7f8vNte//UblIB3lkcxYUGuTL6vB6T7eorAQXE43 6Q== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3gsb4p6pkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 23 Jun 2022 05:51:21 -0500 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_128_GCM_SHA256) id 15.1.2375.28; Thu, 23 Jun 2022 11:51:20 +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.1.2375.28 via Frontend Transport; Thu, 23 Jun 2022 11:51:20 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 2E141478; Thu, 23 Jun 2022 10:51:20 +0000 (UTC) From: Charles Keepax To: CC: , , , , , Subject: [PATCH 1/6] ASoC: dapm: Initialise kcontrol data for mux/demux controls Date: Thu, 23 Jun 2022 11:51:15 +0100 Message-ID: <20220623105120.1981154-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: KwGg4DYMYHVZ_4afJPVsb4OeEpRKMVcx X-Proofpoint-ORIG-GUID: KwGg4DYMYHVZ_4afJPVsb4OeEpRKMVcx X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 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 --- 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 869c76506b669..a8e842e02cdc2 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.30.2