Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5956748iob; Tue, 10 May 2022 07:24:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtker6OTbZbzdcPv697TDjOwe5HwHsvrrFf44Qz9jG5tIVdkCsPdsA+sNrs0KdT5EXMrKf X-Received: by 2002:a17:90b:1e09:b0:1dc:d3fa:dabc with SMTP id pg9-20020a17090b1e0900b001dcd3fadabcmr228472pjb.225.1652192684449; Tue, 10 May 2022 07:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652192684; cv=none; d=google.com; s=arc-20160816; b=aovD2UJrMomz20f6R84Xe2UHC0zclnKxxeJMPxb3PZ/3aGXbCkIP+65SdUcHQ+xI7d KjVYKBYUymE76nwzB04UPkRF1hCpCGeeO+OXid5VUsmo6b0DBLnHuCu/rqgaohlNWFQQ kdUHmYVIY55YfgXokoHLanx0UVp8TVzRCO+ifODfX8A46lSB25HgnKGjeheXhGQKc2Vl N607hTKQk+Ohnni71afUZsVxWQ0Cq5r3SWsv6MSggIQiCuAjMLUNJRmMka5Wx5VqeGbo FJ42vQQ0GXqzM7gttTd73xBqgKAo0JTEEV/EhW3E1lfVMQEga8ciNR/tx9glOy5da8XC b5og== 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=kSfjFv9niqrbFgKkzPlwX3nfkfaCQb2jyhOx7Yzc6X8=; b=AvekKa4PLQiFZwPDkzlR9fArepuCFIuXxTHDZAsEudPlZuQmo6iuUCag9th997xrY9 OH7EwD9K7vmugn5je5WIGKJj5i+vvUlGR7Gj0eBvNE465/7vR+J+vYSWfF++5F6KC1k6 kDFP0vMExNT+mHeEuAXFaOT9r9zQVfUAY52K0jhGT36tEiYTdfipeUt528H0tA8tYks5 rXA3IceOVJNuzKfmt23MQn3z+jfNOJXQw41dUqla8h368DlipmAYGn12fD75s9SoHmd0 sMnnH23SmjBN54DiVlU7Li5d9jP1SmsRpdY6qKZS1SiSH+vaisTu8kB8Xtrzto/+8CvS Ow7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UMefxCXf; 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 pw12-20020a17090b278c00b001d529ef7481si2802276pjb.168.2022.05.10.07.24.26; Tue, 10 May 2022 07:24:44 -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=UMefxCXf; 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 S1343743AbiEJOHM (ORCPT + 99 others); Tue, 10 May 2022 10:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244124AbiEJNgv (ORCPT ); Tue, 10 May 2022 09:36:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725452D9ED5; Tue, 10 May 2022 06:25:24 -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 4AF4C61767; Tue, 10 May 2022 13:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46789C385A6; Tue, 10 May 2022 13:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189113; bh=2HnKUKKeygCNULEDLTGebDWd/Upf5P086EXE4P6TmGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMefxCXfdDoy5SVdDHbjuAoiuhMmrzbtXUM9YtSn05LjfItGsXbcr0Ylrq9GsG1D4 nmK8PNqAIxcNsjuY+R0YNKKN9IxnqjwwuOQFnRoPa+bDJq4nOkEtYllTxcrvj0k3rQ JjVdmguSrFo280CPgZ8iUEy8+R7VYC2CvyuIYBzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Adam Thomson Subject: [PATCH 5.10 17/70] ASoC: da7219: Fix change notifications for tone generator frequency Date: Tue, 10 May 2022 15:07:36 +0200 Message-Id: <20220510130733.370742040@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.861729621@linuxfoundation.org> References: <20220510130732.861729621@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.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,URIBL_BLOCKED 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: Mark Brown commit 08ef48404965cfef99343d6bbbcf75b88c74aa0e upstream. The tone generator frequency control just returns 0 on successful write, not a boolean value indicating if there was a change or not. Compare what was written with the value that was there previously so that notifications are generated appropriately when the value changes. Signed-off-by: Mark Brown Reviewed-by: Adam Thomson Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220420133437.569229-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/da7219.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -446,7 +446,7 @@ static int da7219_tonegen_freq_put(struc struct soc_mixer_control *mixer_ctrl = (struct soc_mixer_control *) kcontrol->private_value; unsigned int reg = mixer_ctrl->reg; - __le16 val; + __le16 val_new, val_old; int ret; /* @@ -454,13 +454,19 @@ static int da7219_tonegen_freq_put(struc * Therefore we need to convert to little endian here to align with * HW registers. */ - val = cpu_to_le16(ucontrol->value.integer.value[0]); + val_new = cpu_to_le16(ucontrol->value.integer.value[0]); mutex_lock(&da7219->ctrl_lock); - ret = regmap_raw_write(da7219->regmap, reg, &val, sizeof(val)); + ret = regmap_raw_read(da7219->regmap, reg, &val_old, sizeof(val_old)); + if (ret == 0 && (val_old != val_new)) + ret = regmap_raw_write(da7219->regmap, reg, + &val_new, sizeof(val_new)); mutex_unlock(&da7219->ctrl_lock); - return ret; + if (ret < 0) + return ret; + + return val_old != val_new; }