From patchwork Fri May 27 13:45:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 68752 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp98787qge; Fri, 27 May 2016 06:46:45 -0700 (PDT) X-Received: by 10.98.95.71 with SMTP id t68mr22452584pfb.158.1464356804990; Fri, 27 May 2016 06:46:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si28474978paz.202.2016.05.27.06.46.44; Fri, 27 May 2016 06:46:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754912AbcE0Nqm (ORCPT + 30 others); Fri, 27 May 2016 09:46:42 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35750 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752658AbcE0Np5 (ORCPT ); Fri, 27 May 2016 09:45:57 -0400 Received: by mail-wm0-f44.google.com with SMTP id a136so73754583wme.0 for ; Fri, 27 May 2016 06:45:56 -0700 (PDT) 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; bh=1fTzLWS7mtDh06cyO5fjOhZcJ4y1yxhcY9M9zd59dN4=; b=WpG3TJD6ADD5LAgNVXEBMjeadETEU/zwpnhV9dvYb0547pvq7SHjseRtWovXtq/6w2 7kSvyFjQHIZpsNPiqusYF2kPXmRdeimwM7nXekm9lEhLuRYQmtmtloZvEV+TEIZLys/e 9Uv7SjDRgxNxlwJpZFO/Fkx8DeFIuo9l4hrgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1fTzLWS7mtDh06cyO5fjOhZcJ4y1yxhcY9M9zd59dN4=; b=Z3cI6y8db0qb6rIeGIQXkp8ds/mmE5LaMw/3eI6ok2JK24+1P7V3QhZTc16mTQ3RhW 5m421b2p6Ufr30EUILbVr+xImTfeRa8IwZhn6UOodDxYbTOvjAwmBm68Qidq3ZnXPaYt QQFHqj6lF5SMbFKIQamXwdDj+sq9W2pIvuIkWkE2xVlhwaAmhsKWwyvNXarkrildP7vN BX76Ut+1c3VxKnyhLDFNc7qsWgkNaqq3yuWVUhCHD4sWfWPM4erZDKltn4zAK1UedJ02 KgQ3Lc9C1p/ujzOsxs8wqQcyyisftaTGtXeHGnv/QAfbD0N9a5bXyfBFjPDqGm4sPklX G+dA== X-Gm-Message-State: ALyK8tJzwdcmI0xmwUwwnL6IgJyvxQ7Pw+twtVVKz0lKlPh32nWda884hXO87xG674ZAeU9Q X-Received: by 10.194.51.8 with SMTP id g8mr14761182wjo.15.1464356755920; Fri, 27 May 2016 06:45:55 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id jq1sm19430323wjc.28.2016.05.27.06.45.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 May 2016 06:45:55 -0700 (PDT) From: Srinivas Kandagatla To: Mark Brown , alsa-devel@alsa-project.org Cc: Rob Herring , Mark Rutland , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kwestfie@codeaurora.org, plai@codeaurora.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [RFC v2 2/3] ASoC: Introduce SOC_SINGLE_S8_TLV() macro Date: Fri, 27 May 2016 14:45:45 +0100 Message-Id: <1464356746-29610-3-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464356746-29610-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1464356746-29610-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces SOC_SINGLE_S8_TLV() macro for volume control on chips which supports both negative and positive gains with sign bit on a 8 bit register, Gain ranges from -128 to +127 with a predefined step size. Currently we only have support to DOUBLE_S8_TLV() which does not fit for cases where we just have separate gain control register for each channel. One of the Qualcomm SOC msm8916 has such gain control register whose gain range is from -38.4dB to +38.4dB with step size of 0.3dB. Signed-off-by: Srinivas Kandagatla --- include/sound/soc.h | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.8.2 diff --git a/include/sound/soc.h b/include/sound/soc.h index 02b4a21..b23fc50 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -179,6 +179,17 @@ .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \ xmin, xmax, xsign_bit, xinvert) } +#define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, 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, \ + .min = xmin, .max = xmax, .platform_max = xmax, \ + .sign_bit = 7,} } #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \