Daniel Drake | b8b88b7 | 2017-06-12 11:01:45 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright Everest Semiconductor Co.,Ltd |
| 3 | * |
| 4 | * Author: David Yang <yangxiaohua@everest-semi.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | * |
| 10 | */ |
| 11 | |
| 12 | #ifndef _ES8316_H |
| 13 | #define _ES8316_H |
| 14 | |
| 15 | /* |
| 16 | * ES8316 register space |
| 17 | */ |
| 18 | |
| 19 | /* Reset Control */ |
| 20 | #define ES8316_RESET 0x00 |
| 21 | |
| 22 | /* Clock Management */ |
| 23 | #define ES8316_CLKMGR_CLKSW 0x01 |
| 24 | #define ES8316_CLKMGR_CLKSEL 0x02 |
| 25 | #define ES8316_CLKMGR_ADCOSR 0x03 |
| 26 | #define ES8316_CLKMGR_ADCDIV1 0x04 |
| 27 | #define ES8316_CLKMGR_ADCDIV2 0x05 |
| 28 | #define ES8316_CLKMGR_DACDIV1 0x06 |
| 29 | #define ES8316_CLKMGR_DACDIV2 0x07 |
| 30 | #define ES8316_CLKMGR_CPDIV 0x08 |
| 31 | |
| 32 | /* Serial Data Port Control */ |
| 33 | #define ES8316_SERDATA1 0x09 |
| 34 | #define ES8316_SERDATA_ADC 0x0a |
| 35 | #define ES8316_SERDATA_DAC 0x0b |
| 36 | |
| 37 | /* System Control */ |
| 38 | #define ES8316_SYS_VMIDSEL 0x0c |
| 39 | #define ES8316_SYS_PDN 0x0d |
| 40 | #define ES8316_SYS_LP1 0x0e |
| 41 | #define ES8316_SYS_LP2 0x0f |
| 42 | #define ES8316_SYS_VMIDLOW 0x10 |
| 43 | #define ES8316_SYS_VSEL 0x11 |
| 44 | #define ES8316_SYS_REF 0x12 |
| 45 | |
| 46 | /* Headphone Mixer */ |
| 47 | #define ES8316_HPMIX_SEL 0x13 |
| 48 | #define ES8316_HPMIX_SWITCH 0x14 |
| 49 | #define ES8316_HPMIX_PDN 0x15 |
| 50 | #define ES8316_HPMIX_VOL 0x16 |
| 51 | |
| 52 | /* Charge Pump Headphone driver */ |
| 53 | #define ES8316_CPHP_OUTEN 0x17 |
| 54 | #define ES8316_CPHP_ICAL_VOL 0x18 |
| 55 | #define ES8316_CPHP_PDN1 0x19 |
| 56 | #define ES8316_CPHP_PDN2 0x1a |
| 57 | #define ES8316_CPHP_LDOCTL 0x1b |
| 58 | |
| 59 | /* Calibration */ |
| 60 | #define ES8316_CAL_TYPE 0x1c |
| 61 | #define ES8316_CAL_SET 0x1d |
| 62 | #define ES8316_CAL_HPLIV 0x1e |
| 63 | #define ES8316_CAL_HPRIV 0x1f |
| 64 | #define ES8316_CAL_HPLMV 0x20 |
| 65 | #define ES8316_CAL_HPRMV 0x21 |
| 66 | |
| 67 | /* ADC Control */ |
| 68 | #define ES8316_ADC_PDN_LINSEL 0x22 |
| 69 | #define ES8316_ADC_PGAGAIN 0x23 |
| 70 | #define ES8316_ADC_D2SEPGA 0x24 |
| 71 | #define ES8316_ADC_DMIC 0x25 |
| 72 | #define ES8316_ADC_MUTE 0x26 |
| 73 | #define ES8316_ADC_VOLUME 0x27 |
| 74 | #define ES8316_ADC_ALC1 0x29 |
| 75 | #define ES8316_ADC_ALC2 0x2a |
| 76 | #define ES8316_ADC_ALC3 0x2b |
| 77 | #define ES8316_ADC_ALC4 0x2c |
| 78 | #define ES8316_ADC_ALC5 0x2d |
| 79 | #define ES8316_ADC_ALC_NG 0x2e |
| 80 | |
| 81 | /* DAC Control */ |
| 82 | #define ES8316_DAC_PDN 0x2f |
| 83 | #define ES8316_DAC_SET1 0x30 |
| 84 | #define ES8316_DAC_SET2 0x31 |
| 85 | #define ES8316_DAC_SET3 0x32 |
| 86 | #define ES8316_DAC_VOLL 0x33 |
| 87 | #define ES8316_DAC_VOLR 0x34 |
| 88 | |
| 89 | /* GPIO */ |
| 90 | #define ES8316_GPIO_SEL 0x4d |
| 91 | #define ES8316_GPIO_DEBOUNCE 0x4e |
| 92 | #define ES8316_GPIO_FLAG 0x4f |
| 93 | |
| 94 | /* Test mode */ |
| 95 | #define ES8316_TESTMODE 0x50 |
| 96 | #define ES8316_TEST1 0x51 |
| 97 | #define ES8316_TEST2 0x52 |
| 98 | #define ES8316_TEST3 0x53 |
| 99 | |
| 100 | /* |
| 101 | * Field definitions |
| 102 | */ |
| 103 | |
| 104 | /* ES8316_RESET */ |
| 105 | #define ES8316_RESET_CSM_ON 0x80 |
| 106 | |
| 107 | /* ES8316_CLKMGR_CLKSW */ |
| 108 | #define ES8316_CLKMGR_CLKSW_MCLK_ON 0x40 |
| 109 | #define ES8316_CLKMGR_CLKSW_BCLK_ON 0x20 |
| 110 | |
| 111 | /* ES8316_SERDATA1 */ |
| 112 | #define ES8316_SERDATA1_MASTER 0x80 |
| 113 | #define ES8316_SERDATA1_BCLK_INV 0x20 |
| 114 | |
| 115 | /* ES8316_SERDATA_ADC and _DAC */ |
| 116 | #define ES8316_SERDATA2_FMT_MASK 0x3 |
| 117 | #define ES8316_SERDATA2_FMT_I2S 0x00 |
| 118 | #define ES8316_SERDATA2_FMT_LEFTJ 0x01 |
| 119 | #define ES8316_SERDATA2_FMT_RIGHTJ 0x02 |
| 120 | #define ES8316_SERDATA2_FMT_PCM 0x03 |
| 121 | #define ES8316_SERDATA2_ADCLRP 0x20 |
| 122 | #define ES8316_SERDATA2_LEN_MASK 0x1c |
| 123 | #define ES8316_SERDATA2_LEN_24 0x00 |
| 124 | #define ES8316_SERDATA2_LEN_20 0x04 |
| 125 | #define ES8316_SERDATA2_LEN_18 0x08 |
| 126 | #define ES8316_SERDATA2_LEN_16 0x0c |
| 127 | #define ES8316_SERDATA2_LEN_32 0x10 |
| 128 | |
| 129 | #endif |