[alsa-devel] HD-audio regression after commit 34588709af61be1550b4e2bcee5c85d0ac4f34d4

Manolo Díaz diaz.manolo at gmail.com
Fri Jan 18 17:48:23 CET 2013


El vie, 18 ene 2013 a las 16:30 horas
Takashi Iwai escribió:

>At Fri, 18 Jan 2013 22:49:37 +0800,
>Raymond Yau wrote:
>> 
>> > > It's already in the repository. Now none of the input sources work for
>> > > me: front-mic, rear-mic nor input line. Alsa-info output is attached.
>> > >
>> > > commit 77ecb70ef5b022a1ee80169583753d85d7a9c396
>> >
>> > Hmm, through a quick glance, all look OK.
>> >
>> 
>> It is strange that three input source are line but audio selector are not
>> the same
>> 
>> Simple mixer control 'Input Source',0
>>   Capabilities: cenum
>>   Items: 'Front Mic' 'Rear Mic' 'Line' 'CD'
>>   Item0: 'Line'
>> Simple mixer control 'Input Source',1
>>   Capabilities: cenum
>>   Items: 'Front Mic' 'Rear Mic' 'Line' 'CD'
>>   Item0: 'Line'
>> Simple mixer control 'Input Source',2
>>   Capabilities: cenum
>>   Items: 'Front Mic' 'Rear Mic' 'Line' 'CD'
>>   Item0: 'Line'
>> 
>> Node 0x0c [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
>>   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=0x27, nsteps=0x36, stepsize=0x05, mute=1
>>   Amp-Out vals:  [0x36 0x36]
>>   Connection: 11
>>      0x38 0x39 0x3a* 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20 0x1f
>> Node 0x0d [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
>>   Control: name="Capture Volume", index=1, device=0
>>     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>>   Control: name="Capture Switch", index=1, device=0
>>     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>>   Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1
>>   Amp-Out vals:  [0x36 0x36]
>>   Connection: 10
>>      0x38 0x39* 0x3a 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20
>> Node 0x0e [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
>>   Control: name="Capture Volume", index=2, device=0
>>     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>>   Control: name="Capture Switch", index=2, device=0
>>     ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>>   Amp-Out caps: ofs=0x27, nsteps=0x36, stepsize=0x05, mute=1
>>   Amp-Out vals:  [0x36 0x36]
>>   Connection: 10
>>      0x38 0x39* 0x3a 0x3b 0x3c 0x18 0x24 0x25 0x3d 0x20
>
>Good catch.  It's a recent regression.
>I fixed now with the patch below.
>
>test/hda-gen-parser and master branches are updated now with this and
>other fixes.
>
>
>thanks,
>
>Takashi
>
>---
>From: Takashi Iwai <tiwai at suse.de>
>Subject: [PATCH] ALSA: hda - Fix the wrong adc_idx for capture source
>
>The patch "ALSA: hda - fix wrong adc_idx in generic parser" fixed the
>adc_idx for the capture volume and capture switch controls.  But also
>modified the adc_idx retrieval for the capture source controls
>wrongly.  As multiple capture source controls are created in a single
>shot with counts > 1, the id.index doesn't contain the real value.
>The real index has to be taken via snd_ctl_get_ioffidx() as in the
>original code.
>
>This patch reverts the fixes partially to recover from the
>regression.
>
>Signed-off-by: Takashi Iwai <tiwai at suse.de>
>---
> sound/pci/hda/hda_generic.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
>index e4e71fa..29f37c9 100644
>--- a/sound/pci/hda/hda_generic.c
>+++ b/sound/pci/hda/hda_generic.c
>@@ -2675,7 +2675,8 @@ static int mux_enum_get(struct snd_kcontrol *kcontrol,
> {
> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
> 	struct hda_gen_spec *spec = codec->spec;
>-	unsigned int adc_idx = kcontrol->id.index;
>+	/* the ctls are created at once with multiple counts */
>+	unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
> 
> 	ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
> 	return 0;
>@@ -2685,7 +2686,7 @@ static int mux_enum_put(struct snd_kcontrol *kcontrol,
> 			    struct snd_ctl_elem_value *ucontrol)
> {
> 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
>-	unsigned int adc_idx = kcontrol->id.index;
>+	unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
> 	return mux_select(codec, adc_idx,
> 			  ucontrol->value.enumerated.item[0]);
> }

The problem persists after commit d821c1ef2c8ada02f1feada071a37ced69b300fe,
master branch

arecord -fdat -Dplughw:0 -vv foo.wav
Recording WAVE 'foo.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Hardware PCM card 0 'HDA ATI SB' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 24064
  period_size  : 6016
  period_time  : 125333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 6016
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 24064
  silence_threshold: 0
  silence_size : 0
  boundary     : 6773413839565225984
  appl_ptr     : 0
  hw_ptr       : 0
##### +                                            | 10%^C

Playing the foo.wav file I can only hear noise.

Regards,
-- 
Manolo Díaz
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: alsa-info.txt
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20130118/a03e07cc/attachment-0001.txt>


More information about the Alsa-devel mailing list