All of lore.kernel.org
 help / color / mirror / Atom feed
* HDA: Sound mutes when combination is below -48 dB
@ 2010-12-03 11:30 David Henningsson
  2010-12-03 11:58 ` Clemens Ladisch
  2010-12-03 11:59 ` Takashi Iwai
  0 siblings, 2 replies; 6+ messages in thread
From: David Henningsson @ 2010-12-03 11:30 UTC (permalink / raw)
  To: ALSA Development Mailing List

[-- Attachment #1: Type: text/plain, Size: 1826 bytes --]

I'm trying to nail down a strange behaviour. I have one "Master" and one 
"Speaker" (or "Headphone") volume control, each ranging from -48 dB to 0 
dB. Whenever the sum of "Master" and "Speaker" is below -48 dB, the 
output mutes. Codec is attached.

"Master" is a "Virtual master" control, and both "Master" and "Speaker" 
control amp-out on nid 0x13. Nid 0x13 does not have amp-out caps, but 
the AFG specifies a range of -96 dB to 0 dB in 0.75 dB steps.

There is some strange things here. First, in 
patch_sigmatel:create_controls_idx, there is this comment:

		/* if dB scale is over -64dB, and finer enough,
		 * let's reduce it to half
		 */
Hmm? Removing half of the volume slider?

Second, assuming we actually buy this decision, wouldn't it make sense 
for people to be able to combine Master and Speaker to get the full -96 
to 0 dB range? Instead, "Master" is just working over the range defined 
by "Speaker".

Third, there is an interesting condition in hda_codec.c:update_amp_value:

	if (val > 0)
		val += ofs;

Now this is in practice turning all volume controls which have ofs (e g 
those being "reduced to half") to a minimum-is-mute error: I can set the 
amp value to either 0 (-96 dB) or the 65 - 127 range (~ -48 dB - 0 dB). 
So it isn't really mute, it's -96 dB signal, but I can't hear that anyway.

So; I think I understand the problem, but I'm not sure of where I should 
try to patch it, to make the best solution.

Finally, is there right to exist for both "virtual masters" and the 
"PCM" softvol talked about a while ago? If I were to decide, I'd 
personally like them both removed (the additional complexity isn't 
motivated IMO), but wouldn't it at least make sense to name the virtual 
master "PCM", to avoid the PCM softvol?

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[-- Attachment #2: hp.txt --]
[-- Type: text/plain, Size: 8666 bytes --]

Codec: IDT 92HD81B1X5
Address: 0
Function Id: 0x1
Vendor Id: 0x111d7605
Subsystem Id: 0x103c1413
Revision Id: 0x100402
No Modem Function Group found
Default PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
Default Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
Default Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x02, mute=1
GPIO: io=3, o=0, i=0, unsolicited=1, wake=1
  IO[0]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0
  IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Power-Map: 0x00
Node 0x0a [Pin Complex] wcaps 0x400583: Stereo Amp-In
  Control: name="Mic Jack Mode", index=0, device=0
    ControlAmp: chs=0, dir=In, idx=0, ofs=0
  Control: name="Mic Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Pincap 0x0001173c: IN OUT HP EAPD Detect
    Vref caps: HIZ 50 GRD 80
  EAPD 0x2: EAPD
  Pin Default 0x03a19020: [Jack] Mic at Ext Left
    Conn = 1/8, Color = Pink
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=02, enabled=1
  Power: setting=D0, actual=D0
  Connection: 3
     0x13* 0x14 0x1c
Node 0x0b [Pin Complex] wcaps 0x400581: Stereo
  Pincap 0x0001001c: OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x0321401f: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Green
    DefAssociation = 0x1, Sequence = 0xf
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=01, enabled=1
  Power: setting=D0, actual=D0
  Connection: 3
     0x13 0x14* 0x1c
Node 0x0c [Pin Complex] wcaps 0x400583: Stereo Amp-In
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00011734: IN OUT EAPD Detect
    Vref caps: HIZ 50 GRD 80
  EAPD 0x2: EAPD
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00: VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 3
     0x13* 0x14 0x1c
Node 0x0d [Pin Complex] wcaps 0x400501: Stereo
  Pincap 0x00010050: OUT EAPD Balanced
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power: setting=D0, actual=D0
  Connection: 3
     0x13* 0x14 0x1c
Node 0x0e [Pin Complex] wcaps 0x400583: Stereo Amp-In
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00010034: IN OUT EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 3
     0x13 0x14* 0x1c
Node 0x0f [Pin Complex] wcaps 0x400583: Stereo Amp-In
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00010034: IN OUT EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 3
     0x13 0x14* 0x1c
Node 0x10 [Pin Complex] wcaps 0x400500: Mono
  Pincap 0x00000010: OUT
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Power: setting=D0, actual=D0
  Connection: 1
     0x1a
Node 0x11 [Pin Complex] wcaps 0x400483: Stereo Amp-In
  Control: name="Front Mic Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: N/A
  Amp-In vals:  [0x01 0x01]
  Pincap 0x00000024: IN Detect
  Pin Default 0x90a60130: [Fixed] Mic at Int N/A
    Conn = Digital, Color = Unknown
    DefAssociation = 0x3, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
Node 0x12 [Vendor Defined Widget] wcaps 0xf00503: Stereo Amp-In
  Amp-In caps: N/A
  Amp-In vals:  [0x00 0x00]
  Power: setting=D0, actual=D0
  Connection: 1
     0x20
Node 0x13 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L
  Control: name="Speaker Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=63
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="STAC92xx Analog", type="Audio", device=0
  Amp-Out caps: N/A
  Amp-Out vals:  [0x41 0x41]
  Converter: stream=5, channel=0
  Power: setting=D0, actual=D0
  Delay: 13 samples
Node 0x14 [Audio Output] wcaps 0xd0c05: Stereo Amp-Out R/L
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=63
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: N/A
  Amp-Out vals:  [0x40 0x40]
  Converter: stream=5, channel=0
  Power: setting=D0, actual=D0
  Delay: 13 samples
Node 0x15 [Audio Input] wcaps 0x1d0541: Stereo
  Device: name="STAC92xx Analog", type="Audio", device=0
  Converter: stream=0, channel=0
  SDI-Select: 0
  Power: setting=D0, actual=D0
  Delay: 13 samples
  Connection: 1
     0x17
  Processing caps: benign=0, ncoeff=0
Node 0x16 [Audio Input] wcaps 0x1d0541: Stereo
  Converter: stream=0, channel=0
  SDI-Select: 0
  Power: setting=D0, actual=D0
  Delay: 13 samples
  Connection: 1
     0x18
  Processing caps: benign=0, ncoeff=0
Node 0x17 [Audio Selector] wcaps 0x300d0d: Stereo Amp-Out R/L
  Control: name="Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x0f, stepsize=0x05, mute=1
  Amp-Out vals:  [0x00 0x00]
  Power: setting=D0, actual=D0
  Connection: 7
     0x0c 0x0e 0x0f 0x1b 0x11* 0x12 0x0a
Node 0x18 [Audio Selector] wcaps 0x300d0d: Stereo Amp-Out R/L
  Amp-Out caps: ofs=0x00, nsteps=0x0f, stepsize=0x05, mute=1
  Amp-Out vals:  [0x80 0x80]
  Power: setting=D0, actual=D0
  Connection: 7
     0x0c* 0x0e 0x0f 0x1b 0x11 0x12 0x0a
Node 0x19 [Audio Selector] wcaps 0x300501: Stereo
  Power: setting=D0, actual=D0
  Connection: 3
     0x13* 0x14 0x1c
Node 0x1a [Audio Mixer] wcaps 0x200500: Mono
  Power: setting=D0, actual=D0
  Connection: 1
     0x19
Node 0x1b [Audio Mixer] wcaps 0x20050b: Stereo Amp-In
  Amp-In caps: ofs=0x17, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-In vals:  [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97] [0x97 0x97]
  Power: setting=D0, actual=D0
  Connection: 6
     0x0c 0x0e 0x0f 0x13 0x14 0x0a
Node 0x1c [Audio Selector] wcaps 0x30050d: Stereo Amp-Out
  Amp-Out caps: ofs=0x1f, nsteps=0x1f, stepsize=0x05, mute=1
  Amp-Out vals:  [0x9f 0x9f]
  Power: setting=D0, actual=D0
  Connection: 1
     0x1b
Node 0x1d [Audio Output] wcaps 0x4061d: Stereo Digital Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Power: setting=D0, actual=D0
  Delay: 4 samples
Node 0x1e [Audio Output] wcaps 0x4061d: Stereo Digital Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Converter: stream=0, channel=0
  Digital:
  Digital category: 0x0
  PCM:
    rates [0x5e0]: 44100 48000 88200 96000 192000
    bits [0xe]: 16 20 24
    formats [0x5]: PCM AC3
  Power: setting=D0, actual=D0
  Delay: 4 samples
Node 0x1f [Pin Complex] wcaps 0x400781: Stereo Digital
  Pincap 0x00000014: OUT Detect
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 1
     0x1d
Node 0x20 [Pin Complex] wcaps 0x400781: Stereo Digital
  Pincap 0x00000034: IN OUT Detect
  Pin Default 0x40f000f0: [N/A] Other at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0xf, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power: setting=D0, actual=D0
  Connection: 1
     0x1e
Node 0x21 [Beep Generator Widget] wcaps 0x70000c: Mono Amp-Out
  Control: name="Beep Playback Switch", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Control: name="Beep Playback Volume", index=0, device=0
    ControlAmp: chs=1, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x03, nsteps=0x03, stepsize=0x17, mute=1
  Amp-Out vals:  [0x00]
Node 0x22 [Vendor Defined Widget] wcaps 0xf00000: Mono

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HDA: Sound mutes when combination is below -48 dB
  2010-12-03 11:30 HDA: Sound mutes when combination is below -48 dB David Henningsson
@ 2010-12-03 11:58 ` Clemens Ladisch
  2010-12-03 11:59 ` Takashi Iwai
  1 sibling, 0 replies; 6+ messages in thread
From: Clemens Ladisch @ 2010-12-03 11:58 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List

David Henningsson wrote:
> I'm trying to nail down a strange behaviour. I have one "Master" and one
> "Speaker" (or "Headphone") volume control, each ranging from -48 dB to 0
> dB. Whenever the sum of "Master" and "Speaker" is below -48 dB, the
> output mutes.

A known SigmaTel bug.  Does your kernel already have these patches?
http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=de8c85f7840e5e29629de95f5af24297fb325e0b
http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=a74ccea51d4314632a81d568d59bf885e5b09d93


Regards,
Clemens

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HDA: Sound mutes when combination is below -48 dB
  2010-12-03 11:30 HDA: Sound mutes when combination is below -48 dB David Henningsson
  2010-12-03 11:58 ` Clemens Ladisch
@ 2010-12-03 11:59 ` Takashi Iwai
  2010-12-03 15:34   ` David Henningsson
  1 sibling, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2010-12-03 11:59 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List

At Fri, 03 Dec 2010 12:30:02 +0100,
David Henningsson wrote:
> 
> I'm trying to nail down a strange behaviour. I have one "Master" and one 
> "Speaker" (or "Headphone") volume control, each ranging from -48 dB to 0 
> dB. Whenever the sum of "Master" and "Speaker" is below -48 dB, the 
> output mutes. Codec is attached.
> 
> "Master" is a "Virtual master" control, and both "Master" and "Speaker" 
> control amp-out on nid 0x13. Nid 0x13 does not have amp-out caps, but 
> the AFG specifies a range of -96 dB to 0 dB in 0.75 dB steps.
> 
> There is some strange things here. First, in 
> patch_sigmatel:create_controls_idx, there is this comment:
> 
> 		/* if dB scale is over -64dB, and finer enough,
> 		 * let's reduce it to half
> 		 */
> Hmm? Removing half of the volume slider?
> 
> Second, assuming we actually buy this decision, wouldn't it make sense 
> for people to be able to combine Master and Speaker to get the full -96 
> to 0 dB range? Instead, "Master" is just working over the range defined 
> by "Speaker".

Well, the problem was fairly old.  You must think of the world before
anything dB evaluation was introduced in the mixer apps.  They just
took a percentage value, so we got to cut it off to give some "usable"
interface for them.

The biggest problem right now is that you can't take it back so easily
"just for PA".  The PCM softvol is also the same.  There is no perfect
solution, and PA isn't by 100% people here.  However, we must not give
a regression in 100% manner.

OK, let's back to the bug point...

> Third, there is an interesting condition in hda_codec.c:update_amp_value:
> 
> 	if (val > 0)
> 		val += ofs;
> 
> Now this is in practice turning all volume controls which have ofs (e g 
> those being "reduced to half") to a minimum-is-mute error: I can set the 
> amp value to either 0 (-96 dB) or the 65 - 127 range (~ -48 dB - 0 dB). 
> So it isn't really mute, it's -96 dB signal, but I can't hear that anyway.

OK, this looks really like a bug that the driver gives min-mute flag.
The min-mute flag should be given only for the STAC codecs with lower
resolution, such as STAC9200.  It seems that STAC925x (and STAC9202)
are also in this category, while STAC9205 and other IDT codecs have
higher resolutions.

Since both STAC9200 and STAC925x have own Master definition, the
simplest solution is to remove TLV_DB_SCALE_MUTE for vmaster like
below...


thanks,

Takashi

---
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index efa4225..1780890 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1150,8 +1150,6 @@ static int stac92xx_build_controls(struct hda_codec *codec)
 					HDA_OUTPUT, vmaster_tlv);
 		/* correct volume offset */
 		vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset;
-		/* minimum value is actually mute */
-		vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
 		err = snd_hda_add_vmaster(codec, "Master Playback Volume",
 					  vmaster_tlv, slave_vols);
 		if (err < 0)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: HDA: Sound mutes when combination is below -48 dB
  2010-12-03 11:59 ` Takashi Iwai
@ 2010-12-03 15:34   ` David Henningsson
  2010-12-03 15:50     ` Takashi Iwai
  2010-12-27  5:56     ` Raymond Yau
  0 siblings, 2 replies; 6+ messages in thread
From: David Henningsson @ 2010-12-03 15:34 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ALSA Development Mailing List

On 2010-12-03 12:59, Takashi Iwai wrote:
> At Fri, 03 Dec 2010 12:30:02 +0100,
> David Henningsson wrote:
>>
>> I'm trying to nail down a strange behaviour. I have one "Master" and one
>> "Speaker" (or "Headphone") volume control, each ranging from -48 dB to 0
>> dB. Whenever the sum of "Master" and "Speaker" is below -48 dB, the
>> output mutes. Codec is attached.
>>
>> "Master" is a "Virtual master" control, and both "Master" and "Speaker"
>> control amp-out on nid 0x13. Nid 0x13 does not have amp-out caps, but
>> the AFG specifies a range of -96 dB to 0 dB in 0.75 dB steps.
>>
>> There is some strange things here. First, in
>> patch_sigmatel:create_controls_idx, there is this comment:
>>
>> 		/* if dB scale is over -64dB, and finer enough,
>> 		 * let's reduce it to half
>> 		 */
>> Hmm? Removing half of the volume slider?
>>
>> Second, assuming we actually buy this decision, wouldn't it make sense
>> for people to be able to combine Master and Speaker to get the full -96
>> to 0 dB range? Instead, "Master" is just working over the range defined
>> by "Speaker".
>
> Well, the problem was fairly old.  You must think of the world before
> anything dB evaluation was introduced in the mixer apps.  They just
> took a percentage value, so we got to cut it off to give some "usable"
> interface for them.
>
> The biggest problem right now is that you can't take it back so easily
> "just for PA".  The PCM softvol is also the same.  There is no perfect
> solution, and PA isn't by 100% people here.  However, we must not give
> a regression in 100% manner.

Ok. I'm not certain I agree, but I see your point.

>
> OK, let's back to the bug point...
>
>> Third, there is an interesting condition in hda_codec.c:update_amp_value:
>>
>> 	if (val>  0)
>> 		val += ofs;
>>
>> Now this is in practice turning all volume controls which have ofs (e g
>> those being "reduced to half") to a minimum-is-mute error: I can set the
>> amp value to either 0 (-96 dB) or the 65 - 127 range (~ -48 dB - 0 dB).
>> So it isn't really mute, it's -96 dB signal, but I can't hear that anyway.
>
> OK, this looks really like a bug that the driver gives min-mute flag.
> The min-mute flag should be given only for the STAC codecs with lower
> resolution, such as STAC9200.  It seems that STAC925x (and STAC9202)
> are also in this category, while STAC9205 and other IDT codecs have
> higher resolutions.
>
> Since both STAC9200 and STAC925x have own Master definition, the
> simplest solution is to remove TLV_DB_SCALE_MUTE for vmaster like
> below...

I've tried it, but it doesn't help. Test case is simple: run the codec 
attached to the previous mail in hda-emu [1]. Then turn "Master" down 
from 64 to 60, or anything that makes the combination of "Master" and 
"Speaker" less than -48 dB, and notice that the amp value sent to the 
codec is 0x0 (i e -96 dB).

[1] If I never thanked you for that program, I do so now, it is a really 
great tool!

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HDA: Sound mutes when combination is below -48 dB
  2010-12-03 15:34   ` David Henningsson
@ 2010-12-03 15:50     ` Takashi Iwai
  2010-12-27  5:56     ` Raymond Yau
  1 sibling, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2010-12-03 15:50 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List

At Fri, 03 Dec 2010 16:34:14 +0100,
David Henningsson wrote:
> 
> On 2010-12-03 12:59, Takashi Iwai wrote:
> > At Fri, 03 Dec 2010 12:30:02 +0100,
> > David Henningsson wrote:
> >>
> >> I'm trying to nail down a strange behaviour. I have one "Master" and one
> >> "Speaker" (or "Headphone") volume control, each ranging from -48 dB to 0
> >> dB. Whenever the sum of "Master" and "Speaker" is below -48 dB, the
> >> output mutes. Codec is attached.
> >>
> >> "Master" is a "Virtual master" control, and both "Master" and "Speaker"
> >> control amp-out on nid 0x13. Nid 0x13 does not have amp-out caps, but
> >> the AFG specifies a range of -96 dB to 0 dB in 0.75 dB steps.
> >>
> >> There is some strange things here. First, in
> >> patch_sigmatel:create_controls_idx, there is this comment:
> >>
> >> 		/* if dB scale is over -64dB, and finer enough,
> >> 		 * let's reduce it to half
> >> 		 */
> >> Hmm? Removing half of the volume slider?
> >>
> >> Second, assuming we actually buy this decision, wouldn't it make sense
> >> for people to be able to combine Master and Speaker to get the full -96
> >> to 0 dB range? Instead, "Master" is just working over the range defined
> >> by "Speaker".
> >
> > Well, the problem was fairly old.  You must think of the world before
> > anything dB evaluation was introduced in the mixer apps.  They just
> > took a percentage value, so we got to cut it off to give some "usable"
> > interface for them.
> >
> > The biggest problem right now is that you can't take it back so easily
> > "just for PA".  The PCM softvol is also the same.  There is no perfect
> > solution, and PA isn't by 100% people here.  However, we must not give
> > a regression in 100% manner.
> 
> Ok. I'm not certain I agree, but I see your point.
> 
> >
> > OK, let's back to the bug point...
> >
> >> Third, there is an interesting condition in hda_codec.c:update_amp_value:
> >>
> >> 	if (val>  0)
> >> 		val += ofs;
> >>
> >> Now this is in practice turning all volume controls which have ofs (e g
> >> those being "reduced to half") to a minimum-is-mute error: I can set the
> >> amp value to either 0 (-96 dB) or the 65 - 127 range (~ -48 dB - 0 dB).
> >> So it isn't really mute, it's -96 dB signal, but I can't hear that anyway.
> >
> > OK, this looks really like a bug that the driver gives min-mute flag.
> > The min-mute flag should be given only for the STAC codecs with lower
> > resolution, such as STAC9200.  It seems that STAC925x (and STAC9202)
> > are also in this category, while STAC9205 and other IDT codecs have
> > higher resolutions.
> >
> > Since both STAC9200 and STAC925x have own Master definition, the
> > simplest solution is to remove TLV_DB_SCALE_MUTE for vmaster like
> > below...
> 
> I've tried it, but it doesn't help. Test case is simple: run the codec 
> attached to the previous mail in hda-emu [1]. Then turn "Master" down 
> from 64 to 60, or anything that makes the combination of "Master" and 
> "Speaker" less than -48 dB, and notice that the amp value sent to the 
> codec is 0x0 (i e -96 dB).

Ah, it's vmaster that limits the min/max in the upper layer.
In the current code, 0 is always handled as 0 in update_amp_value(),
so this is the case.

Fixing it would be tricky.  The easiest way is to reduce this cut-off,
but then it will hit too many people.


> [1] If I never thanked you for that program, I do so now, it is a really 
> great tool!

Good to hear :)


thanks,

Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: HDA: Sound mutes when combination is below -48 dB
  2010-12-03 15:34   ` David Henningsson
  2010-12-03 15:50     ` Takashi Iwai
@ 2010-12-27  5:56     ` Raymond Yau
  1 sibling, 0 replies; 6+ messages in thread
From: Raymond Yau @ 2010-12-27  5:56 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/12/3 David Henningsson <david.henningsson@canonical.com>

> On 2010-12-03 12:59, Takashi Iwai wrote:
> > At Fri, 03 Dec 2010 12:30:02 +0100,
> > David Henningsson wrote:
> >>
> >> I'm trying to nail down a strange behaviour. I have one "Master" and one
> >> "Speaker" (or "Headphone") volume control, each ranging from -48 dB to 0
> >> dB. Whenever the sum of "Master" and "Speaker" is below -48 dB, the
> >> output mutes. Codec is attached.
> >>
> >> "Master" is a "Virtual master" control, and both "Master" and "Speaker"
> >> control amp-out on nid 0x13. Nid 0x13 does not have amp-out caps, but
> >> the AFG specifies a range of -96 dB to 0 dB in 0.75 dB steps.
> >>
> >> There is some strange things here. First, in
> >> patch_sigmatel:create_controls_idx, there is this comment:
> >>
> >>              /* if dB scale is over -64dB, and finer enough,
> >>               * let's reduce it to half
> >>               */
> >> Hmm? Removing half of the volume slider?
> >>
> >> Second, assuming we actually buy this decision, wouldn't it make sense
> >> for people to be able to combine Master and Speaker to get the full -96
> >> to 0 dB range? Instead, "Master" is just working over the range defined
> >> by "Speaker".
> >
> > Well, the problem was fairly old.  You must think of the world before
> > anything dB evaluation was introduced in the mixer apps.  They just
> > took a percentage value, so we got to cut it off to give some "usable"
> > interface for them.
> >
> > The biggest problem right now is that you can't take it back so easily
> > "just for PA".  The PCM softvol is also the same.  There is no perfect
> > solution, and PA isn't by 100% people here.  However, we must not give
> > a regression in 100% manner.
>
> Ok. I'm not certain I agree, but I see your point.
>

Seem that softvol plugin "PCM playback volume" really follow the OSS
emulation "PCM" volume which mute at 0% , so is this a bug which report
-51dB to the alsa application ?

Do softvol plugin need to use TLV_DB_SCALE_MUTE too ?


>
> >
> > OK, let's back to the bug point...
> >
> >> Third, there is an interesting condition in
> hda_codec.c:update_amp_value:
> >>
> >>      if (val>  0)
> >>              val += ofs;
> >>
> >> Now this is in practice turning all volume controls which have ofs (e g
> >> those being "reduced to half") to a minimum-is-mute error: I can set the
> >> amp value to either 0 (-96 dB) or the 65 - 127 range (~ -48 dB - 0 dB).
> >> So it isn't really mute, it's -96 dB signal, but I can't hear that
> anyway.
> >
> > OK, this looks really like a bug that the driver gives min-mute flag.
> > The min-mute flag should be given only for the STAC codecs with lower
> > resolution, such as STAC9200.  It seems that STAC925x (and STAC9202)
> > are also in this category, while STAC9205 and other IDT codecs have
> > higher resolutions.
> >
> > Since both STAC9200 and STAC925x have own Master definition, the
> > simplest solution is to remove TLV_DB_SCALE_MUTE for vmaster like
> > below...
>
> I've tried it, but it doesn't help. Test case is simple: run the codec
> attached to the previous mail in hda-emu [1]. Then turn "Master" down
> from 64 to 60, or anything that makes the combination of "Master" and
> "Speaker" less than -48 dB, and notice that the amp value sent to the
> codec is 0x0 (i e -96 dB).
>
> [1] If I never thanked you for that program, I do so now, it is a really
> great tool!
>
>
Just using your alsamixertest-48.11 to test hda sound card

When using -i plughw:1

INFO:root:Running test for mixer PCM, level -3.000000 dB
INFO:root:Running test for mixer PCM, level -6.000000 dB
INFO:root:Running test for mixer PCM, level -9.000000 dB
INFO:root:Running test for mixer PCM, level -12.000000 dB
INFO:root:Running test for mixer PCM, level -15.000000 dB
INFO:root:Running test for mixer PCM, level -18.000000 dB
INFO:root:Running test for mixer PCM, level -21.000000 dB
INFO:root:Running test for mixer PCM, level -24.000000 dB
INFO:root:Running test for mixer PCM, level -27.000000 dB
INFO:root:Running test for mixer PCM, level -30.000000 dB
INFO:root:Running test for mixer PCM, level -33.000000 dB
INFO:root:Running test for mixer PCM, level -36.000000 dB
INFO:root:Running test for mixer PCM, level -39.000000 dB
INFO:root:Running test for mixer PCM, level -42.000000 dB
INFO:root:Running test for mixer PCM, level -45.000000 dB
INFO:root:Running test for mixer PCM, level -48.000000 dB
ERROR:root:Error 5: Mixer PCM mutes the signal at -51.000000 dB.


using -i plug:front as the same way as  PA server

The dB value  measured by your program is double of the value and this
proves that the softvol control "PCM Playback Volume" has effect on both
playback stream and capture stream to get this kind of result

why PA server still use "front" device for capture when the most common
sound card have these problem ?

 ./alsamixertest.py -i plug:front:1 -o plug:front:1 -m hw:1  --step=3
set(['Front', 'Master Front', 'Master', 'Hardware Master', 'PCM'])
...
INFO:root:Running initial test signal.
INFO:root:Testing that Master actually mutes the signal
INFO:root:Testing that Front actually mutes the signal
INFO:root:Running test for mixer Master, level -3.000000 dB
INFO:root:Running test for mixer Master, level -6.000000 dB
INFO:root:Running test for mixer Master, level -9.000000 dB
INFO:root:Running test for mixer Master, level -12.000000 dB
INFO:root:Running test for mixer Master, level -15.000000 dB
INFO:root:Running test for mixer Master, level -18.000000 dB
INFO:root:Running test for mixer Master, level -21.000000 dB
INFO:root:Running test for mixer Master, level -24.000000 dB
INFO:root:Running test for mixer Master, level -27.000000 dB
INFO:root:Running test for mixer Master, level -30.000000 dB
INFO:root:Running test for mixer Master, level -33.000000 dB
INFO:root:Running test for mixer Master, level -36.000000 dB
INFO:root:Running test for mixer Master, level -39.000000 dB
INFO:root:Running test for mixer Master, level -42.000000 dB
INFO:root:Running test for mixer Master, level -45.000000 dB
INFO:root:Running test for mixer Master, level -48.000000 dB
INFO:root:Running test for mixer Master, level -51.000000 dB
INFO:root:Running test for mixer Master, level -54.000000 dB
INFO:root:Running test for mixer Master, level -57.000000 dB
INFO:root:Running test for mixer Master, level -58.500000 dB
ERROR:root:Error 5: Mixer Master mutes the signal at -60.000000 dB.
INFO:root:Running test for mixer PCM, level -3.000000 dB
WARNING:root:Mixer PCM is 2.991528 dB off at -3.000000 dB.
INFO:root:Running test for mixer PCM, level -6.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-6.000000, expected
-9.726178 dB but measured -15.716394 dB.
INFO:root:Running test for mixer PCM, level -9.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-9.000000, expected
-12.726178 dB but measured -21.838096 dB.
INFO:root:Running test for mixer PCM, level -12.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-12.000000,
expected -15.726178 dB but measured -27.715342 dB.
INFO:root:Running test for mixer PCM, level -15.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-15.000000,
expected -18.726178 dB but measured -33.712999 dB.
INFO:root:Running test for mixer PCM, level -18.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-18.000000,
expected -21.726178 dB but measured -39.919739 dB.
INFO:root:Running test for mixer PCM, level -21.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-21.000000,
expected -24.726178 dB but measured -45.718424 dB.
INFO:root:Running test for mixer PCM, level -24.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-24.000000,
expected -27.726178 dB but measured -51.824640 dB.
INFO:root:Running test for mixer PCM, level -27.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-27.000000,
expected -30.726178 dB but measured -57.709120 dB.
INFO:root:Running test for mixer PCM, level -30.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-30.000000,
expected -33.726178 dB but measured -63.726170 dB.
INFO:root:Running test for mixer PCM, level -33.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-33.000000,
expected -36.726178 dB but measured -69.971399 dB.
INFO:root:Running test for mixer PCM, level -36.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-36.000000,
expected -39.726178 dB but measured -75.738969 dB.
INFO:root:Running test for mixer PCM, level -39.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-39.000000,
expected -42.726178 dB but measured -81.733219 dB.
INFO:root:Running test for mixer PCM, level -42.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-42.000000,
expected -45.726178 dB but measured -87.774599 dB.
INFO:root:Running test for mixer PCM, level -45.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-45.000000,
expected -48.726178 dB but measured -93.806418 dB.
INFO:root:Running test for mixer PCM, level -48.000000 dB
ERROR:root:Error 6: Mixer PCM has invalid dB data for dB=-48.000000,
expected -51.726178 dB but measured -99.685773 dB.
INFO:root:Running test for mixer PCM, level -51.000000 dB

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-27  5:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03 11:30 HDA: Sound mutes when combination is below -48 dB David Henningsson
2010-12-03 11:58 ` Clemens Ladisch
2010-12-03 11:59 ` Takashi Iwai
2010-12-03 15:34   ` David Henningsson
2010-12-03 15:50     ` Takashi Iwai
2010-12-27  5:56     ` Raymond Yau

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.