From patchwork Sun Jun 19 17:42:38 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: 894992 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 p5JHjQfS031866 for ; Sun, 19 Jun 2011 17:45:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754326Ab1FSRnu (ORCPT ); Sun, 19 Jun 2011 13:43:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44020 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754296Ab1FSRnt (ORCPT ); Sun, 19 Jun 2011 13:43:49 -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 p5JHhljN023053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 19 Jun 2011 13:43:47 -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 p5JHhWq7018286; Sun, 19 Jun 2011 13:43:46 -0400 Date: Sun, 19 Jun 2011 14:42:38 -0300 From: Mauro Carvalho Chehab Cc: Linux Media Mailing List , alsa-devel@alsa-project.org Subject: [PATCH 07/11] [media] em28xx-audio: add debug info for the volume control Message-ID: <20110619144238.213f02d5@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) 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 302553a..56739a4 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -464,6 +464,13 @@ static int em28xx_vol_put(struct snd_kcontrol *kcontrol, val |= rc & 0x8000; /* Preserve the mute flag */ rc = em28xx_write_ac97(dev, kcontrol->private_value, val); + if (rc < 0) + goto err; + + dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); err: mutex_unlock(&dev->lock); @@ -482,6 +489,11 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol, if (val < 0) return val; + dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); + value->value.integer.value[0] = 0x1f - (val & 0x1f); value->value.integer.value[1] = 0x1f - ((val << 8) & 0x1f); @@ -506,6 +518,13 @@ static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol, rc |= 0x8000; rc = em28xx_write_ac97(dev, kcontrol->private_value, rc); + if (rc < 0) + goto err; + + dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); err: mutex_unlock(&dev->lock); @@ -529,6 +548,11 @@ static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol, else value->value.integer.value[0] = 1; + dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", + (val & 0x8000) ? "muted " : "", + 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), + val, (int)kcontrol->private_value); + return 0; } @@ -556,6 +580,8 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, err = snd_ctl_add(card, kctl); if (err < 0) return err; + dprintk("Added control %s for ac97 volume control 0x%04x\n", + ctl_name, id); memset (&tmp, 0, sizeof(tmp)); tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -572,6 +598,8 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, err = snd_ctl_add(card, kctl); if (err < 0) return err; + dprintk("Added control %s for ac97 volume control 0x%04x\n", + ctl_name, id); return 0; }