From patchwork Tue Feb 22 11:59:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545287 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 3E5B5C433EF for ; Tue, 22 Feb 2022 12:01:21 +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 113A4177E; Tue, 22 Feb 2022 13:00:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 113A4177E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531279; bh=Asi3U5OBQYoCEq4Se6NRdPEVRqZ5au0PL+t5nkXVE1k=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vK90CKaupyeM9mP2lq29jyeYg/ea5FZP5TumLeofABD/JT5wlFxLE+/bOqlH4gn0l ZX1Ydw5vkjrjlKowSh+5aAGStx+MHV9hEIOLy6K6/QgbXMxA1GYJKX6opNPB1Oruwh gUoeN4z7ZT7g1vqu2cBGwYYths04/2ZWb30h8S9Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 540CEF80511; Tue, 22 Feb 2022 13:00:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AA7D1F8012C; Tue, 22 Feb 2022 12:59:55 +0100 (CET) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 7FCD8F80118 for ; Tue, 22 Feb 2022 12:59:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7FCD8F80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RX6X4lmj" Received: by mail-wm1-x330.google.com with SMTP id k3-20020a1ca103000000b0037bdea84f9cso1614931wme.1 for ; Tue, 22 Feb 2022 03:59:49 -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=HYM5KhvV8cAY2xeJWd0M65Y2tn1Q2u3N1GUicP98cl8=; b=RX6X4lmjUY/h74tOHBTweptlgfLuFmBZXV8kDh2RmGzLeHzQ1u8tX6ZCvYEtccu4xQ HDE9G6MNBk9HNR+SajG7pQzZdjFm0r67Nunqg/UVJnUCN2CbZpLjLDUlDFZtZnYjNzfq Z3zwno2Ykj4Sld3+FXEO0uOwjcVctBiD0cvjfm+O/+WywJgfmbAUvej5JRLmwvqJ7EN4 S2oaW8N4IX+XJtROIFJSlARsVfqzcBW/5U0cHVTULCTgfbDMCB6hJt54sDFM+Z4ws3WN 4fY5UycCJvCdpNSsRatWPKCJ/qwZILJzH9jmJPjjVdWjuXBA7FDNZsZ8FLGwGLK3M9E+ mzhw== 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=HYM5KhvV8cAY2xeJWd0M65Y2tn1Q2u3N1GUicP98cl8=; b=i+DgG828xu8E4C1akhvAHuq/5bAvWto3/dvfCkmT9pUm+k3Mi1RBuI1c8Oz6OAh6Vi 639j93t+gSkx2jKnEtLPDRQsfSrXW5fRduUiCV1ppUzVewW5BUblf5i0U+xY9T1NtOoV SOUhXY8twLmfzhYnbJRoq+mbUsCDLkiCfkFD1GaYebvaGZ3nJk37OcrHCrX2HpIzSpW0 L/UGfGCkm7Kg2/GxbGTqDkC6ZGV63jBBLwgdeHnB9+avFztWspmH2MlHa7YWeJYyt56X O5uQcuaQdBWj7XIlrYeieRowdgpJ+fqub3Mltx3V2kmvCJdnuCjTIwhBG3/wV/qocgIT Xh4A== X-Gm-Message-State: AOAM533he78bJFSK2QG6Uhvm/g/QA7t+Cl0Jg9qhDmGZWXLxDzm8J6+T gVH6oc50zpuL9/n+RwtlBMbz66BeKmhabA== X-Google-Smtp-Source: ABdhPJzLhrz3DxbtX9yGvLu3mqXzHXSgCBONoNArMwvkRmF9SNZLw5cuOed4dssa5O1/3S/74GG3Aw== X-Received: by 2002:a05:600c:2e02:b0:380:d7dc:5530 with SMTP id o2-20020a05600c2e0200b00380d7dc5530mr1856598wmf.115.1645531188467; Tue, 22 Feb 2022 03:59:48 -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 a18sm50014661wrg.13.2022.02.22.03.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:48 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 01/16] ASoC: codecs: rx-macro: fix accessing compander for aux Date: Tue, 22 Feb 2022 11:59:18 +0000 Message-Id: <20220222115933.9114-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" AUX interpolator does not have compander, so check before accessing compander data for this. Without this checkan array of out bounds access will be made in comp_enabled[] array. Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index fadf3c99c89d..a7f86b094a4f 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -2040,6 +2040,10 @@ static int rx_macro_load_compander_coeff(struct snd_soc_component *component, int i; int hph_pwr_mode; + /* AUX does not have compander */ + if (comp == INTERP_AUX) + return 0; + if (!rx->comp_enabled[comp]) return 0; From patchwork Tue Feb 22 11:59:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545077 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 06BCCC433FE for ; Tue, 22 Feb 2022 12:00:51 +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 86020175F; Tue, 22 Feb 2022 12:59:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 86020175F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531249; bh=iZnLVqPhEdCoeqFRLaS0iaEnLO4STijD7zpqt3gEDfM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oW3MYdYiXp/JlH3F8/gO+Ce2f8GaISAIocwiUQqaDyIo1infpIuDLgqWRwDKgfJo7 DGF2AC56BF6q0C2GQJl+Dk9W+22ZyAMNHPRO4Z3kkZ71YFbzx5llbe/TU/GcR0LYBF E/3obV+wQ6432giwlX/VaDIwEg+cfCtoVxRawmas= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 59578F80238; Tue, 22 Feb 2022 12:59:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A041DF804FD; Tue, 22 Feb 2022 12:59:55 +0100 (CET) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 CAD1EF8012C for ; Tue, 22 Feb 2022 12:59:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CAD1EF8012C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UIYqOQ5C" Received: by mail-wr1-x42f.google.com with SMTP id j17so6035464wrc.0 for ; Tue, 22 Feb 2022 03:59:50 -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=86hxaHzF3RhEyMf0w7EdDLKHhFRcTnHl9QY4411LC24=; b=UIYqOQ5C+72BzCNoV0Ugv17YE9b5pOJ8j4O4j8v5N3W3spxXNFGYmh+JuMT6dyBZKb LgYLALuS0ZRyW1ETyfWUoXYOnHNSlESqQGOuAtDPwGhyqehPgnuqkf2MRw35c5ojGyet d+GFubJ4UQzpFdkmNknnaqkjCTknZYI4L01jiQ1kDjKNVKmkGPek9fNkR3DS4A6SKxqp KwEdE9xqccsnhLTHECBq0N2JJMy7Z6sLOgz4asz9ckKRmkYEIkjNtX7EhALiFDUSxUlI cnSrdT75XERF/adspig2vL09edaCtVQF3noFXpLboD2IJ1N2tuACnHavad6EqLbiVA5w +DaA== 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=86hxaHzF3RhEyMf0w7EdDLKHhFRcTnHl9QY4411LC24=; b=5rdgx6Dj1LhL15QgDAiD8/AAKv6cpkgPCb5ePJlQuHMrWgj7/NyaaXS+4nvHpvssRg 0gj+AUw5tlxvfRVwfS6B5/um6mCdKnNG153FCZCIUwZqsdUTtjfPt4ExmZ8gQ1EsIHsB VVHq7uLvrVlzj2nrKA8NCU2BRfC03aResuEW+zM07/TPry6QdXlZD56Emp1RZhc20alN ItmPWO8/NMalcDkQFZNDilJaNpRgBDgM0F7Y1RIKhaqSH8w5nFW5Huy8YA6smtCZKW5c iMHP7RKkDgzkprsVdBPO3qIMpsrc6DbdPLgYkOMQX9yT+NyfMo6UyP94/rQTIEH7M+Zi /QXw== X-Gm-Message-State: AOAM530TQPF+KPu2Xzk7FSHwC+dhJfadJ+TE5nKQQu9qKfliEGRTRoy+ g7bBiR1Xrj+fGGY0frDBnFI8GA== X-Google-Smtp-Source: ABdhPJzmGXWQa2fjf4E5qRANCuTFxziwaIr5wdxaoMdvMBH8nLxjraz5vVllu62TnUTDy9y72pbn3Q== X-Received: by 2002:a5d:5185:0:b0:1e5:78a3:7747 with SMTP id k5-20020a5d5185000000b001e578a37747mr19520727wrv.470.1645531189570; Tue, 22 Feb 2022 03:59:49 -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 a18sm50014661wrg.13.2022.02.22.03.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:49 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 02/16] ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 11:59:19 +0000 Message-Id: <20220222115933.9114-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index a7f86b094a4f..058d8634ce40 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -2273,7 +2273,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); struct rx_macro *rx = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = rx->rx_port_value[widget->shift]; return 0; } @@ -2285,7 +2285,7 @@ static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct snd_soc_dapm_update *update = NULL; - u32 rx_port_value = ucontrol->value.integer.value[0]; + u32 rx_port_value = ucontrol->value.enumerated.item[0]; u32 aif_rst; struct rx_macro *rx = snd_soc_component_get_drvdata(component); @@ -2397,7 +2397,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct rx_macro *rx = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = rx->hph_pwr_mode; + ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode; return 0; } @@ -2407,7 +2407,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct rx_macro *rx = snd_soc_component_get_drvdata(component); - rx->hph_pwr_mode = ucontrol->value.integer.value[0]; + rx->hph_pwr_mode = ucontrol->value.enumerated.item[0]; return 0; } From patchwork Tue Feb 22 11:59:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545074 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 A8FCDC433FE for ; Tue, 22 Feb 2022 12:02:49 +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 B53CC17A3; Tue, 22 Feb 2022 13:01:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B53CC17A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531367; bh=7L0MaZUFtVhaDRMQtwSZV3TbXZZYsB14bS5A8nzpVoQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ponmEGLsGlU74jIScwkKPoVwPWnp91EgvBIwnlgrzRqz6F1I2d7CQmHwOPxSUeqMx 9xFhTSx4CLa0qwvFlmeAvF8Lri9yaUYqNvsc98Bw4hdp+/NSEeeKXFf6gArIhLcMLN OtxvSv+Tw3MPAHN/E2vUK/MBbgu2fuH02iOxb9bM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5BDDBF80529; Tue, 22 Feb 2022 13:00:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 65B2DF80518; Tue, 22 Feb 2022 13:00:02 +0100 (CET) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 7719EF80224 for ; Tue, 22 Feb 2022 12:59:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7719EF80224 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CQqzgB9y" Received: by mail-wm1-x32f.google.com with SMTP id x3-20020a05600c21c300b0037c01ad715bso1621002wmj.2 for ; Tue, 22 Feb 2022 03:59:51 -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=qAYVw6f87nBCDJGUCPz374Y+GRm8ih0aIXd7jYiegYk=; b=CQqzgB9yPbuTyePAU9nroBloxL1ZgVMRzSIxuE5V8cp8RnsAAmLD/DG4Y/U4+52JtP l0i4vxh63W11kE4hkrTnjovKpOEVgEa1OuzczjQflVozla893MxHxmTRZ5RSpbgYPPpu WWWCPTDJC6Ah2yvXr1BXpsOLIK8iBQlC1cLaVJyOHRuFnvHI0iZWvmwHpjWP3WmThslC Az2U5BLZUkpfGspnqVwzfcBt+TqzwaTTQGEBq8/AjQs0gqSr+1LZOL29qIt0ZY/0QuqW Hb/khWTEL9bGjL6XLp9XcEClJHUQYc66qWhLG2pBq4leI/6VB9v52SoFzyqpLgYHk4tN oqWA== 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=qAYVw6f87nBCDJGUCPz374Y+GRm8ih0aIXd7jYiegYk=; b=wcl21FKbGxyDwYKa8TK01XABuYtLEknjzQX3k0GAJbN2S+oJMiWf3NE0E9gdL68uMk eevMpuKGVkaiT8pfgjWfVqNXUe3Y2FhUolAqvugEJ1/03fd4VRCwma/SiacX7IMraEno QuOZZtQlBjSfd8EzrdCdk3fSumiPtZ/lb9h/ATBUGpaJuCmtzb6zP22ank/XIvuX9Qd5 bz8na4u7qNHKlCWoLFzXXEudDCqrVZbMvNaHJ7nyf1IUHNnurZCT0z9keSSZhiwLokOz PalWIa4rIdqaVpDMXAOohOs9PsMkCrU8RARlkxKika3O9+EmVGYUssskt0KpvchmIwq6 f4Zg== X-Gm-Message-State: AOAM530iGOPwJZqcRzgrHU8ZfFMke2HH8qK1iw9pNhrTvjPTomev4CuG BelqdfkNGjMSdKIXGSpLA2ygmg== X-Google-Smtp-Source: ABdhPJwhpijOE/o2mCXCiE9KnjdyQ6TxkwxS7wznSwBFTO06MlhP+grm26A3hMPj6+GwbD3L+uTUQg== X-Received: by 2002:a05:600c:3650:b0:37b:dd89:2f01 with SMTP id y16-20020a05600c365000b0037bdd892f01mr3086611wmq.43.1645531190597; Tue, 22 Feb 2022 03:59:50 -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 a18sm50014661wrg.13.2022.02.22.03.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:50 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 03/16] ASoC: codecs: tx-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 11:59:20 +0000 Message-Id: <20220222115933.9114-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Also few return value of put functions, so that change notifications are sent correctly. Fixes: c39667ddcfc5 ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-tx-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 094756544eed..f90786100d1a 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -998,7 +998,7 @@ static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l; - ucontrol->value.integer.value[0] = tx->dec_mode[path]; + ucontrol->value.enumerated.item[0] = tx->dec_mode[path]; return 0; } @@ -1007,14 +1007,14 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); - int value = ucontrol->value.integer.value[0]; + int value = ucontrol->value.enumerated.item[0]; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l; struct tx_macro *tx = snd_soc_component_get_drvdata(component); tx->dec_mode[path] = value; - return 0; + return 1; } static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, @@ -1037,7 +1037,7 @@ static int tx_macro_set_bcs(struct snd_kcontrol *kcontrol, tx->bcs_enable = value; - return 0; + return 1; } static int tx_macro_hw_params(struct snd_pcm_substream *substream, From patchwork Tue Feb 22 11:59:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545285 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 DDE0AC433EF for ; Tue, 22 Feb 2022 12:02:30 +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 2167217D5; Tue, 22 Feb 2022 13:01:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2167217D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531349; bh=dyKyvWtXMdWEUtKwENfHZO2WbXgW6qFiov2rOODx+pU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VxwYxszmNFrAESnnISaEzoz13wRJXt3Mz30cMiFRUW6fqxg5VNbYd70xT0c3ikRHk h73lgLdJhcxtjSs/xWE64J3Q/fX2xKSQ+F7ct1KZnkLaAvhmL9gHtSU4R47nJXBQsY 6odaWJQ+14DAxG5xGczHtFSalHYLCpVCQTGREI5Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 26D51F8012C; Tue, 22 Feb 2022 13:00:10 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 19571F80516; Tue, 22 Feb 2022 13:00:02 +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 10E81F801F5 for ; Tue, 22 Feb 2022 12:59:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 10E81F801F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SanxqFiR" Received: by mail-wm1-x336.google.com with SMTP id i19so11368013wmq.5 for ; Tue, 22 Feb 2022 03:59:52 -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=b/RMewZRNdO9Wc+5bCNqy1Hhh9vonM3PUYPjxzgWe6c=; b=SanxqFiRWVCfz2tMk6aRuN8EEWVdZcWBZqQ/p98luZkdfvMRIOd/tTpvxbWWTEU53M +K2TVExVtW+/JyRFknezKVtcO5x12s/Yn17Y9baJmceusyiSFROq1sIowVFwhAXaQjre J/bQdVKvT3CfbuacjV/caOuz/9GQLYDwX4q3y4G4KTC7uVgy29Bt5TEv41mAKt1uV0bD bu8hEpEzxqK5v0nBIJfN3ilaTQ+3BGT49GMN7JYKt76nx3cJViR9l+yyEIWABmRTFw9e lHwVf1OhEGAGt+5qkdF0ggw+czKMt2L7rJZvogJtHTRbqr5DM8A0aPvizAnMNJi9TJxz ztEA== 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=b/RMewZRNdO9Wc+5bCNqy1Hhh9vonM3PUYPjxzgWe6c=; b=hMFh2AuNEgnNqO6I2d6wfDyOv49hIKrMtw7o97d7kAgEVA4woS0PSDIlAGCaIO/wuH QCDqDN2nT9mucD7jaPr6FCp98VE7YOzDaZJl+c8dq07FOvsn6TVNeFktWWTDtP390PIX rHEfTrPodE3aM/vaZhsn0JAM7EmsJkEcj8EIx+SMCfUJCTzu20p0h12rtJOuV95FNDRZ kbqJoBYuF5r+mzgnJ8hOu3vtxW5uBdeJcYqzREit1SovD+lKJvm7ymOfbwrO8Xi6hb4q PgFeuXwbmEccu7jH8mG1XGLXv0n/F3Anh7f93RYuqblZBKdI4AVvIZny7fMg/cAEqJzr 3UVw== X-Gm-Message-State: AOAM530rTV0s/kI0al4M3Kb7Ln01vzXiXyfPAQ2RiRAqc1UvB92JxB+h ptA/zysNNr7sERZA+lXZ5/p77w== X-Google-Smtp-Source: ABdhPJxzgULSLUP2pqn4tukUw2n0gKmU+1hjzQ8HM08B5i+0uUMqJIsF0uL6zc5my2JKVFxfGP6fJQ== X-Received: by 2002:a05:600c:354c:b0:380:dec4:10ac with SMTP id i12-20020a05600c354c00b00380dec410acmr1382242wmq.62.1645531191766; Tue, 22 Feb 2022 03:59:51 -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 a18sm50014661wrg.13.2022.02.22.03.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:51 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 04/16] ASoC: codecs: va-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 11:59:21 +0000 Message-Id: <20220222115933.9114-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-va-macro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c index 803e4dca0538..0fd0139e8229 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -781,7 +781,7 @@ static int va_macro_dec_mode_get(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l; - ucontrol->value.integer.value[0] = va->dec_mode[path]; + ucontrol->value.enumerated.item[0] = va->dec_mode[path]; return 0; } @@ -790,7 +790,7 @@ static int va_macro_dec_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); - int value = ucontrol->value.integer.value[0]; + int value = ucontrol->value.enumerated.item[0]; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l; struct va_macro *va = snd_soc_component_get_drvdata(comp); From patchwork Tue Feb 22 11:59:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545284 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 36147C433F5 for ; Tue, 22 Feb 2022 12:03:02 +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 6D7851774; Tue, 22 Feb 2022 13:02:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6D7851774 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531380; bh=lB8OV4dDj2dHTsaucpGM2OONEOzfnwG8IyCDHINaWzc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=oU92GiTbEhcT2MzH4Nyu4LKNPFaE5W7tG2dg1kxOEGgyV60rqH8nT98gwZZ0Cf+wk wIRFzcmBBuLWnZxC8mvzV3A40VKzPE76nZtFKYMd0auZyIZaSPP8aSwCjpprurZNYg nzWK/ZOsOEWXngkrYAfkbyVlvj95+dkhRJuL3hvI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ACE93F8051F; Tue, 22 Feb 2022 13:00:13 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7F780F800D1; Tue, 22 Feb 2022 13:00:02 +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 392EFF800D1 for ; Tue, 22 Feb 2022 12:59:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 392EFF800D1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BFcQ0xeG" Received: by mail-wm1-x334.google.com with SMTP id d14-20020a05600c34ce00b0037bf4d14dc7so1618330wmq.3 for ; Tue, 22 Feb 2022 03:59:53 -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=F4+KoWOLDfBWBNmg8ATzKj3dgQDIuJh9SiDFM0VqDsI=; b=BFcQ0xeGjkb5gAjr4AmA0Upb6D/t5gZ3sgiwyOwFnOPwn7x3emUhI03zW9x9tKD9gI XhZcTlsxhpPG756DZ4gni1co0nrdMBbo9jTz/H0WsiBSyskEsiKG8jWaROZiOaZ+UONI o1ywDWRZqTdZDrb8uuU3dFlLb0E9wTgK21wlnNyClrSvZgt2CpkgteBG1MhxcUavVKie yNTf+OT0eaJFVzXCUT5G+JstVJvzlk1f1r0S6zwH3n/vl0rfBQK9AZ5+9hd8329QWaMW BWyFMVbrEnnmYz8GL70pMisVsQpkqxveoYDWvgppJKDE+8dK4GIW3Kts4NPiAEwKzyof 5TPA== 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=F4+KoWOLDfBWBNmg8ATzKj3dgQDIuJh9SiDFM0VqDsI=; b=qhUx/vX/YT8TWP5Sw5qthxDQdVP7wIhLsdo83a+557m0zJOB5KNNuoJ85Pqa4cvWii S960vUykfjMKqnAajZtJQX2hVTMGcaUGcYxFMKUE+J0Y8HsJApp85Rrok8BQMZV9XWZY nqfQAQCZ0ClJU5xXuNGo7ltoPZ4ADFCxLAwQGbOg/8x7d1OJPKWuVoMv4/3Ba7O158r+ BuumO3VWzDw2PHzS62NvUTKfo1FfhxzZBJto+g5UeXR/pNzRNGPU3kkuYbvlV91XSx92 hs2N1I4NjeW61bgnmQ+jTzyHTtDo2wL8i8ECWirzEmEiTiUxFW9XM0O9mWAi6rAP/Yme wkDA== X-Gm-Message-State: AOAM533yBFGkNqyouEUoY5oOKTaBdNbmyHXzacn+QZsjHMKlg8MbcpTV 4jIUZj1LL++gEe96k33Kwelyhg== X-Google-Smtp-Source: ABdhPJxq6HIDurY9AQGuguDuGeBZZw3FpNl85sCDgC+WPGHKegdDi8iHlSvjQXET7sL/ND1r74vreg== X-Received: by 2002:a05:600c:230d:b0:37d:5882:ec9b with SMTP id 13-20020a05600c230d00b0037d5882ec9bmr3053532wmo.162.1645531192803; Tue, 22 Feb 2022 03:59:52 -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 a18sm50014661wrg.13.2022.02.22.03.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:52 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 05/16] ASoC: codecs: wsa-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 11:59:22 +0000 Message-Id: <20220222115933.9114-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Also fix return value of put function, so that change notifications are sent correctly. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-wsa-macro.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 05bf18ae10e7..7de09c46264b 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1806,7 +1806,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = wsa->ear_spkr_gain; + ucontrol->value.enumerated.item[0] = wsa->ear_spkr_gain; return 0; } @@ -1817,7 +1817,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); - wsa->ear_spkr_gain = ucontrol->value.integer.value[0]; + wsa->ear_spkr_gain = ucontrol->value.enumerated.item[0]; return 0; } @@ -1831,7 +1831,7 @@ static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol, snd_soc_dapm_to_component(widget->dapm); struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = wsa->rx_port_value[widget->shift]; return 0; } @@ -1845,7 +1845,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol, snd_soc_dapm_to_component(widget->dapm); struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct snd_soc_dapm_update *update = NULL; - u32 rx_port_value = ucontrol->value.integer.value[0]; + u32 rx_port_value = ucontrol->value.enumerated.item[0]; u32 bit_input; u32 aif_rst; struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); @@ -1888,7 +1888,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol, snd_soc_dapm_mux_update_power(widget->dapm, kcontrol, rx_port_value, e, update); - return 0; + return 1; } static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, From patchwork Tue Feb 22 11:59:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545075 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 9DEF4C43219 for ; Tue, 22 Feb 2022 12:02:11 +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 C377F17C1; Tue, 22 Feb 2022 13:01:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C377F17C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531329; bh=3pyhuthwanfxS5nWWbTlgdbILpj0kyAne8vH/5EO01I=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DpwmgY8eE2b2WJ0srJo9yiWxczTOqbKneUCvN6T81G7XwM34epb4z8Scdf4iNar95 6Ed3Oo08tNJ8E2eHLkT3BjM969LB6ooZbYdv10CLxlQUzLrD54xyzubbXRpM4IZhow mahHuHmXylSTrt2K/GJtC/+OcxZ0cl271IyGlLK4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B5E62F8051B; Tue, 22 Feb 2022 13:00:08 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EB9EBF80519; Tue, 22 Feb 2022 13:00:01 +0100 (CET) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 82027F80311 for ; Tue, 22 Feb 2022 12:59:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 82027F80311 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YSKSCQX8" Received: by mail-wr1-x433.google.com with SMTP id j17so6035933wrc.0 for ; Tue, 22 Feb 2022 03:59:57 -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=ht2zsDCw6mTpQAlwd9QIJhSI+uSP7rAlJbSv+42FdW4=; b=YSKSCQX8VLsIIuyC0rpsqZIVu8heWghUgpq9tyco/RlMfoMRfvL0TXTGRgj62ydrAC C3WqlPBHcTZVpsg2EZlDVsJbq1d3AwyyqN2HLIoyroTXtH8hT09QEZVJJCA9dfOYWVvg n0XHBDHlVGZGLjnue046qqwlgxFfVPHHjaRNX8lTueg2stxjhgOv0/5Q601rwSOfvtut IZ2zecmhTYgxYuzifrlK06I/9FYAfiP8zhDIZR0M8MYpwKeyKTv0PqTr9+iAJwalaU4x z+HWpXfi4FedctzjsaznTVd2Yv1nPrNU430A4MU3MvSeqkbG8O7zAHBYqUMaCXwOiIoW CBYg== 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=ht2zsDCw6mTpQAlwd9QIJhSI+uSP7rAlJbSv+42FdW4=; b=fl/05Tw/mZHF+6risq3vfW11tRNmnCeanRIRsT+sxtWpO3Ebhkz1HUbkWCLZinHKqj iRRqtbOJdAX9Yocr5b7oYGysFuHZuPQiIaXerHVggqB6oizLoeT8gXPJy6axKB5chict NMMyX8UpkRIabXwulfzlBemkEW7cCyE4kFUVLChFzvUEOcOuzeRx3uAw2l+8DbjbLnoD UP5Ct6WdkBSTzBcPnGzJvKBL2tWzuJmrw/68GV131gKr3vXXW/GDcCP38gk549/rkna/ MLsjKJJoUcsDUOPUNHZylBaNjkzBXKoIUO8MLnCfW4tT5PXf5K8k1zEw20UDB3iBYvgx oPhQ== X-Gm-Message-State: AOAM531DSqE2286/A+4r3xGX7bviw2AnFuu2thl6DahOEeXrHOzLzyEI H5qXE1NPBqrl8632sjFCCO3Rvw== X-Google-Smtp-Source: ABdhPJznEZqGfqmVrP+p0Vldxzh+Nd5LHUSodJxau7eBZeNvoTKPAn+XDsrnpIFSB15jtzso9lZVBQ== X-Received: by 2002:a05:6000:1ace:b0:1e8:cbe4:9920 with SMTP id i14-20020a0560001ace00b001e8cbe49920mr19167947wry.121.1645531193943; Tue, 22 Feb 2022 03:59:53 -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 a18sm50014661wrg.13.2022.02.22.03.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:53 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 06/16] ASoC: codecs: wc938x: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 11:59:23 +0000 Message-Id: <20220222115933.9114-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fix this by using enumerated items instead of integers. Fixes: e8ba1e05bdc0 ("ASoC: codecs: wcd938x: add basic controls") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd938x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index cf61d23bfb1c..deecc83eb592 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2506,7 +2506,7 @@ static int wcd938x_tx_mode_get(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l; - ucontrol->value.integer.value[0] = wcd938x->tx_mode[path]; + ucontrol->value.enumerated.item[0] = wcd938x->tx_mode[path]; return 0; } @@ -2530,7 +2530,7 @@ static int wcd938x_rx_hph_mode_get(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = wcd938x->hph_mode; + ucontrol->value.enumerated.item[0] = wcd938x->hph_mode; return 0; } From patchwork Tue Feb 22 11:59:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545286 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 CF1FFC433F5 for ; Tue, 22 Feb 2022 12:01:58 +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 C13E3176E; Tue, 22 Feb 2022 13:01:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C13E3176E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531316; bh=KeHoijlGPwYDj/ey1agbpqvcLCXSfxbw7neMyY12oAo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rkn1YkkiyVZ5s02GreZTnga1ysQaexkFXo4bYM7IrHYMhH/RoNFgbKYm0pfKuxq6F ojlX3CFKoQnttx8nUmXctZrGHAXHaSHPsoMxKEwTi2DaUkTvInPZTxYgXcRbua0gEq dlu91J7qqhpC3p6VZZSUcvx+jpFbjplxoNMOpotI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 25FB8F80518; Tue, 22 Feb 2022 13:00:04 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6C837F80516; Tue, 22 Feb 2022 13:00:00 +0100 (CET) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (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 EB0D7F8012C for ; Tue, 22 Feb 2022 12:59:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EB0D7F8012C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hQhF2lYs" Received: by mail-wm1-x32a.google.com with SMTP id n18-20020a05600c4f9200b003806ce86c6dso1606881wmq.5 for ; Tue, 22 Feb 2022 03:59:55 -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=Gs0UQYeLXZEFiZSAa7cijQLwxToifauUEWbaq2HVPLo=; b=hQhF2lYshRddH8Qmwv6xe2HTRpj9tSjW0CaazwoE+mE1cgElLDzWzmHuTV4JXiPGBV AUCQ3FQZjP57GvQ/sZ+mowISk/cqEhdDw1pCl9dnIXJl2h0YmJVZH8FEMvRGK+Bp0jH9 a3ll4LnZqjVMJeTYMDzK9pS24gsjGYrCqfo7gnOX93w9EYceBMXSKj//bdtpmuDrZlLA 5pKTIcQPPBLBxiNwOLzcTtlJL0zUTlATc34BKwdBlTN1vBPOyfahVVMyf907TFJAID4z 1WJ1NElr9prP+F+zAoLIxcCzvfJNyxWSZPliGfYddxe/hfyeA7s3mPhLGtl4kAXUi0n8 M3Vg== 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=Gs0UQYeLXZEFiZSAa7cijQLwxToifauUEWbaq2HVPLo=; b=htdFl1uA9iZj2bBotZsxyBisFdC/R8ZLndeLivJL5DdfFgm5EYwBjNY7z4WX3VBk6k cUjyzw48y1Y8738XSORdG18zAyevxDP95s0tgyEbdGlKBGj5nhk3LLg7NFoM++E0ZgFt 8eX6RJCnyLGBVgENtm89ko8mspdgYiAy88xzSpcu+iY6/C0eFFIKhQj4/K3malqHqMQ8 QxyV27OXZfCCuFm7sN4v108KC82TfuBOaIIAJgkbDLy2FsjoYIVKstsqgyUazfbYeAuk nl/itOcNdoQb3p2y2BSZgCn1A0RPydZP7cLubonDEeNIDJaW7REA2wL5RZ14YoJSm2Oa IpWg== X-Gm-Message-State: AOAM530zdP/410DHNNRYCLqHJ50ajaUFol6G0PVCrPpy/vGj7oiWjlQw iRpWADx3Cv5kQvMRUCP04ovreg== X-Google-Smtp-Source: ABdhPJyerxVrI5Q29+9f2FJy6PGgtGJNzvbGOEfw9WxIncxMV/L+KX65i3zEOZrwD0cL3u9DIN+fNw== X-Received: by 2002:a1c:4d09:0:b0:380:e340:bfba with SMTP id o9-20020a1c4d09000000b00380e340bfbamr888266wmh.80.1645531194962; Tue, 22 Feb 2022 03:59:54 -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 a18sm50014661wrg.13.2022.02.22.03.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:54 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 07/16] ASoC: codecs: wcd938x: fix kcontrol max values Date: Tue, 22 Feb 2022 11:59:24 +0000 Message-Id: <20220222115933.9114-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MAX. set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as max field is integer type. Without this patch amixer for these controls will show -1 as max value to userspace. Fixes: bcee7ed09b8e ("ASoC: codecs: wcd938x: add Multi Button Headset Control support") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd938x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index deecc83eb592..782877db8c3c 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3577,14 +3577,14 @@ static int wcd938x_hph_impedance_get(struct snd_kcontrol *kcontrol, } static const struct snd_kcontrol_new hph_type_detect_controls[] = { - SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPH Type", 0, 0, WCD_MBHC_HPH_STEREO, 0, wcd938x_get_hph_type, NULL), }; static const struct snd_kcontrol_new impedance_detect_controls[] = { - SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHL Impedance", 0, 0, INT_MAX, 0, wcd938x_hph_impedance_get, NULL), - SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHR Impedance", 0, 1, INT_MAX, 0, wcd938x_hph_impedance_get, NULL), }; From patchwork Tue Feb 22 11:59:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545071 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 4C380C433F5 for ; Tue, 22 Feb 2022 12:04:26 +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 7DCDA17AD; Tue, 22 Feb 2022 13:03:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7DCDA17AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531464; bh=OTqe7P6ZDt3BcL/rzHwWxH0caW7iOvtaHWapELEE1Oc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=J+dttthh48lDmlrWRK3AELVZSE4oAz/vjV2zQCIm/QwSnEgGG3JtZXy5aDcIullEd FidEjSRneNK3sEJdh3wTKaQDMlfCpWICRRLEhUFF9D36yytbh4w6ix1xX/eXNNFA0c W4neV9XB1hCnI9l5W2oFx+sylAC4+bl35KllYeP8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6378AF80549; Tue, 22 Feb 2022 13:00:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 21458F80529; Tue, 22 Feb 2022 13:00:09 +0100 (CET) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 40F02F8051C for ; Tue, 22 Feb 2022 12:59:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 40F02F8051C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ws7XkwwK" Received: by mail-wm1-x335.google.com with SMTP id n29-20020a05600c3b9d00b00380e379bae2so211766wms.3 for ; Tue, 22 Feb 2022 03:59:57 -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=9SOM2m1l2t9AVsCxObqTWKpNPnvoS4HHumlCtnLuW+M=; b=Ws7XkwwKIezWgelZILQpFNUflefi0UZ+gNdHXODwz5Wgz6M7G4Lkz03OEg8ypHxZSh F1dAdWeyAZAq/ggyhtolZpE13XXYYVaZHSHu1k2Lnk4ASX7aXK8xXL0mj6yGKxZeqbLi I+DNvCVWd2qRSyMKkFs1GpZyBSI6fAbUTHA6jzXS2lQHOEn/zrHOBiH+Bad2DUGbq26E 3CIXJU2YwhumujO1PvGEQFUqWQ3sfAwWig01vvqeznAA+YaHlz/Tzxjrsaz2iZVheRZ6 DSD2sDIWZpRw0TjFCniFsNcLLfp9VAUbEG37WPP3dlQykVOMA+1ZoESKqRirFR+Qxb0C oRXw== 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=9SOM2m1l2t9AVsCxObqTWKpNPnvoS4HHumlCtnLuW+M=; b=cH2suXlUDZSrOr9DHhYs3rn/RodPSw/C4Do50VB4AKbpxfEn00NQ9Y4YtDGucm2vVD 7jHvRP3w6kpLqVpjfWqrql6fX+0kAAq1rsN6t+6Gs09cyNwUp7ZoSbv1PaLiB8rFPujf 1bEf8zbLU08CWOsjHBLvvLBd5R9sWjZxYrmPE6XtvE4G+YLvEA4reX6EY/MhpX3bb95W qzKueMtFL7J7k9/oodv71Ufh4RYDzRsNsO/NdIeWdY13KfZkM31KY6p3QOUKF164QZie IfyxwlNWbBjdDUkOAS2VaGLp8Nk2HhYyY8hz8zr7DYhh3L5Q9UrWVanGO0lb7+Iju9kz OewA== X-Gm-Message-State: AOAM533yaCXx9VnDOvrS1cjcbq8AhrXXLvuqDtbSeiekcb4nr4/kND5g 40hb2yIrRzrMIcjyfRAxfvxI/A== X-Google-Smtp-Source: ABdhPJzqXjAvt+WjhqvdqALlx7KBzS2s2u+JGKdes+D0KUZHJe2rkc1SqLbt7miNgQbZuB+oG+Iv1Q== X-Received: by 2002:a7b:c159:0:b0:37c:c0d5:6534 with SMTP id z25-20020a7bc159000000b0037cc0d56534mr3022313wmi.182.1645531195942; Tue, 22 Feb 2022 03:59:55 -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 a18sm50014661wrg.13.2022.02.22.03.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:55 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 08/16] ASoC: codecs: wcd934x: fix kcontrol max values Date: Tue, 22 Feb 2022 11:59:25 +0000 Message-Id: <20220222115933.9114-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MAX. set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as max field is integer type. Without this patch amixer for these controls will show -1 as max value to userspace. Fixes: 9fb9b1690f0b ("ASoC: codecs: wcd934x: add mbhc support") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 6c468527fec6..f2674905a4a7 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3023,14 +3023,14 @@ static int wcd934x_hph_impedance_get(struct snd_kcontrol *kcontrol, return 0; } static const struct snd_kcontrol_new hph_type_detect_controls[] = { - SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPH Type", 0, 0, WCD_MBHC_HPH_STEREO, 0, wcd934x_get_hph_type, NULL), }; static const struct snd_kcontrol_new impedance_detect_controls[] = { - SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHL Impedance", 0, 0, INT_MAX, 0, wcd934x_hph_impedance_get, NULL), - SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHR Impedance", 0, 1, INT_MAX, 0, wcd934x_hph_impedance_get, NULL), }; From patchwork Tue Feb 22 11:59:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545283 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 D61C1C433FE for ; Tue, 22 Feb 2022 12:03:37 +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 2153217DA; Tue, 22 Feb 2022 13:02:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2153217DA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531416; bh=Tav74BvuRa2PbxXQjXYIr6aEZYGE/+bwylo90YsFX3M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=myHshLkz00u3UYKh8IAldq11eGGN//POK3T2CBKsAQCcS3nfzBkiWREkqh8zzWB6Y vgcErbLF8mNMQRO8FIcwPkLfBD+WtQZNfYrOOhyYpvwyqHtePmXqlHmxmpmTZ4Lehp xhmzzNyNjF9X/yUXf8PM0XpacAVZgoNeM9b3xNDo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6FE6DF80526; Tue, 22 Feb 2022 13:00:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9D082F80520; Tue, 22 Feb 2022 13:00:07 +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 A6BD9F80508 for ; Tue, 22 Feb 2022 12:59:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6BD9F80508 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OlsqQ+HY" Received: by mail-wm1-x332.google.com with SMTP id az13-20020a05600c600d00b003808a3380faso1625834wmb.1 for ; Tue, 22 Feb 2022 03:59:57 -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=TT58Pxq1258T4AxyuLdXgL1OIhP7Hr2onHMX8NaDui0=; b=OlsqQ+HYW21fdRD6Ie2kAF0sLLQXbbvVHzDRxuPbFBpppJeOcibTqM53uRG725SIm/ 5hZ/AGJpEmJP5N3am+fe7KIvlFwLrrn93UN6ZV3ky4sQrUoAs5TVKpAU2Q4F+cz8SQGX K+rfi/eblBV5qbMFbU07oElE7eOsTeU1tp/c6zSPfUQlgNqwOKlMS4iRRFl5cAIU1zyN CoftkLdoW0KnNngUjTdrxms5xLic4p6+Etf3nDx2U7ZAufFJf6o1G7O/HKH14OlwAIdL HxNtQvbXxGDxymxxMkGeYxlSLWZEiJ5+Y4A+VovzD/K2OmbM8zA4S1Zvalqg2czbNlVg nz2g== 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=TT58Pxq1258T4AxyuLdXgL1OIhP7Hr2onHMX8NaDui0=; b=gGGqvFAdG1T8C5rJ1LH032T13vjDtocitT3rxQWMPu0mN7PS0RmDcopzHlOeAkLuB8 kgvL1RFEylSh6Vggf7GbvMZfJxyoZYQ0ieFOQZTDNjnBvwBYUv9/INw4lRZzL5Pnk86l KbiCm1i2hZfdpNiYgkvdyXyMiPxqRFgWQLBKrOsYGVPiswLVWinmAyBjPWPam5ncBHrx 5mfUnYrrW/Prj7LFPbGZfsqfODyGkIf8klkkStetmY1p1UTcRkoQsQJLbNmTfOsg3Qei YY/Ar3dn4sImuFnRO7zunHOnyQxRzFwITftmUdkeWXmUZ42aVszX6f3qtBCESNiRCgaR 5IoA== X-Gm-Message-State: AOAM5322JnlcW2CPDtN3Tr+kunmU8FBhG1jaCaK26hUX/KFdPQ2rRl0q +yLtlUfrhHykguAXmXa6kFmZgw== X-Google-Smtp-Source: ABdhPJxBY/ikhqjz0AGd2wmSRhvxpIVt0C6nKXdpBIDhdfbRAM6xKSfI39VaB3VRbnro5u+Oi0EiQA== X-Received: by 2002:a1c:a915:0:b0:380:e3de:b78f with SMTP id s21-20020a1ca915000000b00380e3deb78fmr321477wme.19.1645531196938; Tue, 22 Feb 2022 03:59:56 -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 a18sm50014661wrg.13.2022.02.22.03.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:56 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 09/16] ASoC: codecs: wcd934x: fix return value of wcd934x_rx_hph_mode_put Date: Tue, 22 Feb 2022 11:59:26 +0000 Message-Id: <20220222115933.9114-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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_rx_hph_mode_put 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index f2674905a4a7..ab580f37cf00 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3314,7 +3314,7 @@ static int wcd934x_rx_hph_mode_put(struct snd_kcontrol *kc, } wcd->hph_mode = mode_val; - return 0; + return 1; } static int slim_rx_mux_get(struct snd_kcontrol *kc, From patchwork Tue Feb 22 11:59:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545072 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 CACC8C433F5 for ; Tue, 22 Feb 2022 12:03:53 +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 B46A517B5; Tue, 22 Feb 2022 13:03:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B46A517B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531431; bh=fETT2PX6LWrH6I39NlaWrqZkrrIzaqOETURVoO7FZvI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jZNILgNOg/nHSiGoctKZAueKuhskl/ZIzAs3d5VB7ZWtCNagvrbwu2DredQbDTnMW x2qfHGlcTAvc4AiGyspc4pMSB7R5RX1NcBIMoPRJ+8yqPIx0wFUsjUIH38bJC2eixY zL8LHSZsxltnogc8BXK3tN2HbF9rmGQMR5S/4IlI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F2B44F8053B; Tue, 22 Feb 2022 13:00:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43874F80527; Tue, 22 Feb 2022 13:00:09 +0100 (CET) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 A3902F8012C for ; Tue, 22 Feb 2022 12:59:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A3902F8012C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NFB3RliS" Received: by mail-wr1-x436.google.com with SMTP id p9so32695192wra.12 for ; Tue, 22 Feb 2022 03:59:59 -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=FmiJNex1ot8tDEQkrlMDikI8ft3IlZn2sN6gtT8TTKk=; b=NFB3RliSVCvIj1utGaE/jSklWt1AArhvVYfiMhiGpoNLoRv65H7F7COpmVqkX/CmKk D88sHc4WmVJ5AQlccvWS/rDejHhplBiTj6CYQVahEKJFZ3MUNg8ByGToogl9GHCbs7St qQtjocyj7dMI/0dXBEN3DFVvFWAtlu4XysqdruQ3xlv9dmlLXdKshOrhekswoHG2Lq4X jlHzhyBFFuFWkLpxDFIgkBC6VrhbQwOQoqvRdiIwShMkD8mCCOow/iMu9Q7dVitNSGoD UmL+1Q58u6wBi5owCaGJSHaGtvutHULTfMpGF+n6lE15gKDVSaRdzFf47XnKRzKDypjs NwBA== 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=FmiJNex1ot8tDEQkrlMDikI8ft3IlZn2sN6gtT8TTKk=; b=g7IvKkGQpwi0LlRFuY+euIxz4pcQdLWpnxAYaWm3v98Qp2D3QylIAMrUpff5AjVQsG HpL3uHDjmwZRvNUAssM9ge+kFvZPgISG7EJKG1LyhdE+Qd5hBPEMRssNx8iuxRpet9GT oAjqd2eNAGp6ZE6Ksmrk3UgGXltJWNyBaufDg0ycmo7g4x4Fz7W7Ey1hMoS33SgiL7ZY eOyuoTTPHZ0I2pbq/bemGCWyPDAnnRZUdoCRXCfB8KAFcwQ2t71iiKajdsTdQf7hC0dt 0CdJThF63c/91LGPozdPUyYVf6LAP0rWQVSYwi18ZD+ygvgwmepI4GIRc42JPcrFn2ks noeQ== X-Gm-Message-State: AOAM531XUzArYuOSUAEoibtljIIwu9NyU8RpvXBGKY4ZD55pbnVsCWgs uzSAj2m2GroIjqyDCX9UEGNSFA== X-Google-Smtp-Source: ABdhPJz4PUmhR2AT0PBVCIOTknderZ9Je7FIrmTupP/bK0KhlsEDdjeHurgqYXa+WjyF7LnxbZiDaw== X-Received: by 2002:a05:6000:154c:b0:1ea:76b7:20c4 with SMTP id 12-20020a056000154c00b001ea76b720c4mr4529319wry.626.1645531197891; Tue, 22 Feb 2022 03:59:57 -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 a18sm50014661wrg.13.2022.02.22.03.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:57 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 10/16] ASoC: codecs: rx-macro: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:27 +0000 Message-Id: <20220222115933.9114-11-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_S8_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_S8_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: af3d54b99764 ("ASoC: codecs: lpass-rx-macro: add support for lpass rx macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index 058d8634ce40..d31d4d45ba01 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -2800,17 +2800,17 @@ static int rx_macro_iir_filter_info(struct snd_kcontrol *kcontrol, static const struct snd_kcontrol_new rx_macro_snd_controls[] = { SOC_SINGLE_S8_TLV("RX_RX0 Digital Volume", CDC_RX_RX0_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX_RX1 Digital Volume", CDC_RX_RX1_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX_RX2 Digital Volume", CDC_RX_RX2_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX_RX0 Mix Digital Volume", CDC_RX_RX0_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX_RX1 Mix Digital Volume", CDC_RX_RX1_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX_RX2 Mix Digital Volume", CDC_RX_RX2_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_EXT("RX_COMP1 Switch", SND_SOC_NOPM, RX_MACRO_COMP1, 1, 0, rx_macro_get_compander, rx_macro_set_compander), @@ -2834,28 +2834,28 @@ static const struct snd_kcontrol_new rx_macro_snd_controls[] = { rx_macro_aux_hpf_mode_put), SOC_SINGLE_S8_TLV("IIR0 INP0 Volume", - CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, -84, 40, + CDC_RX_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP1 Volume", - CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, -84, 40, + CDC_RX_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP2 Volume", - CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, -84, 40, + CDC_RX_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP3 Volume", - CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, -84, 40, + CDC_RX_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP0 Volume", - CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, -84, 40, + CDC_RX_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", - CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, -84, 40, + CDC_RX_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", - CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, -84, 40, + CDC_RX_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", - CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, -84, 40, + CDC_RX_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 0, 124, digital_gain), SOC_SINGLE("IIR1 Band1 Switch", CDC_RX_SIDETONE_IIR0_IIR_CTL, From patchwork Tue Feb 22 11:59:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545282 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 89226C433EF for ; Tue, 22 Feb 2022 12:04:10 +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 C172517F8; Tue, 22 Feb 2022 13:03:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C172517F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531448; bh=zMKThusJ1WpkgUD2eE8/khlaRFdMFPz5EOm4A71h4Xk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BQv5mYPBCVqmGLN9490PxLQ8Ly71c9PQLUlqzHwSbj1fceuMi6/mTSpNNyx3slWNa HYQsATNwm7GCILo4GURNd2ZLxI34HwQorhMDqrmwoO7C61yH1MB+jODJVeMyYuALQE yNJH8IVwQAdeI9snyAWyFc/o55GTON7FHHwk9VZA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ADF2FF8053D; Tue, 22 Feb 2022 13:00:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5A376F8051C; Tue, 22 Feb 2022 13:00:09 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 6B563F80517 for ; Tue, 22 Feb 2022 12:59:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6B563F80517 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RPo2H0r3" Received: by mail-wr1-x42a.google.com with SMTP id d3so17079191wrf.1 for ; Tue, 22 Feb 2022 03:59:59 -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=PovLFlAjWbVecaLj2Jyj4ZWgXRh7VtxF4soiFyKrJgg=; b=RPo2H0r344YT+gcGkz/K6ZQ4DgEydlk2KAkMh1T6kF+gXl17FFLgt4QiphRmGmCOwf tDv69AMM0cOWCQa55Kx4ax2/HI56fhYMoZrGMY1mxbWLG5d8DKRIeRO94RGN/cIEN81U 7RTJcwumUoW3P6Rp2knoV76ajl/ent7tOHK5zuYamkLnwipiWtmkKOE3SSC3wQHkH5GF kRDbRGyqkiL1F6+FFLNLde/c7lne+amzDqyhxrCi8gAxrtFykuRXoukliI3ptsqWw23G 0+z2Z3hl0g2CCT4TVBAbuDZ2CQcJdTayk4DM6PDoK8D/hx9xoBch1YiJa5Qk8fPIVrRf srpA== 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=PovLFlAjWbVecaLj2Jyj4ZWgXRh7VtxF4soiFyKrJgg=; b=dtVsAegjMxBHrtXq6Q4O6gDdNGXjbYkWXp+FYf3h4X6HnpKqVkoQt/nZldZC1psEkl NNwXZiZCGn5Op1BWY+tcTTccUkW6RUFYAllWGKfwlrdv4bDJCnCA4vnUNGQ3qGMbQWyM 78JBrDr0e8rW4pRMmMQE14pAMqA9ZOIedr2DkkkoPpmuaYCPJQ4UKATVoWF5JDN5SaJG mCpvhq18xpAeyF8lDo8kA9aTuBKl3KPRgt5V/2Pk/Go3grz5xZdEa44BHMOkc1fnVjgx ZOhLPaY638dplgLv5bUhMwIPLIsH0SEkC9ooGDDb8D4SS0GAe3/tEfw4C+fr1b5OtFOs Rp6g== X-Gm-Message-State: AOAM533zmaBinwkiCm7ktKsorvnZZ2CdkjOtYvnTJqwqgu5spymnwHkj 9SkONbmVzi5tomzn8mpCF0frcg== X-Google-Smtp-Source: ABdhPJxoRUq2WzjRe6cKbSthqOXk77aleSu329nCmKU4CL67S3d0nugmziFoGclsdJjqwrFWUzbMxA== X-Received: by 2002:a5d:5986:0:b0:1ea:75c6:3d0a with SMTP id n6-20020a5d5986000000b001ea75c63d0amr4634125wri.166.1645531199050; Tue, 22 Feb 2022 03:59:59 -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 a18sm50014661wrg.13.2022.02.22.03.59.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:58 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 11/16] ASoC: codecs: tx-macro: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:28 +0000 Message-Id: <20220222115933.9114-12-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_S8_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_S8_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: c39667ddcfc5 ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-tx-macro.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index f90786100d1a..56c1f3cf73f8 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -1600,28 +1600,28 @@ static const struct snd_soc_dapm_route tx_audio_map[] = { static const struct snd_kcontrol_new tx_macro_snd_controls[] = { SOC_SINGLE_S8_TLV("TX_DEC0 Volume", CDC_TX0_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC1 Volume", CDC_TX1_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC2 Volume", CDC_TX2_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC3 Volume", CDC_TX3_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC4 Volume", CDC_TX4_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC5 Volume", CDC_TX5_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC6 Volume", CDC_TX6_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("TX_DEC7 Volume", CDC_TX7_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_ENUM_EXT("DEC0 MODE", dec_mode_mux_enum[0], tx_macro_dec_mode_get, tx_macro_dec_mode_put), From patchwork Tue Feb 22 11:59:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545073 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 66067C433F5 for ; Tue, 22 Feb 2022 12:03:21 +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 A27CA17BC; Tue, 22 Feb 2022 13:02:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A27CA17BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531399; bh=Smc0hHMkWk2MfbJj2r2nDBrTAfS0RY2loBuD8DlZ844=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=aM4ptr+4Wq/EbeWsZLVTOLep1WruBCjL1zgz5jWw76pJ/HI/UXqv8uu+z5T0HfFls YB/k1s/LcZ6b0hUqurbl/VkRIBBzXnEXGOW9ulaKnTNggy9pn56RV1bxa8e3fFN3l+ ePxoG433g0qQunI2yTKRD2ks3WvhIBZ4CI5RKliM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AD593F80534; Tue, 22 Feb 2022 13:00:14 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7C3C0F8051B; Tue, 22 Feb 2022 13:00:06 +0100 (CET) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 1675AF8051A for ; Tue, 22 Feb 2022 13:00:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1675AF8051A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MNCET+Ql" Received: by mail-wm1-x32c.google.com with SMTP id j9-20020a05600c190900b0037bff8a24ebso1613323wmq.4 for ; Tue, 22 Feb 2022 04:00:00 -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=/v7fSBOaCbI8QU+K0IcaQnfo96v3GrLJ30LztRsyJ5g=; b=MNCET+QlGmQPanpZT4PW8Xckp97SRYGXNmqWF8PHeTF+q/fMJ3EjRHoltz4BANS63a 36raoLXF48uS0eRqLHydIP69Jeoa5vGquoluLa1pPQkVH8UY6SiqEj0/LbslxpX+quXv VCBj+sTZA67FDJB4xmxwNRb2RKexFd9R0R4sSK2j+3hcYa6fYB7CYb7wxIHQX6xHSYRc G6xj9c97QI6G0+ZFzjuQ4f6COeQTWLSsMRQ/wLryyDvZiTnoE6b089OWuadmMpY6v59O yYtu5KrrKShNzIjtz02d1CXu8XYmSIeAbv5MpcB+FEesO4T4/6kFgBNfDejyWTOMu56m ZjGQ== 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=/v7fSBOaCbI8QU+K0IcaQnfo96v3GrLJ30LztRsyJ5g=; b=2Q9hbWGaJ2tNLsTwLuAQyWtIm65+Q5KkAB1TfwxRhz4KI/Pmxhs1ttxFUuM8ez6+CB l2sQielYEfTiB69uRsE97EcJIK6cGz4+w5dcrEYD46allmuFIb8D10iQoqDCqzcPqXfo aqYQymWhDwYV6gOhmvAUA/O+7Xk9j+Y/rJF6CRMQIeERK/JJ0IUyDJNST+Gs2VLeJ7mL EiSzTGjqtE89hpej8iHzJkP5jN3wA4XFIY/xv7Zf7+wpecCnyNUxJU6bxzfn4rr6m6oL 4YnlGFi/eGta97CSei0CNBl7koIfRKVjfZvjFhd4yv830nGOafDVxGx+VUFje+Gf5/yA vV1A== X-Gm-Message-State: AOAM532RVFRLN4rZz3V3AScRWmpaAuD8K3Xs8URdpaIYszkGdsuA8bv4 LiZZ3q0zaxWT6XVMTf9LlQZHAt9vhHad9w== X-Google-Smtp-Source: ABdhPJxm5KxVyTSngzgUaBGqqhFnBKRzEk5moazJ/aSxsnm0IlLurKgepYu3YSWeNUtxyAZEFPtoMw== X-Received: by 2002:a1c:5451:0:b0:37c:71d:5c40 with SMTP id p17-20020a1c5451000000b0037c071d5c40mr3092013wmi.1.1645531199996; Tue, 22 Feb 2022 03:59:59 -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 a18sm50014661wrg.13.2022.02.22.03.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 03:59:59 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 12/16] ASoC: codecs: va-macro: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:29 +0000 Message-Id: <20220222115933.9114-13-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_S8_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_S8_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-va-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c index 0fd0139e8229..555675690166 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -1256,13 +1256,13 @@ static const struct soc_enum dec_mode_mux_enum[] = { static const struct snd_kcontrol_new va_macro_snd_controls[] = { SOC_SINGLE_S8_TLV("VA_DEC0 Volume", CDC_VA_TX0_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("VA_DEC1 Volume", CDC_VA_TX1_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("VA_DEC2 Volume", CDC_VA_TX2_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("VA_DEC3 Volume", CDC_VA_TX3_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_ENUM_EXT("VA_DEC0 MODE", dec_mode_mux_enum[0], va_macro_dec_mode_get, va_macro_dec_mode_put), From patchwork Tue Feb 22 11:59:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545280 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 2642BC433EF for ; Tue, 22 Feb 2022 12:05:21 +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 648B7181A; Tue, 22 Feb 2022 13:04:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 648B7181A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531519; bh=9Jz+PWFfDErr8IAAuUwJR/qOjE52QesXY5GP1dl54uI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CLsHlig6eqI4Sm4V/bCPuoUqXOYwBhdDIEHThMvZmPdSr+japylcZhEKvMHDpTVrq xiSjY9lLEa7Y0SNs3wFiUJkMB3M4woCLHTY3wnYq0ubd+hcUSiCdLoYZla3zpDxBgV qozqNA+Of9lQ/SEJVzwEc+lynK2tvnliyC6uEHZo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 16986F80578; Tue, 22 Feb 2022 13:00:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 784C9F8052F; Tue, 22 Feb 2022 13:00:12 +0100 (CET) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (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 25A9DF8051E for ; Tue, 22 Feb 2022 13:00:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 25A9DF8051E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NYMWNbip" Received: by mail-wm1-x32e.google.com with SMTP id i19so11368428wmq.5 for ; Tue, 22 Feb 2022 04:00:03 -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=aQBKVZb4u7024qTgLZ2s864oDNFbW3uHg+4te5BtCOE=; b=NYMWNbipBHYZahgQldqX2PZzyaPbcRUJoLxmAPDUeUPfy5PNMVxXp0eSsSO2WzlHjO Ebg5DrRYGU6SGuiK88+kTtiVolqzZbtTqH4KOxvVat6cVeLM0+zHnRCl+ED4GBpIFFaB ARwwm+kk4Pd0P6FNhJDthT4UoPdUlzia+rVbbp6w2r2U075/4k3SS2PL3OBujcXZ8Zc+ mwYp2McLJSiJCzEVuZxeg2/H5b3gnZ9E6kY4PXGZE6Sro8a68IHIFI40yvDVHPvqSkI6 udI0pHlccfsH5bIi3uNUcV8bhIQ+0shbrzMfGV84lMYiGAOoy5y/cNDoNdE4Z5Y2bwQ7 vzYw== 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=aQBKVZb4u7024qTgLZ2s864oDNFbW3uHg+4te5BtCOE=; b=pEQLaFDaa5w6hoN1EEajqLA5YE4V068Qgpq0I+T601LHrArNY1AoEM2cgJtxnCZkoH DoNevr525dqjfupVT371hMo2oDwhXAII9mE0z9UhspqrZiGpMOqJFmZMhFImheL/sfa8 05HAa/q4V3iHnIJCqus4OypDpt/hmFa27xgIGp9ZGjFk/SR39hxWBvFDzN8zlXnbixmY OkLCSUr8zlZ5Tap1jUJZ3gRwMxn7phm+iX7Y8v6EIVQBbS5SAP8HNV3F1zUFdeV83JE/ 3oNvWgNL3r4J8UP0ZL5PaLYz5Bz3+zSwky9uLgiUy/6FtkTqIB90avOtQqOI+t64N/or zi1Q== X-Gm-Message-State: AOAM530+CiRILvI7Q1Ij7HegoPtDp4euZlaaA+sob0kz3AP58SN2X0Q4 9BDx0jd+PCV7mvPfkPCZSSs5GgNq1WckVg== X-Google-Smtp-Source: ABdhPJz7QFBQZkBwyxemqJekiErYbd5W8OP3oWFf3xc+jJ27/6at0TozdCdAYIg/aUnO/t13yodIqA== X-Received: by 2002:a05:600c:4e12:b0:37b:ebf6:3d17 with SMTP id b18-20020a05600c4e1200b0037bebf63d17mr3061640wmq.44.1645531200990; Tue, 22 Feb 2022 04:00:00 -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 a18sm50014661wrg.13.2022.02.22.04.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 04:00:00 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 13/16] ASoC: codecs: wsa-macro: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:30 +0000 Message-Id: <20220222115933.9114-14-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_S8_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_S8_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-wsa-macro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index 7de09c46264b..b769fb2ef2f6 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1929,9 +1929,9 @@ static const struct snd_kcontrol_new wsa_macro_snd_controls[] = { wsa_macro_soft_clip_enable_put), SOC_SINGLE_S8_TLV("WSA_RX0 Digital Volume", CDC_WSA_RX0_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("WSA_RX1 Digital Volume", CDC_WSA_RX1_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE("WSA_RX0 Digital Mute", CDC_WSA_RX0_RX_PATH_CTL, 4, 1, 0), SOC_SINGLE("WSA_RX1 Digital Mute", CDC_WSA_RX1_RX_PATH_CTL, 4, 1, 0), From patchwork Tue Feb 22 11:59:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545070 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 B2D1BC433F5 for ; Tue, 22 Feb 2022 12:05:03 +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 F0D241832; Tue, 22 Feb 2022 13:04:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F0D241832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531502; bh=X6//3mNKQ+iPoi8MRwWr//2U6e39CPxb8YCLNP1SE1s=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JblYCXPJDf0JzJZFhgBxkeRBPpW39Wrlcr6Rgaj2seu1cQetIBdGC2/wq3Tl/x4tx PXD3pKAAspGiPBULaRlEHBTyrO53AKRh8vPFOOmnBZuT2XUsxExRnoMlMQB6mEC+W7 s0kAMQCfULET/mLprYdB+GCNd92A0/8wyksicPCo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8EB16F80571; Tue, 22 Feb 2022 13:00:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D48F7F80520; Tue, 22 Feb 2022 13:00:12 +0100 (CET) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 B98E0F80520 for ; Tue, 22 Feb 2022 13:00:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B98E0F80520 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="x1SxOjEV" Received: by mail-wr1-x42c.google.com with SMTP id s1so6314091wrg.10 for ; Tue, 22 Feb 2022 04:00:03 -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=KcD87WuVqOE7wlGnuGasxFMiIGXUTo8Tdbjfbz+gy5A=; b=x1SxOjEVDF/UusL/0LmmHYeP0Ofgtl2s6OI52+vXm+z6+SMO49T6Id0LmiWeUHvsDH SpTiR+thuI4SqWpu2ywNUvbEfT1kEJJB8NtRY3bAZTJpg5aVcM4vc2G4SItQhBR5rr1b Xx00hhIXMj+QrW19dcIzCIXRL5hDOSDKGIkSFrjH9hqd3LCeWKhyWXoK1qQTJCc77P9D lr6ShwJhp2T/tmanl6XbQEDs/o1U5rbhgpT6m430LS2DnjIr8IBAbJLuNWbloc8wMBGc UwdTqrsM/NkXi4PZRZXO46e9uUiarx856HcPfqfr2VHsrlhhFShpwOPEzcFQobtvEx5P eWGg== 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=KcD87WuVqOE7wlGnuGasxFMiIGXUTo8Tdbjfbz+gy5A=; b=oOWwITGrckPwZQ5vity31Icr6/h3yaCOdyADAWX1RSe3cBJWDsJPNnd5SS+ned76TV zd485J66Evg6kZCUBiMyo4uYxgE5DHR6yIiRPKzdyLvoLBcL3NsljFll89zQR4gqxr5q Y8KDtwL3lwb6zUjoVV8eqEz/XDaNtDvPoahMK+IeCmDfytsYPiAHBhhtGj05ntuXLeQQ 2HlgEdsJmsyXBzniWKHsZXpYcyBpVPKi6KKrYQlKBPLRV7Afub8ZoF3mksaQKRVuzgDc U6wNjEF6Km9MQlCdiVKmMKmaVl8v/J4kc0pQeLtIHC3Ov+d4nrovRas1ZwS2h9atKW1c Jq9w== X-Gm-Message-State: AOAM533tWMqB3E+FNUOljEAoy48xfcMfnE6i2l2XGZTTCR6W05ztFYAD /YjmWuoISkUU2ZAXu4fe+PeWwQ== X-Google-Smtp-Source: ABdhPJxmeBWo72PiNWEHoBgszTA9DNaXGtpZ+YmdIUWLfk09iBTb+c6uKkES/taiEMzmaAR2NhJlpA== X-Received: by 2002:a05:6000:2ae:b0:1ea:78a3:fe7e with SMTP id l14-20020a05600002ae00b001ea78a3fe7emr4284839wry.682.1645531201945; Tue, 22 Feb 2022 04:00:01 -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 a18sm50014661wrg.13.2022.02.22.04.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 04:00:01 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 14/16] ASoC: codecs: wcd938x: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:31 +0000 Message-Id: <20220222115933.9114-15-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_S8_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_S8_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: 1cde8b822332 ("ASoC: wcd934x: add basic controls") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 62 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index ab580f37cf00..5e45d5eec7c2 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3996,83 +3996,83 @@ static const struct snd_kcontrol_new wcd934x_snd_controls[] = { SOC_SINGLE_TLV("ADC4 Volume", WCD934X_ANA_AMIC4, 0, 20, 0, analog_gain), SOC_SINGLE_S8_TLV("RX0 Digital Volume", WCD934X_CDC_RX0_RX_VOL_CTL, - -84, 40, digital_gain), /* -84dB min - 40dB max */ + 0, 124, digital_gain), /* -84dB min - 40dB max */ SOC_SINGLE_S8_TLV("RX1 Digital Volume", WCD934X_CDC_RX1_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX2 Digital Volume", WCD934X_CDC_RX2_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX3 Digital Volume", WCD934X_CDC_RX3_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX4 Digital Volume", WCD934X_CDC_RX4_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX7 Digital Volume", WCD934X_CDC_RX7_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX8 Digital Volume", WCD934X_CDC_RX8_RX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX0 Mix Digital Volume", WCD934X_CDC_RX0_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX1 Mix Digital Volume", WCD934X_CDC_RX1_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX2 Mix Digital Volume", WCD934X_CDC_RX2_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX3 Mix Digital Volume", WCD934X_CDC_RX3_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX4 Mix Digital Volume", WCD934X_CDC_RX4_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX7 Mix Digital Volume", WCD934X_CDC_RX7_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("RX8 Mix Digital Volume", WCD934X_CDC_RX8_RX_VOL_MIX_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC0 Volume", WCD934X_CDC_TX0_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC1 Volume", WCD934X_CDC_TX1_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC2 Volume", WCD934X_CDC_TX2_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC3 Volume", WCD934X_CDC_TX3_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC4 Volume", WCD934X_CDC_TX4_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC5 Volume", WCD934X_CDC_TX5_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC6 Volume", WCD934X_CDC_TX6_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC7 Volume", WCD934X_CDC_TX7_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("DEC8 Volume", WCD934X_CDC_TX8_TX_VOL_CTL, - -84, 40, digital_gain), + 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP0 Volume", - WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B1_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP1 Volume", - WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B2_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP2 Volume", - WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B3_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR0 INP3 Volume", - WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR0_IIR_GAIN_B4_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP0 Volume", - WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B1_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", - WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B2_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", - WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B3_CTL, 0, 124, digital_gain), SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", - WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B4_CTL, -84, 40, + WCD934X_CDC_SIDETONE_IIR1_IIR_GAIN_B4_CTL, 0, 124, digital_gain), SOC_ENUM("TX0 HPF cut off", cf_dec0_enum), From patchwork Tue Feb 22 11:59:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545069 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 A030FC433EF for ; Tue, 22 Feb 2022 12:05:38 +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 D79A01848; Tue, 22 Feb 2022 13:04:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D79A01848 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531536; bh=FCDj+ae/PfJ8FTz6bF1L9/2cypzyhRVDjH18xeur8U4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dQtClPHVnMhKcqAZ6Ad0W/Cz5qT+mOyK1MMB2rUMtvinvrL/IAx6U/FqNSf7RlJe6 gXuwgCElhg67zbkQ3pTIA9H+Vs6U37nmNo0KP7T3mXFUSayAXk1mJhTQU1gIF5X/1y noAU6ythNlVOJnIAqumPg1gkrqdtunEHxmoEaS8Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 87A91F80588; Tue, 22 Feb 2022 13:00:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83665F80537; Tue, 22 Feb 2022 13:00:15 +0100 (CET) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 9DFC9F80526 for ; Tue, 22 Feb 2022 13:00:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9DFC9F80526 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZcSttheq" Received: by mail-wr1-x42c.google.com with SMTP id j22so6642457wrb.13 for ; Tue, 22 Feb 2022 04:00:04 -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=YmZEQ3ujH3Pl/PlsauuKASqPX6aha5wSkDNcz+GXFIs=; b=ZcSttheqZnwkIgV2EU86exfYjrFWaOGCDWXrMLKQ8kORkWiA8gaQCjNZk7zEtxkvwc BUbtMrKB1nEAK2jmQZvuLZrb0cwYMA12eF0ueiMTMakoKY8aUpBBD+mqwOYNaATSENF4 sELx5pl6prlUVdzPKNa9yB3URLb2s4L6+tUIA4hUykhmidIrFyayNYhDiKQoDJuQ7LDr 4aFJWt5v3fzyzdm100KtKwhoI+b/WfL5k+8CG8WTEqgUyDszA1CXsHTM6FVPope/3pzB Aly6MBZtia7ImgFjOU6LvPtrLc/ilDX5UibKm0jCCuYRzmyOIzpD/Lheev+vSOl5kZb/ qQ3A== 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=YmZEQ3ujH3Pl/PlsauuKASqPX6aha5wSkDNcz+GXFIs=; b=PQIVLbfFcYvoVHL3Aij7jpxPpwBty64ovsRB9xQ+OuwVvugIOxSEycDQX+6FmEmNYv bLLD3V663Idilf/AGnZkTThjqoRQgVFPFi0RjS/PGEpBQ98Pta55Cb2dT+NPWPSGLXfu wrs8arNa/Ah5vO0/DTtrgMZucXxgWDzha5vyr3K6sjdp7pOct/OD0XAeC01N07WUUhh7 JbmqPuwkzIFjOWa7KHUZSGuXzshSH+fzR0ZP6tnwQOuaYJd0pXHotY1vISTmCAmHHypY PeQjvU+GJ4oWGfky5tOMgziMkBETFd8155xGxDfyIk2chOntsCTgcKZTo5dmrOx5wWxj dlgw== X-Gm-Message-State: AOAM53225HxtkATPdpq/73ktdMOzkfrvF5foOq4oiuT/OfcSXbQPcMlQ +PfYZES5cC1vFiBrjYS7FdN5mQ== X-Google-Smtp-Source: ABdhPJxndahYnuQraQMbxX+OKEAxy1ZcBC0/LyfDFYD/2+U7rFud58FwmA390FMxfotlbCmKLdl1vg== X-Received: by 2002:a5d:6546:0:b0:1e3:2236:e338 with SMTP id z6-20020a5d6546000000b001e32236e338mr18795796wrv.72.1645531203029; Tue, 22 Feb 2022 04:00:03 -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 a18sm50014661wrg.13.2022.02.22.04.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 04:00:02 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 15/16] ASoC: codecs: wcd9335: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:32 +0000 Message-Id: <20220222115933.9114-16-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_SX_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_SX_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: 8c4f021d806a ("ASoC: wcd9335: add basic controls") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd9335.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index 1e60db4056ad..cf7bdd309f70 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -2254,50 +2254,50 @@ static int wcd9335_rx_hph_mode_put(struct snd_kcontrol *kc, static const struct snd_kcontrol_new wcd9335_snd_controls[] = { /* -84dB min - 40dB max */ SOC_SINGLE_SX_TLV("RX0 Digital Volume", WCD9335_CDC_RX0_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX1 Digital Volume", WCD9335_CDC_RX1_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX2 Digital Volume", WCD9335_CDC_RX2_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX3 Digital Volume", WCD9335_CDC_RX3_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX4 Digital Volume", WCD9335_CDC_RX4_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX5 Digital Volume", WCD9335_CDC_RX5_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX6 Digital Volume", WCD9335_CDC_RX6_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX7 Digital Volume", WCD9335_CDC_RX7_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX8 Digital Volume", WCD9335_CDC_RX8_RX_VOL_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX0 Mix Digital Volume", WCD9335_CDC_RX0_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX1 Mix Digital Volume", WCD9335_CDC_RX1_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX2 Mix Digital Volume", WCD9335_CDC_RX2_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX3 Mix Digital Volume", WCD9335_CDC_RX3_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX4 Mix Digital Volume", WCD9335_CDC_RX4_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX5 Mix Digital Volume", WCD9335_CDC_RX5_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX6 Mix Digital Volume", WCD9335_CDC_RX6_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX7 Mix Digital Volume", WCD9335_CDC_RX7_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("RX8 Mix Digital Volume", WCD9335_CDC_RX8_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_ENUM("RX INT0_1 HPF cut off", cf_int0_1_enum), SOC_ENUM("RX INT0_2 HPF cut off", cf_int0_2_enum), SOC_ENUM("RX INT1_1 HPF cut off", cf_int1_1_enum), From patchwork Tue Feb 22 11:59:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 545281 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 C4CF4C433F5 for ; Tue, 22 Feb 2022 12:04:50 +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 0ADDF180D; Tue, 22 Feb 2022 13:03:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0ADDF180D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1645531489; bh=CiFVsUsoB1r1VbTvGd0g0XbirCUbZDzp7G/oBXX1TrM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EyY+FG1byl+gm5ONwave+1TnqQLsOtxIFmIBq7D5Liyck6P4KIl9TdLmOe2M/5Jkn RjkdKIVj6fKGp2R1QUcighyS4dVAW6rSriOmQuAbni4t8HBMyXo8Ok52z/KAYDCXCE 3jJ2svjWyemcS6Ve5Zr9waJfsv4hiLY6tRiNIuwU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F0C61F80567; Tue, 22 Feb 2022 13:00:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8680AF80533; Tue, 22 Feb 2022 13:00:12 +0100 (CET) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 9BCF9F8051F for ; Tue, 22 Feb 2022 13:00:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9BCF9F8051F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Rpb2UzY+" Received: by mail-wr1-x435.google.com with SMTP id s1so6314291wrg.10 for ; Tue, 22 Feb 2022 04:00:05 -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=pmndN/v1gfV2GMDQd7C0kB+ah/Uk4LJSxeSRIEDOEZE=; b=Rpb2UzY+Gi6K58Fex63hU24KXZBDztbcykj7Zq4FXVoEsMWWI4+I5fZMp1UeRoKQVz MuvlZJ1KqmhQU2HS2raT4pjapl7iq4W2yWte+IPxqy8sTvcX20BqHEO7xqvj79qJilnL nAUEJ5Uh8vFXtKSbnstYctwUSXeafnXBn5izOdGlATMHpQ4NYIYw9HK2xtnvAXMIGHrS H423otBZ7ZMfeqEX7eJ+uF+0BcNFQfO+MYceerE3Ov0rFdYaWKIEixon+efn11ncEhwO DlNHJy3rhGllfXwnys1ZGQj5B2mf2B71Sdc8RA1gRZdYCfY+BogP3X48NHTINHHpBPkJ xMvQ== 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=pmndN/v1gfV2GMDQd7C0kB+ah/Uk4LJSxeSRIEDOEZE=; b=1SiDfyJQ6lAlpds9UMqKTwV+R0jdcj9PZxSttXRlk+EGwoXu8reIzqixGTHhHdv7XJ jLWvVQhyTukY295tQwcTYb1jOOHY44wvVTPvcZVYqkcSnmenFcm2fEj58FlPvlOLHh+C JNCcPe0epm0QkvVX8UdY473R/JEZMsyZNAZNx4gyPKtxN3Rh6doCA1UIep6aFGpZb+3b hGkwRTyx1XoYSMrspR0vMOk20lSf/KOhFvSMPI9lX9URBLvI973y5CurHCWwpbxAHnXL NtAd3vjRl9KydiEUCNLjjhwmCnZ77SqqZYsBiByaUgfpBD08iWeTbNmEZpQ6McmwltSD wxHQ== X-Gm-Message-State: AOAM5313hqNcWa5Swcc85o6e2BKf3/TFUbG4L6CWniTJycavl1dPjH0e yFYAT3Av/ZkTgHo4jOysSWazbg== X-Google-Smtp-Source: ABdhPJztxT8/JwToFdxyy+VpFZDnnFcGv3rSeV10jPNkhYPb2XbdgZ4Ib8t1Dfd+5cG7E3O7BCeHjA== X-Received: by 2002:a5d:64af:0:b0:1df:3cb8:3f42 with SMTP id m15-20020a5d64af000000b001df3cb83f42mr18912558wrp.24.1645531204162; Tue, 22 Feb 2022 04:00:04 -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 a18sm50014661wrg.13.2022.02.22.04.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 04:00:03 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH 16/16] ASoC: codecs: msm8916-wcd-digital: fix tlv min max range Date: Tue, 22 Feb 2022 11:59:33 +0000 Message-Id: <20220222115933.9114-17-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222115933.9114-1-srinivas.kandagatla@linaro.org> References: <20220222115933.9114-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, Srinivas Kandagatla , quic_srivasam@quicinc.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" on Qualcomm codecs gain tlv control specifies min max range as both negative to positive numbers like SOC_SINGLE_SX_TLV("... Volume", .., -84, 40, gain) However with recent boundary checks added in commit 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_put_volsw()) setting a value above 40 gain will fail. So fix this min max range correctly to SOC_SINGLE_SX_TLV("... Volume", .., 0, 124, gain) so that users can now set gain correctly Fixes: ef8a4757a6db ("ASoC: msm8916-wcd-digital: Add sidetone support") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/msm8916-wcd-digital.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c index fcc10c8bc625..b32803bf6f63 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c @@ -554,21 +554,21 @@ static const struct snd_kcontrol_new msm8916_wcd_digital_snd_controls[] = { WCD_IIR_FILTER_CTL("IIR2 Band4", IIR2, BAND4), WCD_IIR_FILTER_CTL("IIR2 Band5", IIR2, BAND5), SOC_SINGLE_SX_TLV("IIR1 INP1 Volume", LPASS_CDC_IIR1_GAIN_B1_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP2 Volume", LPASS_CDC_IIR1_GAIN_B2_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP3 Volume", LPASS_CDC_IIR1_GAIN_B3_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("IIR1 INP4 Volume", LPASS_CDC_IIR1_GAIN_B4_CTL, 0, -84, 40, digital_gain), SOC_SINGLE_SX_TLV("IIR2 INP1 Volume", LPASS_CDC_IIR2_GAIN_B1_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("IIR2 INP2 Volume", LPASS_CDC_IIR2_GAIN_B2_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("IIR2 INP3 Volume", LPASS_CDC_IIR2_GAIN_B3_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), SOC_SINGLE_SX_TLV("IIR2 INP4 Volume", LPASS_CDC_IIR2_GAIN_B4_CTL, - 0, -84, 40, digital_gain), + 0, 0, 124, digital_gain), };