提交 3e289f16 编写于 作者: T Takashi Iwai 提交者: Jaroslav Kysela

[ALSA] hda-codec - Print all AMP IN values

HDA generic driver
Print all AMP IN values when multiple nodes are connected.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 1ccc67d6
...@@ -68,21 +68,27 @@ static void print_amp_caps(snd_info_buffer_t *buffer, ...@@ -68,21 +68,27 @@ static void print_amp_caps(snd_info_buffer_t *buffer,
static void print_amp_vals(snd_info_buffer_t *buffer, static void print_amp_vals(snd_info_buffer_t *buffer,
struct hda_codec *codec, hda_nid_t nid, struct hda_codec *codec, hda_nid_t nid,
int dir, int stereo) int dir, int stereo, int indices)
{ {
unsigned int val; unsigned int val;
if (stereo) { int i;
if (dir == HDA_OUTPUT)
dir = AC_AMP_GET_OUTPUT;
else
dir = AC_AMP_GET_INPUT;
for (i = 0; i < indices; i++) {
snd_iprintf(buffer, " [");
if (stereo) {
val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE,
AC_AMP_GET_LEFT | dir | i);
snd_iprintf(buffer, "0x%02x ", val);
}
val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE, val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE,
AC_AMP_GET_LEFT | AC_AMP_GET_RIGHT | dir | i);
(dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : snd_iprintf(buffer, "0x%02x]", val);
AC_AMP_GET_INPUT));
snd_iprintf(buffer, "0x%02x ", val);
} }
val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE, snd_iprintf(buffer, "\n");
AC_AMP_GET_RIGHT |
(dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT :
AC_AMP_GET_INPUT));
snd_iprintf(buffer, "0x%02x\n", val);
} }
static void print_pcm_caps(snd_info_buffer_t *buffer, static void print_pcm_caps(snd_info_buffer_t *buffer,
...@@ -217,6 +223,9 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer) ...@@ -217,6 +223,9 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
unsigned int wid_caps = snd_hda_param_read(codec, nid, unsigned int wid_caps = snd_hda_param_read(codec, nid,
AC_PAR_AUDIO_WIDGET_CAP); AC_PAR_AUDIO_WIDGET_CAP);
unsigned int wid_type = (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; unsigned int wid_type = (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
int conn_len = 0;
hda_nid_t conn[HDA_MAX_CONNECTIONS];
snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid,
get_wid_type_name(wid_type), wid_caps); get_wid_type_name(wid_type), wid_caps);
if (wid_caps & AC_WCAP_STEREO) if (wid_caps & AC_WCAP_STEREO)
...@@ -231,19 +240,23 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer) ...@@ -231,19 +240,23 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
snd_iprintf(buffer, " Amp-Out"); snd_iprintf(buffer, " Amp-Out");
snd_iprintf(buffer, "\n"); snd_iprintf(buffer, "\n");
if (wid_caps & AC_WCAP_CONN_LIST)
conn_len = snd_hda_get_connections(codec, nid, conn,
HDA_MAX_CONNECTIONS);
if (wid_caps & AC_WCAP_IN_AMP) { if (wid_caps & AC_WCAP_IN_AMP) {
snd_iprintf(buffer, " Amp-In caps: "); snd_iprintf(buffer, " Amp-In caps: ");
print_amp_caps(buffer, codec, nid, HDA_INPUT); print_amp_caps(buffer, codec, nid, HDA_INPUT);
snd_iprintf(buffer, " Amp-In vals: "); snd_iprintf(buffer, " Amp-In vals: ");
print_amp_vals(buffer, codec, nid, HDA_INPUT, print_amp_vals(buffer, codec, nid, HDA_INPUT,
wid_caps & AC_WCAP_STEREO); wid_caps & AC_WCAP_STEREO, conn_len);
} }
if (wid_caps & AC_WCAP_OUT_AMP) { if (wid_caps & AC_WCAP_OUT_AMP) {
snd_iprintf(buffer, " Amp-Out caps: "); snd_iprintf(buffer, " Amp-Out caps: ");
print_amp_caps(buffer, codec, nid, HDA_OUTPUT); print_amp_caps(buffer, codec, nid, HDA_OUTPUT);
snd_iprintf(buffer, " Amp-Out vals: "); snd_iprintf(buffer, " Amp-Out vals: ");
print_amp_vals(buffer, codec, nid, HDA_OUTPUT, print_amp_vals(buffer, codec, nid, HDA_OUTPUT,
wid_caps & AC_WCAP_STEREO); wid_caps & AC_WCAP_STEREO, 1);
} }
if (wid_type == AC_WID_PIN) { if (wid_type == AC_WID_PIN) {
...@@ -267,10 +280,7 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer) ...@@ -267,10 +280,7 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
} }
if (wid_caps & AC_WCAP_CONN_LIST) { if (wid_caps & AC_WCAP_CONN_LIST) {
hda_nid_t conn[HDA_MAX_CONNECTIONS]; int c, curr = -1;
int c, conn_len, curr = -1;
conn_len = snd_hda_get_connections(codec, nid, conn,
HDA_MAX_CONNECTIONS);
if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) if (conn_len > 1 && wid_type != AC_WID_AUD_MIX)
curr = snd_hda_codec_read(codec, nid, 0, curr = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_CONNECT_SEL, 0); AC_VERB_GET_CONNECT_SEL, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册