Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __SOUND_CS4231_REGS_H
0003 #define __SOUND_CS4231_REGS_H
0004 
0005 /*
0006  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
0007  *  Definitions for CS4231 & InterWave chips & compatible chips registers
0008  */
0009 
0010 /* IO ports */
0011 
0012 #define CS4231P(x)      (c_d_c_CS4231##x)
0013 
0014 #define c_d_c_CS4231REGSEL  0
0015 #define c_d_c_CS4231REG     1
0016 #define c_d_c_CS4231STATUS  2
0017 #define c_d_c_CS4231PIO     3
0018 
0019 /* codec registers */
0020 
0021 #define CS4231_LEFT_INPUT   0x00    /* left input control */
0022 #define CS4231_RIGHT_INPUT  0x01    /* right input control */
0023 #define CS4231_AUX1_LEFT_INPUT  0x02    /* left AUX1 input control */
0024 #define CS4231_AUX1_RIGHT_INPUT 0x03    /* right AUX1 input control */
0025 #define CS4231_AUX2_LEFT_INPUT  0x04    /* left AUX2 input control */
0026 #define CS4231_AUX2_RIGHT_INPUT 0x05    /* right AUX2 input control */
0027 #define CS4231_LEFT_OUTPUT  0x06    /* left output control register */
0028 #define CS4231_RIGHT_OUTPUT 0x07    /* right output control register */
0029 #define CS4231_PLAYBK_FORMAT    0x08    /* clock and data format - playback - bits 7-0 MCE */
0030 #define CS4231_IFACE_CTRL   0x09    /* interface control - bits 7-2 MCE */
0031 #define CS4231_PIN_CTRL     0x0a    /* pin control */
0032 #define CS4231_TEST_INIT    0x0b    /* test and initialization */
0033 #define CS4231_MISC_INFO    0x0c    /* miscellaneous information */
0034 #define CS4231_LOOPBACK     0x0d    /* loopback control */
0035 #define CS4231_PLY_UPR_CNT  0x0e    /* playback upper base count */
0036 #define CS4231_PLY_LWR_CNT  0x0f    /* playback lower base count */
0037 #define CS4231_ALT_FEATURE_1    0x10    /* alternate #1 feature enable */
0038 #define AD1845_AF1_MIC_LEFT 0x10    /* alternate #1 feature + MIC left */
0039 #define CS4231_ALT_FEATURE_2    0x11    /* alternate #2 feature enable */
0040 #define AD1845_AF2_MIC_RIGHT    0x11    /* alternate #2 feature + MIC right */
0041 #define CS4231_LEFT_LINE_IN 0x12    /* left line input control */
0042 #define CS4231_RIGHT_LINE_IN    0x13    /* right line input control */
0043 #define CS4231_TIMER_LOW    0x14    /* timer low byte */
0044 #define CS4231_TIMER_HIGH   0x15    /* timer high byte */
0045 #define CS4231_LEFT_MIC_INPUT   0x16    /* left MIC input control register (InterWave only) */
0046 #define AD1845_UPR_FREQ_SEL 0x16    /* upper byte of frequency select */
0047 #define CS4231_RIGHT_MIC_INPUT  0x17    /* right MIC input control register (InterWave only) */
0048 #define AD1845_LWR_FREQ_SEL 0x17    /* lower byte of frequency select */
0049 #define CS4236_EXT_REG      0x17    /* extended register access */
0050 #define CS4231_IRQ_STATUS   0x18    /* irq status register */
0051 #define CS4231_LINE_LEFT_OUTPUT 0x19    /* left line output control register (InterWave only) */
0052 #define CS4231_VERSION      0x19    /* CS4231(A) - version values */
0053 #define CS4231_MONO_CTRL    0x1a    /* mono input/output control */
0054 #define CS4231_LINE_RIGHT_OUTPUT 0x1b   /* right line output control register (InterWave only) */
0055 #define AD1845_PWR_DOWN     0x1b    /* power down control */
0056 #define CS4235_LEFT_MASTER  0x1b    /* left master output control */
0057 #define CS4231_REC_FORMAT   0x1c    /* clock and data format - record - bits 7-0 MCE */
0058 #define AD1845_CLOCK        0x1d    /* crystal clock select and total power down */
0059 #define CS4235_RIGHT_MASTER 0x1d    /* right master output control */
0060 #define CS4231_REC_UPR_CNT  0x1e    /* record upper count */
0061 #define CS4231_REC_LWR_CNT  0x1f    /* record lower count */
0062 
0063 /* definitions for codec register select port - CODECP( REGSEL ) */
0064 
0065 #define CS4231_INIT     0x80    /* CODEC is initializing */
0066 #define CS4231_MCE      0x40    /* mode change enable */
0067 #define CS4231_TRD      0x20    /* transfer request disable */
0068 
0069 /* definitions for codec status register - CODECP( STATUS ) */
0070 
0071 #define CS4231_GLOBALIRQ    0x01    /* IRQ is active */
0072 
0073 /* definitions for codec irq status */
0074 
0075 #define CS4231_PLAYBACK_IRQ 0x10
0076 #define CS4231_RECORD_IRQ   0x20
0077 #define CS4231_TIMER_IRQ    0x40
0078 #define CS4231_ALL_IRQS     0x70
0079 #define CS4231_REC_UNDERRUN 0x08
0080 #define CS4231_REC_OVERRUN  0x04
0081 #define CS4231_PLY_OVERRUN  0x02
0082 #define CS4231_PLY_UNDERRUN 0x01
0083 
0084 /* definitions for CS4231_LEFT_INPUT and CS4231_RIGHT_INPUT registers */
0085 
0086 #define CS4231_ENABLE_MIC_GAIN  0x20
0087 
0088 #define CS4231_MIXS_LINE    0x00
0089 #define CS4231_MIXS_AUX1    0x40
0090 #define CS4231_MIXS_MIC     0x80
0091 #define CS4231_MIXS_ALL     0xc0
0092 
0093 /* definitions for clock and data format register - CS4231_PLAYBK_FORMAT */
0094 
0095 #define CS4231_LINEAR_8     0x00    /* 8-bit unsigned data */
0096 #define CS4231_ALAW_8       0x60    /* 8-bit A-law companded */
0097 #define CS4231_ULAW_8       0x20    /* 8-bit U-law companded */
0098 #define CS4231_LINEAR_16    0x40    /* 16-bit twos complement data - little endian */
0099 #define CS4231_LINEAR_16_BIG    0xc0    /* 16-bit twos complement data - big endian */
0100 #define CS4231_ADPCM_16     0xa0    /* 16-bit ADPCM */
0101 #define CS4231_STEREO       0x10    /* stereo mode */
0102 /* bits 3-1 define frequency divisor */
0103 #define CS4231_XTAL1        0x00    /* 24.576 crystal */
0104 #define CS4231_XTAL2        0x01    /* 16.9344 crystal */
0105 
0106 /* definitions for interface control register - CS4231_IFACE_CTRL */
0107 
0108 #define CS4231_RECORD_PIO   0x80    /* record PIO enable */
0109 #define CS4231_PLAYBACK_PIO 0x40    /* playback PIO enable */
0110 #define CS4231_CALIB_MODE   0x18    /* calibration mode bits */
0111 #define CS4231_AUTOCALIB    0x08    /* auto calibrate */
0112 #define CS4231_SINGLE_DMA   0x04    /* use single DMA channel */
0113 #define CS4231_RECORD_ENABLE    0x02    /* record enable */
0114 #define CS4231_PLAYBACK_ENABLE  0x01    /* playback enable */
0115 
0116 /* definitions for pin control register - CS4231_PIN_CTRL */
0117 
0118 #define CS4231_IRQ_ENABLE   0x02    /* enable IRQ */
0119 #define CS4231_XCTL1        0x40    /* external control #1 */
0120 #define CS4231_XCTL0        0x80    /* external control #0 */
0121 
0122 /* definitions for test and init register - CS4231_TEST_INIT */
0123 
0124 #define CS4231_CALIB_IN_PROGRESS 0x20   /* auto calibrate in progress */
0125 #define CS4231_DMA_REQUEST  0x10    /* DMA request in progress */
0126 
0127 /* definitions for misc control register - CS4231_MISC_INFO */
0128 
0129 #define CS4231_MODE2        0x40    /* MODE 2 */
0130 #define CS4231_IW_MODE3     0x6c    /* MODE 3 - InterWave enhanced mode */
0131 #define CS4231_4236_MODE3   0xe0    /* MODE 3 - CS4236+ enhanced mode */
0132 
0133 /* definitions for alternate feature 1 register - CS4231_ALT_FEATURE_1 */
0134 
0135 #define CS4231_DACZ     0x01    /* zero DAC when underrun */
0136 #define CS4231_TIMER_ENABLE 0x40    /* codec timer enable */
0137 #define CS4231_OLB      0x80    /* output level bit */
0138 
0139 /* definitions for Extended Registers - CS4236+ */
0140 
0141 #define CS4236_REG(i23val)  (((i23val << 2) & 0x10) | ((i23val >> 4) & 0x0f))
0142 #define CS4236_I23VAL(reg)  ((((reg)&0xf) << 4) | (((reg)&0x10) >> 2) | 0x8)
0143 
0144 #define CS4236_LEFT_LINE    0x08    /* left LINE alternate volume */
0145 #define CS4236_RIGHT_LINE   0x18    /* right LINE alternate volume */
0146 #define CS4236_LEFT_MIC     0x28    /* left MIC volume */
0147 #define CS4236_RIGHT_MIC    0x38    /* right MIC volume */
0148 #define CS4236_LEFT_MIX_CTRL    0x48    /* synthesis and left input mixer control */
0149 #define CS4236_RIGHT_MIX_CTRL   0x58    /* right input mixer control */
0150 #define CS4236_LEFT_FM      0x68    /* left FM volume */
0151 #define CS4236_RIGHT_FM     0x78    /* right FM volume */
0152 #define CS4236_LEFT_DSP     0x88    /* left DSP serial port volume */
0153 #define CS4236_RIGHT_DSP    0x98    /* right DSP serial port volume */
0154 #define CS4236_RIGHT_LOOPBACK   0xa8    /* right loopback monitor volume */
0155 #define CS4236_DAC_MUTE     0xb8    /* DAC mute and IFSE enable */
0156 #define CS4236_ADC_RATE     0xc8    /* indenpendent ADC sample frequency */
0157 #define CS4236_DAC_RATE     0xd8    /* indenpendent DAC sample frequency */
0158 #define CS4236_LEFT_MASTER  0xe8    /* left master digital audio volume */
0159 #define CS4236_RIGHT_MASTER 0xf8    /* right master digital audio volume */
0160 #define CS4236_LEFT_WAVE    0x0c    /* left wavetable serial port volume */
0161 #define CS4236_RIGHT_WAVE   0x1c    /* right wavetable serial port volume */
0162 #define CS4236_VERSION      0x9c    /* chip version and ID */
0163 
0164 /* definitions for extended registers - OPTI93X */
0165 #define OPTi931_AUX_LEFT_INPUT  0x10
0166 #define OPTi931_AUX_RIGHT_INPUT 0x11
0167 #define OPTi93X_MIC_LEFT_INPUT  0x14
0168 #define OPTi93X_MIC_RIGHT_INPUT 0x15
0169 #define OPTi93X_OUT_LEFT    0x16
0170 #define OPTi93X_OUT_RIGHT   0x17
0171 
0172 #endif /* __SOUND_CS4231_REGS_H */