Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  Support for Digigram Lola PCI-e boards
0004  *
0005  *  Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
0006  */
0007 
0008 #ifndef _LOLA_H
0009 #define _LOLA_H
0010 
0011 #define DRVNAME "snd-lola"
0012 #define SFX DRVNAME ": "
0013 
0014 /*
0015  * Lola HD Audio Registers BAR0
0016  */
0017 #define LOLA_BAR0_GCAP      0x00
0018 #define LOLA_BAR0_VMIN      0x02
0019 #define LOLA_BAR0_VMAJ      0x03
0020 #define LOLA_BAR0_OUTPAY    0x04
0021 #define LOLA_BAR0_INPAY     0x06
0022 #define LOLA_BAR0_GCTL      0x08
0023 #define LOLA_BAR0_WAKEEN    0x0c
0024 #define LOLA_BAR0_STATESTS  0x0e
0025 #define LOLA_BAR0_GSTS      0x10
0026 #define LOLA_BAR0_OUTSTRMPAY    0x18
0027 #define LOLA_BAR0_INSTRMPAY 0x1a
0028 #define LOLA_BAR0_INTCTL    0x20
0029 #define LOLA_BAR0_INTSTS    0x24
0030 #define LOLA_BAR0_WALCLK    0x30
0031 #define LOLA_BAR0_SSYNC     0x38
0032 
0033 #define LOLA_BAR0_CORBLBASE 0x40
0034 #define LOLA_BAR0_CORBUBASE 0x44
0035 #define LOLA_BAR0_CORBWP    0x48    /* no ULONG access */
0036 #define LOLA_BAR0_CORBRP    0x4a    /* no ULONG access */
0037 #define LOLA_BAR0_CORBCTL   0x4c    /* no ULONG access */
0038 #define LOLA_BAR0_CORBSTS   0x4d    /* UCHAR access only */
0039 #define LOLA_BAR0_CORBSIZE  0x4e    /* no ULONG access */
0040 
0041 #define LOLA_BAR0_RIRBLBASE 0x50
0042 #define LOLA_BAR0_RIRBUBASE 0x54
0043 #define LOLA_BAR0_RIRBWP    0x58
0044 #define LOLA_BAR0_RINTCNT   0x5a    /* no ULONG access */
0045 #define LOLA_BAR0_RIRBCTL   0x5c
0046 #define LOLA_BAR0_RIRBSTS   0x5d    /* UCHAR access only */
0047 #define LOLA_BAR0_RIRBSIZE  0x5e    /* no ULONG access */
0048 
0049 #define LOLA_BAR0_ICW       0x60
0050 #define LOLA_BAR0_IRR       0x64
0051 #define LOLA_BAR0_ICS       0x68
0052 #define LOLA_BAR0_DPLBASE   0x70
0053 #define LOLA_BAR0_DPUBASE   0x74
0054 
0055 /* stream register offsets from stream base 0x80 */
0056 #define LOLA_BAR0_SD0_OFFSET    0x80
0057 #define LOLA_REG0_SD_CTL    0x00
0058 #define LOLA_REG0_SD_STS    0x03
0059 #define LOLA_REG0_SD_LPIB   0x04
0060 #define LOLA_REG0_SD_CBL    0x08
0061 #define LOLA_REG0_SD_LVI    0x0c
0062 #define LOLA_REG0_SD_FIFOW  0x0e
0063 #define LOLA_REG0_SD_FIFOSIZE   0x10
0064 #define LOLA_REG0_SD_FORMAT 0x12
0065 #define LOLA_REG0_SD_BDLPL  0x18
0066 #define LOLA_REG0_SD_BDLPU  0x1c
0067 
0068 /*
0069  * Lola Digigram Registers BAR1
0070  */
0071 #define LOLA_BAR1_FPGAVER   0x00
0072 #define LOLA_BAR1_DEVER     0x04
0073 #define LOLA_BAR1_UCBMV     0x08
0074 #define LOLA_BAR1_JTAG      0x0c
0075 #define LOLA_BAR1_UARTRX    0x10
0076 #define LOLA_BAR1_UARTTX    0x14
0077 #define LOLA_BAR1_UARTCR    0x18
0078 #define LOLA_BAR1_NVRAMVER  0x1c
0079 #define LOLA_BAR1_CTRLSPI   0x20
0080 #define LOLA_BAR1_DSPI      0x24
0081 #define LOLA_BAR1_AISPI     0x28
0082 #define LOLA_BAR1_GRAN      0x2c
0083 
0084 #define LOLA_BAR1_DINTCTL   0x80
0085 #define LOLA_BAR1_DIINTCTL  0x84
0086 #define LOLA_BAR1_DOINTCTL  0x88
0087 #define LOLA_BAR1_LRC       0x90
0088 #define LOLA_BAR1_DINTSTS   0x94
0089 #define LOLA_BAR1_DIINTSTS  0x98
0090 #define LOLA_BAR1_DOINTSTS  0x9c
0091 
0092 #define LOLA_BAR1_DSD0_OFFSET   0xa0
0093 #define LOLA_BAR1_DSD_SIZE  0x18
0094 
0095 #define LOLA_BAR1_DSDnSTS       0x00
0096 #define LOLA_BAR1_DSDnLPIB      0x04
0097 #define LOLA_BAR1_DSDnCTL       0x08
0098 #define LOLA_BAR1_DSDnLVI       0x0c
0099 #define LOLA_BAR1_DSDnBDPL      0x10
0100 #define LOLA_BAR1_DSDnBDPU      0x14
0101 
0102 #define LOLA_BAR1_SSYNC     0x03e8
0103 
0104 #define LOLA_BAR1_BOARD_CTRL    0x0f00
0105 #define LOLA_BAR1_BOARD_MODE    0x0f02
0106 
0107 #define LOLA_BAR1_SOURCE_GAIN_ENABLE        0x1000
0108 #define LOLA_BAR1_DEST00_MIX_GAIN_ENABLE    0x1004
0109 #define LOLA_BAR1_DEST31_MIX_GAIN_ENABLE    0x1080
0110 #define LOLA_BAR1_SOURCE00_01_GAIN      0x1084
0111 #define LOLA_BAR1_SOURCE30_31_GAIN      0x10c0
0112 #define LOLA_BAR1_SOURCE_GAIN(src) \
0113     (LOLA_BAR1_SOURCE00_01_GAIN + (src) * 2)
0114 #define LOLA_BAR1_DEST00_MIX00_01_GAIN      0x10c4
0115 #define LOLA_BAR1_DEST00_MIX30_31_GAIN      0x1100
0116 #define LOLA_BAR1_DEST01_MIX00_01_GAIN      0x1104
0117 #define LOLA_BAR1_DEST01_MIX30_31_GAIN      0x1140
0118 #define LOLA_BAR1_DEST31_MIX00_01_GAIN      0x1884
0119 #define LOLA_BAR1_DEST31_MIX30_31_GAIN      0x18c0
0120 #define LOLA_BAR1_MIX_GAIN(dest, mix) \
0121     (LOLA_BAR1_DEST00_MIX00_01_GAIN + (dest) * 0x40 + (mix) * 2)
0122 #define LOLA_BAR1_ANALOG_CLIP_IN        0x18c4
0123 #define LOLA_BAR1_PEAKMETERS_SOURCE00_01    0x18c8
0124 #define LOLA_BAR1_PEAKMETERS_SOURCE30_31    0x1904
0125 #define LOLA_BAR1_PEAKMETERS_SOURCE(src) \
0126     (LOLA_BAR1_PEAKMETERS_SOURCE00_01 + (src) * 2)
0127 #define LOLA_BAR1_PEAKMETERS_DEST00_01      0x1908
0128 #define LOLA_BAR1_PEAKMETERS_DEST30_31      0x1944
0129 #define LOLA_BAR1_PEAKMETERS_DEST(dest) \
0130     (LOLA_BAR1_PEAKMETERS_DEST00_01 + (dest) * 2)
0131 #define LOLA_BAR1_PEAKMETERS_AGC00_01       0x1948
0132 #define LOLA_BAR1_PEAKMETERS_AGC14_15       0x1964
0133 #define LOLA_BAR1_PEAKMETERS_AGC(x) \
0134     (LOLA_BAR1_PEAKMETERS_AGC00_01 + (x) * 2)
0135 
0136 /* GCTL reset bit */
0137 #define LOLA_GCTL_RESET     (1 << 0)
0138 /* GCTL unsolicited response enable bit */
0139 #define LOLA_GCTL_UREN      (1 << 8)
0140 
0141 /* CORB/RIRB control, read/write pointer */
0142 #define LOLA_RBCTL_DMA_EN   0x02    /* enable DMA */
0143 #define LOLA_RBCTL_IRQ_EN   0x01    /* enable IRQ */
0144 #define LOLA_RBRWP_CLR      0x8000  /* read/write pointer clear */
0145 
0146 #define LOLA_RIRB_EX_UNSOL_EV   0x40000000
0147 #define LOLA_RIRB_EX_ERROR  0x80000000
0148 
0149 /* CORB int mask: CMEI[0] */
0150 #define LOLA_CORB_INT_CMEI  0x01
0151 #define LOLA_CORB_INT_MASK  LOLA_CORB_INT_CMEI
0152 
0153 /* RIRB int mask: overrun[2], response[0] */
0154 #define LOLA_RIRB_INT_RESPONSE  0x01
0155 #define LOLA_RIRB_INT_OVERRUN   0x04
0156 #define LOLA_RIRB_INT_MASK  (LOLA_RIRB_INT_RESPONSE | LOLA_RIRB_INT_OVERRUN)
0157 
0158 /* DINTCTL and DINTSTS */
0159 #define LOLA_DINT_GLOBAL    0x80000000 /* global interrupt enable bit */
0160 #define LOLA_DINT_CTRL      0x40000000 /* controller interrupt enable bit */
0161 #define LOLA_DINT_FIFOERR   0x20000000 /* global fifo error enable bit */
0162 #define LOLA_DINT_MUERR     0x10000000 /* global microcontroller underrun error */
0163 
0164 /* DSDnCTL bits */
0165 #define LOLA_DSD_CTL_SRST   0x01    /* stream reset bit */
0166 #define LOLA_DSD_CTL_SRUN   0x02    /* stream DMA start bit */
0167 #define LOLA_DSD_CTL_IOCE   0x04    /* interrupt on completion enable */
0168 #define LOLA_DSD_CTL_DEIE   0x10    /* descriptor error interrupt enable */
0169 #define LOLA_DSD_CTL_VLRCV  0x20    /* valid LRCountValue information in bits 8..31 */
0170 #define LOLA_LRC_MASK       0xffffff00
0171 
0172 /* DSDnSTS */
0173 #define LOLA_DSD_STS_BCIS   0x04    /* buffer completion interrupt status */
0174 #define LOLA_DSD_STS_DESE   0x10    /* descriptor error interrupt */
0175 #define LOLA_DSD_STS_FIFORDY    0x20    /* fifo ready */
0176 
0177 #define LOLA_CORB_ENTRIES   256
0178 
0179 #define MAX_STREAM_IN_COUNT 16
0180 #define MAX_STREAM_OUT_COUNT    16
0181 #define MAX_STREAM_COUNT    16
0182 #define MAX_PINS        MAX_STREAM_COUNT
0183 #define MAX_STREAM_BUFFER_COUNT 16
0184 #define MAX_AUDIO_INOUT_COUNT   16
0185 
0186 #define LOLA_CLOCK_TYPE_INTERNAL    0
0187 #define LOLA_CLOCK_TYPE_AES         1
0188 #define LOLA_CLOCK_TYPE_AES_SYNC    2
0189 #define LOLA_CLOCK_TYPE_WORDCLOCK   3
0190 #define LOLA_CLOCK_TYPE_ETHERSOUND  4
0191 #define LOLA_CLOCK_TYPE_VIDEO       5
0192 
0193 #define LOLA_CLOCK_FORMAT_NONE      0
0194 #define LOLA_CLOCK_FORMAT_NTSC      1
0195 #define LOLA_CLOCK_FORMAT_PAL       2
0196 
0197 #define MAX_SAMPLE_CLOCK_COUNT  48
0198 
0199 /* parameters used with mixer widget's mixer capabilities */
0200 #define LOLA_PEAK_METER_CAN_AGC_MASK        1
0201 #define LOLA_PEAK_METER_CAN_ANALOG_CLIP_MASK    2
0202 
0203 struct lola_bar {
0204     unsigned long addr;
0205     void __iomem *remap_addr;
0206 };
0207 
0208 /* CORB/RIRB */
0209 struct lola_rb {
0210     __le32 *buf;        /* CORB/RIRB buffer, 8 byte per each entry */
0211     dma_addr_t addr;    /* physical address of CORB/RIRB buffer */
0212     unsigned short rp, wp;  /* read/write pointers */
0213     int cmds;       /* number of pending requests */
0214 };
0215 
0216 /* Pin widget setup */
0217 struct lola_pin {
0218     unsigned int nid;
0219     bool is_analog;
0220     unsigned int amp_mute;
0221     unsigned int amp_step_size;
0222     unsigned int amp_num_steps;
0223     unsigned int amp_offset;
0224     unsigned int max_level;
0225     unsigned int config_default_reg;
0226     unsigned int fixed_gain_list_len;
0227     unsigned int cur_gain_step;
0228 };
0229 
0230 struct lola_pin_array {
0231     unsigned int num_pins;
0232     unsigned int num_analog_pins;
0233     struct lola_pin pins[MAX_PINS];
0234 };
0235 
0236 /* Clock widget setup */
0237 struct lola_sample_clock {
0238     unsigned int type;
0239     unsigned int format;
0240     unsigned int freq;
0241 };
0242 
0243 struct lola_clock_widget {
0244     unsigned int nid;
0245     unsigned int items;
0246     unsigned int cur_index;
0247     unsigned int cur_freq;
0248     bool cur_valid;
0249     struct lola_sample_clock sample_clock[MAX_SAMPLE_CLOCK_COUNT];
0250     unsigned int idx_lookup[MAX_SAMPLE_CLOCK_COUNT];
0251 };
0252 
0253 #define LOLA_MIXER_DIM      32
0254 struct lola_mixer_array {
0255     u32 src_gain_enable;
0256     u32 dest_mix_gain_enable[LOLA_MIXER_DIM];
0257     u16 src_gain[LOLA_MIXER_DIM];
0258     u16 dest_mix_gain[LOLA_MIXER_DIM][LOLA_MIXER_DIM];
0259 };
0260 
0261 /* Mixer widget setup */
0262 struct lola_mixer_widget {
0263     unsigned int nid;
0264     unsigned int caps;
0265     struct lola_mixer_array __iomem *array;
0266     struct lola_mixer_array *array_saved;
0267     unsigned int src_stream_outs;
0268     unsigned int src_phys_ins;
0269     unsigned int dest_stream_ins;
0270     unsigned int dest_phys_outs;
0271     unsigned int src_stream_out_ofs;
0272     unsigned int dest_phys_out_ofs;
0273     unsigned int src_mask;
0274     unsigned int dest_mask;
0275 };
0276 
0277 /* Audio stream */
0278 struct lola_stream {
0279     unsigned int nid;   /* audio widget NID */
0280     unsigned int index; /* array index */
0281     unsigned int dsd;   /* DSD index */
0282     bool can_float;
0283     struct snd_pcm_substream *substream; /* assigned PCM substream */
0284     struct lola_stream *master; /* master stream (for multi-channel) */
0285 
0286     /* buffer setup */
0287     unsigned int bufsize;
0288     unsigned int period_bytes;
0289     unsigned int frags;
0290 
0291     /* format + channel setup */
0292     unsigned int format_verb;
0293 
0294     /* flags */
0295     unsigned int opened:1;
0296     unsigned int prepared:1;
0297     unsigned int paused:1;
0298     unsigned int running:1;
0299 };
0300 
0301 #define PLAY    SNDRV_PCM_STREAM_PLAYBACK
0302 #define CAPT    SNDRV_PCM_STREAM_CAPTURE
0303 
0304 struct lola_pcm {
0305     unsigned int num_streams;
0306     struct snd_dma_buffer *bdl; /* BDL buffer */
0307     struct lola_stream streams[MAX_STREAM_COUNT];
0308 };
0309 
0310 /* card instance */
0311 struct lola {
0312     struct snd_card *card;
0313     struct pci_dev *pci;
0314 
0315     /* pci resources */
0316     struct lola_bar bar[2];
0317     int irq;
0318 
0319     /* locks */
0320     spinlock_t reg_lock;
0321     struct mutex open_mutex;
0322 
0323     /* CORB/RIRB */
0324     struct lola_rb corb;
0325     struct lola_rb rirb;
0326     unsigned int res, res_ex;   /* last read values */
0327     /* last command (for debugging) */
0328     unsigned int last_cmd_nid, last_verb, last_data, last_extdata;
0329 
0330     /* CORB/RIRB buffers */
0331     struct snd_dma_buffer *rb;
0332 
0333     /* unsolicited events */
0334     unsigned int last_unsol_res;
0335 
0336     /* streams */
0337     struct lola_pcm pcm[2];
0338 
0339     /* input src */
0340     unsigned int input_src_caps_mask;
0341     unsigned int input_src_mask;
0342 
0343     /* pins */
0344     struct lola_pin_array pin[2];
0345 
0346     /* clock */
0347     struct lola_clock_widget clock;
0348     int ref_count_rate;
0349     unsigned int sample_rate;
0350 
0351     /* mixer */
0352     struct lola_mixer_widget mixer;
0353 
0354     /* hw info */
0355     unsigned int version;
0356     unsigned int lola_caps;
0357 
0358     /* parameters */
0359     unsigned int granularity;
0360     unsigned int sample_rate_min;
0361     unsigned int sample_rate_max;
0362 
0363     /* flags */
0364     unsigned int initialized:1;
0365     unsigned int cold_reset:1;
0366     unsigned int polling_mode:1;
0367 
0368     /* for debugging */
0369     unsigned int debug_res;
0370     unsigned int debug_res_ex;
0371 };
0372 
0373 #define BAR0    0
0374 #define BAR1    1
0375 
0376 /* Helper macros */
0377 #define lola_readl(chip, idx, name) \
0378     readl((chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
0379 #define lola_readw(chip, idx, name) \
0380     readw((chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
0381 #define lola_readb(chip, idx, name) \
0382     readb((chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
0383 #define lola_writel(chip, idx, name, val) \
0384     writel((val), (chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
0385 #define lola_writew(chip, idx, name, val) \
0386     writew((val), (chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
0387 #define lola_writeb(chip, idx, name, val) \
0388     writeb((val), (chip)->bar[idx].remap_addr + LOLA_##idx##_##name)
0389 
0390 #define lola_dsd_read(chip, dsd, name) \
0391     readl((chip)->bar[BAR1].remap_addr + LOLA_BAR1_DSD0_OFFSET + \
0392           (LOLA_BAR1_DSD_SIZE * (dsd)) + LOLA_BAR1_DSDn##name)
0393 #define lola_dsd_write(chip, dsd, name, val) \
0394     writel((val), (chip)->bar[BAR1].remap_addr + LOLA_BAR1_DSD0_OFFSET + \
0395            (LOLA_BAR1_DSD_SIZE * (dsd)) + LOLA_BAR1_DSDn##name)
0396 
0397 /* GET verbs HDAudio */
0398 #define LOLA_VERB_GET_STREAM_FORMAT     0xa00
0399 #define LOLA_VERB_GET_AMP_GAIN_MUTE     0xb00
0400 #define LOLA_VERB_PARAMETERS            0xf00
0401 #define LOLA_VERB_GET_POWER_STATE       0xf05
0402 #define LOLA_VERB_GET_CONV          0xf06
0403 #define LOLA_VERB_GET_UNSOLICITED_RESPONSE  0xf08
0404 #define LOLA_VERB_GET_DIGI_CONVERT_1        0xf0d
0405 #define LOLA_VERB_GET_CONFIG_DEFAULT        0xf1c
0406 #define LOLA_VERB_GET_SUBSYSTEM_ID      0xf20
0407 /* GET verbs Digigram */
0408 #define LOLA_VERB_GET_FIXED_GAIN        0xfc0
0409 #define LOLA_VERB_GET_GAIN_SELECT       0xfc1
0410 #define LOLA_VERB_GET_MAX_LEVEL         0xfc2
0411 #define LOLA_VERB_GET_CLOCK_LIST        0xfc3
0412 #define LOLA_VERB_GET_CLOCK_SELECT      0xfc4
0413 #define LOLA_VERB_GET_CLOCK_STATUS      0xfc5
0414 
0415 /* SET verbs HDAudio */
0416 #define LOLA_VERB_SET_STREAM_FORMAT     0x200
0417 #define LOLA_VERB_SET_AMP_GAIN_MUTE     0x300
0418 #define LOLA_VERB_SET_POWER_STATE       0x705
0419 #define LOLA_VERB_SET_CHANNEL_STREAMID      0x706
0420 #define LOLA_VERB_SET_UNSOLICITED_ENABLE    0x708
0421 #define LOLA_VERB_SET_DIGI_CONVERT_1        0x70d
0422 /* SET verbs Digigram */
0423 #define LOLA_VERB_SET_GAIN_SELECT       0xf81
0424 #define LOLA_VERB_SET_CLOCK_SELECT      0xf84
0425 #define LOLA_VERB_SET_GRANULARITY_STEPS     0xf86
0426 #define LOLA_VERB_SET_SOURCE_GAIN       0xf87
0427 #define LOLA_VERB_SET_MIX_GAIN          0xf88
0428 #define LOLA_VERB_SET_DESTINATION_GAIN      0xf89
0429 #define LOLA_VERB_SET_SRC           0xf8a
0430 
0431 /* Parameter IDs used with LOLA_VERB_PARAMETERS */
0432 #define LOLA_PAR_VENDOR_ID          0x00
0433 #define LOLA_PAR_FUNCTION_TYPE          0x05
0434 #define LOLA_PAR_AUDIO_WIDGET_CAP       0x09
0435 #define LOLA_PAR_PCM                0x0a
0436 #define LOLA_PAR_STREAM_FORMATS         0x0b
0437 #define LOLA_PAR_PIN_CAP            0x0c
0438 #define LOLA_PAR_AMP_IN_CAP         0x0d
0439 #define LOLA_PAR_CONNLIST_LEN           0x0e
0440 #define LOLA_PAR_POWER_STATE            0x0f
0441 #define LOLA_PAR_GPIO_CAP           0x11
0442 #define LOLA_PAR_AMP_OUT_CAP            0x12
0443 #define LOLA_PAR_SPECIFIC_CAPS          0x80
0444 #define LOLA_PAR_FIXED_GAIN_LIST        0x81
0445 
0446 /* extract results of LOLA_PAR_SPECIFIC_CAPS */
0447 #define LOLA_AFG_MIXER_WIDGET_PRESENT(res)  ((res & (1 << 21)) != 0)
0448 #define LOLA_AFG_CLOCK_WIDGET_PRESENT(res)  ((res & (1 << 20)) != 0)
0449 #define LOLA_AFG_INPUT_PIN_COUNT(res)       ((res >> 10) & 0x2ff)
0450 #define LOLA_AFG_OUTPUT_PIN_COUNT(res)      ((res) & 0x2ff)
0451 
0452 /* extract results of LOLA_PAR_AMP_IN_CAP / LOLA_PAR_AMP_OUT_CAP */
0453 #define LOLA_AMP_MUTE_CAPABLE(res)      ((res & (1 << 31)) != 0)
0454 #define LOLA_AMP_STEP_SIZE(res)         ((res >> 24) & 0x7f)
0455 #define LOLA_AMP_NUM_STEPS(res)         ((res >> 12) & 0x3ff)
0456 #define LOLA_AMP_OFFSET(res)            ((res) & 0x3ff)
0457 
0458 #define LOLA_GRANULARITY_MIN        8
0459 #define LOLA_GRANULARITY_MAX        32
0460 #define LOLA_GRANULARITY_STEP       8
0461 
0462 /* parameters used with unsolicited command/response */
0463 #define LOLA_UNSOLICITED_TAG_MASK   0x3f
0464 #define LOLA_UNSOLICITED_TAG        0x1a
0465 #define LOLA_UNSOLICITED_ENABLE     0x80
0466 #define LOLA_UNSOL_RESP_TAG_OFFSET  26
0467 
0468 /* count values in the Vendor Specific Mixer Widget's Audio Widget Capabilities */
0469 #define LOLA_MIXER_SRC_INPUT_PLAY_SEPARATION(res)   ((res >> 2) & 0x1f)
0470 #define LOLA_MIXER_DEST_REC_OUTPUT_SEPARATION(res)  ((res >> 7) & 0x1f)
0471 
0472 int lola_codec_write(struct lola *chip, unsigned int nid, unsigned int verb,
0473              unsigned int data, unsigned int extdata);
0474 int lola_codec_read(struct lola *chip, unsigned int nid, unsigned int verb,
0475             unsigned int data, unsigned int extdata,
0476             unsigned int *val, unsigned int *extval);
0477 int lola_codec_flush(struct lola *chip);
0478 #define lola_read_param(chip, nid, param, val) \
0479     lola_codec_read(chip, nid, LOLA_VERB_PARAMETERS, param, 0, val, NULL)
0480 
0481 /* PCM */
0482 int lola_create_pcm(struct lola *chip);
0483 int lola_init_pcm(struct lola *chip, int dir, int *nidp);
0484 void lola_pcm_update(struct lola *chip, struct lola_pcm *pcm, unsigned int bits);
0485 
0486 /* clock */
0487 int lola_init_clock_widget(struct lola *chip, int nid);
0488 int lola_set_granularity(struct lola *chip, unsigned int val, bool force);
0489 int lola_enable_clock_events(struct lola *chip);
0490 int lola_set_clock_index(struct lola *chip, unsigned int idx);
0491 int lola_set_clock(struct lola *chip, int idx);
0492 int lola_set_sample_rate(struct lola *chip, int rate);
0493 bool lola_update_ext_clock_freq(struct lola *chip, unsigned int val);
0494 unsigned int lola_sample_rate_convert(unsigned int coded);
0495 
0496 /* mixer */
0497 int lola_init_pins(struct lola *chip, int dir, int *nidp);
0498 int lola_init_mixer_widget(struct lola *chip, int nid);
0499 void lola_free_mixer(struct lola *chip);
0500 int lola_create_mixer(struct lola *chip);
0501 int lola_setup_all_analog_gains(struct lola *chip, int dir, bool mute);
0502 void lola_save_mixer(struct lola *chip);
0503 void lola_restore_mixer(struct lola *chip);
0504 int lola_set_src_config(struct lola *chip, unsigned int src_mask, bool update);
0505 
0506 /* proc */
0507 #ifdef CONFIG_SND_DEBUG
0508 void lola_proc_debug_new(struct lola *chip);
0509 #else
0510 #define lola_proc_debug_new(chip)
0511 #endif
0512 
0513 #endif /* _LOLA_H */