Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp440945lqs; Tue, 5 Mar 2024 06:37:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXegw3RhAX/WmlfCbRqiBc3gteM8CveLL0OBvDZLnUBLRSeBQjcjOV+2vM+pCtoCUnFb0Z1YeWL69tJiEIiprOIpa6mI1WtNLMQQny/WA== X-Google-Smtp-Source: AGHT+IFdW4j13B7EPX/fW4u6IAu7i5Us3dU3qxlyrY8rPcSbiDAR5X6J+Ee8RnluG/t1KA5jA9dF X-Received: by 2002:a17:906:d156:b0:a3f:2d9c:c66b with SMTP id br22-20020a170906d15600b00a3f2d9cc66bmr8950224ejb.22.1709649470672; Tue, 05 Mar 2024 06:37:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709649470; cv=pass; d=google.com; s=arc-20160816; b=iTbXvPhE+YBRqdr7/ylprsnYwOQwa+HBWG8BstokIG8oyTxjZ7vFBgXnksiBYmuaIG XPENsYRzAFAJSEPNG4vQnLlOSt/SSla2/VTGPrDYjs1SaAB5ZTmCPYFOaQ1uTzPrOgos AIhSBXjmGlwaqJX8gFxA3mrGeS7LkTKb2moT//4jsbd3LY31ObCfm+cQTmZBvxj1L83A Pw3TlD8KoWRfNaGANGsosZLsmAeeBcpsyB/seyK1jqMgADF3BwkRgnO6etiJ4VDqEEBg AefHdC3Ft2pWqIHVUrvKLkvZTAgNo67DO4jGK2KqEllWLMvtWaGLYHi15CvKYzqMzaJg AmKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=7nOGJSWM5DMTY+8OJI5pb0eawfVnNHkYI1yq5zzD180=; fh=2Nt6gk3gPvwOdwcJtrHNtNEL9XfCtvtFncBpJgtdmfg=; b=TixCYm2z+WVvlL8w2/bF91FGmYshLnIwV4RYMrrOazZDsoGfNFcGfeCaFknWbQsfrw vmpJYLlsYe9btx/bDCNRliwXe7px5Xf5UFqSmWCwQax3RVuzj6qrk8OpyAXOACGxdrzs 7CBik6Cs5+b/v2/X9829nuHu6c2qD27BxykH86UamBP/jBzLQn/AWIIt3GIHxp5crboz wq7TY7Tm3wpTQocHB1c48OIl5kqAoCh+hFkwyD5o6ndDSLRbjCp5n/003Y4YkprXExwH ko15zu+qnMX0H1gof9LtHHaUhMHeY36EONpeI/1ONIBZyhfpgjioSd8wEUKqXHV8pSRF SepQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JSYcxPM0; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-92523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id do17-20020a170906c11100b00a4580818913si1413490ejc.686.2024.03.05.06.37.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 06:37:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JSYcxPM0; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-92523-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92523-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D5E741F24CAF for ; Tue, 5 Mar 2024 14:37:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92F771272A4; Tue, 5 Mar 2024 14:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="JSYcxPM0" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 746FE86AD4; Tue, 5 Mar 2024 14:37:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709649423; cv=none; b=dPbxVHRhhmS12zp9sdr+fqkJ83yJAO2DawJikHgS9wbH1tk56qM1n1vHB4iSFX6zxsVthcWtHEFrYQKLPU0RDqpNbl1fC2VneQusOfDVYvPMfeVYVdLcmrajwkRwQvRqbtC865ApUcqzpWqjAQnNkMWyXjmDTPi4l4kFpF4WJd0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709649423; c=relaxed/simple; bh=VqibmGC3Jl/dxCE8AV7JqAdCOckz+GBMN1nkxkHyhc8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pUCL5E4n51am7VIfmKJXoBgY64YESN2M+dkMQO4nX5RpAOmS9df56mFbVSKQ94bAA1XZQM9LUBUrzFC6HjHn8gqySEl2VuU01Vh07Bcnr8gd6HWyWnOkNpc76kqjHjLcyyFAygBq3/dchQyD1nRxfHlQFyGJKxtpaptkXy0d78U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=JSYcxPM0; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 8196EC0007; Tue, 5 Mar 2024 14:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709649419; 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=7nOGJSWM5DMTY+8OJI5pb0eawfVnNHkYI1yq5zzD180=; b=JSYcxPM0+0rhLj26E5SZB3FUzzRurNnAaU1CH+3UgpdNQ6wPRIE4OKy7o/X9iaLQS3j6Ik tBAcgFXvpizqQJAg+YN4CVZIQOOqM5lCOe/HFuyRx/Zvy1YV5hzi8HtYccvvlfWeiLx+Iy IZZMkJfUurV8XVmYr+xZ/TujhXifNHOu9nfWPfUf7i/rIHGCbPAs8hhm+l6neQoES2mVT0 uO0myHxI/y0sLaBkTHNPD7OYbMPtpej+6lKHLfE9gDDt8ETFyZoy8mUyZtTFlcGaZRDv6Y Zi4XdHThllDRIJ+ZZTGQTmwTserdcjXUUGC6N0ImwtGSnHVMycw38I4HHFZkzw== From: Luca Ceresoli Date: Tue, 05 Mar 2024 15:36:30 +0100 Subject: [PATCH v4 3/7] ASoC: core: add SOC_DOUBLE_RANGE_TLV() helper macro Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240305-rk3308-audio-codec-v4-3-312acdbe628f@bootlin.com> References: <20240305-rk3308-audio-codec-v4-0-312acdbe628f@bootlin.com> In-Reply-To: <20240305-rk3308-audio-codec-v4-0-312acdbe628f@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, alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Luca Ceresoli X-Mailer: b4 0.13.0 X-GND-Sasl: luca.ceresoli@bootlin.com 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 v4: nothing 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 |\ -- 2.34.1