From patchwork Wed Feb 21 10:22:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 13565391 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A3E88C48BC3 for ; Wed, 21 Feb 2024 10:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4xLWiXoOlmJ9iYj+MQwyB+q18injg9yxOhKacBGUiFM=; b=MuHiXQnnKBJaQ5 qtTxJsHcFRdXwWlvuQXxl5xk8utaEZy+SuUzCDdSXHBsENZDB349yEQqD+sJ5+jc5E7M4FhpVwekK S6eg11HSL95AAeJqD0xGlcFdYuyxgA2/r12EfAyZ7SBf53nHwN5goJBwtKOqz7X+RoOXa6GSoOqrB s9zTsaO9EgxWgyqFx0HhQ7MwseCCnIEOA8H2keuQ4PegHECCYpzHvt/5ZOf/e0AE5g5XCG5s8u7wX YoGnkASEan3xIeG9TtaHlIxwXYHV+4minjBfrHo9T0NwH8NVvSnw/dAmoxKX6dUJwj0YzlpUGqaES tnboE7Llr28RymYsV6eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcjlL-00000000TdS-15qv; Wed, 21 Feb 2024 10:23:39 +0000 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcjkv-00000000TLq-15eq; Wed, 21 Feb 2024 10:23:15 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 67DCF240003; Wed, 21 Feb 2024 10:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708510991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KUrik2L/XdfT2NBxFB5is5OzPEkx0nf8lGt/JdUz6EE=; b=T3fUK25OtBYlXiQ83D6l9qjN93jlVX6k3Kec8Ptp0EUERId6w8rla6gdrSKst+wK+d/olU Q90Lv7Of5QpOxyCm13N3TOSKhcCgemYWUIx/uYP9rFE/QzC9OgdLVJgWuIu1LWfUEzCxtI MxWSf6AJmLLGKmXMYNzTd9ZOwOhurcXnvMaUtSvLW7itf1dg86CA4BjplAZ5356+HTVSXL X9tbFw2uIU8upxI5cNYFgzweonS5yNewyzMMrIoZuAqW/CY/cAVQaPndAiq1vW8ziB5K66 yXbNeWU90Gtw1/WXGJ/xjCQix7HOuYHadzGKov1DxDdIevZs0bwMbDM/ixYCeA== From: Luca Ceresoli Date: Wed, 21 Feb 2024 11:22:47 +0100 Subject: [PATCH v3 3/7] ASoC: core: add SOC_DOUBLE_RANGE_TLV() helper macro MIME-Version: 1.0 Message-Id: <20240221-rk3308-audio-codec-v3-3-dfa34abfcef6@bootlin.com> References: <20240221-rk3308-audio-codec-v3-0-dfa34abfcef6@bootlin.com> In-Reply-To: <20240221-rk3308-audio-codec-v3-0-dfa34abfcef6@bootlin.com> To: Nicolas Frattaroli , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Heiko Stuebner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel Cc: Thomas Petazzoni , linux-rockchip@lists.infradead.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.12.4 X-GND-Sasl: luca.ceresoli@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_022313_525844_56E37268 X-CRM114-Status: GOOD ( 11.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org No macro currently allows handling a stereo control that has left and right in the same register and whose minimum register value is not zero. Add one that does that. Note that even though the snd_soc_*_volsw_range() look more appropriate given the _range suffix, they are not suitable because they don't honor the two shift values. The snd_soc_*_volsw() look more generic and are suitable for the task. Signed-off-by: Luca Ceresoli --- Changed in v3: nothing This patch is new in v2. --- include/sound/soc.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 6defc5547ff9..7492315ce0b8 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -149,6 +149,18 @@ {.reg = xreg, .rreg = xreg, \ .shift = shift_left, .rshift = shift_right, \ .max = xmax, .min = xmin} } +#define SOC_DOUBLE_RANGE_TLV(xname, xreg, xshift_left, xshift_right, xmin, xmax, \ + xinvert, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ + SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw, \ + .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ + .private_value = (unsigned long)&(struct soc_mixer_control) \ + {.reg = xreg, .rreg = xreg, \ + .shift = xshift_left, .rshift = xshift_right, \ + .min = xmin, .max = xmax, .invert = xinvert} } #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\