From patchwork Sat Mar 14 02:31:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: klem.dev@gmail.com X-Patchwork-Id: 6010541 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31A0CBF90F for ; Sat, 14 Mar 2015 02:34:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5ADBC202DD for ; Sat, 14 Mar 2015 02:34:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 311BE201ED for ; Sat, 14 Mar 2015 02:34:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4373D260529; Sat, 14 Mar 2015 03:34:04 +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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 2442F26052B; Sat, 14 Mar 2015 03:32:41 +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 C45E9260569; Sat, 14 Mar 2015 03:32:39 +0100 (CET) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by alsa0.perex.cz (Postfix) with ESMTP id 9379E260529; Sat, 14 Mar 2015 03:32:04 +0100 (CET) Received: by webcq43 with SMTP id cq43so3714552web.2; Fri, 13 Mar 2015 19:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=ZAMemH1p6X7KjsulGcCsX+k7ekHoQgi3abR+rKhphhg=; b=oY/ewJmcq39qLX1eNui50CQ5HqxqcJBoVxQYUDh6TvkaRr95F4Ez+vB/9X2ak6CssI 80u6YzwO5S50s6zLU6AQQgMJ+NDEX3cn76BxcVv04GinAKlHYUgQYD+NZb8u8O9qYshq bgVVFKiTvxYS2+nuw3IfEi4i1yohCFEa1ZMskcUkpJ+FqusL/G4LtKpEoX+jtxZ1amDp s7bfSdIhmY7n2U8UGQp7dhkj7ffe7t1nsx4beyJfCDi+8HY9C2YrrqQ6Dq7AvzQuYj2Z Z6ZBHopX0h8QyM+4DpMOVTVE8EnpNE6TYhSRX0ols2ZjfVw1/qgkOZqWoMV0Cl5Swy8x j/Cw== X-Received: by 10.194.63.172 with SMTP id h12mr100517091wjs.48.1426300324352; Fri, 13 Mar 2015 19:32:04 -0700 (PDT) Received: from localhost.localdomain (vil78-2-88-166-91-58.fbx.proxad.net. [88.166.91.58]) by mx.google.com with ESMTPSA id i10sm5131247wja.40.2015.03.13.19.32.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Mar 2015 19:32:03 -0700 (PDT) Message-ID: <55039da3.6a07c20a.1b00.ffffa602@mx.google.com> X-Google-Original-Message-ID: <1426300302-20542-5-git-send-email-me> From: klem.dev@gmail.com X-Google-Original-From: me To: patch@alsa-project.org Date: Sat, 14 Mar 2015 03:31:41 +0100 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426300302-20542-1-git-send-email-me> References: <1426300302-20542-1-git-send-email-me> MIME-Version: 1.0 Cc: =?UTF-8?q?Cl=C3=A9ment=20Guedez?= , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 5/6] ESI W192M : Add text Line in/Mic for selecting input gain state 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Clément Guedez Add text Line in/Mic for selecting input gain state in mixer for ESI W192M. Signed-off-by: Clément Guedez diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c index 3af9daf..497ff1a 100644 --- a/sound/pci/ice1712/wtm.c +++ b/sound/pci/ice1712/wtm.c @@ -339,8 +339,23 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, /* * MIC / LINE switch fonction */ +static int stac9460_mic_sw_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + static char *texts[2] = { "Line In", "Mic" }; + + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; + uinfo->count = 1; + uinfo->value.enumerated.items = 2; + if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) + uinfo->value.enumerated.item = uinfo->value.enumerated.items + - 1; + strcpy(uinfo->value.enumerated.name, + texts[uinfo->value.enumerated.item]); + + return 0; +} -#define stac9460_mic_sw_info snd_ctl_boolean_mono_info static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -354,7 +369,7 @@ static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol, val = stac9460_get(ice, STAC946X_GENERAL_PURPOSE); else val = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE); - ucontrol->value.integer.value[0] = ~val>>7 & 0x1; + ucontrol->value.enumerated.item[0] = (val >> 7) & 0x1; return 0; } @@ -370,7 +385,7 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol, old = stac9460_get(ice, STAC946X_GENERAL_PURPOSE); else old = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE); - new = (~ucontrol->value.integer.value[0] << 7 & 0x80) | (old & ~0x80); + new = (ucontrol->value.enumerated.item[0] << 7 & 0x80) | (old & ~0x80); change = (new != old); if (change) { if (id == 0)