Home | History | Annotate | Download | only in linux
      1 #ifndef _UAPI_MSM_AUDIO_CALIBRATION_H
      2 #define _UAPI_MSM_AUDIO_CALIBRATION_H
      3 
      4 #include <linux/types.h>
      5 #include <linux/ioctl.h>
      6 
      7 #define CAL_IOCTL_MAGIC 'a'
      8 
      9 #define AUDIO_ALLOCATE_CALIBRATION	_IOWR(CAL_IOCTL_MAGIC, \
     10 							200, void *)
     11 #define AUDIO_DEALLOCATE_CALIBRATION	_IOWR(CAL_IOCTL_MAGIC, \
     12 							201, void *)
     13 #define AUDIO_PREPARE_CALIBRATION	_IOWR(CAL_IOCTL_MAGIC, \
     14 							202, void *)
     15 #define AUDIO_SET_CALIBRATION		_IOWR(CAL_IOCTL_MAGIC, \
     16 							203, void *)
     17 #define AUDIO_GET_CALIBRATION		_IOWR(CAL_IOCTL_MAGIC, \
     18 							204, void *)
     19 #define AUDIO_POST_CALIBRATION		_IOWR(CAL_IOCTL_MAGIC, \
     20 							205, void *)
     21 
     22 /* For Real-Time Audio Calibration */
     23 #define AUDIO_GET_RTAC_ADM_INFO		_IOR(CAL_IOCTL_MAGIC, \
     24 							207, void *)
     25 #define AUDIO_GET_RTAC_VOICE_INFO	_IOR(CAL_IOCTL_MAGIC, \
     26 							208, void *)
     27 #define AUDIO_GET_RTAC_ADM_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     28 							209, void *)
     29 #define AUDIO_SET_RTAC_ADM_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     30 							210, void *)
     31 #define AUDIO_GET_RTAC_ASM_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     32 							211, void *)
     33 #define AUDIO_SET_RTAC_ASM_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     34 							212, void *)
     35 #define AUDIO_GET_RTAC_CVS_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     36 							213, void *)
     37 #define AUDIO_SET_RTAC_CVS_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     38 							214, void *)
     39 #define AUDIO_GET_RTAC_CVP_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     40 							215, void *)
     41 #define AUDIO_SET_RTAC_CVP_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     42 							216, void *)
     43 #define AUDIO_GET_RTAC_AFE_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     44 							217, void *)
     45 #define AUDIO_SET_RTAC_AFE_CAL		_IOWR(CAL_IOCTL_MAGIC, \
     46 							218, void *)
     47 enum {
     48 	CVP_VOC_RX_TOPOLOGY_CAL_TYPE = 0,
     49 	CVP_VOC_TX_TOPOLOGY_CAL_TYPE,
     50 	CVP_VOCPROC_STATIC_CAL_TYPE,
     51 	CVP_VOCPROC_DYNAMIC_CAL_TYPE,
     52 	CVS_VOCSTRM_STATIC_CAL_TYPE,
     53 	CVP_VOCDEV_CFG_CAL_TYPE,
     54 	CVP_VOCPROC_STATIC_COL_CAL_TYPE,
     55 	CVP_VOCPROC_DYNAMIC_COL_CAL_TYPE,
     56 	CVS_VOCSTRM_STATIC_COL_CAL_TYPE,
     57 
     58 	ADM_TOPOLOGY_CAL_TYPE,
     59 	ADM_CUST_TOPOLOGY_CAL_TYPE,
     60 	ADM_AUDPROC_CAL_TYPE,
     61 	ADM_AUDVOL_CAL_TYPE,
     62 
     63 	ASM_TOPOLOGY_CAL_TYPE,
     64 	ASM_CUST_TOPOLOGY_CAL_TYPE,
     65 	ASM_AUDSTRM_CAL_TYPE,
     66 
     67 	AFE_COMMON_RX_CAL_TYPE,
     68 	AFE_COMMON_TX_CAL_TYPE,
     69 	AFE_ANC_CAL_TYPE,
     70 	AFE_AANC_CAL_TYPE,
     71 	AFE_FB_SPKR_PROT_CAL_TYPE,
     72 	AFE_HW_DELAY_CAL_TYPE,
     73 	AFE_SIDETONE_CAL_TYPE,
     74 
     75 	LSM_CUST_TOPOLOGY_CAL_TYPE,
     76 	LSM_TOPOLOGY_CAL_TYPE,
     77 	LSM_CAL_TYPE,
     78 
     79 	ADM_RTAC_INFO_CAL_TYPE,
     80 	VOICE_RTAC_INFO_CAL_TYPE,
     81 	ADM_RTAC_APR_CAL_TYPE,
     82 	ASM_RTAC_APR_CAL_TYPE,
     83 	VOICE_RTAC_APR_CAL_TYPE,
     84 
     85 	MAD_CAL_TYPE,
     86 	ULP_AFE_CAL_TYPE,
     87 	ULP_LSM_CAL_TYPE,
     88 
     89 	DTS_EAGLE_CAL_TYPE,
     90 	AUDIO_CORE_METAINFO_CAL_TYPE,
     91 
     92 	MAX_CAL_TYPES,
     93 };
     94 
     95 enum {
     96 	VERSION_0_0,
     97 };
     98 
     99 enum {
    100 	PER_VOCODER_CAL_BIT_MASK = 0x10000,
    101 };
    102 
    103 #define MAX_IOCTL_CMD_SIZE	512
    104 
    105 /* common structures */
    106 
    107 struct audio_cal_header {
    108 	int32_t		data_size;
    109 	int32_t		version;
    110 	int32_t		cal_type;
    111 	int32_t		cal_type_size;
    112 };
    113 
    114 struct audio_cal_type_header {
    115 	int32_t		version;
    116 	int32_t		buffer_number;
    117 };
    118 
    119 struct audio_cal_data {
    120 	/* Size of cal data at mem_handle allocation or at vaddr */
    121 	int32_t		cal_size;
    122 	/* If mem_handle if shared memory is used*/
    123 	int32_t		mem_handle;
    124 	/* size of virtual memory if shared memory not used */
    125 };
    126 
    127 
    128 /* AUDIO_ALLOCATE_CALIBRATION */
    129 struct audio_cal_type_alloc {
    130 	struct audio_cal_type_header	cal_hdr;
    131 	struct audio_cal_data		cal_data;
    132 };
    133 
    134 struct audio_cal_alloc {
    135 	struct audio_cal_header		hdr;
    136 	struct audio_cal_type_alloc	cal_type;
    137 };
    138 
    139 
    140 /* AUDIO_DEALLOCATE_CALIBRATION */
    141 struct audio_cal_type_dealloc {
    142 	struct audio_cal_type_header	cal_hdr;
    143 	struct audio_cal_data		cal_data;
    144 };
    145 
    146 struct audio_cal_dealloc {
    147 	struct audio_cal_header		hdr;
    148 	struct audio_cal_type_dealloc	cal_type;
    149 };
    150 
    151 
    152 /* AUDIO_PREPARE_CALIBRATION */
    153 struct audio_cal_type_prepare {
    154 	struct audio_cal_type_header	cal_hdr;
    155 	struct audio_cal_data		cal_data;
    156 };
    157 
    158 struct audio_cal_prepare {
    159 	struct audio_cal_header		hdr;
    160 	struct audio_cal_type_prepare	cal_type;
    161 };
    162 
    163 
    164 /* AUDIO_POST_CALIBRATION */
    165 struct audio_cal_type_post {
    166 	struct audio_cal_type_header	cal_hdr;
    167 	struct audio_cal_data		cal_data;
    168 };
    169 
    170 struct audio_cal_post {
    171 	struct audio_cal_header		hdr;
    172 	struct audio_cal_type_post	cal_type;
    173 };
    174 
    175 /*AUDIO_CORE_META_INFO */
    176 
    177 struct audio_cal_info_metainfo {
    178 	uint32_t nKey;
    179 };
    180 
    181 /* Cal info types */
    182 enum {
    183 	RX_DEVICE,
    184 	TX_DEVICE,
    185 	MAX_PATH_TYPE
    186 };
    187 
    188 struct audio_cal_info_adm_top {
    189 	int32_t		topology;
    190 	int32_t		acdb_id;
    191 	/* RX_DEVICE or TX_DEVICE */
    192 	int32_t		path;
    193 	int32_t		app_type;
    194 };
    195 
    196 struct audio_cal_info_audproc {
    197 	int32_t		acdb_id;
    198 	/* RX_DEVICE or TX_DEVICE */
    199 	int32_t		path;
    200 	int32_t		app_type;
    201 	int32_t		sample_rate;
    202 };
    203 
    204 struct audio_cal_info_audvol {
    205 	int32_t		acdb_id;
    206 	/* RX_DEVICE or TX_DEVICE */
    207 	int32_t		path;
    208 	int32_t		app_type;
    209 	int32_t		vol_index;
    210 };
    211 
    212 struct audio_cal_info_afe {
    213 	int32_t		acdb_id;
    214 	/* RX_DEVICE or TX_DEVICE */
    215 	int32_t		path;
    216 	int32_t		sample_rate;
    217 };
    218 
    219 struct audio_cal_info_asm_top {
    220 	int32_t		topology;
    221 	int32_t		app_type;
    222 };
    223 
    224 struct audio_cal_info_audstrm {
    225 	int32_t		app_type;
    226 };
    227 
    228 struct audio_cal_info_aanc {
    229 	int32_t		acdb_id;
    230 };
    231 
    232 #define MAX_HW_DELAY_ENTRIES	25
    233 
    234 struct audio_cal_hw_delay_entry {
    235 	uint32_t sample_rate;
    236 	uint32_t delay_usec;
    237 };
    238 
    239 struct audio_cal_hw_delay_data {
    240 	uint32_t				num_entries;
    241 	struct audio_cal_hw_delay_entry		entry[MAX_HW_DELAY_ENTRIES];
    242 };
    243 
    244 struct audio_cal_info_hw_delay {
    245 	int32_t					acdb_id;
    246 	/* RX_DEVICE or TX_DEVICE */
    247 	int32_t					path;
    248 	int32_t					property_type;
    249 	struct audio_cal_hw_delay_data		data;
    250 };
    251 
    252 enum msm_spkr_prot_states {
    253 	MSM_SPKR_PROT_CALIBRATED,
    254 	MSM_SPKR_PROT_CALIBRATION_IN_PROGRESS,
    255 	MSM_SPKR_PROT_DISABLED,
    256 	MSM_SPKR_PROT_NOT_CALIBRATED
    257 };
    258 
    259 struct audio_cal_info_spk_prot_cfg {
    260 	int32_t		r0;
    261 	int32_t		t0;
    262 	uint32_t	mode; /*0 - Start spk prot
    263 	1 - Start calib
    264 	2 - Disable spk prot*/
    265 };
    266 
    267 struct audio_cal_info_msm_spk_prot_status {
    268 	int32_t		r0;
    269 	int32_t		status;
    270 };
    271 
    272 struct audio_cal_info_sidetone {
    273 	uint16_t	enable;
    274 	uint16_t	gain;
    275 	int32_t		tx_acdb_id;
    276 	int32_t		rx_acdb_id;
    277 	int32_t		mid;
    278 	int32_t		pid;
    279 };
    280 
    281 struct audio_cal_info_lsm_top {
    282 	int32_t		topology;
    283 	int32_t		acdb_id;
    284 	int32_t		app_type;
    285 };
    286 
    287 
    288 struct audio_cal_info_lsm {
    289 	int32_t		acdb_id;
    290 	/* RX_DEVICE or TX_DEVICE */
    291 	int32_t		path;
    292 	int32_t		app_type;
    293 };
    294 
    295 struct audio_cal_info_voc_top {
    296 	int32_t		topology;
    297 	int32_t		acdb_id;
    298 };
    299 
    300 struct audio_cal_info_vocproc {
    301 	int32_t		tx_acdb_id;
    302 	int32_t		rx_acdb_id;
    303 	int32_t		tx_sample_rate;
    304 	int32_t		rx_sample_rate;
    305 };
    306 
    307 enum {
    308 	DEFAULT_FEATURE_SET,
    309 	VOL_BOOST_FEATURE_SET,
    310 };
    311 
    312 struct audio_cal_info_vocvol {
    313 	int32_t		tx_acdb_id;
    314 	int32_t		rx_acdb_id;
    315 	/* DEFUALT_ or VOL_BOOST_FEATURE_SET */
    316 	int32_t		feature_set;
    317 };
    318 
    319 struct audio_cal_info_vocdev_cfg {
    320 	int32_t		tx_acdb_id;
    321 	int32_t		rx_acdb_id;
    322 };
    323 
    324 #define MAX_VOICE_COLUMNS	20
    325 
    326 union audio_cal_col_na {
    327 	uint8_t		val8;
    328 	uint16_t	val16;
    329 	uint32_t	val32;
    330 	uint64_t	val64;
    331 } __packed;
    332 
    333 struct audio_cal_col {
    334 	uint32_t		id;
    335 	uint32_t		type;
    336 	union audio_cal_col_na	na_value;
    337 } __packed;
    338 
    339 struct audio_cal_col_data {
    340 	uint32_t		num_columns;
    341 	struct audio_cal_col	column[MAX_VOICE_COLUMNS];
    342 } __packed;
    343 
    344 struct audio_cal_info_voc_col {
    345 	int32_t				table_id;
    346 	int32_t				tx_acdb_id;
    347 	int32_t				rx_acdb_id;
    348 	struct audio_cal_col_data	data;
    349 };
    350 
    351 /* AUDIO_SET_CALIBRATION & */
    352 struct audio_cal_type_basic {
    353 	struct audio_cal_type_header	cal_hdr;
    354 	struct audio_cal_data		cal_data;
    355 };
    356 
    357 struct audio_cal_basic {
    358 	struct audio_cal_header		hdr;
    359 	struct audio_cal_type_basic	cal_type;
    360 };
    361 
    362 struct audio_cal_type_adm_top {
    363 	struct audio_cal_type_header	cal_hdr;
    364 	struct audio_cal_data		cal_data;
    365 	struct audio_cal_info_adm_top	cal_info;
    366 };
    367 
    368 struct audio_cal_adm_top {
    369 	struct audio_cal_header		hdr;
    370 	struct audio_cal_type_adm_top	cal_type;
    371 };
    372 
    373 struct audio_cal_type_metainfo {
    374 	struct audio_cal_type_header	cal_hdr;
    375 	struct audio_cal_data		cal_data;
    376 	struct audio_cal_info_metainfo	cal_info;
    377 };
    378 
    379 struct audio_core_metainfo {
    380 	struct audio_cal_header	  hdr;
    381 	struct audio_cal_type_metainfo cal_type;
    382 };
    383 
    384 struct audio_cal_type_audproc {
    385 	struct audio_cal_type_header	cal_hdr;
    386 	struct audio_cal_data		cal_data;
    387 	struct audio_cal_info_audproc	cal_info;
    388 };
    389 
    390 struct audio_cal_audproc {
    391 	struct audio_cal_header		hdr;
    392 	struct audio_cal_type_audproc	cal_type;
    393 };
    394 
    395 struct audio_cal_type_audvol {
    396 	struct audio_cal_type_header	cal_hdr;
    397 	struct audio_cal_data		cal_data;
    398 	struct audio_cal_info_audvol	cal_info;
    399 };
    400 
    401 struct audio_cal_audvol {
    402 	struct audio_cal_header		hdr;
    403 	struct audio_cal_type_audvol	cal_type;
    404 };
    405 
    406 struct audio_cal_type_asm_top {
    407 	struct audio_cal_type_header	cal_hdr;
    408 	struct audio_cal_data		cal_data;
    409 	struct audio_cal_info_asm_top	cal_info;
    410 };
    411 
    412 struct audio_cal_asm_top {
    413 	struct audio_cal_header		hdr;
    414 	struct audio_cal_type_asm_top	cal_type;
    415 };
    416 
    417 struct audio_cal_type_audstrm {
    418 	struct audio_cal_type_header	cal_hdr;
    419 	struct audio_cal_data		cal_data;
    420 	struct audio_cal_info_audstrm	cal_info;
    421 };
    422 
    423 struct audio_cal_audstrm {
    424 	struct audio_cal_header		hdr;
    425 	struct audio_cal_type_audstrm	cal_type;
    426 };
    427 
    428 struct audio_cal_type_afe {
    429 	struct audio_cal_type_header	cal_hdr;
    430 	struct audio_cal_data		cal_data;
    431 	struct audio_cal_info_afe	cal_info;
    432 };
    433 
    434 struct audio_cal_afe {
    435 	struct audio_cal_header		hdr;
    436 	struct audio_cal_type_afe	cal_type;
    437 };
    438 
    439 struct audio_cal_type_aanc {
    440 	struct audio_cal_type_header	cal_hdr;
    441 	struct audio_cal_data		cal_data;
    442 	struct audio_cal_info_aanc	cal_info;
    443 };
    444 
    445 struct audio_cal_aanc {
    446 	struct audio_cal_header		hdr;
    447 	struct audio_cal_type_aanc	cal_type;
    448 };
    449 
    450 struct audio_cal_type_fb_spk_prot_cfg {
    451 	struct audio_cal_type_header		cal_hdr;
    452 	struct audio_cal_data			cal_data;
    453 	struct audio_cal_info_spk_prot_cfg	cal_info;
    454 };
    455 
    456 struct audio_cal_fb_spk_prot_cfg {
    457 	struct audio_cal_header			hdr;
    458 	struct audio_cal_type_fb_spk_prot_cfg	cal_type;
    459 };
    460 
    461 struct audio_cal_type_hw_delay {
    462 	struct audio_cal_type_header	cal_hdr;
    463 	struct audio_cal_data		cal_data;
    464 	struct audio_cal_info_hw_delay	cal_info;
    465 };
    466 
    467 struct audio_cal_hw_delay {
    468 	struct audio_cal_header		hdr;
    469 	struct audio_cal_type_hw_delay	cal_type;
    470 };
    471 
    472 struct audio_cal_type_sidetone {
    473 	struct audio_cal_type_header		cal_hdr;
    474 	struct audio_cal_data			cal_data;
    475 	struct audio_cal_info_sidetone		cal_info;
    476 };
    477 
    478 struct audio_cal_sidetone {
    479 	struct audio_cal_header			hdr;
    480 	struct audio_cal_type_sidetone		cal_type;
    481 };
    482 
    483 struct audio_cal_type_lsm_top {
    484 	struct audio_cal_type_header	cal_hdr;
    485 	struct audio_cal_data		cal_data;
    486 	struct audio_cal_info_lsm_top	cal_info;
    487 };
    488 
    489 struct audio_cal_lsm_top {
    490 	struct audio_cal_header		hdr;
    491 	struct audio_cal_type_lsm_top	cal_type;
    492 };
    493 
    494 struct audio_cal_type_lsm {
    495 	struct audio_cal_type_header	cal_hdr;
    496 	struct audio_cal_data		cal_data;
    497 	struct audio_cal_info_lsm	cal_info;
    498 };
    499 
    500 struct audio_cal_lsm {
    501 	struct audio_cal_header		hdr;
    502 	struct audio_cal_type_lsm	cal_type;
    503 };
    504 
    505 struct audio_cal_type_voc_top {
    506 	struct audio_cal_type_header	cal_hdr;
    507 	struct audio_cal_data		cal_data;
    508 	struct audio_cal_info_voc_top	cal_info;
    509 };
    510 
    511 struct audio_cal_voc_top {
    512 	struct audio_cal_header		hdr;
    513 	struct audio_cal_type_voc_top	cal_type;
    514 };
    515 
    516 struct audio_cal_type_vocproc {
    517 	struct audio_cal_type_header	cal_hdr;
    518 	struct audio_cal_data		cal_data;
    519 	struct audio_cal_info_vocproc	cal_info;
    520 };
    521 
    522 struct audio_cal_vocproc {
    523 	struct audio_cal_header		hdr;
    524 	struct audio_cal_type_vocproc	cal_type;
    525 };
    526 
    527 struct audio_cal_type_vocvol {
    528 	struct audio_cal_type_header	cal_hdr;
    529 	struct audio_cal_data		cal_data;
    530 	struct audio_cal_info_vocvol	cal_info;
    531 };
    532 
    533 struct audio_cal_vocvol {
    534 	struct audio_cal_header		hdr;
    535 	struct audio_cal_type_vocvol	cal_type;
    536 };
    537 
    538 struct audio_cal_type_vocdev_cfg {
    539 	struct audio_cal_type_header		cal_hdr;
    540 	struct audio_cal_data			cal_data;
    541 	struct audio_cal_info_vocdev_cfg	cal_info;
    542 };
    543 
    544 struct audio_cal_vocdev_cfg {
    545 	struct audio_cal_header			hdr;
    546 	struct audio_cal_type_vocdev_cfg	cal_type;
    547 };
    548 
    549 struct audio_cal_type_voc_col {
    550 	struct audio_cal_type_header	cal_hdr;
    551 	struct audio_cal_data		cal_data;
    552 	struct audio_cal_info_voc_col	cal_info;
    553 };
    554 
    555 struct audio_cal_voc_col {
    556 	struct audio_cal_header		hdr;
    557 	struct audio_cal_type_voc_col	cal_type;
    558 };
    559 
    560 /* AUDIO_GET_CALIBRATION */
    561 struct audio_cal_type_fb_spk_prot_status {
    562 	struct audio_cal_type_header			cal_hdr;
    563 	struct audio_cal_data				cal_data;
    564 	struct audio_cal_info_msm_spk_prot_status	cal_info;
    565 };
    566 
    567 struct audio_cal_fb_spk_prot_status {
    568 	struct audio_cal_header				hdr;
    569 	struct audio_cal_type_fb_spk_prot_status	cal_type;
    570 };
    571 
    572 #endif /* _UAPI_MSM_AUDIO_CALIBRATION_H */
    573