Skip to content

Commit

Permalink
Add function-id parse and proc output
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwai committed Mar 23, 2009
1 parent 6d49232 commit d44ee75
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
24 changes: 24 additions & 0 deletions configure.ac
Expand Up @@ -270,5 +270,29 @@ if test "$HDA_CODEC_PIN_AMP_WORKAROUND" = "1"; then
AC_DEFINE(HDA_CODEC_PIN_AMP_WORKAROUND)
fi

AC_MSG_CHECKING(for hda_codec.function_id)
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Iinclude"
HDA_CODEC_FUNCTION_ID=
AC_TRY_COMPILE([
#include "hda-types.h"
#include "hda-log.h"
#include <sound/driver.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include "kernel/hda_codec.h"
],[
struct hda_codec codec;
codec.function_id = 1;
],
[AC_MSG_RESULT(yes); HDA_CODEC_FUNCTION_ID="1"],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT(unknown)]
)
CFLAGS=$ac_save_CFLAGS
if test "$HDA_CODEC_FUNCTION_ID" = "1"; then
AC_DEFINE(HDA_CODEC_FUNCTION_ID)
fi

AC_OUTPUT(Makefile kernel/Makefile include/Makefile)

7 changes: 5 additions & 2 deletions hda-int.c
Expand Up @@ -712,8 +712,11 @@ static int par_node_count(struct xhda_codec *codec, struct xhda_node *node,
static int par_function_type(struct xhda_codec *codec, struct xhda_node *node,
unsigned int cmd)
{
if (node && node->nid == 0x01)
return 0x01;
if (node && node->nid == 0x01) {
if (codec->function_id)
return codec->function_id;
return 0x01; /* FIXME */
}
return 0;
}

Expand Down
3 changes: 3 additions & 0 deletions hda-parse.c
Expand Up @@ -391,6 +391,9 @@ static int parse_root(const char *buffer)

if ((p = strmatch(buffer, "Address: "))) {
codec->addr = strtoul(p, NULL, 0);
} else if ((p = strmatch(buffer, "Function Id: "))) {
codec->function_id = strtoul(p, NULL, 0);
return 0;
} else if ((p = strmatch(buffer, "Vendor Id: "))) {
codec->vendor_id = strtoul(p, NULL, 0);
return 0;
Expand Down
7 changes: 5 additions & 2 deletions hda_own_proc.c
Expand Up @@ -581,8 +581,11 @@ static void print_codec_info(struct snd_info_entry *entry,
snd_iprintf(buffer, "Codec: %s\n", buf);
#endif
snd_iprintf(buffer, "Address: %d\n", codec->addr);
snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id);
snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id);
#ifdef HDA_CODEC_FUNCTION_ID
snd_iprintf(buffer, "Function Id: 0x%x\n", codec->function_id);
#endif
snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id);
snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id);
snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);

if (codec->mfg)
Expand Down
1 change: 1 addition & 0 deletions include/hda-types.h
Expand Up @@ -75,6 +75,7 @@ struct xhda_value_cache {

struct xhda_codec {
unsigned int addr;
unsigned int function_id;
unsigned int vendor_id;
unsigned int subsystem_id;
unsigned int revision_id;
Expand Down

0 comments on commit d44ee75

Please sign in to comment.