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