aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_proc.c34
2 files changed, 33 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 2b5d19e48a27..ab2a444ba501 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -361,6 +361,7 @@ struct hda_codec {
361 unsigned int epss:1; /* supporting EPSS? */ 361 unsigned int epss:1; /* supporting EPSS? */
362 unsigned int cached_write:1; /* write only to caches */ 362 unsigned int cached_write:1; /* write only to caches */
363 unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */ 363 unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */
364 unsigned int dump_coef:1; /* dump processing coefs in codec proc file */
364#ifdef CONFIG_PM 365#ifdef CONFIG_PM
365 unsigned int power_on :1; /* current (global) power-state */ 366 unsigned int power_on :1; /* current (global) power-state */
366 unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ 367 unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index a8cb22eec89e..ce5a6da83419 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -24,9 +24,14 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <sound/core.h> 26#include <sound/core.h>
27#include <linux/module.h>
27#include "hda_codec.h" 28#include "hda_codec.h"
28#include "hda_local.h" 29#include "hda_local.h"
29 30
31static int dump_coef = -1;
32module_param(dump_coef, int, 0644);
33MODULE_PARM_DESC(dump_coef, "Dump processing coefficients in codec proc file (-1=auto, 0=disable, 1=enable)");
34
30static char *bits_names(unsigned int bits, char *names[], int size) 35static char *bits_names(unsigned int bits, char *names[], int size)
31{ 36{
32 int i, n; 37 int i, n;
@@ -488,14 +493,39 @@ static void print_unsol_cap(struct snd_info_buffer *buffer,
488 (unsol & AC_UNSOL_ENABLED) ? 1 : 0); 493 (unsol & AC_UNSOL_ENABLED) ? 1 : 0);
489} 494}
490 495
496static inline bool can_dump_coef(struct hda_codec *codec)
497{
498 switch (dump_coef) {
499 case 0: return false;
500 case 1: return true;
501 default: return codec->dump_coef;
502 }
503}
504
491static void print_proc_caps(struct snd_info_buffer *buffer, 505static void print_proc_caps(struct snd_info_buffer *buffer,
492 struct hda_codec *codec, hda_nid_t nid) 506 struct hda_codec *codec, hda_nid_t nid)
493{ 507{
508 unsigned int i, ncoeff, oldindex;
494 unsigned int proc_caps = snd_hda_param_read(codec, nid, 509 unsigned int proc_caps = snd_hda_param_read(codec, nid,
495 AC_PAR_PROC_CAP); 510 AC_PAR_PROC_CAP);
511 ncoeff = (proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT;
496 snd_iprintf(buffer, " Processing caps: benign=%d, ncoeff=%d\n", 512 snd_iprintf(buffer, " Processing caps: benign=%d, ncoeff=%d\n",
497 proc_caps & AC_PCAP_BENIGN, 513 proc_caps & AC_PCAP_BENIGN, ncoeff);
498 (proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT); 514
515 if (!can_dump_coef(codec))
516 return;
517
518 /* Note: This is racy - another process could run in parallel and change
519 the coef index too. */
520 oldindex = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_COEF_INDEX, 0);
521 for (i = 0; i < ncoeff; i++) {
522 unsigned int val;
523 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, i);
524 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF,
525 0);
526 snd_iprintf(buffer, " Coeff 0x%02x: 0x%04x\n", i, val);
527 }
528 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, oldindex);
499} 529}
500 530
501static void print_conn_list(struct snd_info_buffer *buffer, 531static void print_conn_list(struct snd_info_buffer *buffer,