Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: hdaudio(4) & mixerctl(1) strangeness ...



On Mon, Apr 05, 2010 at 01:23:11AM +0200, Nicolas Joly wrote:
> 
> Hi,
> 
> While looking into sound support status for my Sony VAIO VGN-BZ12VN
> running -current, i noticed that mixerctl(1) report some strange
> 256 values for some outputs.master volume deltas.
> 
> njoly@nicodeme [~]> mixerctl -av
[...]
> outputs.master2=0,0 volume delta=256
> outputs.master2.mute=off  [ off on ]
[...]
> The mixerctl man page states that the volume values are restricted to
> the 0-255 range ... I fail to see what's a delta value of 256 will do
> here, but it seems to have an unexpected behaviour here :
> 
> njoly@nicodeme [~]> mixerctl -w outputs.master2++
> outputs.master2: 0,0 -> 128,128
> njoly@nicodeme [~]> mixerctl -w outputs.master2++
> outputs.master2: 128,128 -> 128,128
> 
> Any idea what's going on there ?

I finally got some time to look into this one and found that this is
the case when a widget has a ctl_step == 0. According to the HDA
specifications (7.3.4.10 - Amplifier Capabilities), this states that
the amplifier gain is fixed and may not be changed.

The attached patch, fix it for me, by making hdaudio_afg_set_port() a
no-op when ctl_step == 0.

njoly@nicodeme [~]> mixerctl -v outputs.master2
outputs.master2=0,0 volume delta=256
njoly@nicodeme [~]> mixerctl -vw outputs.master2++
outputs.master2: 0,0 -> 0,0
njoly@nicodeme [~]> mixerctl -vw outputs.master2+=10
outputs.master2: 0,0 -> 0,0

Comments ?

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
Index: sys/dev/pci/hdaudio/hdaudio_afg.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/hdaudio/hdaudio_afg.c,v
retrieving revision 1.20
diff -u -p -r1.20 hdaudio_afg.c
--- sys/dev/pci/hdaudio/hdaudio_afg.c   24 Feb 2010 22:38:08 -0000      1.20
+++ sys/dev/pci/hdaudio/hdaudio_afg.c   17 Apr 2010 21:27:41 -0000
@@ -3417,9 +3417,8 @@ hdaudio_afg_set_port(void *opaque, mixer
        switch (mx->mx_di.type) {
        case AUDIO_MIXER_VALUE:
                if (ctl->ctl_step == 0)
-                       divisor = 128; /* ??? - just avoid div by 0 */
-               else
-                       divisor = 255 / ctl->ctl_step;
+                       break;
+               divisor = 255 / ctl->ctl_step;
 
                hdaudio_afg_control_amp_set(ctl, HDAUDIO_AMP_MUTE_NONE,
                  mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] / divisor,
@@ -3478,7 +3477,7 @@ hdaudio_afg_get_port(void *opaque, mixer
        switch (mx->mx_di.type) {
        case AUDIO_MIXER_VALUE:
                if (ctl->ctl_step == 0)
-                       factor = 128; /* ??? - just avoid div by 0 */
+                       factor = 1;
                else
                        factor = 255 / ctl->ctl_step;
 


Home | Main Index | Thread Index | Old Index