From patchwork Sun Feb 23 15:10:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 3704191 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DBFA39F35F for ; Sun, 23 Feb 2014 15:12:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E6B6201E4 for ; Sun, 23 Feb 2014 15:12:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E1BDF201BF for ; Sun, 23 Feb 2014 15:12:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1CC40265583; Sun, 23 Feb 2014 16:12:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id E8AD52651EB; Sun, 23 Feb 2014 16:10:19 +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 5D19F265144; Sun, 23 Feb 2014 16:10:15 +0100 (CET) Received: from smtp-out-167.synserver.de (smtp-out-249.synserver.de [212.40.185.249]) by alsa0.perex.cz (Postfix) with ESMTP id BC51E265164 for ; Sun, 23 Feb 2014 16:10:08 +0100 (CET) Received: (qmail 32581 invoked by uid 0); 23 Feb 2014 15:10:05 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 31924 Received: from ppp-46-244-149-120.dynamic.mnet-online.de (HELO lars-adi-laptop.fritz.box) [46.244.149.120] by 217.119.54.87 with SMTP; 23 Feb 2014 15:10:05 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Sun, 23 Feb 2014 16:10:14 +0100 Message-Id: <1393168221-23018-5-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1393168221-23018-1-git-send-email-lars@metafoo.de> References: <1393168221-23018-1-git-send-email-lars@metafoo.de> Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen , patches@opensource.wolfsonmicro.com, =?UTF-8?q?Philippe=20R=C3=A9tornaz?= , Charles Keepax , Steffen Trumtrar , Jerry Wong Subject: [alsa-devel] [PATCH 04/11] ASoC: Add macros for defining virtual enums 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 With the upcoming consolidation of normal MUXs and virtual MUXs we need to be able to distinguish between enums with and without a backing register at the enum level. Use the same approach as used for virtual mixer controls by setting the reg field of the enum to SND_SOC_NOPM for enums without a backing register. This patch adds a set of helper macros that can be used to define such enums. Signed-off-by: Lars-Peter Clausen --- include/sound/soc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index e005196..a25de13 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -189,6 +189,8 @@ .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \ SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues) +#define SOC_ENUM_SINGLE_VIRT(xmax, xtexts) \ + SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xmax, xtexts) #define SOC_ENUM(xname, xenum) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ .info = snd_soc_info_enum_double, \ @@ -293,6 +295,8 @@ ARRAY_SIZE(xtexts), xtexts, xvalues) #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) +#define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ + const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) /* * Component probe and remove ordering levels for components with runtime @@ -1090,7 +1094,7 @@ struct soc_mreg_control { /* enumerated kcontrol */ struct soc_enum { - unsigned short reg; + int reg; unsigned char shift_l; unsigned char shift_r; unsigned int items;