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