aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-03-03 17:29:47 -0500
committerTakashi Iwai <tiwai@suse.de>2015-03-23 08:19:38 -0400
commit9ba17b4d132f56a680fa1ba0bc2a8f98b6263d93 (patch)
treebc30e4c61923f45eab27f9fc0f5d96d4c5132554 /sound/pci
parent01ed3c06c6d5e7e861650ae76117dd4194d87316 (diff)
ALSA: hda - Implement uncached version of parameter reads
Sometimes we need the uncached reads, e.g. for refreshing the tree. This patch provides the helper function for that and uses it for refreshing widgets, reading subtrees and the whole proc reads. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c4
-rw-r--r--sound/pci/hda/hda_proc.c28
2 files changed, 16 insertions, 16 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 8eb42f4226ff..39b5660653f0 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -586,8 +586,8 @@ static int read_widget_caps(struct hda_codec *codec, hda_nid_t fg_node)
586 return -ENOMEM; 586 return -ENOMEM;
587 nid = codec->core.start_nid; 587 nid = codec->core.start_nid;
588 for (i = 0; i < codec->core.num_nodes; i++, nid++) 588 for (i = 0; i < codec->core.num_nodes; i++, nid++)
589 codec->wcaps[i] = snd_hda_param_read(codec, nid, 589 codec->wcaps[i] = snd_hdac_read_parm_uncached(&codec->core,
590 AC_PAR_AUDIO_WIDGET_CAP); 590 nid, AC_PAR_AUDIO_WIDGET_CAP);
591 return 0; 591 return 0;
592} 592}
593 593
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index a4f5a30f1d41..ee6230767c64 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -32,6 +32,10 @@ static int dump_coef = -1;
32module_param(dump_coef, int, 0644); 32module_param(dump_coef, int, 0644);
33MODULE_PARM_DESC(dump_coef, "Dump processing coefficients in codec proc file (-1=auto, 0=disable, 1=enable)"); 33MODULE_PARM_DESC(dump_coef, "Dump processing coefficients in codec proc file (-1=auto, 0=disable, 1=enable)");
34 34
35/* always use noncached version */
36#define param_read(codec, nid, parm) \
37 snd_hdac_read_parm_uncached(&(codec)->core, nid, parm)
38
35static char *bits_names(unsigned int bits, char *names[], int size) 39static char *bits_names(unsigned int bits, char *names[], int size)
36{ 40{
37 int i, n; 41 int i, n;
@@ -119,9 +123,8 @@ static void print_amp_caps(struct snd_info_buffer *buffer,
119 struct hda_codec *codec, hda_nid_t nid, int dir) 123 struct hda_codec *codec, hda_nid_t nid, int dir)
120{ 124{
121 unsigned int caps; 125 unsigned int caps;
122 caps = snd_hda_param_read(codec, nid, 126 caps = param_read(codec, nid, dir == HDA_OUTPUT ?
123 dir == HDA_OUTPUT ? 127 AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP);
124 AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP);
125 if (caps == -1 || caps == 0) { 128 if (caps == -1 || caps == 0) {
126 snd_iprintf(buffer, "N/A\n"); 129 snd_iprintf(buffer, "N/A\n");
127 return; 130 return;
@@ -225,8 +228,8 @@ static void print_pcm_formats(struct snd_info_buffer *buffer,
225static void print_pcm_caps(struct snd_info_buffer *buffer, 228static void print_pcm_caps(struct snd_info_buffer *buffer,
226 struct hda_codec *codec, hda_nid_t nid) 229 struct hda_codec *codec, hda_nid_t nid)
227{ 230{
228 unsigned int pcm = snd_hda_param_read(codec, nid, AC_PAR_PCM); 231 unsigned int pcm = param_read(codec, nid, AC_PAR_PCM);
229 unsigned int stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM); 232 unsigned int stream = param_read(codec, nid, AC_PAR_STREAM);
230 if (pcm == -1 || stream == -1) { 233 if (pcm == -1 || stream == -1) {
231 snd_iprintf(buffer, "N/A\n"); 234 snd_iprintf(buffer, "N/A\n");
232 return; 235 return;
@@ -273,7 +276,7 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
273 static char *jack_conns[4] = { "Jack", "N/A", "Fixed", "Both" }; 276 static char *jack_conns[4] = { "Jack", "N/A", "Fixed", "Both" };
274 unsigned int caps, val; 277 unsigned int caps, val;
275 278
276 caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 279 caps = param_read(codec, nid, AC_PAR_PIN_CAP);
277 snd_iprintf(buffer, " Pincap 0x%08x:", caps); 280 snd_iprintf(buffer, " Pincap 0x%08x:", caps);
278 if (caps & AC_PINCAP_IN) 281 if (caps & AC_PINCAP_IN)
279 snd_iprintf(buffer, " IN"); 282 snd_iprintf(buffer, " IN");
@@ -401,8 +404,7 @@ static void print_pin_ctls(struct snd_info_buffer *buffer,
401static void print_vol_knob(struct snd_info_buffer *buffer, 404static void print_vol_knob(struct snd_info_buffer *buffer,
402 struct hda_codec *codec, hda_nid_t nid) 405 struct hda_codec *codec, hda_nid_t nid)
403{ 406{
404 unsigned int cap = snd_hda_param_read(codec, nid, 407 unsigned int cap = param_read(codec, nid, AC_PAR_VOL_KNB_CAP);
405 AC_PAR_VOL_KNB_CAP);
406 snd_iprintf(buffer, " Volume-Knob: delta=%d, steps=%d, ", 408 snd_iprintf(buffer, " Volume-Knob: delta=%d, steps=%d, ",
407 (cap >> 7) & 1, cap & 0x7f); 409 (cap >> 7) & 1, cap & 0x7f);
408 cap = snd_hda_codec_read(codec, nid, 0, 410 cap = snd_hda_codec_read(codec, nid, 0,
@@ -487,7 +489,7 @@ static void print_power_state(struct snd_info_buffer *buffer,
487 [ilog2(AC_PWRST_EPSS)] = "EPSS", 489 [ilog2(AC_PWRST_EPSS)] = "EPSS",
488 }; 490 };
489 491
490 int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE); 492 int sup = param_read(codec, nid, AC_PAR_POWER_STATE);
491 int pwr = snd_hda_codec_read(codec, nid, 0, 493 int pwr = snd_hda_codec_read(codec, nid, 0,
492 AC_VERB_GET_POWER_STATE, 0); 494 AC_VERB_GET_POWER_STATE, 0);
493 if (sup != -1) 495 if (sup != -1)
@@ -531,8 +533,7 @@ static void print_proc_caps(struct snd_info_buffer *buffer,
531 struct hda_codec *codec, hda_nid_t nid) 533 struct hda_codec *codec, hda_nid_t nid)
532{ 534{
533 unsigned int i, ncoeff, oldindex; 535 unsigned int i, ncoeff, oldindex;
534 unsigned int proc_caps = snd_hda_param_read(codec, nid, 536 unsigned int proc_caps = param_read(codec, nid, AC_PAR_PROC_CAP);
535 AC_PAR_PROC_CAP);
536 ncoeff = (proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT; 537 ncoeff = (proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT;
537 snd_iprintf(buffer, " Processing caps: benign=%d, ncoeff=%d\n", 538 snd_iprintf(buffer, " Processing caps: benign=%d, ncoeff=%d\n",
538 proc_caps & AC_PCAP_BENIGN, ncoeff); 539 proc_caps & AC_PCAP_BENIGN, ncoeff);
@@ -597,7 +598,7 @@ static void print_gpio(struct snd_info_buffer *buffer,
597 struct hda_codec *codec, hda_nid_t nid) 598 struct hda_codec *codec, hda_nid_t nid)
598{ 599{
599 unsigned int gpio = 600 unsigned int gpio =
600 snd_hda_param_read(codec, codec->core.afg, AC_PAR_GPIO_CAP); 601 param_read(codec, codec->core.afg, AC_PAR_GPIO_CAP);
601 unsigned int enable, direction, wake, unsol, sticky, data; 602 unsigned int enable, direction, wake, unsol, sticky, data;
602 int i, max; 603 int i, max;
603 snd_iprintf(buffer, "GPIO: io=%d, o=%d, i=%d, " 604 snd_iprintf(buffer, "GPIO: io=%d, o=%d, i=%d, "
@@ -727,8 +728,7 @@ static void print_codec_info(struct snd_info_entry *entry,
727 728
728 for (i = 0; i < nodes; i++, nid++) { 729 for (i = 0; i < nodes; i++, nid++) {
729 unsigned int wid_caps = 730 unsigned int wid_caps =
730 snd_hda_param_read(codec, nid, 731 param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
731 AC_PAR_AUDIO_WIDGET_CAP);
732 unsigned int wid_type = get_wcaps_type(wid_caps); 732 unsigned int wid_type = get_wcaps_type(wid_caps);
733 hda_nid_t *conn = NULL; 733 hda_nid_t *conn = NULL;
734 int conn_len = 0; 734 int conn_len = 0;