Discussion:
SigmaTel STAC9221 - Mux Amp-Out > 0x02 == microphone not working
Ivan N. Zlatev
2007-05-27 22:50:35 UTC
Permalink
Hello,

I am on an iMac ("*imac-20" model/pinconfig) with a Intel HD card with
the SigmaTel STAC9221 codec. I have attached the inital codec info
after modprobe. I am using Alsa HG. Setting the mux gain to a value >
20 (0x02 Amp-Out value) results a non-working microphone. Steps and
codec diffs as follows:

1) initial - microphone working
2) Mux Gain = 10 - microphone working

Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x00 0x00]
+ Amp-Out vals: [0x01 0x01]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a

3) Mux Gain = 20 - microphone working

Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x01 0x01]
+ Amp-Out vals: [0x02 0x02]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a


4) Mux Gain = 30 - microphone not working

Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x02 0x02]
+ Amp-Out vals: [0x03 0x03]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a


4) Mux Gain = 40 - microphone not working

Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x03 0x03]
+ Amp-Out vals: [0x04 0x04]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a

Regards
--
Ivan N. Zlatev

Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
Takashi Iwai
2007-05-29 15:08:01 UTC
Permalink
At Sun, 27 May 2007 23:50:35 +0100,
Post by Ivan N. Zlatev
Hello,
I am on an iMac ("*imac-20" model/pinconfig) with a Intel HD card with
the SigmaTel STAC9221 codec. I have attached the inital codec info
after modprobe. I am using Alsa HG. Setting the mux gain to a value >
20 (0x02 Amp-Out value) results a non-working microphone. Steps and
Thanks for the survey!

And, does this volume have any influence on the quality of recorded
sound at all? If not, we should remove this control rather than
keeping a dangerous thing...


Takashi
Post by Ivan N. Zlatev
1) initial - microphone working
2) Mux Gain = 10 - microphone working
Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x00 0x00]
+ Amp-Out vals: [0x01 0x01]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a
3) Mux Gain = 20 - microphone working
Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x01 0x01]
+ Amp-Out vals: [0x02 0x02]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a
4) Mux Gain = 30 - microphone not working
Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x02 0x02]
+ Amp-Out vals: [0x03 0x03]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a
4) Mux Gain = 40 - microphone not working
Node 0x12 [Audio Selector] wcaps 0x30010d: Stereo Amp-Out
Amp-Out caps: ofs=0x00, nsteps=0x04, stepsize=0x27, mute=0
- Amp-Out vals: [0x03 0x03]
+ Amp-Out vals: [0x04 0x04]
Connection: 7
0x0e 0x15 0x0f 0x0b* 0x0c 0x0d 0x0a
Regards
--
Ivan N. Zlatev
Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
Ivan N. Zlatev
2007-05-29 15:20:33 UTC
Permalink
Post by Takashi Iwai
And, does this volume have any influence on the quality of recorded
sound at all? If not, we should remove this control rather than
keeping a dangerous thing...
Yes. This controls the microphone boost level (without boost the sound
recorded has *very* low volume). Also Windows shows up a +20db
microphone boost slider on this machine.
--
Ivan N. Zlatev

Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
Takashi Iwai
2007-05-29 15:29:10 UTC
Permalink
At Tue, 29 May 2007 16:20:33 +0100,
Post by Ivan N. Zlatev
Post by Takashi Iwai
And, does this volume have any influence on the quality of recorded
sound at all? If not, we should remove this control rather than
keeping a dangerous thing...
Yes. This controls the microphone boost level (without boost the sound
recorded has *very* low volume). Also Windows shows up a +20db
microphone boost slider on this machine.
Ah, OK. Then the control seems indicates the wrong max level indeed.
So, we need two fixes:

- rename "Mux Capture Volume" to more intuitive one, such as "Capture
Boost" or something like that.

- limit the max level of this volume to 2.

The latter is a bit hard to fix. Let's see whether I can do some
hack...


thanks,

Takashi
Takashi Iwai
2007-05-29 16:18:08 UTC
Permalink
At Tue, 29 May 2007 17:29:10 +0200,
Post by Takashi Iwai
At Tue, 29 May 2007 16:20:33 +0100,
Post by Ivan N. Zlatev
Post by Takashi Iwai
And, does this volume have any influence on the quality of recorded
sound at all? If not, we should remove this control rather than
keeping a dangerous thing...
Yes. This controls the microphone boost level (without boost the sound
recorded has *very* low volume). Also Windows shows up a +20db
microphone boost slider on this machine.
Ah, OK. Then the control seems indicates the wrong max level indeed.
- rename "Mux Capture Volume" to more intuitive one, such as "Capture
Boost" or something like that.
- limit the max level of this volume to 2.
The latter is a bit hard to fix. Let's see whether I can do some
hack...
Could you check the patch below?
(This doesn't rename but just fix the latter item.)


Takashi

diff -r 200fc3a7ef62 pci/hda/hda_codec.c
--- a/pci/hda/hda_codec.c Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_codec.c Tue May 29 18:17:15 2007 +0200
@@ -711,6 +711,19 @@ static u32 query_amp_caps(struct hda_cod
info->status |= INFO_AMP_CAPS;
}
return info->amp_caps;
+}
+
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+ unsigned int caps)
+{
+ struct hda_amp_info *info;
+
+ info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0));
+ if (!info)
+ return -EINVAL;
+ info->amp_caps = caps;
+ info->status |= INFO_AMP_CAPS;
+ return 0;
}

/*
diff -r 200fc3a7ef62 pci/hda/hda_local.h
--- a/pci/hda/hda_local.h Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_local.h Tue May 29 18:17:02 2007 +0200
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_c
return codec->wcaps[nid - codec->start_nid];
}

+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+ unsigned int caps);

#endif /* __SOUND_HDA_LOCAL_H */
diff -r 200fc3a7ef62 pci/hda/patch_sigmatel.c
--- a/pci/hda/patch_sigmatel.c Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/patch_sigmatel.c Tue May 29 18:12:30 2007 +0200
@@ -2033,6 +2033,12 @@ static int patch_stac925x(struct hda_cod

codec->patch_ops = stac92xx_patch_ops;

+ /* Fix Mux capture level; max to 2 */
+ snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
+ (0 << AC_AMPCAP_OFFSET_SHIFT) |
+ (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+ (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+ (0 << AC_AMPCAP_MUTE_SHIFT));
return 0;
}
Ivan N. Zlatev
2007-05-29 16:49:54 UTC
Permalink
Post by Takashi Iwai
At Tue, 29 May 2007 17:29:10 +0200,
Post by Takashi Iwai
At Tue, 29 May 2007 16:20:33 +0100,
Post by Ivan N. Zlatev
Post by Takashi Iwai
And, does this volume have any influence on the quality of recorded
sound at all? If not, we should remove this control rather than
keeping a dangerous thing...
Yes. This controls the microphone boost level (without boost the sound
recorded has *very* low volume). Also Windows shows up a +20db
microphone boost slider on this machine.
Ah, OK. Then the control seems indicates the wrong max level indeed.
- rename "Mux Capture Volume" to more intuitive one, such as "Capture
Boost" or something like that.
- limit the max level of this volume to 2.
The latter is a bit hard to fix. Let's see whether I can do some
hack...
Could you check the patch below?
(This doesn't rename but just fix the latter item.)
Takashi
diff -r 200fc3a7ef62 pci/hda/hda_codec.c
--- a/pci/hda/hda_codec.c Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_codec.c Tue May 29 18:17:15 2007 +0200
@@ -711,6 +711,19 @@ static u32 query_amp_caps(struct hda_cod
info->status |= INFO_AMP_CAPS;
}
return info->amp_caps;
+}
+
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+ unsigned int caps)
+{
+ struct hda_amp_info *info;
+
+ info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0));
+ if (!info)
+ return -EINVAL;
+ info->amp_caps = caps;
+ info->status |= INFO_AMP_CAPS;
+ return 0;
}
/*
diff -r 200fc3a7ef62 pci/hda/hda_local.h
--- a/pci/hda/hda_local.h Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_local.h Tue May 29 18:17:02 2007 +0200
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_c
return codec->wcaps[nid - codec->start_nid];
}
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+ unsigned int caps);
#endif /* __SOUND_HDA_LOCAL_H */
diff -r 200fc3a7ef62 pci/hda/patch_sigmatel.c
--- a/pci/hda/patch_sigmatel.c Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/patch_sigmatel.c Tue May 29 18:12:30 2007 +0200
@@ -2033,6 +2033,12 @@ static int patch_stac925x(struct hda_cod
codec->patch_ops = stac92xx_patch_ops;
+ /* Fix Mux capture level; max to 2 */
+ snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
+ (0 << AC_AMPCAP_OFFSET_SHIFT) |
+ (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+ (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+ (0 << AC_AMPCAP_MUTE_SHIFT));
return 0;
}
Works, BUT the last hunk is at the wrong place. The
snd_hda_override_amp_caps call should be in patch_stac922x (...) and
not in patch_stac925x (...)

Cheers!
--
Ivan N. Zlatev

Web: http://www.i-nZ.net
"It's all some kind of whacked out conspiracy."
Takashi Iwai
2007-05-29 17:03:10 UTC
Permalink
At Tue, 29 May 2007 17:49:54 +0100,
Post by Ivan N. Zlatev
Post by Takashi Iwai
At Tue, 29 May 2007 17:29:10 +0200,
Post by Takashi Iwai
At Tue, 29 May 2007 16:20:33 +0100,
Post by Ivan N. Zlatev
Post by Takashi Iwai
And, does this volume have any influence on the quality of recorded
sound at all? If not, we should remove this control rather than
keeping a dangerous thing...
Yes. This controls the microphone boost level (without boost the sound
recorded has *very* low volume). Also Windows shows up a +20db
microphone boost slider on this machine.
Ah, OK. Then the control seems indicates the wrong max level indeed.
- rename "Mux Capture Volume" to more intuitive one, such as "Capture
Boost" or something like that.
- limit the max level of this volume to 2.
The latter is a bit hard to fix. Let's see whether I can do some
hack...
Could you check the patch below?
(This doesn't rename but just fix the latter item.)
Takashi
diff -r 200fc3a7ef62 pci/hda/hda_codec.c
--- a/pci/hda/hda_codec.c Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_codec.c Tue May 29 18:17:15 2007 +0200
@@ -711,6 +711,19 @@ static u32 query_amp_caps(struct hda_cod
info->status |= INFO_AMP_CAPS;
}
return info->amp_caps;
+}
+
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+ unsigned int caps)
+{
+ struct hda_amp_info *info;
+
+ info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0));
+ if (!info)
+ return -EINVAL;
+ info->amp_caps = caps;
+ info->status |= INFO_AMP_CAPS;
+ return 0;
}
/*
diff -r 200fc3a7ef62 pci/hda/hda_local.h
--- a/pci/hda/hda_local.h Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_local.h Tue May 29 18:17:02 2007 +0200
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_c
return codec->wcaps[nid - codec->start_nid];
}
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+ unsigned int caps);
#endif /* __SOUND_HDA_LOCAL_H */
diff -r 200fc3a7ef62 pci/hda/patch_sigmatel.c
--- a/pci/hda/patch_sigmatel.c Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/patch_sigmatel.c Tue May 29 18:12:30 2007 +0200
@@ -2033,6 +2033,12 @@ static int patch_stac925x(struct hda_cod
codec->patch_ops = stac92xx_patch_ops;
+ /* Fix Mux capture level; max to 2 */
+ snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
+ (0 << AC_AMPCAP_OFFSET_SHIFT) |
+ (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+ (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+ (0 << AC_AMPCAP_MUTE_SHIFT));
return 0;
}
Works, BUT the last hunk is at the wrong place. The
snd_hda_override_amp_caps call should be in patch_stac922x (...) and
not in patch_stac925x (...)
Aha, a typical error :)
I committed the fixed patch to ALSA HG tree now.
Could you check the HG tree later whether it really works?

Also, any other pending issues?


thanks,

Takashi

Loading...