Commit c772bbe69a0171f12ad2adde5c150b4e211365ec

Authored by Takashi Iwai
1 parent 1c5d7b312f

ALSA: lola - Changes in proc file

The codec proc file becomes a read only that shows the codec widgets
in a text form.  A new proc file, codec_rw, is introduced instead for
accessing the Lola verb directly by reading and writing to it.

Also, regs proc file shows the contents of DSD, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 142 additions and 6 deletions Side-by-side Diff

sound/pci/lola/lola_proc.c
... ... @@ -26,9 +26,126 @@
26 26 #include <sound/pcm.h>
27 27 #include "lola.h"
28 28  
  29 +static void print_audio_widget(struct snd_info_buffer *buffer,
  30 + struct lola *chip, int nid, const char *name)
  31 +{
  32 + unsigned int val;
  33 +
  34 + lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
  35 + snd_iprintf(buffer, "Node 0x%02x %s wcaps 0x%x\n", nid, name, val);
  36 + lola_read_param(chip, nid, LOLA_PAR_STREAM_FORMATS, &val);
  37 + snd_iprintf(buffer, " Formats: 0x%x\n", val);
  38 +}
  39 +
  40 +static void print_pin_widget(struct snd_info_buffer *buffer,
  41 + struct lola *chip, int nid, unsigned int ampcap,
  42 + const char *name)
  43 +{
  44 + unsigned int val;
  45 +
  46 + lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
  47 + snd_iprintf(buffer, "Node 0x%02x %s wcaps 0x%x\n", nid, name, val);
  48 + if (val == 0x00400200)
  49 + return;
  50 + lola_read_param(chip, nid, ampcap, &val);
  51 + snd_iprintf(buffer, " Amp-Caps: 0x%x\n", val);
  52 + snd_iprintf(buffer, " mute=%d, step-size=%d, steps=%d, ofs=%d\n",
  53 + LOLA_AMP_MUTE_CAPABLE(val),
  54 + LOLA_AMP_STEP_SIZE(val),
  55 + LOLA_AMP_NUM_STEPS(val),
  56 + LOLA_AMP_OFFSET(val));
  57 + lola_codec_read(chip, nid, LOLA_VERB_GET_MAX_LEVEL, 0, 0, &val, NULL);
  58 + snd_iprintf(buffer, " Max-level: 0x%x\n", val);
  59 +}
  60 +
  61 +static void print_clock_widget(struct snd_info_buffer *buffer,
  62 + struct lola *chip, int nid)
  63 +{
  64 + int i, j, num_clocks;
  65 + unsigned int val;
  66 +
  67 + lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
  68 + snd_iprintf(buffer, "Node 0x%02x [Clock] wcaps 0x%x\n", nid, val);
  69 + num_clocks = val & 0xff;
  70 + for (i = 0; i < num_clocks; i += 4) {
  71 + unsigned int res_ex;
  72 + unsigned short items[4];
  73 + const char *name;
  74 +
  75 + lola_codec_read(chip, nid, LOLA_VERB_GET_CLOCK_LIST,
  76 + i, 0, &val, &res_ex);
  77 + items[0] = val & 0xfff;
  78 + items[1] = (val >> 16) & 0xfff;
  79 + items[2] = res_ex & 0xfff;
  80 + items[3] = (res_ex >> 16) & 0xfff;
  81 + for (j = 0; j < 4; j++) {
  82 + unsigned char type = items[j] >> 8;
  83 + unsigned int freq = items[j] & 0xff;
  84 + if (i + j >= num_clocks)
  85 + break;
  86 + if (type == LOLA_CLOCK_TYPE_INTERNAL) {
  87 + name = "Internal";
  88 + freq = lola_sample_rate_convert(freq);
  89 + } else if (type == LOLA_CLOCK_TYPE_VIDEO) {
  90 + name = "Video";
  91 + freq = lola_sample_rate_convert(freq);
  92 + } else {
  93 + name = "Other";
  94 + }
  95 + snd_iprintf(buffer, " Clock %d: Type %d:%s, freq=%d\n",
  96 + i + j, type, name, freq);
  97 + }
  98 + }
  99 +}
  100 +
  101 +static void print_mixer_widget(struct snd_info_buffer *buffer,
  102 + struct lola *chip, int nid)
  103 +{
  104 + unsigned int val;
  105 +
  106 + lola_read_param(chip, nid, LOLA_PAR_AUDIO_WIDGET_CAP, &val);
  107 + snd_iprintf(buffer, "Node 0x%02x [Mixer] wcaps 0x%x\n", nid, val);
  108 +}
  109 +
  110 +static void lola_proc_codec_read(struct snd_info_entry *entry,
  111 + struct snd_info_buffer *buffer)
  112 +{
  113 + struct lola *chip = entry->private_data;
  114 + unsigned int val;
  115 + int i, nid;
  116 +
  117 + lola_read_param(chip, 0, LOLA_PAR_VENDOR_ID, &val);
  118 + snd_iprintf(buffer, "Vendor: 0x%08x\n", val);
  119 + lola_read_param(chip, 1, LOLA_PAR_FUNCTION_TYPE, &val);
  120 + snd_iprintf(buffer, "Function Type: %d\n", val);
  121 + lola_read_param(chip, 1, LOLA_PAR_SPECIFIC_CAPS, &val);
  122 + snd_iprintf(buffer, "Specific-Caps: 0x%08x\n", val);
  123 + snd_iprintf(buffer, " Pins-In %d, Pins-Out %d\n",
  124 + chip->pin[CAPT].num_pins, chip->pin[PLAY].num_pins);
  125 + nid = 2;
  126 + for (i = 0; i < chip->pcm[CAPT].num_streams; i++, nid++)
  127 + print_audio_widget(buffer, chip, nid, "[Audio-In]");
  128 + for (i = 0; i < chip->pcm[PLAY].num_streams; i++, nid++)
  129 + print_audio_widget(buffer, chip, nid, "[Audio-Out]");
  130 + for (i = 0; i < chip->pin[CAPT].num_pins; i++, nid++)
  131 + print_pin_widget(buffer, chip, nid, LOLA_PAR_AMP_IN_CAP,
  132 + "[Pin-In]");
  133 + for (i = 0; i < chip->pin[PLAY].num_pins; i++, nid++)
  134 + print_pin_widget(buffer, chip, nid, LOLA_PAR_AMP_OUT_CAP,
  135 + "[Pin-Out]");
  136 + if (LOLA_AFG_CLOCK_WIDGET_PRESENT(chip->lola_caps)) {
  137 + print_clock_widget(buffer, chip, nid);
  138 + nid++;
  139 + }
  140 + if (LOLA_AFG_MIXER_WIDGET_PRESENT(chip->lola_caps)) {
  141 + print_mixer_widget(buffer, chip, nid);
  142 + nid++;
  143 + }
  144 +}
  145 +
29 146 /* direct codec access for debugging */
30   -static void lola_proc_codec_write(struct snd_info_entry *entry,
31   - struct snd_info_buffer *buffer)
  147 +static void lola_proc_codec_rw_write(struct snd_info_entry *entry,
  148 + struct snd_info_buffer *buffer)
32 149 {
33 150 struct lola *chip = entry->private_data;
34 151 char line[64];
... ... @@ -42,8 +159,8 @@
42 159 }
43 160 }
44 161  
45   -static void lola_proc_codec_read(struct snd_info_entry *entry,
46   - struct snd_info_buffer *buffer)
  162 +static void lola_proc_codec_rw_read(struct snd_info_entry *entry,
  163 + struct snd_info_buffer *buffer)
47 164 {
48 165 struct lola *chip = entry->private_data;
49 166 snd_iprintf(buffer, "0x%x 0x%x\n", chip->debug_res, chip->debug_res_ex);
50 167  
51 168  
52 169  
53 170  
54 171  
... ... @@ -62,24 +179,43 @@
62 179 snd_iprintf(buffer, "BAR0 %02x: %08x\n", i,
63 180 readl(chip->bar[BAR0].remap_addr + i));
64 181 }
  182 + snd_iprintf(buffer, "\n");
65 183 for (i = 0; i < 0x30; i += 4) {
66 184 snd_iprintf(buffer, "BAR1 %02x: %08x\n", i,
67 185 readl(chip->bar[BAR1].remap_addr + i));
68 186 }
  187 + snd_iprintf(buffer, "\n");
69 188 for (i = 0x80; i < 0xa0; i += 4) {
70 189 snd_iprintf(buffer, "BAR1 %02x: %08x\n", i,
71 190 readl(chip->bar[BAR1].remap_addr + i));
72 191 }
  192 + snd_iprintf(buffer, "\n");
  193 + for (i = 0; i < 32; i++) {
  194 + snd_iprintf(buffer, "DSD %02x STS %08x\n", i,
  195 + lola_dsd_read(chip, i, STS));
  196 + snd_iprintf(buffer, "DSD %02x LPIB %08x\n", i,
  197 + lola_dsd_read(chip, i, LPIB));
  198 + snd_iprintf(buffer, "DSD %02x CTL %08x\n", i,
  199 + lola_dsd_read(chip, i, CTL));
  200 + snd_iprintf(buffer, "DSD %02x LVIL %08x\n", i,
  201 + lola_dsd_read(chip, i, LVI));
  202 + snd_iprintf(buffer, "DSD %02x BDPL %08x\n", i,
  203 + lola_dsd_read(chip, i, BDPL));
  204 + snd_iprintf(buffer, "DSD %02x BDPU %08x\n", i,
  205 + lola_dsd_read(chip, i, BDPU));
  206 + }
73 207 }
74 208  
75 209 void __devinit lola_proc_debug_new(struct lola *chip)
76 210 {
77 211 struct snd_info_entry *entry;
78 212  
79   - if (!snd_card_proc_new(chip->card, "codec", &entry)) {
  213 + if (!snd_card_proc_new(chip->card, "codec", &entry))
80 214 snd_info_set_text_ops(entry, chip, lola_proc_codec_read);
  215 + if (!snd_card_proc_new(chip->card, "codec_rw", &entry)) {
  216 + snd_info_set_text_ops(entry, chip, lola_proc_codec_rw_read);
81 217 entry->mode |= S_IWUSR;
82   - entry->c.text.write = lola_proc_codec_write;
  218 + entry->c.text.write = lola_proc_codec_rw_write;
83 219 }
84 220 if (!snd_card_proc_new(chip->card, "regs", &entry))
85 221 snd_info_set_text_ops(entry, chip, lola_proc_regs_read);