lola.h 16 KB

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