~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/pci/lola/lola.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  *  Support for Digigram Lola PCI-e boards
  4  *
  5  *  Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
  6  */
  7 
  8 #ifndef _LOLA_H
  9 #define _LOLA_H
 10 
 11 #define DRVNAME "snd-lola"
 12 #define SFX     DRVNAME ": "
 13 
 14 /*
 15  * Lola HD Audio Registers BAR0
 16  */
 17 #define LOLA_BAR0_GCAP          0x00
 18 #define LOLA_BAR0_VMIN          0x02
 19 #define LOLA_BAR0_VMAJ          0x03
 20 #define LOLA_BAR0_OUTPAY        0x04
 21 #define LOLA_BAR0_INPAY         0x06
 22 #define LOLA_BAR0_GCTL          0x08
 23 #define LOLA_BAR0_WAKEEN        0x0c
 24 #define LOLA_BAR0_STATESTS      0x0e
 25 #define LOLA_BAR0_GSTS          0x10
 26 #define LOLA_BAR0_OUTSTRMPAY    0x18
 27 #define LOLA_BAR0_INSTRMPAY     0x1a
 28 #define LOLA_BAR0_INTCTL        0x20
 29 #define LOLA_BAR0_INTSTS        0x24
 30 #define LOLA_BAR0_WALCLK        0x30
 31 #define LOLA_BAR0_SSYNC         0x38
 32 
 33 #define LOLA_BAR0_CORBLBASE     0x40
 34 #define LOLA_BAR0_CORBUBASE     0x44
 35 #define LOLA_BAR0_CORBWP        0x48    /* no ULONG access */
 36 #define LOLA_BAR0_CORBRP        0x4a    /* no ULONG access */
 37 #define LOLA_BAR0_CORBCTL       0x4c    /* no ULONG access */
 38 #define LOLA_BAR0_CORBSTS       0x4d    /* UCHAR access only */
 39 #define LOLA_BAR0_CORBSIZE      0x4e    /* no ULONG access */
 40 
 41 #define LOLA_BAR0_RIRBLBASE     0x50
 42 #define LOLA_BAR0_RIRBUBASE     0x54
 43 #define LOLA_BAR0_RIRBWP        0x58
 44 #define LOLA_BAR0_RINTCNT       0x5a    /* no ULONG access */
 45 #define LOLA_BAR0_RIRBCTL       0x5c
 46 #define LOLA_BAR0_RIRBSTS       0x5d    /* UCHAR access only */
 47 #define LOLA_BAR0_RIRBSIZE      0x5e    /* no ULONG access */
 48 
 49 #define LOLA_BAR0_ICW           0x60
 50 #define LOLA_BAR0_IRR           0x64
 51 #define LOLA_BAR0_ICS           0x68
 52 #define LOLA_BAR0_DPLBASE       0x70
 53 #define LOLA_BAR0_DPUBASE       0x74
 54 
 55 /* stream register offsets from stream base 0x80 */
 56 #define LOLA_BAR0_SD0_OFFSET    0x80
 57 #define LOLA_REG0_SD_CTL        0x00
 58 #define LOLA_REG0_SD_STS        0x03
 59 #define LOLA_REG0_SD_LPIB       0x04
 60 #define LOLA_REG0_SD_CBL        0x08
 61 #define LOLA_REG0_SD_LVI        0x0c
 62 #define LOLA_REG0_SD_FIFOW      0x0e
 63 #define LOLA_REG0_SD_FIFOSIZE   0x10
 64 #define LOLA_REG0_SD_FORMAT     0x12
 65 #define LOLA_REG0_SD_BDLPL      0x18
 66 #define LOLA_REG0_SD_BDLPU      0x1c
 67 
 68 /*
 69  * Lola Digigram Registers BAR1
 70  */
 71 #define LOLA_BAR1_FPGAVER       0x00
 72 #define LOLA_BAR1_DEVER         0x04
 73 #define LOLA_BAR1_UCBMV         0x08
 74 #define LOLA_BAR1_JTAG          0x0c
 75 #define LOLA_BAR1_UARTRX        0x10
 76 #define LOLA_BAR1_UARTTX        0x14
 77 #define LOLA_BAR1_UARTCR        0x18
 78 #define LOLA_BAR1_NVRAMVER      0x1c
 79 #define LOLA_BAR1_CTRLSPI       0x20
 80 #define LOLA_BAR1_DSPI          0x24
 81 #define LOLA_BAR1_AISPI         0x28
 82 #define LOLA_BAR1_GRAN          0x2c
 83 
 84 #define LOLA_BAR1_DINTCTL       0x80
 85 #define LOLA_BAR1_DIINTCTL      0x84
 86 #define LOLA_BAR1_DOINTCTL      0x88
 87 #define LOLA_BAR1_LRC           0x90
 88 #define LOLA_BAR1_DINTSTS       0x94
 89 #define LOLA_BAR1_DIINTSTS      0x98
 90 #define LOLA_BAR1_DOINTSTS      0x9c
 91 
 92 #define LOLA_BAR1_DSD0_OFFSET   0xa0
 93 #define LOLA_BAR1_DSD_SIZE      0x18
 94 
 95 #define LOLA_BAR1_DSDnSTS       0x00
 96 #define LOLA_BAR1_DSDnLPIB      0x04
 97 #define LOLA_BAR1_DSDnCTL       0x08
 98 #define LOLA_BAR1_DSDnLVI       0x0c
 99 #define LOLA_BAR1_DSDnBDPL      0x10
100 #define LOLA_BAR1_DSDnBDPU      0x14
101 
102 #define LOLA_BAR1_SSYNC         0x03e8
103 
104 #define LOLA_BAR1_BOARD_CTRL    0x0f00
105 #define LOLA_BAR1_BOARD_MODE    0x0f02
106 
107 #define LOLA_BAR1_SOURCE_GAIN_ENABLE            0x1000
108 #define LOLA_BAR1_DEST00_MIX_GAIN_ENABLE        0x1004
109 #define LOLA_BAR1_DEST31_MIX_GAIN_ENABLE        0x1080
110 #define LOLA_BAR1_SOURCE00_01_GAIN              0x1084
111 #define LOLA_BAR1_SOURCE30_31_GAIN              0x10c0
112 #define LOLA_BAR1_SOURCE_GAIN(src) \
113         (LOLA_BAR1_SOURCE00_01_GAIN + (src) * 2)
114 #define LOLA_BAR1_DEST00_MIX00_01_GAIN          0x10c4
115 #define LOLA_BAR1_DEST00_MIX30_31_GAIN          0x1100
116 #define LOLA_BAR1_DEST01_MIX00_01_GAIN          0x1104
117 #define LOLA_BAR1_DEST01_MIX30_31_GAIN          0x1140
118 #define LOLA_BAR1_DEST31_MIX00_01_GAIN          0x1884
119 #define LOLA_BAR1_DEST31_MIX30_31_GAIN          0x18c0
120 #define LOLA_BAR1_MIX_GAIN(dest, mix) \
121         (LOLA_BAR1_DEST00_MIX00_01_GAIN + (dest) * 0x40 + (mix) * 2)
122 #define LOLA_BAR1_ANALOG_CLIP_IN                0x18c4
123 #define LOLA_BAR1_PEAKMETERS_SOURCE00_01        0x18c8
124 #define LOLA_BAR1_PEAKMETERS_SOURCE30_31        0x1904
125 #define LOLA_BAR1_PEAKMETERS_SOURCE(src) \
126         (LOLA_BAR1_PEAKMETERS_SOURCE00_01 + (src) * 2)
127 #define LOLA_BAR1_PEAKMETERS_DEST00_01          0x1908
128 #define LOLA_BAR1_PEAKMETERS_DEST30_31          0x1944
129 #define LOLA_BAR1_PEAKMETERS_DEST(dest) \
130         (LOLA_BAR1_PEAKMETERS_DEST00_01 + (dest) * 2)
131 #define LOLA_BAR1_PEAKMETERS_AGC00_01           0x1948
132 #define LOLA_BAR1_PEAKMETERS_AGC14_15           0x1964
133 #define LOLA_BAR1_PEAKMETERS_AGC(x) \
134         (LOLA_BAR1_PEAKMETERS_AGC00_01 + (x) * 2)
135 
136 /* GCTL reset bit */
137 #define LOLA_GCTL_RESET         (1 << 0)
138 /* GCTL unsolicited response enable bit */
139 #define LOLA_GCTL_UREN          (1 << 8)
140 
141 /* CORB/RIRB control, read/write pointer */
142 #define LOLA_RBCTL_DMA_EN       0x02    /* enable DMA */
143 #define LOLA_RBCTL_IRQ_EN       0x01    /* enable IRQ */
144 #define LOLA_RBRWP_CLR          0x8000  /* read/write pointer clear */
145 
146 #define LOLA_RIRB_EX_UNSOL_EV   0x40000000
147 #define LOLA_RIRB_EX_ERROR      0x80000000
148 
149 /* CORB int mask: CMEI[0] */
150 #define LOLA_CORB_INT_CMEI      0x01
151 #define LOLA_CORB_INT_MASK      LOLA_CORB_INT_CMEI
152 
153 /* RIRB int mask: overrun[2], response[0] */
154 #define LOLA_RIRB_INT_RESPONSE  0x01
155 #define LOLA_RIRB_INT_OVERRUN   0x04
156 #define LOLA_RIRB_INT_MASK      (LOLA_RIRB_INT_RESPONSE | LOLA_RIRB_INT_OVERRUN)
157 
158 /* DINTCTL and DINTSTS */
159 #define LOLA_DINT_GLOBAL        0x80000000 /* global interrupt enable bit */
160 #define LOLA_DINT_CTRL          0x40000000 /* controller interrupt enable bit */
161 #define LOLA_DINT_FIFOERR       0x20000000 /* global fifo error enable bit */
162 #define LOLA_DINT_MUERR         0x10000000 /* global microcontroller underrun error */
163 
164 /* DSDnCTL bits */
165 #define LOLA_DSD_CTL_SRST       0x01    /* stream reset bit */
166 #define LOLA_DSD_CTL_SRUN       0x02    /* stream DMA start bit */
167 #define LOLA_DSD_CTL_IOCE       0x04    /* interrupt on completion enable */
168 #define LOLA_DSD_CTL_DEIE       0x10    /* descriptor error interrupt enable */
169 #define LOLA_DSD_CTL_VLRCV      0x20    /* valid LRCountValue information in bits 8..31 */
170 #define LOLA_LRC_MASK           0xffffff00
171 
172 /* DSDnSTS */
173 #define LOLA_DSD_STS_BCIS       0x04    /* buffer completion interrupt status */
174 #define LOLA_DSD_STS_DESE       0x10    /* descriptor error interrupt */
175 #define LOLA_DSD_STS_FIFORDY    0x20    /* fifo ready */
176 
177 #define LOLA_CORB_ENTRIES       256
178 
179 #define MAX_STREAM_IN_COUNT     16
180 #define MAX_STREAM_OUT_COUNT    16
181 #define MAX_STREAM_COUNT        16
182 #define MAX_PINS                MAX_STREAM_COUNT
183 #define MAX_STREAM_BUFFER_COUNT 16
184 #define MAX_AUDIO_INOUT_COUNT   16
185 
186 #define LOLA_CLOCK_TYPE_INTERNAL    0
187 #define LOLA_CLOCK_TYPE_AES         1
188 #define LOLA_CLOCK_TYPE_AES_SYNC    2
189 #define LOLA_CLOCK_TYPE_WORDCLOCK   3
190 #define LOLA_CLOCK_TYPE_ETHERSOUND  4
191 #define LOLA_CLOCK_TYPE_VIDEO       5
192 
193 #define LOLA_CLOCK_FORMAT_NONE      0
194 #define LOLA_CLOCK_FORMAT_NTSC      1
195 #define LOLA_CLOCK_FORMAT_PAL       2
196 
197 #define MAX_SAMPLE_CLOCK_COUNT  48
198 
199 /* parameters used with mixer widget's mixer capabilities */
200 #define LOLA_PEAK_METER_CAN_AGC_MASK            1
201 #define LOLA_PEAK_METER_CAN_ANALOG_CLIP_MASK    2
202 
203 struct lola_bar {
204         unsigned long addr;
205         void __iomem *remap_addr;
206 };
207 
208 /* CORB/RIRB */
209 struct lola_rb {
210         __le32 *buf;            /* CORB/RIRB buffer, 8 byte per each entry */
211         dma_addr_t addr;        /* physical address of CORB/RIRB buffer */
212         unsigned short rp, wp;  /* read/write pointers */
213         int cmds;               /* number of pending requests */
214 };
215 
216 /* Pin widget setup */
217 struct lola_pin {
218         unsigned int nid;
219         bool is_analog;
220         unsigned int amp_mute;
221         unsigned int amp_step_size;
222         unsigned int amp_num_steps;
223         unsigned int amp_offset;
224         unsigned int max_level;
225         unsigned int config_default_reg;
226         unsigned int fixed_gain_list_len;
227         unsigned int cur_gain_step;
228 };
229 
230 struct lola_pin_array {
231         unsigned int num_pins;
232         unsigned int num_analog_pins;
233         struct lola_pin pins[MAX_PINS];
234 };
235 
236 /* Clock widget setup */
237 struct lola_sample_clock {
238         unsigned int type;
239         unsigned int format;
240         unsigned int freq;
241 };
242 
243 struct lola_clock_widget {
244         unsigned int nid;
245         unsigned int items;
246         unsigned int cur_index;
247         unsigned int cur_freq;
248         bool cur_valid;
249         struct lola_sample_clock sample_clock[MAX_SAMPLE_CLOCK_COUNT];
250         unsigned int idx_lookup[MAX_SAMPLE_CLOCK_COUNT];
251 };
252 
253 #define LOLA_MIXER_DIM      32
254 struct lola_mixer_array {
255         u32 src_gain_enable;
256         u32 dest_mix_gain_enable[LOLA_MIXER_DIM];
257         u16 src_gain[LOLA_MIXER_DIM];
258         u16 dest_mix_gain[LOLA_MIXER_DIM][LOLA_MIXER_DIM];
259 };
260 
261 /* Mixer widget setup */
262 struct lola_mixer_widget {
263         unsigned int nid;
264         unsigned int caps;
265         struct lola_mixer_array __iomem *array;
266         struct lola_mixer_array *array_saved;
267         unsigned int src_stream_outs;
268         unsigned int src_phys_ins;
269         unsigned int dest_stream_ins;
270         unsigned int dest_phys_outs;
271         unsigned int src_stream_out_ofs;
272         unsigned int dest_phys_out_ofs;
273         unsigned int src_mask;
274         unsigned int dest_mask;
275 };
276 
277 /* Audio stream */
278 struct lola_stream {
279         unsigned int nid;       /* audio widget NID */
280         unsigned int index;     /* array index */
281         unsigned int dsd;       /* DSD index */
282         bool can_float;
283         struct snd_pcm_substream *substream; /* assigned PCM substream */
284         struct lola_stream *master;     /* master stream (for multi-channel) */
285 
286         /* buffer setup */
287         unsigned int bufsize;
288         unsigned int period_bytes;
289         unsigned int frags;
290 
291         /* format + channel setup */
292         unsigned int format_verb;
293 
294         /* flags */
295         unsigned int opened:1;
296         unsigned int prepared:1;
297         unsigned int paused:1;
298         unsigned int running:1;
299 };
300 
301 #define PLAY    SNDRV_PCM_STREAM_PLAYBACK
302 #define CAPT    SNDRV_PCM_STREAM_CAPTURE
303 
304 struct lola_pcm {
305         unsigned int num_streams;
306         struct snd_dma_buffer *bdl; /* BDL buffer */
307         struct lola_stream streams[MAX_STREAM_COUNT];
308 };
309 
310 /* card instance */
311 struct lola {
312         struct snd_card *card;
313         struct pci_dev *pci;
314 
315         /* pci resources */
316         struct lola_bar bar[2];
317         int irq;
318 
319         /* locks */
320         spinlock_t reg_lock;
321         struct mutex open_mutex;
322 
323         /* CORB/RIRB */
324         struct lola_rb corb;
325         struct lola_rb rirb;
326         unsigned int res, res_ex;       /* last read values */
327         /* last command (for debugging) */
328         unsigned int last_cmd_nid, last_verb, last_data, last_extdata;
329 
330         /* CORB/RIRB buffers */
331         struct snd_dma_buffer *rb;
332 
333         /* unsolicited events */
334         unsigned int last_unsol_res;
335 
336         /* streams */
337         struct lola_pcm pcm[2];
338 
339         /* input src */
340         unsigned int input_src_caps_mask;
341         unsigned int input_src_mask;
342 
343         /* pins */
344         struct lola_pin_array pin[2];
345 
346         /* clock */
347         struct lola_clock_widget clock;
348         int ref_count_rate;
349         unsigned int sample_rate;
350 
351         /* mixer */
352         struct lola_mixer_widget mixer;
353 
354         /* hw info */
355         unsigned int version;
356         unsigned int lola_caps;
357 
358         /* parameters */
359         unsigned int granularity;
360         unsigned int sample_rate_min;
361         unsigned int sample_rate_max;
362 
363         /* flags */
364         unsigned int initialized:1;
365         unsigned int cold_reset:1;
366         unsigned int polling_mode:1;
367 
368         /* for debugging */
369         unsigned int debug_res;
370         unsigned int debug_res_ex;
371 };
372 
373 #define BAR0    0
374 #define BAR1    1
375 
376 /* Helper macros */
377 #define lola_readl(chip, idx, name) \
378         readl((chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
379 #define lola_readw(chip, idx, name) \
380         readw((chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
381 #define lola_readb(chip, idx, name) \
382         readb((chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
383 #define lola_writel(chip, idx, name, val) \
384         writel((val), (chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
385 #define lola_writew(chip, idx, name, val) \
386         writew((val), (chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
387 #define lola_writeb(chip, idx, name, val) \
388         writeb((val), (chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
389 
390 #define lola_dsd_read(chip, dsd, name) \
391         readl((chip)->bar[BAR1].remap_addr + LOLA_BAR1_DSD0_OFFSET + \
392               (LOLA_BAR1_DSD_SIZE * (dsd)) + LOLA_BAR1_DSDn##name)
393 #define lola_dsd_write(chip, dsd, name, val) \
394         writel((val), (chip)->bar[BAR1].remap_addr + LOLA_BAR1_DSD0_OFFSET + \
395                (LOLA_BAR1_DSD_SIZE * (dsd)) + LOLA_BAR1_DSDn##name)
396 
397 /* GET verbs HDAudio */
398 #define LOLA_VERB_GET_STREAM_FORMAT             0xa00
399 #define LOLA_VERB_GET_AMP_GAIN_MUTE             0xb00
400 #define LOLA_VERB_PARAMETERS                    0xf00
401 #define LOLA_VERB_GET_POWER_STATE               0xf05
402 #define LOLA_VERB_GET_CONV                      0xf06
403 #define LOLA_VERB_GET_UNSOLICITED_RESPONSE      0xf08
404 #define LOLA_VERB_GET_DIGI_CONVERT_1            0xf0d
405 #define LOLA_VERB_GET_CONFIG_DEFAULT            0xf1c
406 #define LOLA_VERB_GET_SUBSYSTEM_ID              0xf20
407 /* GET verbs Digigram */
408 #define LOLA_VERB_GET_FIXED_GAIN                0xfc0
409 #define LOLA_VERB_GET_GAIN_SELECT               0xfc1
410 #define LOLA_VERB_GET_MAX_LEVEL                 0xfc2
411 #define LOLA_VERB_GET_CLOCK_LIST                0xfc3
412 #define LOLA_VERB_GET_CLOCK_SELECT              0xfc4
413 #define LOLA_VERB_GET_CLOCK_STATUS              0xfc5
414 
415 /* SET verbs HDAudio */
416 #define LOLA_VERB_SET_STREAM_FORMAT             0x200
417 #define LOLA_VERB_SET_AMP_GAIN_MUTE             0x300
418 #define LOLA_VERB_SET_POWER_STATE               0x705
419 #define LOLA_VERB_SET_CHANNEL_STREAMID          0x706
420 #define LOLA_VERB_SET_UNSOLICITED_ENABLE        0x708
421 #define LOLA_VERB_SET_DIGI_CONVERT_1            0x70d
422 /* SET verbs Digigram */
423 #define LOLA_VERB_SET_GAIN_SELECT               0xf81
424 #define LOLA_VERB_SET_CLOCK_SELECT              0xf84
425 #define LOLA_VERB_SET_GRANULARITY_STEPS         0xf86
426 #define LOLA_VERB_SET_SOURCE_GAIN               0xf87
427 #define LOLA_VERB_SET_MIX_GAIN                  0xf88
428 #define LOLA_VERB_SET_DESTINATION_GAIN          0xf89
429 #define LOLA_VERB_SET_SRC                       0xf8a
430 
431 /* Parameter IDs used with LOLA_VERB_PARAMETERS */
432 #define LOLA_PAR_VENDOR_ID                      0x00
433 #define LOLA_PAR_FUNCTION_TYPE                  0x05
434 #define LOLA_PAR_AUDIO_WIDGET_CAP               0x09
435 #define LOLA_PAR_PCM                            0x0a
436 #define LOLA_PAR_STREAM_FORMATS                 0x0b
437 #define LOLA_PAR_PIN_CAP                        0x0c
438 #define LOLA_PAR_AMP_IN_CAP                     0x0d
439 #define LOLA_PAR_CONNLIST_LEN                   0x0e
440 #define LOLA_PAR_POWER_STATE                    0x0f
441 #define LOLA_PAR_GPIO_CAP                       0x11
442 #define LOLA_PAR_AMP_OUT_CAP                    0x12
443 #define LOLA_PAR_SPECIFIC_CAPS                  0x80
444 #define LOLA_PAR_FIXED_GAIN_LIST                0x81
445 
446 /* extract results of LOLA_PAR_SPECIFIC_CAPS */
447 #define LOLA_AFG_MIXER_WIDGET_PRESENT(res)      ((res & (1 << 21)) != 0)
448 #define LOLA_AFG_CLOCK_WIDGET_PRESENT(res)      ((res & (1 << 20)) != 0)
449 #define LOLA_AFG_INPUT_PIN_COUNT(res)           ((res >> 10) & 0x2ff)
450 #define LOLA_AFG_OUTPUT_PIN_COUNT(res)          ((res) & 0x2ff)
451 
452 /* extract results of LOLA_PAR_AMP_IN_CAP / LOLA_PAR_AMP_OUT_CAP */
453 #define LOLA_AMP_MUTE_CAPABLE(res)              ((res & (1 << 31)) != 0)
454 #define LOLA_AMP_STEP_SIZE(res)                 ((res >> 24) & 0x7f)
455 #define LOLA_AMP_NUM_STEPS(res)                 ((res >> 12) & 0x3ff)
456 #define LOLA_AMP_OFFSET(res)                    ((res) & 0x3ff)
457 
458 #define LOLA_GRANULARITY_MIN            8
459 #define LOLA_GRANULARITY_MAX            32
460 #define LOLA_GRANULARITY_STEP           8
461 
462 /* parameters used with unsolicited command/response */
463 #define LOLA_UNSOLICITED_TAG_MASK       0x3f
464 #define LOLA_UNSOLICITED_TAG            0x1a
465 #define LOLA_UNSOLICITED_ENABLE         0x80
466 #define LOLA_UNSOL_RESP_TAG_OFFSET      26
467 
468 /* count values in the Vendor Specific Mixer Widget's Audio Widget Capabilities */
469 #define LOLA_MIXER_SRC_INPUT_PLAY_SEPARATION(res)   ((res >> 2) & 0x1f)
470 #define LOLA_MIXER_DEST_REC_OUTPUT_SEPARATION(res)  ((res >> 7) & 0x1f)
471 
472 int lola_codec_write(struct lola *chip, unsigned int nid, unsigned int verb,
473                      unsigned int data, unsigned int extdata);
474 int lola_codec_read(struct lola *chip, unsigned int nid, unsigned int verb,
475                     unsigned int data, unsigned int extdata,
476                     unsigned int *val, unsigned int *extval);
477 int lola_codec_flush(struct lola *chip);
478 #define lola_read_param(chip, nid, param, val) \
479         lola_codec_read(chip, nid, LOLA_VERB_PARAMETERS, param, 0, val, NULL)
480 
481 /* PCM */
482 int lola_create_pcm(struct lola *chip);
483 int lola_init_pcm(struct lola *chip, int dir, int *nidp);
484 void lola_pcm_update(struct lola *chip, struct lola_pcm *pcm, unsigned int bits);
485 
486 /* clock */
487 int lola_init_clock_widget(struct lola *chip, int nid);
488 int lola_set_granularity(struct lola *chip, unsigned int val, bool force);
489 int lola_enable_clock_events(struct lola *chip);
490 int lola_set_clock_index(struct lola *chip, unsigned int idx);
491 int lola_set_clock(struct lola *chip, int idx);
492 int lola_set_sample_rate(struct lola *chip, int rate);
493 bool lola_update_ext_clock_freq(struct lola *chip, unsigned int val);
494 unsigned int lola_sample_rate_convert(unsigned int coded);
495 
496 /* mixer */
497 int lola_init_pins(struct lola *chip, int dir, int *nidp);
498 int lola_init_mixer_widget(struct lola *chip, int nid);
499 void lola_free_mixer(struct lola *chip);
500 int lola_create_mixer(struct lola *chip);
501 int lola_setup_all_analog_gains(struct lola *chip, int dir, bool mute);
502 void lola_save_mixer(struct lola *chip);
503 void lola_restore_mixer(struct lola *chip);
504 int lola_set_src_config(struct lola *chip, unsigned int src_mask, bool update);
505 
506 /* proc */
507 #ifdef CONFIG_SND_DEBUG
508 void lola_proc_debug_new(struct lola *chip);
509 #else
510 #define lola_proc_debug_new(chip)
511 #endif
512 
513 #endif /* _LOLA_H */
514 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php