From patchwork Tue Nov 30 16:05:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 12647753 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 AD83FC433EF for ; Tue, 30 Nov 2021 16:06:45 +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 C0BFB22B8; Tue, 30 Nov 2021 17:05:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C0BFB22B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638288403; bh=krT41KYW3jYje7fPAFdDTFhQoa4snMkJsGUqVZqRplE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WZpcaBddXOxI8VMCS8+ReIjapsg991YTFldSjDaEs07gTWNF7RgUyj/Pb/LsxE/2r /Phl+pZsjq1+3EZ+aTOQiCaUNngxsyGABL3tHVkrpxYddx7l6+93rxWXcwpN+wrfmm j6++pbOuvjGsA9DsFV+Je44ONXQQomUeoclOnrZk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C4719F8032D; Tue, 30 Nov 2021 17:05:40 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4F384F804F1; Tue, 30 Nov 2021 17:05:26 +0100 (CET) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 00241F8032D for ; Tue, 30 Nov 2021 17:05:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 00241F8032D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sDuza+FZ" Received: by mail-wm1-x334.google.com with SMTP id y196so17906489wmc.3 for ; Tue, 30 Nov 2021 08:05:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eiq8mrs4KypbI40KDxp0gW63RCTeIkT2fpDQjEs0zV8=; b=sDuza+FZX9QSH3qeNGT+X+DA4wb9mg3F2wJVZ3Y1NX77eEyJsKvTViqNq4bss6VT8X PTthJDo/VTQ6pVnvRQPbmpUUz1imxJHKY4DCcE0CCRjcu4s8B7bvGpQP5WbMzkSpHR7f mX/NbBx2IlSBKyMAUkQFMmO3BnMa+pcvN8abRYv59VXmjuz+yBZMQMoBfiaQxfQsPU25 9n+Mfg3UYyzKOASyn+A4h7Mg91hI7te93byBsAc8cl/2wCn0vSHZbhHojD7BnpABdI6b aUf+2Oo7bC/UcsAsEk2z89ZMDLRfQlkNcLohcL9jaamWALeKf0ekd/dAJzz2DQmDzNTT gEMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eiq8mrs4KypbI40KDxp0gW63RCTeIkT2fpDQjEs0zV8=; b=6ufqCETWCrYIqNncck0qJ7GjYKdLyq/+b+MaNMT+1YFpiCzDsMMAQ43Fzgy7o4xI4A oDcTr/uXs3suj3zF+//5YtzGOeYuTsBSI4QT6VOLt5ev6mNlatVtFe5lr+sjuhfuI5/g epIz1/fZGMbsBpIpBp+SHr5VDpPF3sr+13m/NVPsLMk7FrG+nRhgyAg9xjZPhAxIZsLD Z/GQjY6ZtVg6Crlbo34ARrQyjlazm72APeC0F195azi0dKwqDMHYKM9u8AhU79lXECDG hLZ9E6Vc06Xwyv6N1ZYNc3RTImDvWjWtrmj3xDL0EBLo5ZCXa6AJpzVhQQi5JJKV8r1X tstQ== X-Gm-Message-State: AOAM530KCPa3+8uJuG9qYhBCqvpeXsjDnhgjVaZ5q2+4Ab1ocAPd7Ag9 +HtqE/J8y9AAeZ1ezrjS2qVmkg== X-Google-Smtp-Source: ABdhPJxyr8BMwJKco7wRY8An11NgrVbV9pVbtue9NByormM7We4hBoSLLdbMlHxs4rByG8OkV8b5MQ== X-Received: by 2002:a1c:4d0b:: with SMTP id o11mr402887wmh.68.1638288315526; Tue, 30 Nov 2021 08:05:15 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id g18sm16719409wrv.42.2021.11.30.08.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:05:14 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 1/4] ASoC: codecs: wcd934x: handle channel mappping list correctly Date: Tue, 30 Nov 2021 16:05:04 +0000 Message-Id: <20211130160507.22180-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> References: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com 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" Currently each channel is added as list to dai channel list, however there is danger of adding same channel to multiple dai channel list which endups corrupting the other list where its already added. This patch ensures that the channel is actually free before adding to the dai channel list and also ensures that the channel is on the list before deleting it. This check was missing previously, and we did not hit this issue as we were testing very simple usecases with sequence of amixer commands. Fixes: a70d9245759a ("ASoC: wcd934x: add capture dapm widgets") Fixes: dd9eb19b5673 ("ASoC: wcd934x: add playback dapm widgets") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 119 +++++++++++++++++++++++++++---------- 1 file changed, 88 insertions(+), 31 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 4f568abd59e2..eb4e2f2a24ae 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3326,6 +3326,31 @@ static int slim_rx_mux_get(struct snd_kcontrol *kc, return 0; } +static int slim_rx_mux_to_dai_id(int mux) +{ + int aif_id; + + switch (mux) { + case 1: + aif_id = AIF1_PB; + break; + case 2: + aif_id = AIF2_PB; + break; + case 3: + aif_id = AIF3_PB; + break; + case 4: + aif_id = AIF4_PB; + break; + default: + aif_id = -1; + break; + } + + return aif_id; +} + static int slim_rx_mux_put(struct snd_kcontrol *kc, struct snd_ctl_elem_value *ucontrol) { @@ -3333,43 +3358,59 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev); struct soc_enum *e = (struct soc_enum *)kc->private_value; struct snd_soc_dapm_update *update = NULL; + struct wcd934x_slim_ch *ch, *c; u32 port_id = w->shift; + bool found = false; + int mux_idx; + int prev_mux_idx = wcd->rx_port_value[port_id]; + int aif_id; - if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0]) - return 0; + mux_idx = ucontrol->value.enumerated.item[0]; - wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; + if (mux_idx == prev_mux_idx) + return 0; - switch (wcd->rx_port_value[port_id]) { + switch(mux_idx) { case 0: - list_del_init(&wcd->rx_chs[port_id].list); - break; - case 1: - list_add_tail(&wcd->rx_chs[port_id].list, - &wcd->dai[AIF1_PB].slim_ch_list); - break; - case 2: - list_add_tail(&wcd->rx_chs[port_id].list, - &wcd->dai[AIF2_PB].slim_ch_list); - break; - case 3: - list_add_tail(&wcd->rx_chs[port_id].list, - &wcd->dai[AIF3_PB].slim_ch_list); + aif_id = slim_rx_mux_to_dai_id(prev_mux_idx); + if (aif_id < 0) + return 0; + + list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) { + if (ch->port == port_id + WCD934X_RX_START) { + found = true; + list_del_init(&ch->list); + break; + } + } + if (!found) + return 0; + break; - case 4: - list_add_tail(&wcd->rx_chs[port_id].list, - &wcd->dai[AIF4_PB].slim_ch_list); + case 1 ... 4: + aif_id = slim_rx_mux_to_dai_id(mux_idx); + if (aif_id < 0) + return 0; + + if (list_empty(&wcd->rx_chs[port_id].list)) { + list_add_tail(&wcd->rx_chs[port_id].list, + &wcd->dai[aif_id].slim_ch_list); + } else { + dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id); + return 0; + } break; + default: - dev_err(wcd->dev, "Unknown AIF %d\n", - wcd->rx_port_value[port_id]); + dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx); goto err; } + wcd->rx_port_value[port_id] = mux_idx; snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id], e, update); - return 0; + return 1; err: return -EINVAL; } @@ -3815,6 +3856,7 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, struct soc_mixer_control *mixer = (struct soc_mixer_control *)kc->private_value; int enable = ucontrol->value.integer.value[0]; + struct wcd934x_slim_ch *ch, *c; int dai_id = widget->shift; int port_id = mixer->shift; @@ -3822,17 +3864,32 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, if (enable == wcd->tx_port_value[port_id]) return 0; - wcd->tx_port_value[port_id] = enable; - - if (enable) - list_add_tail(&wcd->tx_chs[port_id].list, - &wcd->dai[dai_id].slim_ch_list); - else - list_del_init(&wcd->tx_chs[port_id].list); + if (enable) { + if (list_empty(&wcd->tx_chs[port_id].list)) { + list_add_tail(&wcd->tx_chs[port_id].list, + &wcd->dai[dai_id].slim_ch_list); + } else { + dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id); + return 0; + } + } else { + bool found = false; + + list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) { + if (ch->port == port_id) { + found = true; + list_del_init(&wcd->tx_chs[port_id].list); + break; + } + } + if (!found) + return 0; + } + wcd->tx_port_value[port_id] = enable; snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update); - return 0; + return 1; } static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = { From patchwork Tue Nov 30 16:05:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 12647751 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 786E2C433EF for ; Tue, 30 Nov 2021 16:06:20 +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 56A4822AC; Tue, 30 Nov 2021 17:05:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 56A4822AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638288378; bh=taeENlQ9KcgqBvjK4Q2K97S2jBcDzNPzogaBJ4rGWfw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rv8617PHbQOWf/0nOQLq+b+lKwu8JcGREY9ccJE8qvFdmMOTVTUnJbcIJZJWgPNxZ jPb/H61rSWF1OpV+BuBtwCFc2Q7VkaipCKdAgGlxnLk2pnuNnE/RJ5bau5pfMNwDsE WWLZMoZYvz7N5bIcrRGjVXRmJ16R7rSLghnsHjRM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DBF05F8020D; Tue, 30 Nov 2021 17:05:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A7ED3F804EB; Tue, 30 Nov 2021 17:05:24 +0100 (CET) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 89EF8F8020D for ; Tue, 30 Nov 2021 17:05:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 89EF8F8020D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zieBOBgJ" Received: by mail-wm1-x336.google.com with SMTP id c6-20020a05600c0ac600b0033c3aedd30aso15121956wmr.5 for ; Tue, 30 Nov 2021 08:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cf22A45pIeR4jTVVQeT79V6xpjlvyZZcaz2Nd53SNwU=; b=zieBOBgJlezxLM6a+mgn0ZoGwqWpWXR0ep4C0N3OKYR3G6hMjrB3u2lVsIUIKPB4AF IPS6tjfHpQDPGXP3q3eHbMXs6WB5Bqh5f4nCrDfasPgsd47iPhIis9/4Dfh/gdpWZI0C S8vIJmUvHq4XgKVlQWISEu3p0RzYMZ4FXdMS5hOWBsue5ewlinM/VhHGicUAVbboEn/E emdm14dHBi1MQP7QVli6CKznIhjM0tc1U8wgibKyL7fA+ghefz5xVhlrbs5B+N3eGE/O vhbKkOzomFum02wWFxCtWdkUeb96R5GH52kRZcFy8rK/jmBdEqrhD8zrNWtRTv+dcay2 VKfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cf22A45pIeR4jTVVQeT79V6xpjlvyZZcaz2Nd53SNwU=; b=UW/M5wdX917KFigIuBNjLgGNdInaChX06RczLDCHu/anbZvXH8gqINB+0t2okubiNv DbxojerIhJWcZexN6EsG0HMLBVL8mZMDSPhUITeBH5bv/heQmtev9h0Bx6LtldfFohpA UKarNN7PpnAkZJ6jCT202NtSrzvRv9Tc7uekiPtW0onXgpgb2PhGjQhOzyFvUKM1dcg+ WhlCb1v2H+3SAnNSrK81pA6R4+E5yBP0okaTQrKMzlOZK7QAmfEKq2cBeGf1pERY0Myo eqRMcJb6tVA7XgNZL5cSC9Lyx5skm/Mbd5hPDWgwucDO85QC33ec4S+xj9eGBdXKytIm mQQA== X-Gm-Message-State: AOAM530ze5jeurrJEtHTeg/AQFXG3wegUtvBJNAZpdC99SspwgGQXSoX XaTRWBsBR2KdqVxrjGPzaFS+QIAS+ShlnQ== X-Google-Smtp-Source: ABdhPJzLcAC1smNz3lM+4F8KaRwpxqBWaK5zP1R57JU/TzPu4Nnobd90HPstMEfd9+bqfB8qj2ULmA== X-Received: by 2002:a05:600c:2f17:: with SMTP id r23mr347711wmn.93.1638288317080; Tue, 30 Nov 2021 08:05:17 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id g18sm16719409wrv.42.2021.11.30.08.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:05:16 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 2/4] ASoC: codecs: wcd934x: remove redundant ret variable Date: Tue, 30 Nov 2021 16:05:05 +0000 Message-Id: <20211130160507.22180-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> References: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com 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" return value form snd_soc_dapm_put_enum_double() directly instead of taking this in another redundant variable. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index eb4e2f2a24ae..3294c685d4d8 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3420,7 +3420,7 @@ static int wcd934x_int_dem_inp_mux_put(struct snd_kcontrol *kc, { struct soc_enum *e = (struct soc_enum *)kc->private_value; struct snd_soc_component *component; - int reg, val, ret; + int reg, val; component = snd_soc_dapm_kcontrol_component(kc); val = ucontrol->value.enumerated.item[0]; @@ -3443,9 +3443,7 @@ static int wcd934x_int_dem_inp_mux_put(struct snd_kcontrol *kc, WCD934X_RX_DLY_ZN_EN_MASK, WCD934X_RX_DLY_ZN_DISABLE); - ret = snd_soc_dapm_put_enum_double(kc, ucontrol); - - return ret; + return snd_soc_dapm_put_enum_double(kc, ucontrol); } static int wcd934x_dec_enum_put(struct snd_kcontrol *kcontrol, From patchwork Tue Nov 30 16:05:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 12647757 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 C3E91C433F5 for ; Tue, 30 Nov 2021 16:07:32 +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 D4A4922E1; Tue, 30 Nov 2021 17:06:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D4A4922E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638288450; bh=6Nui04VC+EclPqKvAyULiIiD/RZKglvh6skgELwCiHY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CK9MDHUoxu+CHrfAmusMtE8W54i18nI+fTvsy0FoRU8SwNocydz7latBsXpQoYLhj hrvWeEX+9AR+Wa7zqpzoRjrE5vneginIhZELaabkJwVbS30vYnePLcpSD4BGpBurdZ LyxvBEOE7aj0hF9YWLoQn45NZq/WOWCKFM5NIdt4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 77314F80506; Tue, 30 Nov 2021 17:05:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C28EFF8032D; Tue, 30 Nov 2021 17:05:31 +0100 (CET) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AB794F802C4 for ; Tue, 30 Nov 2021 17:05:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AB794F802C4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r5D0WzBw" Received: by mail-wm1-x336.google.com with SMTP id k37-20020a05600c1ca500b00330cb84834fso19947436wms.2 for ; Tue, 30 Nov 2021 08:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OIAtVnx0ZzlGmfdsJR+Ltr1BjxuMXS7lSNZkDDd+8oo=; b=r5D0WzBwgwvEJ6qvAb7BParzqYivB9ouS4MM1hgX9ewjK+4Qt+7UHp/G2VN98fimd/ ez3cnnPWNlFk1GS8ee2zvMSGNp72n9smLAo1lQB/YHHfmgHaN7VYM7oSPSF6o2HQZ/Vw uI7soY74pafLImmmT5SEw230VCq9hixIKgWWbIGz0gNo3GBowQhK3C6X26RhLRBJ11a8 n2WipiZs4aYPgvG25D77SToLUsPTgOBFPcnSjejmOHHhHCErnQ999MGSHmH5HsWxq6pe dm9mafM038ERfza6Mo9kr5xW5F13r9R9kyfu6HwzH8CAB6QyUPloaeFIKBGVbFdrkEO3 mnlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OIAtVnx0ZzlGmfdsJR+Ltr1BjxuMXS7lSNZkDDd+8oo=; b=yYZs6eYaUIvKrntiNbU38f9Q5AzXj8mflaJgzZl4750DucCxj6DxfL6AG2tMYfIpLT Dj6xs+PzGIUTFkppzIJVVbdte9wz4nUkmWl6j7quAluEPjGfgngZ3iA4gOYZTNLhQCh5 zxxXjLQYfycqwmEDmWrOGwWWDufhzFEWVsXp4t+oDeGSri5eYK+FAh3nHxyPxhzdEzxQ 5xHZZq/t1xWk7Lnp9Rrb0Sdre/Gz4uPEijkH++ctdJYkRkdfuEHXFa/eDar/T2Xgb1W1 ljyKcGqVOAGFhHPQ7CjX7NtPvy5jrzZu7HPEf0u71h27P00eoFFxMfYwUZWoT0YPn7hw Q9SA== X-Gm-Message-State: AOAM5327mTc030OLtSSJv2c1uMkXwaEScCmNi4lbSZURXhVEPXcCJJ1W lwkTKTCaY9VvcISgJE2zKLzTnQ== X-Google-Smtp-Source: ABdhPJwReuuxUsxNupkQZHuNCtvWOALK8zItA8DvAQk1ne0jY1pHEqrMNHn0ZRnUx0d1pg514SymPA== X-Received: by 2002:a1c:9a89:: with SMTP id c131mr394569wme.80.1638288318600; Tue, 30 Nov 2021 08:05:18 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id g18sm16719409wrv.42.2021.11.30.08.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:05:18 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 3/4] ASoC: codecs: wcd934x: return correct value from mixer put Date: Tue, 30 Nov 2021 16:05:06 +0000 Message-Id: <20211130160507.22180-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> References: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com 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" wcd934x_compander_set() currently returns zero eventhough it changes the value. Fix this, so that change notifications are sent correctly. Fixes: 1cde8b822332 ("ASoC: wcd934x: add basic controls") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 3294c685d4d8..6c468527fec6 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3256,6 +3256,9 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc, int value = ucontrol->value.integer.value[0]; int sel; + if (wcd->comp_enabled[comp] == value) + return 0; + wcd->comp_enabled[comp] = value; sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER : WCD934X_HPH_GAIN_SRC_SEL_REGISTER; @@ -3279,10 +3282,10 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc, case COMPANDER_8: break; default: - break; + return 0; } - return 0; + return 1; } static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc, From patchwork Tue Nov 30 16:05:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 12647755 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 6195AC433EF for ; Tue, 30 Nov 2021 16:07:12 +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 6EC9422CF; Tue, 30 Nov 2021 17:06:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6EC9422CF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1638288430; bh=dSLH0Tr+jiDPYsMflrW6NjCV0XVWegqMUDfAXC/s1EY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HxZQP+P6Pl+eU3s2cNdSAcM/fzAEnuDCaSvGDsrOMMkWVt5X2Ca+OBcsV6knHByjQ xhcGj/k+luQMSYMB7lT0i2fSi5aTnuYOwBUEp3sRjdhSwWxBkGw8MNiN8ZbXgaqpTd yLmgVl17tVms0MmyXmIwbr2zWBPGFsd8j4VgtLZ8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 008DDF804FC; Tue, 30 Nov 2021 17:05:42 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 77501F8032D; Tue, 30 Nov 2021 17:05:28 +0100 (CET) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3B494F804AD for ; Tue, 30 Nov 2021 17:05:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3B494F804AD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DC3LRUkn" Received: by mail-wm1-x332.google.com with SMTP id 133so17955176wme.0 for ; Tue, 30 Nov 2021 08:05:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zwiut7mFwVpOIkozl/7l8HWaVugd0GDlQFwZ0pbcpWc=; b=DC3LRUknToLtww9XliTaOCRIG9zbvS3PC1QegcsvRglKmY7uWF5UlMZDIPFsQkgCtH XNHlkiTBMAl1cqz+qKkWUWiTdTf9HDc2eYiVL7p9ViGDCqXzASbxn5dlvZNmcHwbV7pf 2eLtPbNilBuHNPVAgK2SmyNk4FtW4w/ynJr/IbiRvx1G0nNqDcVev5hQc0WJ/z4nRj62 uVmB8D8d4THEISnVdo7tbBqj1WCSYZWkyk3GjAtmEOmlXm8rEdLi+WK6p4JG/M4TU1eQ 5Qj+a2nNreS3aF6+5vZYbT4JThzIWiqUQI69+DgVDatZx2fWfaPtKLl5dp2iQWcVSSge ULwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zwiut7mFwVpOIkozl/7l8HWaVugd0GDlQFwZ0pbcpWc=; b=JilRWYitnEqdsn1u0bilcyhxb/P7d5RS6XyfIbJ/J7jFL6SdpwKlyLvqdU6TezrjTR ztnMas15uWTtRlDYaq91i9cPaytHYcvIi3P78hJNUNx/N3Mc84ntS3WLffublNHDXFWT 10voJUI9ftNNftBdkAxWPMTdTOuEAERBI68Oh51Gx0JwPCRt5opWScrt7qyxBwVeyQsC 4i0QGgaDF++58uWh6CHrA33Ipc8xbSFY65mj31CS+ypC3p/f9am7kS6s15vqosIJFHpw fUvWnKzmfVM2yANrEHhzV2ptC91kESXs8RGO+NNZgjt1/hPKIQ2KgLNGvudcsMzniqpG BUrA== X-Gm-Message-State: AOAM532EzK2ZOgbnmzoQv39swX/uj2kG5eaMZ2dyTjdsV9tA3RStaLNn DqQLWxIIHiRheeamQ+4aU78L3w== X-Google-Smtp-Source: ABdhPJxtW93MuDdgIrHLAiFiqQ3gvI5ucjAo1K99MBBW5zlCNu9ULHrL5CDQWbObdUNIoy6DfRriiw== X-Received: by 2002:a05:600c:1f17:: with SMTP id bd23mr360470wmb.57.1638288320134; Tue, 30 Nov 2021 08:05:20 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id g18sm16719409wrv.42.2021.11.30.08.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:05:19 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 4/4] ASoC: codecs: wsa881x: fix return values from kcontrol put Date: Tue, 30 Nov 2021 16:05:07 +0000 Message-Id: <20211130160507.22180-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> References: <20211130160507.22180-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, tiwai@suse.com 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" wsa881x_set_port() and wsa881x_put_pa_gain() currently returns zero eventhough it changes the value. Fix this, so that change notifications are sent correctly. Fixes: a0aab9e1404a ("ASoC: codecs: add wsa881x amplifier support") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wsa881x.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index 2da4a5fa7a18..564b78f3cdd0 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -772,7 +772,8 @@ static int wsa881x_put_pa_gain(struct snd_kcontrol *kc, usleep_range(1000, 1010); } - return 0; + + return 1; } static int wsa881x_get_port(struct snd_kcontrol *kcontrol, @@ -816,15 +817,22 @@ static int wsa881x_set_port(struct snd_kcontrol *kcontrol, (struct soc_mixer_control *)kcontrol->private_value; int portidx = mixer->reg; - if (ucontrol->value.integer.value[0]) + if (ucontrol->value.integer.value[0]) { + if (data->port_enable[portidx]) + return 0; + data->port_enable[portidx] = true; - else + } else { + if (!data->port_enable[portidx]) + return 0; + data->port_enable[portidx] = false; + } if (portidx == WSA881X_PORT_BOOST) /* Boost Switch */ wsa881x_boost_ctrl(comp, data->port_enable[portidx]); - return 0; + return 1; } static const char * const smart_boost_lvl_text[] = {