diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-11-28 06:55:36 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-11-28 06:55:36 -0500 |
commit | daead538e9d8efe61d7d2bd12993c8d961b0abd6 (patch) | |
tree | 3a60c0e26f5c499547fd77f5ce06deeeee473706 /sound | |
parent | 11cd41b893895c76a8f9bee9467f4b0869b5eeb3 (diff) |
ALSA: hda - Add codec-specific proc hook
Added a hook for proc outputs of codec-specific stuff.
Moved realtek-specific coeff output into patch_realtek.c as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_codec.h | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 16 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 32 |
3 files changed, 38 insertions, 14 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 9fe0b67bb1e4..43af18c4a214 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -784,6 +784,10 @@ struct hda_codec { | |||
784 | int power_count; /* current (global) power refcount */ | 784 | int power_count; /* current (global) power refcount */ |
785 | struct delayed_work power_work; /* delayed task for powerdown */ | 785 | struct delayed_work power_work; /* delayed task for powerdown */ |
786 | #endif | 786 | #endif |
787 | |||
788 | /* codec-specific additional proc output */ | ||
789 | void (*proc_widget_hook)(struct snd_info_buffer *buffer, | ||
790 | struct hda_codec *codec, hda_nid_t nid); | ||
787 | }; | 791 | }; |
788 | 792 | ||
789 | /* direction */ | 793 | /* direction */ |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 9a8498456e6c..7b3817985c34 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -414,17 +414,6 @@ static void print_conn_list(struct snd_info_buffer *buffer, | |||
414 | } | 414 | } |
415 | } | 415 | } |
416 | 416 | ||
417 | static void print_realtek_coef(struct snd_info_buffer *buffer, | ||
418 | struct hda_codec *codec, hda_nid_t nid) | ||
419 | { | ||
420 | int coeff = snd_hda_codec_read(codec, nid, 0, | ||
421 | AC_VERB_GET_PROC_COEF, 0); | ||
422 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); | ||
423 | coeff = snd_hda_codec_read(codec, nid, 0, | ||
424 | AC_VERB_GET_COEF_INDEX, 0); | ||
425 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); | ||
426 | } | ||
427 | |||
428 | static void print_gpio(struct snd_info_buffer *buffer, | 417 | static void print_gpio(struct snd_info_buffer *buffer, |
429 | struct hda_codec *codec, hda_nid_t nid) | 418 | struct hda_codec *codec, hda_nid_t nid) |
430 | { | 419 | { |
@@ -606,9 +595,8 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
606 | if (wid_caps & AC_WCAP_PROC_WID) | 595 | if (wid_caps & AC_WCAP_PROC_WID) |
607 | print_proc_caps(buffer, codec, nid); | 596 | print_proc_caps(buffer, codec, nid); |
608 | 597 | ||
609 | /* NID 0x20 == Realtek Define Registers */ | 598 | if (codec->proc_widget_hook) |
610 | if (codec->vendor_id == 0x10ec && nid == 0x20) | 599 | codec->proc_widget_hook(buffer, codec, nid); |
611 | print_realtek_coef(buffer, codec, nid); | ||
612 | } | 600 | } |
613 | snd_hda_power_down(codec); | 601 | snd_hda_power_down(codec); |
614 | } | 602 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9cd2545d988e..698c85625a42 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -766,6 +766,27 @@ static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | |||
766 | spec->init_verbs[spec->num_init_verbs++] = verb; | 766 | spec->init_verbs[spec->num_init_verbs++] = verb; |
767 | } | 767 | } |
768 | 768 | ||
769 | #ifdef CONFIG_PROC_FS | ||
770 | /* | ||
771 | * hook for proc | ||
772 | */ | ||
773 | static void print_realtek_coef(struct snd_info_buffer *buffer, | ||
774 | struct hda_codec *codec, hda_nid_t nid) | ||
775 | { | ||
776 | int coeff; | ||
777 | |||
778 | if (nid != 0x20) | ||
779 | return; | ||
780 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); | ||
781 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); | ||
782 | coeff = snd_hda_codec_read(codec, nid, 0, | ||
783 | AC_VERB_GET_COEF_INDEX, 0); | ||
784 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); | ||
785 | } | ||
786 | #else | ||
787 | #define print_realtek_coef NULL | ||
788 | #endif | ||
789 | |||
769 | /* | 790 | /* |
770 | * set up from the preset table | 791 | * set up from the preset table |
771 | */ | 792 | */ |
@@ -4344,6 +4365,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4344 | if (!spec->loopback.amplist) | 4365 | if (!spec->loopback.amplist) |
4345 | spec->loopback.amplist = alc880_loopbacks; | 4366 | spec->loopback.amplist = alc880_loopbacks; |
4346 | #endif | 4367 | #endif |
4368 | codec->proc_widget_hook = print_realtek_coef; | ||
4347 | 4369 | ||
4348 | return 0; | 4370 | return 0; |
4349 | } | 4371 | } |
@@ -5869,6 +5891,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
5869 | if (!spec->loopback.amplist) | 5891 | if (!spec->loopback.amplist) |
5870 | spec->loopback.amplist = alc260_loopbacks; | 5892 | spec->loopback.amplist = alc260_loopbacks; |
5871 | #endif | 5893 | #endif |
5894 | codec->proc_widget_hook = print_realtek_coef; | ||
5872 | 5895 | ||
5873 | return 0; | 5896 | return 0; |
5874 | } | 5897 | } |
@@ -7074,6 +7097,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
7074 | if (!spec->loopback.amplist) | 7097 | if (!spec->loopback.amplist) |
7075 | spec->loopback.amplist = alc882_loopbacks; | 7098 | spec->loopback.amplist = alc882_loopbacks; |
7076 | #endif | 7099 | #endif |
7100 | codec->proc_widget_hook = print_realtek_coef; | ||
7077 | 7101 | ||
7078 | return 0; | 7102 | return 0; |
7079 | } | 7103 | } |
@@ -9042,6 +9066,7 @@ static int patch_alc883(struct hda_codec *codec) | |||
9042 | if (!spec->loopback.amplist) | 9066 | if (!spec->loopback.amplist) |
9043 | spec->loopback.amplist = alc883_loopbacks; | 9067 | spec->loopback.amplist = alc883_loopbacks; |
9044 | #endif | 9068 | #endif |
9069 | codec->proc_widget_hook = print_realtek_coef; | ||
9045 | 9070 | ||
9046 | return 0; | 9071 | return 0; |
9047 | } | 9072 | } |
@@ -10848,6 +10873,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10848 | if (!spec->loopback.amplist) | 10873 | if (!spec->loopback.amplist) |
10849 | spec->loopback.amplist = alc262_loopbacks; | 10874 | spec->loopback.amplist = alc262_loopbacks; |
10850 | #endif | 10875 | #endif |
10876 | codec->proc_widget_hook = print_realtek_coef; | ||
10851 | 10877 | ||
10852 | return 0; | 10878 | return 0; |
10853 | } | 10879 | } |
@@ -11913,6 +11939,8 @@ static int patch_alc268(struct hda_codec *codec) | |||
11913 | if (board_config == ALC268_AUTO) | 11939 | if (board_config == ALC268_AUTO) |
11914 | spec->init_hook = alc268_auto_init; | 11940 | spec->init_hook = alc268_auto_init; |
11915 | 11941 | ||
11942 | codec->proc_widget_hook = print_realtek_coef; | ||
11943 | |||
11916 | return 0; | 11944 | return 0; |
11917 | } | 11945 | } |
11918 | 11946 | ||
@@ -12714,6 +12742,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
12714 | if (!spec->loopback.amplist) | 12742 | if (!spec->loopback.amplist) |
12715 | spec->loopback.amplist = alc269_loopbacks; | 12743 | spec->loopback.amplist = alc269_loopbacks; |
12716 | #endif | 12744 | #endif |
12745 | codec->proc_widget_hook = print_realtek_coef; | ||
12717 | 12746 | ||
12718 | return 0; | 12747 | return 0; |
12719 | } | 12748 | } |
@@ -13802,6 +13831,7 @@ static int patch_alc861(struct hda_codec *codec) | |||
13802 | if (!spec->loopback.amplist) | 13831 | if (!spec->loopback.amplist) |
13803 | spec->loopback.amplist = alc861_loopbacks; | 13832 | spec->loopback.amplist = alc861_loopbacks; |
13804 | #endif | 13833 | #endif |
13834 | codec->proc_widget_hook = print_realtek_coef; | ||
13805 | 13835 | ||
13806 | return 0; | 13836 | return 0; |
13807 | } | 13837 | } |
@@ -14763,6 +14793,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
14763 | if (!spec->loopback.amplist) | 14793 | if (!spec->loopback.amplist) |
14764 | spec->loopback.amplist = alc861vd_loopbacks; | 14794 | spec->loopback.amplist = alc861vd_loopbacks; |
14765 | #endif | 14795 | #endif |
14796 | codec->proc_widget_hook = print_realtek_coef; | ||
14766 | 14797 | ||
14767 | return 0; | 14798 | return 0; |
14768 | } | 14799 | } |
@@ -16572,6 +16603,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
16572 | if (!spec->loopback.amplist) | 16603 | if (!spec->loopback.amplist) |
16573 | spec->loopback.amplist = alc662_loopbacks; | 16604 | spec->loopback.amplist = alc662_loopbacks; |
16574 | #endif | 16605 | #endif |
16606 | codec->proc_widget_hook = print_realtek_coef; | ||
16575 | 16607 | ||
16576 | return 0; | 16608 | return 0; |
16577 | } | 16609 | } |