From patchwork Wed Nov 2 07:36:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 9408727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9BCF3601C2 for ; Wed, 2 Nov 2016 07:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C48F29E9A for ; Wed, 2 Nov 2016 07:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 800EF29EB5; Wed, 2 Nov 2016 07:56:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E30F29E9A for ; Wed, 2 Nov 2016 07:55:59 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8F61A266AA1; Wed, 2 Nov 2016 08:55:58 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3B780266A71; Wed, 2 Nov 2016 08:53:33 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B1A4B266965; Wed, 2 Nov 2016 08:36:12 +0100 (CET) Received: from wens.csie.org (mirror2.csie.ntu.edu.tw [140.112.30.76]) by alsa0.perex.cz (Postfix) with ESMTP id 97D67266671 for ; Wed, 2 Nov 2016 08:36:05 +0100 (CET) Received: by wens.csie.org (Postfix, from userid 1000) id ACC535FA07; Wed, 2 Nov 2016 15:36:02 +0800 (CST) From: Chen-Yu Tsai To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Date: Wed, 2 Nov 2016 15:36:00 +0800 Message-Id: <20161102073601.8659-4-wens@csie.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161102073601.8659-1-wens@csie.org> References: <20161102073601.8659-1-wens@csie.org> Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard , Mylene Josserand , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 3/4] ASoC: dapm: Introduce DAPM_DOUBLE dual channel control type X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP A DAPM_DOUBLE control type can be used for dual channel mixer input selectors / mute controls in one register, possibly toggling both channels together. The control is meant to be shared by 2 widgets, 1 for each channel, such that the mixer control exposed to userspace remains a combined stereo control. Signed-off-by: Chen-Yu Tsai --- include/sound/soc-dapm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index d5f4677776ce..f74ec19687f8 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -272,6 +272,11 @@ struct device; /* dapm kcontrol types */ +#define SOC_DAPM_DOUBLE(xname, reg, lshift, rshift, max, invert) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_soc_info_volsw, \ + .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ + .private_value = SOC_DOUBLE_VALUE(reg, lshift, rshift, max, invert, 0) } #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_volsw, \