From: Clemens Ladisch <clemens@ladisch.de>
To: Colin Guthrie <gmane@colin.guthr.ie>
Cc: alsa-devel@alsa-project.org
Subject: [PATCH 1/2] ALSA: HDA: Sigmatel: work around incorrect master muting
Date: Fri, 15 Oct 2010 10:32:50 +0200 [thread overview]
Message-ID: <4CB811B2.4050901@ladisch.de> (raw)
In-Reply-To: <4CB8119D.7090505@ladisch.de>
The HDA specification does not allow for a codec to mute itself just
because the volume is reduced, so _of course_ somebody had to go and do
it. This wouldn'\''t hurt too much when the volume is adjusted by hand,
but programs like PA that try to set the volume automatically could
inadvertently mute the output.
To work around this, change the TLV dB information for the Master volume
on all Sigmatel HDA codecs to indicate the the minimal volume setting
actually mutes.
Reported-by: Colin Guthrie <gmane@colin.guthr.ie>
Reported-by: "Alexander E. Patrakov" <patrakov@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
--- linux-2.6/sound/pci/hda/hda_local.h
+++ linux-2.6/sound/pci/hda/hda_local.h
@@ -38,10 +38,11 @@
*/
#define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \
((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23))
+#define HDA_AMP_VAL_MIN_MUTE (1<<29)
#define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \
HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0)
/* mono volume with index (index=0,1,...) (channel=1,2) */
-#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
+#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, dir, flags) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
.subdevice = HDA_SUBDEV_AMP_FLAG, \
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
@@ -51,16 +52,20 @@
.get = snd_hda_mixer_amp_volume_get, \
.put = snd_hda_mixer_amp_volume_put, \
.tlv = { .c = snd_hda_mixer_amp_tlv }, \
- .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
+ .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, dir) | flags }
/* stereo volume with index */
#define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \
- HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction)
+ HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction, 0)
/* mono volume */
#define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \
- HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction)
+ HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction, 0)
/* stereo volume */
#define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \
HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction)
+/* stereo volume with min=mute */
+#define HDA_CODEC_VOLUME_MIN_MUTE(xname, nid, xindex, direction) \
+ HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, 3, xindex, direction, \
+ HDA_AMP_VAL_MIN_MUTE)
/* mono mute switch with index (index=0,1,...) (channel=1,2) */
#define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
@@ -581,6 +586,7 @@ int snd_hda_check_amp_list_power(struct
#define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1)
#define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf)
#define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f)
+#define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1)
/*
* CEA Short Audio Descriptor data
--- linux-2.6/sound/pci/hda/hda_codec.c
+++ linux-2.6/sound/pci/hda/hda_codec.c
@@ -1831,6 +1831,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kco
hda_nid_t nid = get_amp_nid(kcontrol);
int dir = get_amp_direction(kcontrol);
unsigned int ofs = get_amp_offset(kcontrol);
+ bool min_mute = get_amp_min_mute(kcontrol);
u32 caps, val1, val2;
if (size < 4 * sizeof(unsigned int))
@@ -1841,6 +1842,8 @@ int snd_hda_mixer_amp_tlv(struct snd_kco
val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT);
val1 += ofs;
val1 = ((int)val1) * ((int)val2);
+ if (min_mute)
+ val2 |= 0x10000;
if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv))
return -EFAULT;
if (put_user(2 * sizeof(unsigned int), _tlv + 1))
--- linux-2.6/sound/pci/hda/patch_sigmatel.c
+++ linux-2.6/sound/pci/hda/patch_sigmatel.c
@@ -992,7 +992,7 @@ static struct hda_verb stac9205_core_ini
}
static struct snd_kcontrol_new stac9200_mixer[] = {
- HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
+ HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
@@ -1020,7 +1020,7 @@ static struct snd_kcontrol_new stac92hd7
};
static struct snd_kcontrol_new stac925x_mixer[] = {
- HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),
+ HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xe, 0, HDA_OUTPUT),
HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
{ } /* end */
};
@@ -1144,6 +1144,8 @@ static int stac92xx_build_controls(struc
HDA_OUTPUT, vmaster_tlv);
/* correct volume offset */
vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset;
+ /* minimum value is actually mute */
+ vmaster_tlv[3] |= 0x1000;
err = snd_hda_add_vmaster(codec, "Master Playback Volume",
vmaster_tlv, slave_vols);
if (err < 0)
next prev parent reply other threads:[~2010-10-15 8:31 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 14:39 alsactl adds volume controls? David Henningsson
2010-08-27 15:43 ` Clemens Ladisch
2010-08-27 18:36 ` David Henningsson
2010-08-27 22:58 ` Raymond Yau
2010-08-30 8:01 ` Takashi Iwai
2010-08-30 9:30 ` Raymond Yau
2010-08-30 11:09 ` Takashi Iwai
2010-08-30 13:01 ` David Henningsson
2010-08-30 13:08 ` Takashi Iwai
2010-09-01 13:26 ` David Henningsson
2010-09-01 14:06 ` Raymond Yau
2010-09-02 8:06 ` Takashi Iwai
2010-09-02 9:24 ` David Henningsson
2010-09-02 9:44 ` Takashi Iwai
2010-09-03 7:03 ` David Henningsson
2010-09-03 7:07 ` Jaroslav Kysela
2010-10-02 0:51 ` Raymond Yau
2010-09-03 7:23 ` Raymond Yau
2010-09-02 14:10 ` Jaroslav Kysela
2010-09-02 14:21 ` Clemens Ladisch
2010-09-02 15:24 ` Jaroslav Kysela
2010-09-02 15:52 ` Clemens Ladisch
2010-09-02 17:28 ` Jaroslav Kysela
2010-09-02 20:28 ` Sebastian H.
2010-09-29 14:26 ` Colin Guthrie
2010-09-29 18:09 ` Mark Brown
2010-09-30 9:17 ` Raymond Yau
2010-09-30 11:03 ` Clemens Ladisch
2010-09-30 15:09 ` Colin Guthrie
2010-09-30 15:56 ` Clemens Ladisch
2010-09-30 16:47 ` Mark Brown
2010-09-30 18:09 ` Takashi Iwai
2010-09-30 18:20 ` Colin Guthrie
2010-09-30 20:36 ` Mark Brown
2010-10-01 6:44 ` Clemens Ladisch
2010-10-01 8:19 ` Colin Guthrie
2010-10-01 9:02 ` Clemens Ladisch
2010-10-04 11:35 ` Colin Guthrie
2010-10-04 12:26 ` Clemens Ladisch
2010-10-04 14:01 ` Takashi Iwai
2010-10-07 8:05 ` Clemens Ladisch
2010-10-08 13:21 ` Colin Guthrie
2010-10-08 13:41 ` Clemens Ladisch
2010-10-08 14:05 ` Colin Guthrie
2010-10-08 14:16 ` Colin Guthrie
2010-10-08 14:42 ` Clemens Ladisch
2010-10-08 15:25 ` Colin Guthrie
2010-10-08 15:29 ` Colin Guthrie
2010-10-08 15:49 ` Colin Guthrie
2010-10-12 8:51 ` Colin Guthrie
2010-10-15 8:32 ` Clemens Ladisch
2010-10-15 8:32 ` Clemens Ladisch [this message]
2010-10-15 8:33 ` [PATCH 2/2] tlv: fix returned dB information for min-is-mute controls Clemens Ladisch
2010-10-15 8:39 ` alsactl adds volume controls? Colin Guthrie
2010-10-16 15:49 ` Colin Guthrie
2010-10-17 8:50 ` Takashi Iwai
2010-10-17 11:22 ` Colin Guthrie
2010-10-08 15:49 ` Clemens Ladisch
2010-10-11 1:34 ` Raymond Yau
2010-10-11 8:25 ` Colin Guthrie
2010-10-12 8:37 ` Raymond Yau
2010-10-17 3:39 ` Raymond Yau
2010-10-17 11:18 ` Colin Guthrie
2010-10-04 14:18 ` Alexander E. Patrakov
2010-10-04 11:09 ` Raymond Yau
2010-10-04 11:38 ` Colin Guthrie
2010-10-06 0:05 ` Raymond Yau
2010-10-06 23:29 ` Colin Guthrie
2010-10-01 5:38 ` Raymond Yau
2010-10-03 7:37 ` Raymond Yau
2010-10-23 11:51 ` Raymond Yau
2010-10-23 13:00 ` Colin Guthrie
2010-10-24 11:49 ` Raymond Yau
2010-08-29 1:35 ` Raymond Yau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CB811B2.4050901@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=gmane@colin.guthr.ie \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.