| Flemmard | 49aa69d | 2013-05-23 15:30:36 -0700 | [diff] [blame] | 1 | /* include/linux/a1028.h - a1028 voice processor driver | 
 | 2 |  * | 
 | 3 |  * Copyright (C) 2009 HTC Corporation. | 
 | 4 |  * | 
 | 5 |  * This software is licensed under the terms of the GNU General Public | 
 | 6 |  * License version 2, as published by the Free Software Foundation, and | 
 | 7 |  * may be copied, distributed, and modified under those terms. | 
 | 8 |  * | 
 | 9 |  * This program is distributed in the hope that it will be useful, | 
 | 10 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 11 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 12 |  * GNU General Public License for more details. | 
 | 13 |  * | 
 | 14 |  */ | 
 | 15 |  | 
 | 16 | #ifndef __LINUX_A1028_H | 
 | 17 | #define __LINUX_A1028_H | 
 | 18 |  | 
 | 19 | #include <linux/ioctl.h> | 
 | 20 |  | 
 | 21 | #define A1028_I2C_NAME "audience_a1028" | 
 | 22 | #define A1028_MAX_FW_SIZE	(32*1024) | 
 | 23 | struct a1028img { | 
 | 24 | 	unsigned char *buf; | 
 | 25 | 	unsigned img_size; | 
 | 26 | }; | 
 | 27 |  | 
 | 28 | enum A1028_PathID { | 
 | 29 | 	A1028_PATH_SUSPEND, | 
 | 30 | 	A1028_PATH_INCALL_RECEIVER, | 
 | 31 | 	A1028_PATH_INCALL_HEADSET, | 
 | 32 | 	A1028_PATH_INCALL_SPEAKER, | 
 | 33 | 	A1028_PATH_INCALL_BT, | 
 | 34 | 	A1028_PATH_VR_NO_NS_RECEIVER, | 
 | 35 | 	A1028_PATH_VR_NO_NS_HEADSET, | 
 | 36 | 	A1028_PATH_VR_NO_NS_SPEAKER, | 
 | 37 | 	A1028_PATH_VR_NO_NS_BT, | 
 | 38 | 	A1028_PATH_VR_NS_RECEIVER, | 
 | 39 | 	A1028_PATH_VR_NS_HEADSET, | 
 | 40 | 	A1028_PATH_VR_NS_SPEAKER, | 
 | 41 | 	A1028_PATH_VR_NS_BT, | 
 | 42 | 	A1028_PATH_RECORD_RECEIVER, | 
 | 43 | 	A1028_PATH_RECORD_HEADSET, | 
 | 44 | 	A1028_PATH_RECORD_SPEAKER, | 
 | 45 | 	A1028_PATH_RECORD_BT, | 
 | 46 | 	A1028_PATH_CAMCORDER, | 
 | 47 | 	A1028_PATH_INCALL_TTY, | 
 | 48 | 	A1028_PATH_MFG_LOOPBACK, | 
 | 49 | 	A1028_PATH_MAX | 
 | 50 | }; | 
 | 51 |  | 
 | 52 | struct A1028_config_data { | 
 | 53 | 	unsigned int data_len; | 
 | 54 | 	unsigned int mode_num; | 
 | 55 | 	unsigned char *cmd_data;   | 
 | 56 | }; | 
 | 57 |  | 
 | 58 | enum A1028_NS_states { | 
 | 59 | 	A1028_NS_STATE_AUTO,	 | 
 | 60 | 	A1028_NS_STATE_OFF,	 | 
 | 61 | 	A1028_NS_STATE_CT,	 | 
 | 62 | 	A1028_NS_STATE_FT,	 | 
 | 63 | 	A1028_NS_NUM_STATES | 
 | 64 | }; | 
 | 65 |  | 
 | 66 | #define A1028_IOCTL_MAGIC 'u' | 
 | 67 |  | 
 | 68 | #define A1028_BOOTUP_INIT  _IOW(A1028_IOCTL_MAGIC, 0x01, struct a1028img *) | 
 | 69 | #define A1028_SET_CONFIG   _IOW(A1028_IOCTL_MAGIC, 0x02, enum A1028_PathID) | 
 | 70 | #define A1028_SET_NS_STATE _IOW(A1028_IOCTL_MAGIC, 0x03, enum A1028_NS_states) | 
 | 71 | #define A1028_SET_PARAM	   _IOW(A1028_IOCTL_MAGIC, 0x04,  unsigned) | 
 | 72 | #define A1028_SET_MIC_ONOFF	_IOW(A1028_IOCTL_MAGIC, 0x50, unsigned) | 
 | 73 | #define A1028_SET_MICSEL_ONOFF	_IOW(A1028_IOCTL_MAGIC, 0x51, unsigned) | 
 | 74 | #define A1028_READ_DATA		_IOR(A1028_IOCTL_MAGIC, 0x52, unsigned) | 
 | 75 | #define A1028_WRITE_MSG		_IOW(A1028_IOCTL_MAGIC, 0x53, unsigned) | 
 | 76 | #define A1028_SYNC_CMD		_IO(A1028_IOCTL_MAGIC, 0x54) | 
 | 77 | #define A1028_SET_CMD_FILE	_IOW(A1028_IOCTL_MAGIC, 0x55, unsigned) | 
 | 78 |  | 
 | 79 | #ifdef __KERNEL__ | 
 | 80 |  | 
 | 81 | #define CtrlMode_LAL		0x0001  | 
 | 82 | #define CtrlMode_LAH		0x0002  | 
 | 83 | #define CtrlMode_FE		0x0003  | 
 | 84 | #define CtrlMode_RE		0x0004  | 
 | 85 | #define A100_msg_Sync		0x80000000 | 
 | 86 | #define A100_msg_Sync_Ack	0x80000000 | 
 | 87 |  | 
 | 88 | #define A100_msg_Reset		0x8002 | 
 | 89 | #define RESET_IMMEDIATE		0x0000 | 
 | 90 | #define RESET_DELAYED		0x0001 | 
 | 91 |  | 
 | 92 | #define A100_msg_BootloadInitiate	0x8003 | 
 | 93 | #define A100_msg_GetDeviceParm		0x800B | 
 | 94 | #define A100_msg_SetDeviceParmID	0x800C | 
 | 95 | #define A100_msg_SetDeviceParm		0x800D | 
 | 96 |  | 
 | 97 | #define PCM0WordLength		0x0100 | 
 | 98 | #define PCM0DelFromFsTx		0x0101 | 
 | 99 | #define PCM0DelFromFsRx		0x0102 | 
 | 100 | #define PCM0LatchEdge		0x0103 | 
 | 101 | #define PCM0Endianness		0x0105 | 
 | 102 | #define PCM0TristateEnable	0x0107 | 
 | 103 |  | 
 | 104 | #define PCM1WordLength		0x0200 | 
 | 105 | #define PCM1DelFromFsTx		0x0201 | 
 | 106 | #define PCM1DelFromFsRx		0x0202 | 
 | 107 | #define PCM1LatchEdge		0x0203 | 
 | 108 | #define PCM1Endianness		0x0205 | 
 | 109 | #define PCM1TristateEnable	0x0207 | 
 | 110 |  | 
 | 111 | #define PCMWordLength_16bit	0x10  | 
 | 112 | #define PCMWordLength_24bit	0x18 | 
 | 113 | #define PCMWordLength_32bit	0x20 | 
 | 114 | #define PCMLatchEdge_Tx_F_Rx_R	0x00  | 
 | 115 | #define PCMLatchEdge_Tx_R_Rx_F	0x03  | 
 | 116 | #define PCMEndianness_Little	0x00 | 
 | 117 | #define PCMEndianness_Big	0x01  | 
 | 118 | #define PCMTristate_Disable	0x00  | 
 | 119 | #define PCMTristate_Enable	0x01 | 
 | 120 |  | 
 | 121 | #define ADC0Gain	0x0300 | 
 | 122 | #define ADC0Rate	0x0301 | 
 | 123 | #define ADC0CutoffFreq	0x0302 | 
 | 124 |  | 
 | 125 | #define ADC1Gain	0x0400 | 
 | 126 | #define ADC1Rate	0x0401 | 
 | 127 | #define ADC1CutoffFreq	0x0402 | 
 | 128 |  | 
 | 129 | #define ADC_Gain_0db			0x00 | 
 | 130 | #define ADC_Gain_6db			0x01 | 
 | 131 | #define ADC_Gain_12db			0x02 | 
 | 132 | #define ADC_Gain_18db			0x03 | 
 | 133 | #define ADC_Gain_24db			0x04  | 
 | 134 | #define ADC_Gain_30db			0x05 | 
 | 135 | #define ADC_Rate_8kHz			0x00  | 
 | 136 | #define ADC_Rate_16kHz			0x01 | 
 | 137 | #define ADC_CutoffFreq_NO_DC_Filter	0x00 | 
 | 138 | #define ADC_CutoffFreq_59p68Hz		0x01  | 
 | 139 | #define ADC_CutoffFreq_7p46Hz		0x02 | 
 | 140 | #define ADC_CutoffFreq_3p73Hz		0x03 | 
 | 141 |  | 
 | 142 | #define A100_msg_Sleep		0x80100001 | 
 | 143 |  | 
 | 144 | #define A100_msg_GetAlgorithmParm	0x8016 | 
 | 145 | #define A100_msg_SetAlgorithmParmID	0x8017 | 
 | 146 | #define A100_msg_SetAlgorithmParm	0x8018 | 
 | 147 |  | 
 | 148 | #define AIS_Global_Supression_Level	0x0000 | 
 | 149 | #define Mic_Config			0x0002 | 
 | 150 | #define AEC_Mode			0x0003 | 
 | 151 | #define AEC_CNG				0x0023 | 
 | 152 | #define Output_AGC			0x0004 | 
 | 153 | #define Output_AGC_Target_Level		0x0005 | 
 | 154 | #define Output_AGC_Noise_Floor		0x0006 | 
 | 155 | #define Output_AGC_SNR_Improvement	0x0007 | 
 | 156 | #define Comfort_Noise			0x001A | 
 | 157 | #define Comfort_Noise_Level		0x001B | 
 | 158 |  | 
 | 159 | #define Speaker_Volume			0x0012 | 
 | 160 | #define VEQ_Mode			0x0009 | 
 | 161 | #define VEQ_Max_FarEnd_Limiter_Level	0x000D | 
 | 162 | #define VEQ_Noise_Estimation_Adj	0x0025 | 
 | 163 | #define Receive_NS			0x000E | 
 | 164 | #define Receive_NS_Level		0x000F | 
 | 165 | #define SideTone			0x0015 | 
 | 166 | #define SideTone_Gain			0x0016 | 
 | 167 |  | 
 | 168 | #define A100_msg_GetTxDigitalInputGain  0x801A | 
 | 169 | #define A100_msg_SetTxDigitalInputGain  0x801B | 
 | 170 |  | 
 | 171 | #define A100_msg_GetRcvDigitalInputGain 0x8022 | 
 | 172 | #define A100_msg_SetRcvDigitalInputGain 0x8023 | 
 | 173 |  | 
 | 174 | #define A100_msg_GetTxDigitalOutputGain 0x801D | 
 | 175 | #define A100_msg_SetTxDigitalOutputGain 0x8015 | 
 | 176 |  | 
 | 177 | #define A100_msg_Bypass		0x801C  | 
 | 178 | #define A1028_msg_VP_ON		0x801C0001 | 
 | 179 | #define A1028_msg_VP_OFF	0x801C0000 | 
 | 180 |  | 
 | 181 | #define A100_msg_GetMicRMS	0x8013 | 
 | 182 | #define A100_msg_GetMicPeak	0x8014 | 
 | 183 | #define DiagPath_Pri_Input_Mic	0x0000 | 
 | 184 | #define DiagPath_Sec_Input_Mic	0x0001 | 
 | 185 | #define DiagPath_Output_Mic	0x0002 | 
 | 186 | #define DiagPath_Far_End_Input	0x0003 | 
 | 187 | #define DiagPath_Far_End_Output	0x0004 | 
 | 188 | #define A100_msg_SwapInputCh	0x8019 | 
 | 189 | #define A100_msg_OutputKnownSig	0x801E | 
 | 190 |  | 
 | 191 | #define A1028_msg_BOOT		0x0001 | 
 | 192 | #define A1028_msg_BOOT_ACK	0x01 | 
 | 193 |  | 
 | 194 | #define TIMEOUT			20  | 
 | 195 | #define RETRY_CNT		5 | 
 | 196 | #define POLLING_RETRY_CNT	3 | 
 | 197 | #define A1028_ERROR_CODE	0xffff | 
 | 198 | #define A1028_SLEEP		0 | 
 | 199 | #define A1028_ACTIVE		1 | 
 | 200 | #define A1028_CMD_FIFO_DEPTH	64 | 
 | 201 |  | 
 | 202 | enum A1028_config_mode { | 
 | 203 | 	A1028_CONFIG_FULL, | 
 | 204 | 	A1028_CONFIG_VP | 
 | 205 | }; | 
 | 206 |  | 
 | 207 | struct a1028_platform_data { | 
 | 208 | 	uint32_t gpio_a1028_micsel; | 
 | 209 | 	uint32_t gpio_a1028_wakeup; | 
 | 210 | 	uint32_t gpio_a1028_reset; | 
 | 211 | 	uint32_t gpio_a1028_int; | 
 | 212 | 	uint32_t gpio_a1028_clk; | 
 | 213 | 	uint32_t gpio_a1028_micswitch; | 
 | 214 | }; | 
 | 215 |  | 
 | 216 |  | 
 | 217 | #endif  | 
 | 218 | #endif  |