From patchwork Sun Jun 19 17:42:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 895032 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5JHjQfW031866 for ; Sun, 19 Jun 2011 17:45:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754450Ab1FSRn6 (ORCPT ); Sun, 19 Jun 2011 13:43:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754349Ab1FSRn5 (ORCPT ); Sun, 19 Jun 2011 13:43:57 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5JHhsFh021703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 19 Jun 2011 13:43:54 -0400 Received: from pedra (vpn-238-25.phx2.redhat.com [10.3.238.25]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5JHhWqB018286; Sun, 19 Jun 2011 13:43:53 -0400 Date: Sun, 19 Jun 2011 14:42:44 -0300 From: Mauro Carvalho Chehab Cc: Linux Media Mailing List , alsa-devel@alsa-project.org Subject: [PATCH 06/11] [media] em28xx-audio: volumes are inverted Message-ID: <20110619144244.36da0948@pedra> In-Reply-To: References: Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 19 Jun 2011 17:45:27 +0000 (UTC) While here, fix volume mask to 5 bits Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index c7b96b4..302553a 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -452,8 +452,8 @@ static int em28xx_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *value) { struct em28xx *dev = snd_kcontrol_chip(kcontrol); - u16 val = (value->value.integer.value[0] & 0x1f) | - (value->value.integer.value[1] & 0x1f) << 8; + u16 val = (0x1f - (value->value.integer.value[0] & 0x1f)) | + (0x1f - (value->value.integer.value[1] & 0x1f)) << 8; int rc; mutex_lock(&dev->lock); @@ -482,8 +482,8 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol, if (val < 0) return val; - value->value.integer.value[0] = val & 0x1f; - value->value.integer.value[1] = (val << 8) & 0x1f; + value->value.integer.value[0] = 0x1f - (val & 0x1f); + value->value.integer.value[1] = 0x1f - ((val << 8) & 0x1f); return 0; } @@ -501,9 +501,9 @@ static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol, goto err; if (val) + rc &= 0x1f1f; + else rc |= 0x8000; - else - rc &= 0x7f7f; rc = em28xx_write_ac97(dev, kcontrol->private_value, rc); @@ -525,9 +525,9 @@ static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol, return val; if (val & 0x8000) - value->value.integer.value[0] = 1; - else value->value.integer.value[0] = 0; + else + value->value.integer.value[0] = 1; return 0; }