diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-11-22 08:23:22 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-22 08:23:22 +0100 |
commit | 28e1c453bd5751b3bdea8b2b6731d3d1589e0743 (patch) | |
tree | 582785cf43b6d8e3c4876b090060619adc7359ed | |
parent | 095f0018ec03c8298857ea17419ae17f681b03a9 (diff) | |
download | hda-emu-28e1c453bd5751b3bdea8b2b6731d3d1589e0743.tar.gz |
Use snd_hda_codec_get_pincfg() for listing jacks
Since the recent driver doesn't overwrite the pin default cfg values
any longer, we should use snd_hda_codec_get_pincfg() for querying the
current pincfg values. Also give -r option to show the "original"
default cfg values.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | README | 11 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | hda-ctlsh.c | 22 | ||||
-rw-r--r-- | hda-emu.c | 24 | ||||
-rw-r--r-- | include/hda-log.h | 2 |
5 files changed, 57 insertions, 14 deletions
@@ -176,6 +176,17 @@ BASIC COMMANDS NID 0x10: cfg 0x921701f0: [Fixed] Speaker at Int Front NID 0x11: cfg 0x95a601f0: [Fixed] Mic at Int Top + Usually this shows the jack status the driver keeps internally. + If you'd need to look at the original default pincfg, pass -r + option. + + > jack -r + NID 0x0d: cfg 0x921701f0: [Fixed] Speaker at Int Front + ... + (Note that the difference appears only with 3.8 or later kernel + code. In the older kernels, both results with and without -r + will show the same list.) + When called with a widget numid, it shows the current jack state. > jack 0x0d diff --git a/configure.ac b/configure.ac index 43db88f..63102a8 100644 --- a/configure.ac +++ b/configure.ac @@ -545,5 +545,17 @@ if test "$HAVE_COMMON_PREAPRE" = "yes"; then AC_DEFINE(HAVE_COMMON_PREPARE) fi +AC_MSG_CHECKING(for snd_hda_codec_get_pincfg) +HAVE_SND_HDA_CODEC_GET_PINCFG= +if grep -q 'snd_hda_codec_get_pincfg' kernel/hda_codec.h; then + AC_MSG_RESULT(yes) + HAVE_SND_HDA_CODEC_GET_PINCFG=1 +else + AC_MSG_RESULT(no) +fi +if test "$HAVE_SND_HDA_CODEC_GET_PINCFG" = "1"; then + AC_DEFINE(HAVE_SND_HDA_CODEC_GET_PINCFG) +fi + AC_OUTPUT(Makefile kernel/Makefile include/Makefile) diff --git a/hda-ctlsh.c b/hda-ctlsh.c index d84cc71..5ad95fc 100644 --- a/hda-ctlsh.c +++ b/hda-ctlsh.c @@ -334,11 +334,25 @@ static void handle_module_option(char *line) static void set_jack(char *line) { int nid, val; + char *token; - if (getint(&line, &nid)) { - hda_log_list_jacks(); + token = gettoken(&line); + if (!token) { + hda_log_list_jacks(0); return; } + if (*token == '-') { + /* option */ + switch (token[1]) { + case 'r': + hda_log_list_jacks(1); + return; + default: + usage("jack"); + return; + } + } + nid = strtoul(token, NULL, 0); if (getbool(&line, &val)) { hda_log_jack_state(nid); return; @@ -707,8 +721,8 @@ static struct usage_table usage_str[] = { { "dump", "dump [nid [filename]]", "Dump codec contents in the proc file format; nid = 0 means all widgets", dump_proc }, - { "jack", "jack numid [val]", - "Get jack state or set jack state; val = 0 or 1", + { "jack", "jack [-r] numid [val]", + "Get jack state or set jack state; val = 0 or 1; -r = list from uncached pincfgs", set_jack }, { "unsol", "unsol numid", "Issue an unsolicited event", @@ -57,6 +57,8 @@ static struct snd_card card = { }; static struct xhda_codec proc; +static struct hda_codec *_codec; + static int ignore_invalid_ftype; static int cmd_send(struct hda_bus *bus, unsigned int cmd) @@ -322,7 +324,7 @@ static const char *_get_jack_location(u32 cfg) return "UNKNOWN"; } -void hda_log_list_jacks(void) +void hda_log_list_jacks(int raw) { struct xhda_node *node; unsigned int type, conn; @@ -336,23 +338,29 @@ void hda_log_list_jacks(void) static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" }; for (node = proc.afg.next; node; node = node->next) { + unsigned int pin_default; type = (node->wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; if (type != AC_WID_PIN) continue; - conn = (node->pin_default & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT; + pin_default = node->pin_default; +#ifdef HAVE_SND_HDA_CODEC_GET_PINCFG + if (!raw) + pin_default = snd_hda_codec_get_pincfg(_codec, node->nid); +#endif + conn = (pin_default & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT; if (conn == AC_JACK_PORT_NONE) continue; /* if (!(node->pincap & AC_PINCAP_PRES_DETECT)) continue;*/ hda_log(HDA_LOG_INFO, "NID 0x%02x: cfg 0x%08x: [%s] %s at %s %s\n", - node->nid, node->pin_default, - jack_conns[(node->pin_default & AC_DEFCFG_PORT_CONN) + node->nid, pin_default, + jack_conns[(pin_default & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT], - jack_types[(node->pin_default & AC_DEFCFG_DEVICE) + jack_types[(pin_default & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT], - jack_locations[(node->pin_default >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3], - _get_jack_location(node->pin_default)); + jack_locations[(pin_default >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3], + _get_jack_location(pin_default)); } } @@ -411,8 +419,6 @@ void hda_test_resume(void) * unsol even handling */ -static struct hda_codec *_codec; - static void issue_unsol(int caddr, int res) { caddr |= 1 << 4; diff --git a/include/hda-log.h b/include/hda-log.h index 8b0d392..59e8c75 100644 --- a/include/hda-log.h +++ b/include/hda-log.h @@ -26,7 +26,7 @@ int hda_log_level_set(int level); FILE *hda_get_logfp(void); void hda_log_dump_proc(unsigned int nid, const char *file); -void hda_log_list_jacks(void); +void hda_log_list_jacks(int raw); void hda_log_jack_state(int nid); void hda_log_set_jack(int nid, int val); void hda_log_issue_unsol(int nid); |