1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 2 /* 3 * The MIPI SDCA specification is available for public downloads at 4 * https://www.mipi.org/mipi-sdca-v1-0-download 5 * 6 * Copyright(c) 2024 Intel Corporation 7 */ 8 9 #ifndef __SDCA_FUNCTION_H__ 10 #define __SDCA_FUNCTION_H__ 11 12 #include <linux/bits.h> 13 #include <linux/types.h> 14 #include <linux/hid.h> 15 16 struct acpi_table_swft; 17 struct device; 18 struct sdca_entity; 19 struct sdca_function_desc; 20 21 #define SDCA_NO_INTERRUPT -1 22 23 /* 24 * The addressing space for SDCA relies on 7 bits for Entities, so a 25 * maximum of 128 Entities per function can be represented. 26 */ 27 #define SDCA_MAX_ENTITY_COUNT 128 28 29 /* 30 * Sanity check on number of initialization writes, can be expanded if needed. 31 */ 32 #define SDCA_MAX_INIT_COUNT 2048 33 34 /* 35 * The Cluster IDs are 16-bit, so a maximum of 65535 Clusters per 36 * function can be represented, however limit this to a slightly 37 * more reasonable value. Can be expanded if needed. 38 */ 39 #define SDCA_MAX_CLUSTER_COUNT 256 40 41 /* 42 * Sanity check on number of channels per Cluster, can be expanded if needed. 43 */ 44 #define SDCA_MAX_CHANNEL_COUNT 32 45 46 /* 47 * Sanity check on number of PDE delays, can be expanded if needed. 48 */ 49 #define SDCA_MAX_DELAY_COUNT 256 50 51 /* 52 * Sanity check on size of affected controls data, can be expanded if needed. 53 */ 54 #define SDCA_MAX_AFFECTED_COUNT 2048 55 56 /** 57 * enum sdca_function_type - SDCA Function Type codes 58 * @SDCA_FUNCTION_TYPE_SMART_AMP: Amplifier with protection features. 59 * @SDCA_FUNCTION_TYPE_SIMPLE_AMP: Subset of SmartAmp. 60 * @SDCA_FUNCTION_TYPE_SMART_MIC: Smart microphone with acoustic triggers. 61 * @SDCA_FUNCTION_TYPE_SIMPLE_MIC: Subset of SmartMic. 62 * @SDCA_FUNCTION_TYPE_SPEAKER_MIC: Combination of SmartMic and SmartAmp. 63 * @SDCA_FUNCTION_TYPE_UAJ: 3.5mm Universal Audio jack. 64 * @SDCA_FUNCTION_TYPE_RJ: Retaskable jack. 65 * @SDCA_FUNCTION_TYPE_SIMPLE_JACK: Subset of UAJ. 66 * @SDCA_FUNCTION_TYPE_HID: Human Interface Device, for e.g. buttons. 67 * @SDCA_FUNCTION_TYPE_IMP_DEF: Implementation-defined function. 68 * 69 * SDCA Function Types from SDCA specification v1.0a Section 5.1.2 70 * all Function types not described are reserved. 71 * 72 * Note that SIMPLE_AMP, SIMPLE_MIC and SIMPLE_JACK Function Types 73 * are NOT defined in SDCA 1.0a, but they were defined in earlier 74 * drafts and are planned for 1.1. 75 */ 76 enum sdca_function_type { 77 SDCA_FUNCTION_TYPE_SMART_AMP = 0x01, 78 SDCA_FUNCTION_TYPE_SIMPLE_AMP = 0x02, 79 SDCA_FUNCTION_TYPE_SMART_MIC = 0x03, 80 SDCA_FUNCTION_TYPE_SIMPLE_MIC = 0x04, 81 SDCA_FUNCTION_TYPE_SPEAKER_MIC = 0x05, 82 SDCA_FUNCTION_TYPE_UAJ = 0x06, 83 SDCA_FUNCTION_TYPE_RJ = 0x07, 84 SDCA_FUNCTION_TYPE_SIMPLE_JACK = 0x08, 85 SDCA_FUNCTION_TYPE_HID = 0x0A, 86 SDCA_FUNCTION_TYPE_IMP_DEF = 0x1F, 87 }; 88 89 /* Human-readable names used for kernel logs and Function device registration/bind */ 90 #define SDCA_FUNCTION_TYPE_SMART_AMP_NAME "SmartAmp" 91 #define SDCA_FUNCTION_TYPE_SIMPLE_AMP_NAME "SimpleAmp" 92 #define SDCA_FUNCTION_TYPE_SMART_MIC_NAME "SmartMic" 93 #define SDCA_FUNCTION_TYPE_SIMPLE_MIC_NAME "SimpleMic" 94 #define SDCA_FUNCTION_TYPE_SPEAKER_MIC_NAME "SpeakerMic" 95 #define SDCA_FUNCTION_TYPE_UAJ_NAME "UAJ" 96 #define SDCA_FUNCTION_TYPE_RJ_NAME "RJ" 97 #define SDCA_FUNCTION_TYPE_SIMPLE_NAME "SimpleJack" 98 #define SDCA_FUNCTION_TYPE_HID_NAME "HID" 99 #define SDCA_FUNCTION_TYPE_IMP_DEF_NAME "ImplementationDefined" 100 101 /** 102 * struct sdca_init_write - a single initialization write 103 * @addr: Register address to be written 104 * @val: Single byte value to be written 105 */ 106 struct sdca_init_write { 107 u32 addr; 108 u8 val; 109 }; 110 111 /** 112 * define SDCA_CTL_TYPE - create a unique identifier for an SDCA Control 113 * @ent: Entity Type code. 114 * @sel: Control Selector code. 115 * 116 * Sometimes there is a need to identify a type of Control, for example to 117 * determine what name the control should have. SDCA Selectors are reused 118 * across Entity types, as such it is necessary to combine both the Entity 119 * Type and the Control Selector to obtain a unique identifier. 120 */ 121 #define SDCA_CTL_TYPE(ent, sel) ((ent) << 8 | (sel)) 122 123 /** 124 * define SDCA_CTL_TYPE_S - static version of SDCA_CTL_TYPE 125 * @ent: Entity name, for example IT, MFPU, etc. this string can be read 126 * from the last characters of the SDCA_ENTITY_TYPE_* macros. 127 * @sel: Control Selector name, for example MIC_BIAS, MUTE, etc. this 128 * string can be read from the last characters of the SDCA_CTL_*_* 129 * macros. 130 * 131 * Short hand to specific a Control type statically for example: 132 * SDCA_CTL_TYPE_S(IT, MIC_BIAS). 133 */ 134 #define SDCA_CTL_TYPE_S(ent, sel) SDCA_CTL_TYPE(SDCA_ENTITY_TYPE_##ent, \ 135 SDCA_CTL_##ent##_##sel) 136 137 /** 138 * enum sdca_messageoffset_range - Column definitions UMP MessageOffset 139 */ 140 enum sdca_messageoffset_range { 141 SDCA_MESSAGEOFFSET_BUFFER_START_ADDRESS = 0, 142 SDCA_MESSAGEOFFSET_BUFFER_LENGTH = 1, 143 SDCA_MESSAGEOFFSET_UMP_MODE = 2, 144 SDCA_MESSAGEOFFSET_NCOLS = 3, 145 }; 146 147 /** 148 * enum sdca_ump_mode - SDCA UMP Mode 149 */ 150 enum sdca_ump_mode { 151 SDCA_UMP_MODE_DIRECT = 0x00, 152 SDCA_UMP_MODE_INDIRECT = 0x01, 153 }; 154 155 /** 156 * enum sdca_ump_owner - SDCA UMP Owner 157 */ 158 enum sdca_ump_owner { 159 SDCA_UMP_OWNER_HOST = 0x00, 160 SDCA_UMP_OWNER_DEVICE = 0x01, 161 }; 162 163 /** 164 * enum sdca_it_controls - SDCA Controls for Input Terminal 165 * 166 * Control Selectors for Input Terminal from SDCA specification v1.0 167 * section 6.2.1.3. 168 */ 169 enum sdca_it_controls { 170 SDCA_CTL_IT_MIC_BIAS = 0x03, 171 SDCA_CTL_IT_USAGE = 0x04, 172 SDCA_CTL_IT_LATENCY = 0x08, 173 SDCA_CTL_IT_CLUSTERINDEX = 0x10, 174 SDCA_CTL_IT_DATAPORT_SELECTOR = 0x11, 175 SDCA_CTL_IT_MATCHING_GUID = 0x12, 176 SDCA_CTL_IT_KEEP_ALIVE = 0x13, 177 SDCA_CTL_IT_NDAI_STREAM = 0x14, 178 SDCA_CTL_IT_NDAI_CATEGORY = 0x15, 179 SDCA_CTL_IT_NDAI_CODINGTYPE = 0x16, 180 SDCA_CTL_IT_NDAI_PACKETTYPE = 0x17, 181 }; 182 183 /** 184 * enum sdca_ot_controls - SDCA Controls for Output Terminal 185 * 186 * Control Selectors for Output Terminal from SDCA specification v1.0 187 * section 6.2.2.3. 188 */ 189 enum sdca_ot_controls { 190 SDCA_CTL_OT_USAGE = 0x04, 191 SDCA_CTL_OT_LATENCY = 0x08, 192 SDCA_CTL_OT_DATAPORT_SELECTOR = 0x11, 193 SDCA_CTL_OT_MATCHING_GUID = 0x12, 194 SDCA_CTL_OT_KEEP_ALIVE = 0x13, 195 SDCA_CTL_OT_NDAI_STREAM = 0x14, 196 SDCA_CTL_OT_NDAI_CATEGORY = 0x15, 197 SDCA_CTL_OT_NDAI_CODINGTYPE = 0x16, 198 SDCA_CTL_OT_NDAI_PACKETTYPE = 0x17, 199 }; 200 201 /** 202 * enum sdca_usage_range - Column definitions for Usage 203 */ 204 enum sdca_usage_range { 205 SDCA_USAGE_NUMBER = 0, 206 SDCA_USAGE_CBN = 1, 207 SDCA_USAGE_SAMPLE_RATE = 2, 208 SDCA_USAGE_SAMPLE_WIDTH = 3, 209 SDCA_USAGE_FULL_SCALE = 4, 210 SDCA_USAGE_NOISE_FLOOR = 5, 211 SDCA_USAGE_TAG = 6, 212 SDCA_USAGE_NCOLS = 7, 213 }; 214 215 /** 216 * enum sdca_dataport_selector_range - Column definitions for DataPort_Selector 217 */ 218 enum sdca_dataport_selector_range { 219 SDCA_DATAPORT_SELECTOR_NCOLS = 16, 220 SDCA_DATAPORT_SELECTOR_NROWS = 4, 221 }; 222 223 /** 224 * enum sdca_mu_controls - SDCA Controls for Mixer Unit 225 * 226 * Control Selectors for Mixer Unit from SDCA specification v1.0 227 * section 6.3.4.2. 228 */ 229 enum sdca_mu_controls { 230 SDCA_CTL_MU_MIXER = 0x01, 231 SDCA_CTL_MU_LATENCY = 0x06, 232 }; 233 234 /** 235 * enum sdca_su_controls - SDCA Controls for Selector Unit 236 * 237 * Control Selectors for Selector Unit from SDCA specification v1.0 238 * section 6.3.8.3. 239 */ 240 enum sdca_su_controls { 241 SDCA_CTL_SU_SELECTOR = 0x01, 242 SDCA_CTL_SU_LATENCY = 0x02, 243 }; 244 245 /** 246 * enum sdca_fu_controls - SDCA Controls for Feature Unit 247 * 248 * Control Selectors for Feature Unit from SDCA specification v1.0 249 * section 6.3.2.3. 250 */ 251 enum sdca_fu_controls { 252 SDCA_CTL_FU_MUTE = 0x01, 253 SDCA_CTL_FU_CHANNEL_VOLUME = 0x02, 254 SDCA_CTL_FU_AGC = 0x07, 255 SDCA_CTL_FU_BASS_BOOST = 0x09, 256 SDCA_CTL_FU_LOUDNESS = 0x0A, 257 SDCA_CTL_FU_GAIN = 0x0B, 258 SDCA_CTL_FU_LATENCY = 0x10, 259 }; 260 261 /** 262 * enum sdca_volume_range - Column definitions for Q7.8dB volumes/gains 263 */ 264 enum sdca_volume_range { 265 SDCA_VOLUME_LINEAR_MIN = 0, 266 SDCA_VOLUME_LINEAR_MAX = 1, 267 SDCA_VOLUME_LINEAR_STEP = 2, 268 SDCA_VOLUME_LINEAR_NCOLS = 3, 269 }; 270 271 /** 272 * enum sdca_xu_controls - SDCA Controls for Extension Unit 273 * 274 * Control Selectors for Extension Unit from SDCA specification v1.0 275 * section 6.3.10.3. 276 */ 277 enum sdca_xu_controls { 278 SDCA_CTL_XU_BYPASS = 0x01, 279 SDCA_CTL_XU_LATENCY = 0x06, 280 SDCA_CTL_XU_XU_ID = 0x07, 281 SDCA_CTL_XU_XU_VERSION = 0x08, 282 SDCA_CTL_XU_FDL_CURRENTOWNER = 0x10, 283 SDCA_CTL_XU_FDL_MESSAGEOFFSET = 0x12, 284 SDCA_CTL_XU_FDL_MESSAGELENGTH = 0x13, 285 SDCA_CTL_XU_FDL_STATUS = 0x14, 286 SDCA_CTL_XU_FDL_SET_INDEX = 0x15, 287 SDCA_CTL_XU_FDL_HOST_REQUEST = 0x16, 288 289 /* FDL Status Host->Device bit definitions */ 290 SDCA_CTL_XU_FDLH_TRANSFERRED_CHUNK = BIT(0), 291 SDCA_CTL_XU_FDLH_TRANSFERRED_FILE = BIT(1), 292 SDCA_CTL_XU_FDLH_SET_IN_PROGRESS = BIT(2), 293 SDCA_CTL_XU_FDLH_RESET_ACK = BIT(4), 294 SDCA_CTL_XU_FDLH_REQ_ABORT = BIT(5), 295 /* FDL Status Device->Host bit definitions */ 296 SDCA_CTL_XU_FDLD_REQ_RESET = BIT(4), 297 SDCA_CTL_XU_FDLD_REQ_ABORT = BIT(5), 298 SDCA_CTL_XU_FDLD_ACK_TRANSFER = BIT(6), 299 SDCA_CTL_XU_FDLD_NEEDS_SET = BIT(7), 300 }; 301 302 /** 303 * enum sdca_set_index_range - Column definitions UMP SetIndex 304 */ 305 enum sdca_fdl_set_index_range { 306 SDCA_FDL_SET_INDEX_SET_NUMBER = 0, 307 SDCA_FDL_SET_INDEX_FILE_SET_ID = 1, 308 SDCA_FDL_SET_INDEX_NCOLS = 2, 309 }; 310 311 /** 312 * enum sdca_cs_controls - SDCA Controls for Clock Source 313 * 314 * Control Selectors for Clock Source from SDCA specification v1.0 315 * section 6.4.1.3. 316 */ 317 enum sdca_cs_controls { 318 SDCA_CTL_CS_CLOCK_VALID = 0x02, 319 SDCA_CTL_CS_SAMPLERATEINDEX = 0x10, 320 }; 321 322 /** 323 * enum sdca_samplerateindex_range - Column definitions for SampleRateIndex 324 */ 325 enum sdca_samplerateindex_range { 326 SDCA_SAMPLERATEINDEX_INDEX = 0, 327 SDCA_SAMPLERATEINDEX_RATE = 1, 328 SDCA_SAMPLERATEINDEX_NCOLS = 2, 329 }; 330 331 /** 332 * enum sdca_cx_controls - SDCA Controls for Clock Selector 333 * 334 * Control Selectors for Clock Selector from SDCA specification v1.0 335 * section 6.4.2.3. 336 */ 337 enum sdca_cx_controls { 338 SDCA_CTL_CX_CLOCK_SELECT = 0x01, 339 }; 340 341 /** 342 * enum sdca_pde_controls - SDCA Controls for Power Domain Entity 343 * 344 * Control Selectors for Power Domain Entity from SDCA specification 345 * v1.0 section 6.5.2.2. 346 */ 347 enum sdca_pde_controls { 348 SDCA_CTL_PDE_REQUESTED_PS = 0x01, 349 SDCA_CTL_PDE_ACTUAL_PS = 0x10, 350 }; 351 352 /** 353 * enum sdca_requested_ps_range - Column definitions for Requested PS 354 */ 355 enum sdca_requested_ps_range { 356 SDCA_REQUESTED_PS_STATE = 0, 357 SDCA_REQUESTED_PS_NCOLS = 1, 358 }; 359 360 /** 361 * enum sdca_ge_controls - SDCA Controls for Group Unit 362 * 363 * Control Selectors for Group Unit from SDCA specification v1.0 364 * section 6.5.1.4. 365 */ 366 enum sdca_ge_controls { 367 SDCA_CTL_GE_SELECTED_MODE = 0x01, 368 SDCA_CTL_GE_DETECTED_MODE = 0x02, 369 }; 370 371 /** 372 * enum sdca_selected_mode_range - Column definitions for Selected Mode 373 */ 374 enum sdca_selected_mode_range { 375 SDCA_SELECTED_MODE_INDEX = 0, 376 SDCA_SELECTED_MODE_TERM_TYPE = 1, 377 SDCA_SELECTED_MODE_NCOLS = 2, 378 }; 379 380 /** 381 * enum sdca_detected_mode_values - Predefined GE Detected Mode values 382 */ 383 enum sdca_detected_mode_values { 384 SDCA_DETECTED_MODE_JACK_UNPLUGGED = 0, 385 SDCA_DETECTED_MODE_JACK_UNKNOWN = 1, 386 SDCA_DETECTED_MODE_DETECTION_IN_PROGRESS = 2, 387 }; 388 389 /** 390 * enum sdca_spe_controls - SDCA Controls for Security & Privacy Unit 391 * 392 * Control Selectors for Security & Privacy Unit from SDCA 393 * specification v1.0 Section 6.5.3.2. 394 */ 395 enum sdca_spe_controls { 396 SDCA_CTL_SPE_PRIVATE = 0x01, 397 SDCA_CTL_SPE_PRIVACY_POLICY = 0x02, 398 SDCA_CTL_SPE_PRIVACY_LOCKSTATE = 0x03, 399 SDCA_CTL_SPE_PRIVACY_OWNER = 0x04, 400 SDCA_CTL_SPE_AUTHTX_CURRENTOWNER = 0x10, 401 SDCA_CTL_SPE_AUTHTX_MESSAGEOFFSET = 0x12, 402 SDCA_CTL_SPE_AUTHTX_MESSAGELENGTH = 0x13, 403 SDCA_CTL_SPE_AUTHRX_CURRENTOWNER = 0x14, 404 SDCA_CTL_SPE_AUTHRX_MESSAGEOFFSET = 0x16, 405 SDCA_CTL_SPE_AUTHRX_MESSAGELENGTH = 0x17, 406 }; 407 408 /** 409 * enum sdca_cru_controls - SDCA Controls for Channel Remapping Unit 410 * 411 * Control Selectors for Channel Remapping Unit from SDCA 412 * specification v1.0 Section 6.3.1.3. 413 */ 414 enum sdca_cru_controls { 415 SDCA_CTL_CRU_LATENCY = 0x06, 416 SDCA_CTL_CRU_CLUSTERINDEX = 0x10, 417 }; 418 419 /** 420 * enum sdca_udmpu_controls - SDCA Controls for Up-Down Mixer Processing Unit 421 * 422 * Control Selectors for Up-Down Mixer Processing Unit from SDCA 423 * specification v1.0 Section 6.3.9.3. 424 */ 425 enum sdca_udmpu_controls { 426 SDCA_CTL_UDMPU_LATENCY = 0x06, 427 SDCA_CTL_UDMPU_CLUSTERINDEX = 0x10, 428 SDCA_CTL_UDMPU_ACOUSTIC_ENERGY_LEVEL_MONITOR = 0x11, 429 SDCA_CTL_UDMPU_ULTRASOUND_LOOP_GAIN = 0x12, 430 SDCA_CTL_UDMPU_OPAQUESET_0 = 0x18, 431 SDCA_CTL_UDMPU_OPAQUESET_1 = 0x19, 432 SDCA_CTL_UDMPU_OPAQUESET_2 = 0x1A, 433 SDCA_CTL_UDMPU_OPAQUESET_3 = 0x1B, 434 SDCA_CTL_UDMPU_OPAQUESET_4 = 0x1C, 435 SDCA_CTL_UDMPU_OPAQUESET_5 = 0x1D, 436 SDCA_CTL_UDMPU_OPAQUESET_6 = 0x1E, 437 SDCA_CTL_UDMPU_OPAQUESET_7 = 0x1F, 438 SDCA_CTL_UDMPU_OPAQUESET_8 = 0x20, 439 SDCA_CTL_UDMPU_OPAQUESET_9 = 0x21, 440 SDCA_CTL_UDMPU_OPAQUESET_10 = 0x22, 441 SDCA_CTL_UDMPU_OPAQUESET_11 = 0x23, 442 SDCA_CTL_UDMPU_OPAQUESET_12 = 0x24, 443 SDCA_CTL_UDMPU_OPAQUESET_13 = 0x25, 444 SDCA_CTL_UDMPU_OPAQUESET_14 = 0x26, 445 SDCA_CTL_UDMPU_OPAQUESET_15 = 0x27, 446 SDCA_CTL_UDMPU_OPAQUESET_16 = 0x28, 447 SDCA_CTL_UDMPU_OPAQUESET_17 = 0x29, 448 SDCA_CTL_UDMPU_OPAQUESET_18 = 0x2A, 449 SDCA_CTL_UDMPU_OPAQUESET_19 = 0x2B, 450 SDCA_CTL_UDMPU_OPAQUESET_20 = 0x2C, 451 SDCA_CTL_UDMPU_OPAQUESET_21 = 0x2D, 452 SDCA_CTL_UDMPU_OPAQUESET_22 = 0x2E, 453 SDCA_CTL_UDMPU_OPAQUESET_23 = 0x2F, 454 }; 455 456 /** 457 * enum sdca_mfpu_controls - SDCA Controls for Multi-Function Processing Unit 458 * 459 * Control Selectors for Multi-Function Processing Unit from SDCA 460 * specification v1.0 Section 6.3.3.4. 461 */ 462 enum sdca_mfpu_controls { 463 SDCA_CTL_MFPU_BYPASS = 0x01, 464 SDCA_CTL_MFPU_ALGORITHM_READY = 0x04, 465 SDCA_CTL_MFPU_ALGORITHM_ENABLE = 0x05, 466 SDCA_CTL_MFPU_LATENCY = 0x08, 467 SDCA_CTL_MFPU_ALGORITHM_PREPARE = 0x09, 468 SDCA_CTL_MFPU_CLUSTERINDEX = 0x10, 469 SDCA_CTL_MFPU_CENTER_FREQUENCY_INDEX = 0x11, 470 SDCA_CTL_MFPU_ULTRASOUND_LEVEL = 0x12, 471 SDCA_CTL_MFPU_AE_NUMBER = 0x13, 472 SDCA_CTL_MFPU_AE_CURRENTOWNER = 0x14, 473 SDCA_CTL_MFPU_AE_MESSAGEOFFSET = 0x16, 474 SDCA_CTL_MFPU_AE_MESSAGELENGTH = 0x17, 475 }; 476 477 /** 478 * enum sdca_smpu_controls - SDCA Controls for Smart Mic Processing Unit 479 * 480 * Control Selectors for Smart Mic Processing Unit from SDCA 481 * specification v1.0 Section 6.3.7.3. 482 */ 483 enum sdca_smpu_controls { 484 SDCA_CTL_SMPU_LATENCY = 0x06, 485 SDCA_CTL_SMPU_TRIGGER_ENABLE = 0x10, 486 SDCA_CTL_SMPU_TRIGGER_STATUS = 0x11, 487 SDCA_CTL_SMPU_HIST_BUFFER_MODE = 0x12, 488 SDCA_CTL_SMPU_HIST_BUFFER_PREAMBLE = 0x13, 489 SDCA_CTL_SMPU_HIST_ERROR = 0x14, 490 SDCA_CTL_SMPU_TRIGGER_EXTENSION = 0x15, 491 SDCA_CTL_SMPU_TRIGGER_READY = 0x16, 492 SDCA_CTL_SMPU_HIST_CURRENTOWNER = 0x18, 493 SDCA_CTL_SMPU_HIST_MESSAGEOFFSET = 0x1A, 494 SDCA_CTL_SMPU_HIST_MESSAGELENGTH = 0x1B, 495 SDCA_CTL_SMPU_DTODTX_CURRENTOWNER = 0x1C, 496 SDCA_CTL_SMPU_DTODTX_MESSAGEOFFSET = 0x1E, 497 SDCA_CTL_SMPU_DTODTX_MESSAGELENGTH = 0x1F, 498 SDCA_CTL_SMPU_DTODRX_CURRENTOWNER = 0x20, 499 SDCA_CTL_SMPU_DTODRX_MESSAGEOFFSET = 0x22, 500 SDCA_CTL_SMPU_DTODRX_MESSAGELENGTH = 0x23, 501 }; 502 503 /** 504 * enum sdca_sapu_controls - SDCA Controls for Smart Amp Processing Unit 505 * 506 * Control Selectors for Smart Amp Processing Unit from SDCA 507 * specification v1.0 Section 6.3.6.3. 508 */ 509 enum sdca_sapu_controls { 510 SDCA_CTL_SAPU_LATENCY = 0x05, 511 SDCA_CTL_SAPU_PROTECTION_MODE = 0x10, 512 SDCA_CTL_SAPU_PROTECTION_STATUS = 0x11, 513 SDCA_CTL_SAPU_OPAQUESETREQ_INDEX = 0x12, 514 SDCA_CTL_SAPU_DTODTX_CURRENTOWNER = 0x14, 515 SDCA_CTL_SAPU_DTODTX_MESSAGEOFFSET = 0x16, 516 SDCA_CTL_SAPU_DTODTX_MESSAGELENGTH = 0x17, 517 SDCA_CTL_SAPU_DTODRX_CURRENTOWNER = 0x18, 518 SDCA_CTL_SAPU_DTODRX_MESSAGEOFFSET = 0x1A, 519 SDCA_CTL_SAPU_DTODRX_MESSAGELENGTH = 0x1B, 520 }; 521 522 /** 523 * enum sdca_ppu_controls - SDCA Controls for Post Processing Unit 524 * 525 * Control Selectors for Post Processing Unit from SDCA specification 526 * v1.0 Section 6.3.5.3. 527 */ 528 enum sdca_ppu_controls { 529 SDCA_CTL_PPU_LATENCY = 0x06, 530 SDCA_CTL_PPU_POSTURENUMBER = 0x10, 531 SDCA_CTL_PPU_POSTUREEXTENSION = 0x11, 532 SDCA_CTL_PPU_HORIZONTALBALANCE = 0x12, 533 SDCA_CTL_PPU_VERTICALBALANCE = 0x13, 534 }; 535 536 /** 537 * enum sdca_tg_controls - SDCA Controls for Tone Generator Entity 538 * 539 * Control Selectors for Tone Generator from SDCA specification v1.0 540 * Section 6.5.4.4. 541 */ 542 enum sdca_tg_controls { 543 SDCA_CTL_TG_TONE_DIVIDER = 0x10, 544 }; 545 546 /** 547 * enum sdca_hide_controls - SDCA Controls for HIDE Entity 548 * 549 * Control Selectors for HIDE from SDCA specification v1.0 Section 550 * 6.6.1.2. 551 */ 552 enum sdca_hide_controls { 553 SDCA_CTL_HIDE_HIDTX_CURRENTOWNER = 0x10, 554 SDCA_CTL_HIDE_HIDTX_MESSAGEOFFSET = 0x12, 555 SDCA_CTL_HIDE_HIDTX_MESSAGELENGTH = 0x13, 556 SDCA_CTL_HIDE_HIDRX_CURRENTOWNER = 0x14, 557 SDCA_CTL_HIDE_HIDRX_MESSAGEOFFSET = 0x16, 558 SDCA_CTL_HIDE_HIDRX_MESSAGELENGTH = 0x17, 559 }; 560 561 /** 562 * enum sdca_entity0_controls - SDCA Controls for Entity 0 563 * 564 * Control Selectors for Entity 0 from SDCA specification v1.0 Section 565 * 6.7.1.1. 566 */ 567 enum sdca_entity0_controls { 568 SDCA_CTL_ENTITY_0_COMMIT_GROUP_MASK = 0x01, 569 SDCA_CTL_ENTITY_0_FUNCTION_SDCA_VERSION = 0x04, 570 SDCA_CTL_ENTITY_0_FUNCTION_TYPE = 0x05, 571 SDCA_CTL_ENTITY_0_FUNCTION_MANUFACTURER_ID = 0x06, 572 SDCA_CTL_ENTITY_0_FUNCTION_ID = 0x07, 573 SDCA_CTL_ENTITY_0_FUNCTION_VERSION = 0x08, 574 SDCA_CTL_ENTITY_0_FUNCTION_EXTENSION_ID = 0x09, 575 SDCA_CTL_ENTITY_0_FUNCTION_EXTENSION_VERSION = 0x0A, 576 SDCA_CTL_ENTITY_0_FUNCTION_STATUS = 0x10, 577 SDCA_CTL_ENTITY_0_FUNCTION_ACTION = 0x11, 578 SDCA_CTL_ENTITY_0_MATCHING_GUID = 0x12, 579 SDCA_CTL_ENTITY_0_DEVICE_MANUFACTURER_ID = 0x2C, 580 SDCA_CTL_ENTITY_0_DEVICE_PART_ID = 0x2D, 581 SDCA_CTL_ENTITY_0_DEVICE_VERSION = 0x2E, 582 SDCA_CTL_ENTITY_0_DEVICE_SDCA_VERSION = 0x2F, 583 584 /* Function Status Bits */ 585 SDCA_CTL_ENTITY_0_DEVICE_NEWLY_ATTACHED = BIT(0), 586 SDCA_CTL_ENTITY_0_INTS_DISABLED_ABNORMALLY = BIT(1), 587 SDCA_CTL_ENTITY_0_STREAMING_STOPPED_ABNORMALLY = BIT(2), 588 SDCA_CTL_ENTITY_0_FUNCTION_FAULT = BIT(3), 589 SDCA_CTL_ENTITY_0_UMP_SEQUENCE_FAULT = BIT(4), 590 SDCA_CTL_ENTITY_0_FUNCTION_NEEDS_INITIALIZATION = BIT(5), 591 SDCA_CTL_ENTITY_0_FUNCTION_HAS_BEEN_RESET = BIT(6), 592 SDCA_CTL_ENTITY_0_FUNCTION_BUSY = BIT(7), 593 594 /* Function Action Bits */ 595 SDCA_CTL_ENTITY_0_RESET_FUNCTION_NOW = BIT(0), 596 }; 597 598 #define SDCA_CTL_MIC_BIAS_NAME "Mic Bias" 599 #define SDCA_CTL_USAGE_NAME "Usage" 600 #define SDCA_CTL_LATENCY_NAME "Latency" 601 #define SDCA_CTL_CLUSTERINDEX_NAME "Cluster Index" 602 #define SDCA_CTL_DATAPORT_SELECTOR_NAME "Dataport Selector" 603 #define SDCA_CTL_MATCHING_GUID_NAME "Matching GUID" 604 #define SDCA_CTL_KEEP_ALIVE_NAME "Keep Alive" 605 #define SDCA_CTL_NDAI_STREAM_NAME "NDAI Stream" 606 #define SDCA_CTL_NDAI_CATEGORY_NAME "NDAI Category" 607 #define SDCA_CTL_NDAI_CODINGTYPE_NAME "NDAI Coding Type" 608 #define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type" 609 #define SDCA_CTL_MIXER_NAME "Mixer" 610 #define SDCA_CTL_SELECTOR_NAME "Selector" 611 #define SDCA_CTL_MUTE_NAME "Mute" 612 #define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume" 613 #define SDCA_CTL_AGC_NAME "AGC" 614 #define SDCA_CTL_BASS_BOOST_NAME "Bass Boost" 615 #define SDCA_CTL_LOUDNESS_NAME "Loudness" 616 #define SDCA_CTL_GAIN_NAME "Gain" 617 #define SDCA_CTL_BYPASS_NAME "Bypass" 618 #define SDCA_CTL_XU_ID_NAME "XU ID" 619 #define SDCA_CTL_XU_VERSION_NAME "XU Version" 620 #define SDCA_CTL_FDL_CURRENTOWNER_NAME "FDL Current Owner" 621 #define SDCA_CTL_FDL_MESSAGEOFFSET_NAME "FDL Message Offset" 622 #define SDCA_CTL_FDL_MESSAGELENGTH_NAME "FDL Message Length" 623 #define SDCA_CTL_FDL_STATUS_NAME "FDL Status" 624 #define SDCA_CTL_FDL_SET_INDEX_NAME "FDL Set Index" 625 #define SDCA_CTL_FDL_HOST_REQUEST_NAME "FDL Host Request" 626 #define SDCA_CTL_CLOCK_VALID_NAME "Clock Valid" 627 #define SDCA_CTL_SAMPLERATEINDEX_NAME "Sample Rate Index" 628 #define SDCA_CTL_CLOCK_SELECT_NAME "Clock Select" 629 #define SDCA_CTL_REQUESTED_PS_NAME "Requested PS" 630 #define SDCA_CTL_ACTUAL_PS_NAME "Actual PS" 631 #define SDCA_CTL_SELECTED_MODE_NAME "Selected Mode" 632 #define SDCA_CTL_DETECTED_MODE_NAME "Detected Mode" 633 #define SDCA_CTL_PRIVATE_NAME "Private" 634 #define SDCA_CTL_PRIVACY_POLICY_NAME "Privacy Policy" 635 #define SDCA_CTL_PRIVACY_LOCKSTATE_NAME "Privacy Lockstate" 636 #define SDCA_CTL_PRIVACY_OWNER_NAME "Privacy Owner" 637 #define SDCA_CTL_AUTHTX_CURRENTOWNER_NAME "AuthTX Current Owner" 638 #define SDCA_CTL_AUTHTX_MESSAGEOFFSET_NAME "AuthTX Message Offset" 639 #define SDCA_CTL_AUTHTX_MESSAGELENGTH_NAME "AuthTX Message Length" 640 #define SDCA_CTL_AUTHRX_CURRENTOWNER_NAME "AuthRX Current Owner" 641 #define SDCA_CTL_AUTHRX_MESSAGEOFFSET_NAME "AuthRX Message Offset" 642 #define SDCA_CTL_AUTHRX_MESSAGELENGTH_NAME "AuthRX Message Length" 643 #define SDCA_CTL_ACOUSTIC_ENERGY_LEVEL_MONITOR_NAME "Acoustic Energy Level Monitor" 644 #define SDCA_CTL_ULTRASOUND_LOOP_GAIN_NAME "Ultrasound Loop Gain" 645 #define SDCA_CTL_OPAQUESET_0_NAME "Opaqueset 0" 646 #define SDCA_CTL_OPAQUESET_1_NAME "Opaqueset 1" 647 #define SDCA_CTL_OPAQUESET_2_NAME "Opaqueset 2" 648 #define SDCA_CTL_OPAQUESET_3_NAME "Opaqueset 3" 649 #define SDCA_CTL_OPAQUESET_4_NAME "Opaqueset 4" 650 #define SDCA_CTL_OPAQUESET_5_NAME "Opaqueset 5" 651 #define SDCA_CTL_OPAQUESET_6_NAME "Opaqueset 6" 652 #define SDCA_CTL_OPAQUESET_7_NAME "Opaqueset 7" 653 #define SDCA_CTL_OPAQUESET_8_NAME "Opaqueset 8" 654 #define SDCA_CTL_OPAQUESET_9_NAME "Opaqueset 9" 655 #define SDCA_CTL_OPAQUESET_10_NAME "Opaqueset 10" 656 #define SDCA_CTL_OPAQUESET_11_NAME "Opaqueset 11" 657 #define SDCA_CTL_OPAQUESET_12_NAME "Opaqueset 12" 658 #define SDCA_CTL_OPAQUESET_13_NAME "Opaqueset 13" 659 #define SDCA_CTL_OPAQUESET_14_NAME "Opaqueset 14" 660 #define SDCA_CTL_OPAQUESET_15_NAME "Opaqueset 15" 661 #define SDCA_CTL_OPAQUESET_16_NAME "Opaqueset 16" 662 #define SDCA_CTL_OPAQUESET_17_NAME "Opaqueset 17" 663 #define SDCA_CTL_OPAQUESET_18_NAME "Opaqueset 18" 664 #define SDCA_CTL_OPAQUESET_19_NAME "Opaqueset 19" 665 #define SDCA_CTL_OPAQUESET_20_NAME "Opaqueset 20" 666 #define SDCA_CTL_OPAQUESET_21_NAME "Opaqueset 21" 667 #define SDCA_CTL_OPAQUESET_22_NAME "Opaqueset 22" 668 #define SDCA_CTL_OPAQUESET_23_NAME "Opaqueset 23" 669 #define SDCA_CTL_ALGORITHM_READY_NAME "Algorithm Ready" 670 #define SDCA_CTL_ALGORITHM_ENABLE_NAME "Algorithm Enable" 671 #define SDCA_CTL_ALGORITHM_PREPARE_NAME "Algorithm Prepare" 672 #define SDCA_CTL_CENTER_FREQUENCY_INDEX_NAME "Center Frequency Index" 673 #define SDCA_CTL_ULTRASOUND_LEVEL_NAME "Ultrasound Level" 674 #define SDCA_CTL_AE_NUMBER_NAME "AE Number" 675 #define SDCA_CTL_AE_CURRENTOWNER_NAME "AE Current Owner" 676 #define SDCA_CTL_AE_MESSAGEOFFSET_NAME "AE Message Offset" 677 #define SDCA_CTL_AE_MESSAGELENGTH_NAME "AE Message Length" 678 #define SDCA_CTL_TRIGGER_ENABLE_NAME "Trigger Enable" 679 #define SDCA_CTL_TRIGGER_STATUS_NAME "Trigger Status" 680 #define SDCA_CTL_HIST_BUFFER_MODE_NAME "Hist Buffer Mode" 681 #define SDCA_CTL_HIST_BUFFER_PREAMBLE_NAME "Hist Buffer Preamble" 682 #define SDCA_CTL_HIST_ERROR_NAME "Hist Error" 683 #define SDCA_CTL_TRIGGER_EXTENSION_NAME "Trigger Extension" 684 #define SDCA_CTL_TRIGGER_READY_NAME "Trigger Ready" 685 #define SDCA_CTL_HIST_CURRENTOWNER_NAME "Hist Current Owner" 686 #define SDCA_CTL_HIST_MESSAGEOFFSET_NAME "Hist Message Offset" 687 #define SDCA_CTL_HIST_MESSAGELENGTH_NAME "Hist Message Length" 688 #define SDCA_CTL_DTODTX_CURRENTOWNER_NAME "DTODTX Current Owner" 689 #define SDCA_CTL_DTODTX_MESSAGEOFFSET_NAME "DTODTX Message Offset" 690 #define SDCA_CTL_DTODTX_MESSAGELENGTH_NAME "DTODTX Message Length" 691 #define SDCA_CTL_DTODRX_CURRENTOWNER_NAME "DTODRX Current Owner" 692 #define SDCA_CTL_DTODRX_MESSAGEOFFSET_NAME "DTODRX Message Offset" 693 #define SDCA_CTL_DTODRX_MESSAGELENGTH_NAME "DTODRX Message Length" 694 #define SDCA_CTL_PROTECTION_MODE_NAME "Protection Mode" 695 #define SDCA_CTL_PROTECTION_STATUS_NAME "Protection Status" 696 #define SDCA_CTL_OPAQUESETREQ_INDEX_NAME "Opaqueset Req Index" 697 #define SDCA_CTL_DTODTX_CURRENTOWNER_NAME "DTODTX Current Owner" 698 #define SDCA_CTL_DTODTX_MESSAGEOFFSET_NAME "DTODTX Message Offset" 699 #define SDCA_CTL_DTODTX_MESSAGELENGTH_NAME "DTODTX Message Length" 700 #define SDCA_CTL_DTODRX_CURRENTOWNER_NAME "DTODRX Current Owner" 701 #define SDCA_CTL_DTODRX_MESSAGEOFFSET_NAME "DTODRX Message Offset" 702 #define SDCA_CTL_DTODRX_MESSAGELENGTH_NAME "DTODRX Message Length" 703 #define SDCA_CTL_POSTURENUMBER_NAME "Posture Number" 704 #define SDCA_CTL_POSTUREEXTENSION_NAME "Posture Extension" 705 #define SDCA_CTL_HORIZONTALBALANCE_NAME "Horizontal Balance" 706 #define SDCA_CTL_VERTICALBALANCE_NAME "Vertical Balance" 707 #define SDCA_CTL_TONE_DIVIDER_NAME "Tone Divider" 708 #define SDCA_CTL_HIDTX_CURRENTOWNER_NAME "HIDTX Current Owner" 709 #define SDCA_CTL_HIDTX_MESSAGEOFFSET_NAME "HIDTX Message Offset" 710 #define SDCA_CTL_HIDTX_MESSAGELENGTH_NAME "HIDTX Message Length" 711 #define SDCA_CTL_HIDRX_CURRENTOWNER_NAME "HIDRX Current Owner" 712 #define SDCA_CTL_HIDRX_MESSAGEOFFSET_NAME "HIDRX Message Offset" 713 #define SDCA_CTL_HIDRX_MESSAGELENGTH_NAME "HIDRX Message Length" 714 #define SDCA_CTL_COMMIT_GROUP_MASK_NAME "Commit Group Mask" 715 #define SDCA_CTL_FUNCTION_SDCA_VERSION_NAME "Function SDCA Version" 716 #define SDCA_CTL_FUNCTION_TYPE_NAME "Function Type" 717 #define SDCA_CTL_FUNCTION_MANUFACTURER_ID_NAME "Function Manufacturer ID" 718 #define SDCA_CTL_FUNCTION_ID_NAME "Function ID" 719 #define SDCA_CTL_FUNCTION_VERSION_NAME "Function Version" 720 #define SDCA_CTL_FUNCTION_EXTENSION_ID_NAME "Function Extension ID" 721 #define SDCA_CTL_FUNCTION_EXTENSION_VERSION_NAME "Function Extension Version" 722 #define SDCA_CTL_FUNCTION_STATUS_NAME "Function Status" 723 #define SDCA_CTL_FUNCTION_ACTION_NAME "Function Action" 724 #define SDCA_CTL_DEVICE_MANUFACTURER_ID_NAME "Device Manufacturer ID" 725 #define SDCA_CTL_DEVICE_PART_ID_NAME "Device Part ID" 726 #define SDCA_CTL_DEVICE_VERSION_NAME "Device Version" 727 #define SDCA_CTL_DEVICE_SDCA_VERSION_NAME "Device SDCA Version" 728 729 /** 730 * enum sdca_control_datatype - SDCA Control Data Types 731 * 732 * Data Types as described in the SDCA specification v1.0 section 733 * 7.3. 734 */ 735 enum sdca_control_datatype { 736 SDCA_CTL_DATATYPE_ONEBIT, 737 SDCA_CTL_DATATYPE_INTEGER, 738 SDCA_CTL_DATATYPE_SPEC_ENCODED_VALUE, 739 SDCA_CTL_DATATYPE_BCD, 740 SDCA_CTL_DATATYPE_Q7P8DB, 741 SDCA_CTL_DATATYPE_BYTEINDEX, 742 SDCA_CTL_DATATYPE_POSTURENUMBER, 743 SDCA_CTL_DATATYPE_DP_INDEX, 744 SDCA_CTL_DATATYPE_BITINDEX, 745 SDCA_CTL_DATATYPE_BITMAP, 746 SDCA_CTL_DATATYPE_GUID, 747 SDCA_CTL_DATATYPE_IMPDEF, 748 }; 749 750 /** 751 * enum sdca_access_mode - SDCA Control access mode 752 * 753 * Access modes as described in the SDCA specification v1.0 section 754 * 7.1.8.2. 755 */ 756 enum sdca_access_mode { 757 SDCA_ACCESS_MODE_RW = 0x0, 758 SDCA_ACCESS_MODE_DUAL = 0x1, 759 SDCA_ACCESS_MODE_RW1C = 0x2, 760 SDCA_ACCESS_MODE_RO = 0x3, 761 SDCA_ACCESS_MODE_RW1S = 0x4, 762 SDCA_ACCESS_MODE_DC = 0x5, 763 }; 764 765 /** 766 * enum sdca_access_layer - SDCA Control access layer 767 * 768 * Access layers as described in the SDCA specification v1.0 section 769 * 7.1.9. 770 */ 771 enum sdca_access_layer { 772 SDCA_ACCESS_LAYER_USER = 1 << 0, 773 SDCA_ACCESS_LAYER_APPLICATION = 1 << 1, 774 SDCA_ACCESS_LAYER_CLASS = 1 << 2, 775 SDCA_ACCESS_LAYER_PLATFORM = 1 << 3, 776 SDCA_ACCESS_LAYER_DEVICE = 1 << 4, 777 SDCA_ACCESS_LAYER_EXTENSION = 1 << 5, 778 }; 779 780 /** 781 * struct sdca_control_range - SDCA Control range table 782 * @cols: Number of columns in the range table. 783 * @rows: Number of rows in the range table. 784 * @data: Array of values contained in the range table. 785 */ 786 struct sdca_control_range { 787 unsigned int cols; 788 unsigned int rows; 789 u32 *data; 790 }; 791 792 /** 793 * struct sdca_control - information for one SDCA Control 794 * @label: Name for the Control, from SDCA Specification v1.0, section 7.1.7. 795 * @sel: Identifier used for addressing. 796 * @nbits: Number of bits used in the Control. 797 * @values: Holds the Control value for constants and defaults. 798 * @cn_list: A bitmask showing the valid Control Numbers within this Control, 799 * Control Numbers typically represent channels. 800 * @interrupt_position: SCDA interrupt line that will alert to changes on this 801 * Control. 802 * @type: Format of the data in the Control. 803 * @range: Buffer describing valid range of values for the Control. 804 * @mode: Access mode of the Control. 805 * @layers: Bitmask of access layers of the Control. 806 * @deferrable: Indicates if the access to the Control can be deferred. 807 * @has_default: Indicates the Control has a default value to be written. 808 * @has_fixed: Indicates the Control only supports a single value. 809 */ 810 struct sdca_control { 811 const char *label; 812 int sel; 813 814 int nbits; 815 int *values; 816 u64 cn_list; 817 int interrupt_position; 818 819 enum sdca_control_datatype type; 820 struct sdca_control_range range; 821 enum sdca_access_mode mode; 822 u8 layers; 823 824 bool deferrable; 825 bool is_volatile; 826 bool has_default; 827 bool has_fixed; 828 }; 829 830 /** 831 * enum sdca_terminal_type - SDCA Terminal Types 832 * 833 * Indicate what a Terminal Entity is used for, see in section 6.2.3 834 * of the SDCA v1.0 specification. 835 */ 836 enum sdca_terminal_type { 837 /* Table 77 - Data Port*/ 838 SDCA_TERM_TYPE_GENERIC = 0x101, 839 SDCA_TERM_TYPE_ULTRASOUND = 0x180, 840 SDCA_TERM_TYPE_CAPTURE_DIRECT_PCM_MIC = 0x181, 841 SDCA_TERM_TYPE_RAW_PDM_MIC = 0x182, 842 SDCA_TERM_TYPE_SPEECH = 0x183, 843 SDCA_TERM_TYPE_VOICE = 0x184, 844 SDCA_TERM_TYPE_SECONDARY_PCM_MIC = 0x185, 845 SDCA_TERM_TYPE_ACOUSTIC_CONTEXT_AWARENESS = 0x186, 846 SDCA_TERM_TYPE_DTOD_STREAM = 0x187, 847 SDCA_TERM_TYPE_REFERENCE_STREAM = 0x188, 848 SDCA_TERM_TYPE_SENSE_CAPTURE = 0x189, 849 SDCA_TERM_TYPE_STREAMING_MIC = 0x18A, 850 SDCA_TERM_TYPE_OPTIMIZATION_STREAM = 0x190, 851 SDCA_TERM_TYPE_PDM_RENDER_STREAM = 0x191, 852 SDCA_TERM_TYPE_COMPANION_DATA = 0x192, 853 /* Table 78 - Transducer */ 854 SDCA_TERM_TYPE_MICROPHONE_TRANSDUCER = 0x201, 855 SDCA_TERM_TYPE_MICROPHONE_ARRAY_TRANSDUCER = 0x205, 856 SDCA_TERM_TYPE_PRIMARY_FULL_RANGE_SPEAKER = 0x380, 857 SDCA_TERM_TYPE_PRIMARY_LFE_SPEAKER = 0x381, 858 SDCA_TERM_TYPE_PRIMARY_TWEETER_SPEAKER = 0x382, 859 SDCA_TERM_TYPE_PRIMARY_ULTRASOUND_SPEAKER = 0x383, 860 SDCA_TERM_TYPE_SECONDARY_FULL_RANGE_SPEAKER = 0x390, 861 SDCA_TERM_TYPE_SECONDARY_LFE_SPEAKER = 0x391, 862 SDCA_TERM_TYPE_SECONDARY_TWEETER_SPEAKER = 0x392, 863 SDCA_TERM_TYPE_SECONDARY_ULTRASOUND_SPEAKER = 0x393, 864 SDCA_TERM_TYPE_TERTIARY_FULL_RANGE_SPEAKER = 0x3A0, 865 SDCA_TERM_TYPE_TERTIARY_LFE_SPEAKER = 0x3A1, 866 SDCA_TERM_TYPE_TERTIARY_TWEETER_SPEAKER = 0x3A2, 867 SDCA_TERM_TYPE_TERTIARY_ULTRASOUND_SPEAKER = 0x3A3, 868 SDCA_TERM_TYPE_SPDIF = 0x605, 869 SDCA_TERM_TYPE_NDAI_DISPLAY_AUDIO = 0x610, 870 SDCA_TERM_TYPE_NDAI_USB = 0x612, 871 SDCA_TERM_TYPE_NDAI_BLUETOOTH_MAIN = 0x614, 872 SDCA_TERM_TYPE_NDAI_BLUETOOTH_ALTERNATE = 0x615, 873 SDCA_TERM_TYPE_NDAI_BLUETOOTH_BOTH = 0x616, 874 SDCA_TERM_TYPE_LINEIN_STEREO = 0x680, 875 SDCA_TERM_TYPE_LINEIN_FRONT_LR = 0x681, 876 SDCA_TERM_TYPE_LINEIN_CENTER_LFE = 0x682, 877 SDCA_TERM_TYPE_LINEIN_SURROUND_LR = 0x683, 878 SDCA_TERM_TYPE_LINEIN_REAR_LR = 0x684, 879 SDCA_TERM_TYPE_LINEOUT_STEREO = 0x690, 880 SDCA_TERM_TYPE_LINEOUT_FRONT_LR = 0x691, 881 SDCA_TERM_TYPE_LINEOUT_CENTER_LFE = 0x692, 882 SDCA_TERM_TYPE_LINEOUT_SURROUND_LR = 0x693, 883 SDCA_TERM_TYPE_LINEOUT_REAR_LR = 0x694, 884 SDCA_TERM_TYPE_MIC_JACK = 0x6A0, 885 SDCA_TERM_TYPE_STEREO_JACK = 0x6B0, 886 SDCA_TERM_TYPE_FRONT_LR_JACK = 0x6B1, 887 SDCA_TERM_TYPE_CENTER_LFE_JACK = 0x6B2, 888 SDCA_TERM_TYPE_SURROUND_LR_JACK = 0x6B3, 889 SDCA_TERM_TYPE_REAR_LR_JACK = 0x6B4, 890 SDCA_TERM_TYPE_HEADPHONE_JACK = 0x6C0, 891 SDCA_TERM_TYPE_HEADSET_JACK = 0x6D0, 892 /* Table 79 - System */ 893 SDCA_TERM_TYPE_SENSE_DATA = 0x280, 894 SDCA_TERM_TYPE_PRIVACY_SIGNALING = 0x741, 895 SDCA_TERM_TYPE_PRIVACY_INDICATORS = 0x747, 896 }; 897 898 #define SDCA_TERM_TYPE_LINEIN_STEREO_NAME "LineIn Stereo" 899 #define SDCA_TERM_TYPE_LINEIN_FRONT_LR_NAME "LineIn Front-LR" 900 #define SDCA_TERM_TYPE_LINEIN_CENTER_LFE_NAME "LineIn Center-LFE" 901 #define SDCA_TERM_TYPE_LINEIN_SURROUND_LR_NAME "LineIn Surround-LR" 902 #define SDCA_TERM_TYPE_LINEIN_REAR_LR_NAME "LineIn Rear-LR" 903 #define SDCA_TERM_TYPE_LINEOUT_STEREO_NAME "LineOut Stereo" 904 #define SDCA_TERM_TYPE_LINEOUT_FRONT_LR_NAME "LineOut Front-LR" 905 #define SDCA_TERM_TYPE_LINEOUT_CENTER_LFE_NAME "LineOut Center-LFE" 906 #define SDCA_TERM_TYPE_LINEOUT_SURROUND_LR_NAME "LineOut Surround-LR" 907 #define SDCA_TERM_TYPE_LINEOUT_REAR_LR_NAME "LineOut Rear-LR" 908 #define SDCA_TERM_TYPE_MIC_JACK_NAME "Microphone" 909 #define SDCA_TERM_TYPE_STEREO_JACK_NAME "Speaker Stereo" 910 #define SDCA_TERM_TYPE_FRONT_LR_JACK_NAME "Speaker Front-LR" 911 #define SDCA_TERM_TYPE_CENTER_LFE_JACK_NAME "Speaker Center-LFE" 912 #define SDCA_TERM_TYPE_SURROUND_LR_JACK_NAME "Speaker Surround-LR" 913 #define SDCA_TERM_TYPE_REAR_LR_JACK_NAME "Speaker Rear-LR" 914 #define SDCA_TERM_TYPE_HEADPHONE_JACK_NAME "Headphone" 915 #define SDCA_TERM_TYPE_HEADSET_JACK_NAME "Headset" 916 917 /** 918 * enum sdca_connector_type - SDCA Connector Types 919 * 920 * Indicate the type of Connector that a Terminal Entity represents, 921 * see section 6.2.4 of the SDCA v1.0 specification. 922 */ 923 enum sdca_connector_type { 924 SDCA_CONN_TYPE_UNKNOWN = 0x00, 925 SDCA_CONN_TYPE_2P5MM_JACK = 0x01, 926 SDCA_CONN_TYPE_3P5MM_JACK = 0x02, 927 SDCA_CONN_TYPE_QUARTER_INCH_JACK = 0x03, 928 SDCA_CONN_TYPE_XLR = 0x05, 929 SDCA_CONN_TYPE_SPDIF_OPTICAL = 0x06, 930 SDCA_CONN_TYPE_RCA = 0x07, 931 SDCA_CONN_TYPE_DIN = 0x0E, 932 SDCA_CONN_TYPE_MINI_DIN = 0x0F, 933 SDCA_CONN_TYPE_EIAJ_OPTICAL = 0x13, 934 SDCA_CONN_TYPE_HDMI = 0x14, 935 SDCA_CONN_TYPE_DISPLAYPORT = 0x17, 936 SDCA_CONN_TYPE_LIGHTNING = 0x1B, 937 SDCA_CONN_TYPE_USB_C = 0x1E, 938 SDCA_CONN_TYPE_OTHER = 0xFF, 939 }; 940 941 /** 942 * struct sdca_entity_iot - information specific to Input/Output Entities 943 * @clock: Pointer to the Entity providing this Terminal's clock. 944 * @type: Usage of the Terminal Entity. 945 * @connector: Physical Connector of the Terminal Entity. 946 * @reference: Physical Jack number of the Terminal Entity. 947 * @num_transducer: Number of transducers attached to the Terminal Entity. 948 * @is_dataport: Boolean indicating if this Terminal represents a Dataport. 949 */ 950 struct sdca_entity_iot { 951 struct sdca_entity *clock; 952 953 enum sdca_terminal_type type; 954 enum sdca_connector_type connector; 955 int reference; 956 int num_transducer; 957 958 bool is_dataport; 959 }; 960 961 /** 962 * enum sdca_clock_type - SDCA Clock Types 963 * 964 * Indicate the synchronicity of an Clock Entity, see section 6.4.1.3 965 * of the SDCA v1.0 specification. 966 */ 967 enum sdca_clock_type { 968 SDCA_CLOCK_TYPE_EXTERNAL = 0x00, 969 SDCA_CLOCK_TYPE_INTERNAL_ASYNC = 0x01, 970 SDCA_CLOCK_TYPE_INTERNAL_SYNC = 0x02, 971 SDCA_CLOCK_TYPE_INTERNAL_SOURCE_SYNC = 0x03, 972 }; 973 974 /** 975 * struct sdca_entity_cs - information specific to Clock Source Entities 976 * @type: Synchronicity of the Clock Source. 977 * @max_delay: The maximum delay in microseconds before the clock is stable. 978 */ 979 struct sdca_entity_cs { 980 enum sdca_clock_type type; 981 unsigned int max_delay; 982 }; 983 984 /** 985 * enum sdca_pde_power_state - SDCA Power States 986 * 987 * SDCA Power State values from SDCA specification v1.0 Section 7.12.4. 988 */ 989 enum sdca_pde_power_state { 990 SDCA_PDE_PS0 = 0x0, 991 SDCA_PDE_PS1 = 0x1, 992 SDCA_PDE_PS2 = 0x2, 993 SDCA_PDE_PS3 = 0x3, 994 SDCA_PDE_PS4 = 0x4, 995 }; 996 997 /** 998 * struct sdca_pde_delay - describes the delay changing between 2 power states 999 * @from_ps: The power state being exited. 1000 * @to_ps: The power state being entered. 1001 * @us: The delay in microseconds switching between the two states. 1002 */ 1003 struct sdca_pde_delay { 1004 int from_ps; 1005 int to_ps; 1006 unsigned int us; 1007 }; 1008 1009 /** 1010 * struct sdca_entity_pde - information specific to Power Domain Entities 1011 * @managed: Dynamically allocated array pointing to each Entity 1012 * controlled by this PDE. 1013 * @max_delay: Dynamically allocated array of delays for switching 1014 * between power states. 1015 * @num_managed: Number of Entities controlled by this PDE. 1016 * @num_max_delay: Number of delays specified for state changes. 1017 */ 1018 struct sdca_entity_pde { 1019 struct sdca_entity **managed; 1020 struct sdca_pde_delay *max_delay; 1021 int num_managed; 1022 int num_max_delay; 1023 }; 1024 1025 /** 1026 * enum sdca_entity_type - SDCA Entity Type codes 1027 * @SDCA_ENTITY_TYPE_ENTITY_0: Entity 0, not actually from the 1028 * specification but useful internally as an Entity structure 1029 * is allocated for Entity 0, to hold Entity 0 controls. 1030 * @SDCA_ENTITY_TYPE_IT: Input Terminal. 1031 * @SDCA_ENTITY_TYPE_OT: Output Terminal. 1032 * @SDCA_ENTITY_TYPE_MU: Mixer Unit. 1033 * @SDCA_ENTITY_TYPE_SU: Selector Unit. 1034 * @SDCA_ENTITY_TYPE_FU: Feature Unit. 1035 * @SDCA_ENTITY_TYPE_XU: Extension Unit. 1036 * @SDCA_ENTITY_TYPE_CS: Clock Source. 1037 * @SDCA_ENTITY_TYPE_CX: Clock selector. 1038 * @SDCA_ENTITY_TYPE_PDE: Power-Domain Entity. 1039 * @SDCA_ENTITY_TYPE_GE: Group Entity. 1040 * @SDCA_ENTITY_TYPE_SPE: Security & Privacy Entity. 1041 * @SDCA_ENTITY_TYPE_CRU: Channel Remapping Unit. 1042 * @SDCA_ENTITY_TYPE_UDMPU: Up-Down Mixer Processing Unit. 1043 * @SDCA_ENTITY_TYPE_MFPU: Multi-Function Processing Unit. 1044 * @SDCA_ENTITY_TYPE_SMPU: Smart Microphone Processing Unit. 1045 * @SDCA_ENTITY_TYPE_SAPU: Smart Amp Processing Unit. 1046 * @SDCA_ENTITY_TYPE_PPU: Posture Processing Unit. 1047 * @SDCA_ENTITY_TYPE_TG: Tone Generator. 1048 * @SDCA_ENTITY_TYPE_HIDE: Human Interface Device Entity. 1049 * 1050 * SDCA Entity Types from SDCA specification v1.0 Section 6.1.2 1051 * all Entity Types not described are reserved. 1052 */ 1053 enum sdca_entity_type { 1054 SDCA_ENTITY_TYPE_ENTITY_0 = 0x00, 1055 SDCA_ENTITY_TYPE_IT = 0x02, 1056 SDCA_ENTITY_TYPE_OT = 0x03, 1057 SDCA_ENTITY_TYPE_MU = 0x05, 1058 SDCA_ENTITY_TYPE_SU = 0x06, 1059 SDCA_ENTITY_TYPE_FU = 0x07, 1060 SDCA_ENTITY_TYPE_XU = 0x0A, 1061 SDCA_ENTITY_TYPE_CS = 0x0B, 1062 SDCA_ENTITY_TYPE_CX = 0x0C, 1063 SDCA_ENTITY_TYPE_PDE = 0x11, 1064 SDCA_ENTITY_TYPE_GE = 0x12, 1065 SDCA_ENTITY_TYPE_SPE = 0x13, 1066 SDCA_ENTITY_TYPE_CRU = 0x20, 1067 SDCA_ENTITY_TYPE_UDMPU = 0x21, 1068 SDCA_ENTITY_TYPE_MFPU = 0x22, 1069 SDCA_ENTITY_TYPE_SMPU = 0x23, 1070 SDCA_ENTITY_TYPE_SAPU = 0x24, 1071 SDCA_ENTITY_TYPE_PPU = 0x25, 1072 SDCA_ENTITY_TYPE_TG = 0x30, 1073 SDCA_ENTITY_TYPE_HIDE = 0x31, 1074 }; 1075 1076 /** 1077 * struct sdca_ge_control - control entry in the affected controls list 1078 * @id: Entity ID of the Control affected. 1079 * @sel: Control Selector of the Control affected. 1080 * @cn: Control Number of the Control affected. 1081 * @val: Value written to Control for this Mode. 1082 */ 1083 struct sdca_ge_control { 1084 int id; 1085 int sel; 1086 int cn; 1087 int val; 1088 }; 1089 1090 /** 1091 * struct sdca_ge_mode - mode entry in the affected controls list 1092 * @controls: Dynamically allocated array of controls written for this Mode. 1093 * @num_controls: Number of controls written in this Mode. 1094 * @val: GE Selector Mode value. 1095 */ 1096 struct sdca_ge_mode { 1097 struct sdca_ge_control *controls; 1098 int num_controls; 1099 int val; 1100 }; 1101 1102 /** 1103 * struct sdca_entity_ge - information specific to Group Entities 1104 * @kctl: ALSA control pointer that can be used by linked Entities. 1105 * @modes: Dynamically allocated array of Modes and the Controls written 1106 * in each mode. 1107 * @num_modes: Number of Modes. 1108 */ 1109 struct sdca_entity_ge { 1110 struct snd_kcontrol_new *kctl; 1111 struct sdca_ge_mode *modes; 1112 int num_modes; 1113 }; 1114 1115 /** 1116 * struct sdca_entity_hide - information specific to HIDE Entities 1117 * @hid: HID device structure 1118 * @num_hidtx_ids: number of HIDTx Report ID 1119 * @num_hidrx_ids: number of HIDRx Report ID 1120 * @hidtx_ids: HIDTx Report ID 1121 * @hidrx_ids: HIDRx Report ID 1122 * @af_number_list: which Audio Function Numbers within this Device are 1123 * sending/receiving the messages in this HIDE 1124 * @hide_reside_function_num: indicating which Audio Function Numbers 1125 * within this Device 1126 * @max_delay: the maximum time in microseconds allowed for the Device 1127 * to change the ownership from Device to Host 1128 * @hid_report_desc: HID Report Descriptor for the HIDE Entity 1129 * @hid_desc: HID descriptor for the HIDE Entity 1130 */ 1131 struct sdca_entity_hide { 1132 struct hid_device *hid; 1133 unsigned int *hidtx_ids; 1134 unsigned int *hidrx_ids; 1135 int num_hidtx_ids; 1136 int num_hidrx_ids; 1137 unsigned int af_number_list[SDCA_MAX_FUNCTION_COUNT]; 1138 unsigned int hide_reside_function_num; 1139 unsigned int max_delay; 1140 unsigned char *hid_report_desc; 1141 struct hid_descriptor hid_desc; 1142 }; 1143 1144 /** 1145 * enum sdca_xu_reset_machanism - SDCA FDL Resets 1146 */ 1147 enum sdca_xu_reset_mechanism { 1148 SDCA_XU_RESET_FUNCTION = 0x0, 1149 SDCA_XU_RESET_DEVICE = 0x1, 1150 SDCA_XU_RESET_BUS = 0x2, 1151 }; 1152 1153 /** 1154 * struct sdca_entity_xu - information specific to XU Entities 1155 * @max_delay: the maximum time in microseconds allowed for the Device 1156 * to change the ownership from Device to Host 1157 * @reset_mechanism: indicates the type of reset that can be requested 1158 * the end of an FDL. 1159 */ 1160 struct sdca_entity_xu { 1161 unsigned int max_delay; 1162 enum sdca_xu_reset_mechanism reset_mechanism; 1163 }; 1164 1165 /** 1166 * struct sdca_entity - information for one SDCA Entity 1167 * @label: String such as "OT 12". 1168 * @id: Identifier used for addressing. 1169 * @type: Type code for the Entity. 1170 * @group: Pointer to Group Entity controlling this one, NULL if N/A. 1171 * @sources: Dynamically allocated array pointing to each input Entity 1172 * connected to this Entity. 1173 * @controls: Dynamically allocated array of Controls. 1174 * @num_sources: Number of sources for the Entity. 1175 * @num_controls: Number of Controls for the Entity. 1176 * @iot: Input/Output Terminal specific Entity properties. 1177 * @cs: Clock Source specific Entity properties. 1178 * @pde: Power Domain Entity specific Entity properties. 1179 * @ge: Group Entity specific Entity properties. 1180 * @hide: HIDE Entity specific Entity properties. 1181 * @xu: XU Entity specific Entity properties. 1182 */ 1183 struct sdca_entity { 1184 const char *label; 1185 int id; 1186 enum sdca_entity_type type; 1187 1188 struct sdca_entity *group; 1189 struct sdca_entity **sources; 1190 struct sdca_control *controls; 1191 int num_sources; 1192 int num_controls; 1193 union { 1194 struct sdca_entity_iot iot; 1195 struct sdca_entity_cs cs; 1196 struct sdca_entity_pde pde; 1197 struct sdca_entity_ge ge; 1198 struct sdca_entity_hide hide; 1199 struct sdca_entity_xu xu; 1200 }; 1201 }; 1202 1203 /** 1204 * enum sdca_channel_purpose - SDCA Channel Purpose code 1205 * 1206 * Channel Purpose codes as described in the SDCA specification v1.0 1207 * section 11.4.3. 1208 */ 1209 enum sdca_channel_purpose { 1210 /* Table 210 - Purpose */ 1211 SDCA_CHAN_PURPOSE_GENERIC_AUDIO = 0x01, 1212 SDCA_CHAN_PURPOSE_VOICE = 0x02, 1213 SDCA_CHAN_PURPOSE_SPEECH = 0x03, 1214 SDCA_CHAN_PURPOSE_AMBIENT = 0x04, 1215 SDCA_CHAN_PURPOSE_REFERENCE = 0x05, 1216 SDCA_CHAN_PURPOSE_ULTRASOUND = 0x06, 1217 SDCA_CHAN_PURPOSE_SENSE = 0x08, 1218 SDCA_CHAN_PURPOSE_SILENCE = 0xFE, 1219 SDCA_CHAN_PURPOSE_NON_AUDIO = 0xFF, 1220 /* Table 211 - Amp Sense */ 1221 SDCA_CHAN_PURPOSE_SENSE_V1 = 0x09, 1222 SDCA_CHAN_PURPOSE_SENSE_V2 = 0x0A, 1223 SDCA_CHAN_PURPOSE_SENSE_V12_INTERLEAVED = 0x10, 1224 SDCA_CHAN_PURPOSE_SENSE_V21_INTERLEAVED = 0x11, 1225 SDCA_CHAN_PURPOSE_SENSE_V12_PACKED = 0x12, 1226 SDCA_CHAN_PURPOSE_SENSE_V21_PACKED = 0x13, 1227 SDCA_CHAN_PURPOSE_SENSE_V1212_INTERLEAVED = 0x14, 1228 SDCA_CHAN_PURPOSE_SENSE_V2121_INTERLEAVED = 0x15, 1229 SDCA_CHAN_PURPOSE_SENSE_V1122_INTERLEAVED = 0x16, 1230 SDCA_CHAN_PURPOSE_SENSE_V2211_INTERLEAVED = 0x17, 1231 SDCA_CHAN_PURPOSE_SENSE_V1212_PACKED = 0x18, 1232 SDCA_CHAN_PURPOSE_SENSE_V2121_PACKED = 0x19, 1233 SDCA_CHAN_PURPOSE_SENSE_V1122_PACKED = 0x1A, 1234 SDCA_CHAN_PURPOSE_SENSE_V2211_PACKED = 0x1B, 1235 }; 1236 1237 /** 1238 * enum sdca_channel_relationship - SDCA Channel Relationship code 1239 * 1240 * Channel Relationship codes as described in the SDCA specification 1241 * v1.0 section 11.4.2. 1242 */ 1243 enum sdca_channel_relationship { 1244 /* Table 206 - Streaming */ 1245 SDCA_CHAN_REL_UNDEFINED = 0x00, 1246 SDCA_CHAN_REL_GENERIC_MONO = 0x01, 1247 SDCA_CHAN_REL_GENERIC_LEFT = 0x02, 1248 SDCA_CHAN_REL_GENERIC_RIGHT = 0x03, 1249 SDCA_CHAN_REL_GENERIC_TOP = 0x48, 1250 SDCA_CHAN_REL_GENERIC_BOTTOM = 0x49, 1251 SDCA_CHAN_REL_CAPTURE_DIRECT = 0x4E, 1252 SDCA_CHAN_REL_RENDER_DIRECT = 0x4F, 1253 SDCA_CHAN_REL_FRONT_LEFT = 0x0B, 1254 SDCA_CHAN_REL_FRONT_RIGHT = 0x0C, 1255 SDCA_CHAN_REL_FRONT_CENTER = 0x0D, 1256 SDCA_CHAN_REL_SIDE_LEFT = 0x12, 1257 SDCA_CHAN_REL_SIDE_RIGHT = 0x13, 1258 SDCA_CHAN_REL_BACK_LEFT = 0x16, 1259 SDCA_CHAN_REL_BACK_RIGHT = 0x17, 1260 SDCA_CHAN_REL_LOW_FREQUENCY_EFFECTS = 0x43, 1261 SDCA_CHAN_REL_SOUNDWIRE_MIC = 0x55, 1262 SDCA_CHAN_REL_SENSE_TRANSDUCER_1 = 0x58, 1263 SDCA_CHAN_REL_SENSE_TRANSDUCER_2 = 0x59, 1264 SDCA_CHAN_REL_SENSE_TRANSDUCER_12 = 0x5A, 1265 SDCA_CHAN_REL_SENSE_TRANSDUCER_21 = 0x5B, 1266 SDCA_CHAN_REL_ECHOREF_NONE = 0x70, 1267 SDCA_CHAN_REL_ECHOREF_1 = 0x71, 1268 SDCA_CHAN_REL_ECHOREF_2 = 0x72, 1269 SDCA_CHAN_REL_ECHOREF_3 = 0x73, 1270 SDCA_CHAN_REL_ECHOREF_4 = 0x74, 1271 SDCA_CHAN_REL_ECHOREF_ALL = 0x75, 1272 SDCA_CHAN_REL_ECHOREF_LFE_ALL = 0x76, 1273 /* Table 207 - Speaker */ 1274 SDCA_CHAN_REL_PRIMARY_TRANSDUCER = 0x50, 1275 SDCA_CHAN_REL_SECONDARY_TRANSDUCER = 0x51, 1276 SDCA_CHAN_REL_TERTIARY_TRANSDUCER = 0x52, 1277 SDCA_CHAN_REL_LOWER_LEFT_ALLTRANSDUCER = 0x60, 1278 SDCA_CHAN_REL_LOWER_RIGHT_ALLTRANSDUCER = 0x61, 1279 SDCA_CHAN_REL_UPPER_LEFT_ALLTRANSDUCER = 0x62, 1280 SDCA_CHAN_REL_UPPER_RIGHT_ALLTRANSDUCER = 0x63, 1281 SDCA_CHAN_REL_LOWER_LEFT_PRIMARY = 0x64, 1282 SDCA_CHAN_REL_LOWER_RIGHT_PRIMARY = 0x65, 1283 SDCA_CHAN_REL_UPPER_LEFT_PRIMARY = 0x66, 1284 SDCA_CHAN_REL_UPPER_RIGHT_PRIMARY = 0x67, 1285 SDCA_CHAN_REL_LOWER_LEFT_SECONDARY = 0x68, 1286 SDCA_CHAN_REL_LOWER_RIGHT_SECONDARY = 0x69, 1287 SDCA_CHAN_REL_UPPER_LEFT_SECONDARY = 0x6A, 1288 SDCA_CHAN_REL_UPPER_RIGHT_SECONDARY = 0x6B, 1289 SDCA_CHAN_REL_LOWER_LEFT_TERTIARY = 0x6C, 1290 SDCA_CHAN_REL_LOWER_RIGHT_TERTIARY = 0x6D, 1291 SDCA_CHAN_REL_UPPER_LEFT_TERTIARY = 0x6E, 1292 SDCA_CHAN_REL_UPPER_RIGHT_TERTIARY = 0x6F, 1293 SDCA_CHAN_REL_DERIVED_LOWER_LEFT_PRIMARY = 0x94, 1294 SDCA_CHAN_REL_DERIVED_LOWER_RIGHT_PRIMARY = 0x95, 1295 SDCA_CHAN_REL_DERIVED_UPPER_LEFT_PRIMARY = 0x96, 1296 SDCA_CHAN_REL_DERIVED_UPPER_RIGHT_PRIMARY = 0x97, 1297 SDCA_CHAN_REL_DERIVED_LOWER_LEFT_SECONDARY = 0x98, 1298 SDCA_CHAN_REL_DERIVED_LOWER_RIGHT_SECONDARY = 0x99, 1299 SDCA_CHAN_REL_DERIVED_UPPER_LEFT_SECONDARY = 0x9A, 1300 SDCA_CHAN_REL_DERIVED_UPPER_RIGHT_SECONDARY = 0x9B, 1301 SDCA_CHAN_REL_DERIVED_LOWER_LEFT_TERTIARY = 0x9C, 1302 SDCA_CHAN_REL_DERIVED_LOWER_RIGHT_TERTIARY = 0x9D, 1303 SDCA_CHAN_REL_DERIVED_UPPER_LEFT_TERTIARY = 0x9E, 1304 SDCA_CHAN_REL_DERIVED_UPPER_RIGHT_TERTIARY = 0x9F, 1305 SDCA_CHAN_REL_DERIVED_MONO_PRIMARY = 0xA0, 1306 SDCA_CHAN_REL_DERIVED_MONO_SECONDARY = 0xAB, 1307 SDCA_CHAN_REL_DERIVED_MONO_TERTIARY = 0xAC, 1308 /* Table 208 - Equipment */ 1309 SDCA_CHAN_REL_EQUIPMENT_LEFT = 0x02, 1310 SDCA_CHAN_REL_EQUIPMENT_RIGHT = 0x03, 1311 SDCA_CHAN_REL_EQUIPMENT_COMBINED = 0x47, 1312 SDCA_CHAN_REL_EQUIPMENT_TOP = 0x48, 1313 SDCA_CHAN_REL_EQUIPMENT_BOTTOM = 0x49, 1314 SDCA_CHAN_REL_EQUIPMENT_TOP_LEFT = 0x4A, 1315 SDCA_CHAN_REL_EQUIPMENT_BOTTOM_LEFT = 0x4B, 1316 SDCA_CHAN_REL_EQUIPMENT_TOP_RIGHT = 0x4C, 1317 SDCA_CHAN_REL_EQUIPMENT_BOTTOM_RIGHT = 0x4D, 1318 SDCA_CHAN_REL_EQUIPMENT_SILENCED_OUTPUT = 0x57, 1319 /* Table 209 - Other */ 1320 SDCA_CHAN_REL_ARRAY = 0x04, 1321 SDCA_CHAN_REL_MIC = 0x53, 1322 SDCA_CHAN_REL_RAW = 0x54, 1323 SDCA_CHAN_REL_SILENCED_MIC = 0x56, 1324 SDCA_CHAN_REL_MULTI_SOURCE_1 = 0x78, 1325 SDCA_CHAN_REL_MULTI_SOURCE_2 = 0x79, 1326 SDCA_CHAN_REL_MULTI_SOURCE_3 = 0x7A, 1327 SDCA_CHAN_REL_MULTI_SOURCE_4 = 0x7B, 1328 }; 1329 1330 /** 1331 * struct sdca_channel - a single Channel with a Cluster 1332 * @id: Identifier used for addressing. 1333 * @purpose: Indicates the purpose of the Channel, usually to give 1334 * semantic meaning to the audio, eg. voice, ultrasound. 1335 * @relationship: Indicates the relationship of this Channel to others 1336 * in the Cluster, often used to identify the physical position of the 1337 * Channel eg. left. 1338 */ 1339 struct sdca_channel { 1340 int id; 1341 enum sdca_channel_purpose purpose; 1342 enum sdca_channel_relationship relationship; 1343 }; 1344 1345 /** 1346 * struct sdca_cluster - information about an SDCA Channel Cluster 1347 * @id: Identifier used for addressing. 1348 * @num_channels: Number of Channels within this Cluster. 1349 * @channels: Dynamically allocated array of Channels. 1350 */ 1351 struct sdca_cluster { 1352 int id; 1353 int num_channels; 1354 struct sdca_channel *channels; 1355 }; 1356 1357 /** 1358 * enum sdca_cluster_range - SDCA Range column definitions for ClusterIndex 1359 */ 1360 enum sdca_cluster_range { 1361 SDCA_CLUSTER_BYTEINDEX = 0, 1362 SDCA_CLUSTER_CLUSTERID = 1, 1363 SDCA_CLUSTER_NCOLS = 2, 1364 }; 1365 1366 /** 1367 * struct sdca_fdl_file - information about a file from a fileset used in FDL 1368 * @vendor_id: Vendor ID of the file. 1369 * @file_id: File ID of the file. 1370 * @fdl_offset: Offset information for FDL. 1371 */ 1372 struct sdca_fdl_file { 1373 u16 vendor_id; 1374 u32 file_id; 1375 u32 fdl_offset; 1376 }; 1377 1378 /** 1379 * struct sdca_fdl_set - information about a set of files used in FDL 1380 * @files: Array of files in this FDL set. 1381 * @num_files: Number of files in this FDL set. 1382 * @id: ID of the FDL set. 1383 */ 1384 struct sdca_fdl_set { 1385 struct sdca_fdl_file *files; 1386 int num_files; 1387 u32 id; 1388 }; 1389 1390 /** 1391 * struct sdca_fdl_data - information about a function's FDL data 1392 * @swft: Pointer to the SoundWire File Table. 1393 * @sets: Array of FDL sets used by this function. 1394 * @num_sets: Number of FDL sets used by this function. 1395 */ 1396 struct sdca_fdl_data { 1397 struct acpi_table_swft *swft; 1398 struct sdca_fdl_set *sets; 1399 int num_sets; 1400 }; 1401 1402 /** 1403 * struct sdca_function_data - top-level information for one SDCA function 1404 * @desc: Pointer to short descriptor from initial parsing. 1405 * @init_table: Pointer to a table of initialization writes. 1406 * @entities: Dynamically allocated array of Entities. 1407 * @clusters: Dynamically allocated array of Channel Clusters. 1408 * @num_init_table: Number of initialization writes. 1409 * @num_entities: Number of Entities reported in this Function. 1410 * @num_clusters: Number of Channel Clusters reported in this Function. 1411 * @busy_max_delay: Maximum Function busy delay in microseconds, before an 1412 * error should be reported. 1413 * @reset_max_delay: Maximum Function reset delay in microseconds, before an 1414 * error should be reported. 1415 * @fdl_data: FDL data for this Function, if available. 1416 */ 1417 struct sdca_function_data { 1418 struct sdca_function_desc *desc; 1419 1420 struct sdca_init_write *init_table; 1421 struct sdca_entity *entities; 1422 struct sdca_cluster *clusters; 1423 int num_init_table; 1424 int num_entities; 1425 int num_clusters; 1426 1427 unsigned int busy_max_delay; 1428 unsigned int reset_max_delay; 1429 1430 struct sdca_fdl_data fdl_data; 1431 }; 1432 1433 static inline u32 sdca_range(struct sdca_control_range *range, 1434 unsigned int col, unsigned int row) 1435 { 1436 return range->data[(row * range->cols) + col]; 1437 } 1438 1439 static inline u32 sdca_range_search(struct sdca_control_range *range, 1440 int search_col, int value, int result_col) 1441 { 1442 int i; 1443 1444 for (i = 0; i < range->rows; i++) { 1445 if (sdca_range(range, search_col, i) == value) 1446 return sdca_range(range, result_col, i); 1447 } 1448 1449 return 0; 1450 } 1451 1452 int sdca_parse_function(struct device *dev, struct sdw_slave *sdw, 1453 struct sdca_function_desc *desc, 1454 struct sdca_function_data *function); 1455 1456 struct sdca_control *sdca_selector_find_control(struct device *dev, 1457 struct sdca_entity *entity, 1458 const int sel); 1459 struct sdca_control_range *sdca_control_find_range(struct device *dev, 1460 struct sdca_entity *entity, 1461 struct sdca_control *control, 1462 int cols, int rows); 1463 struct sdca_control_range *sdca_selector_find_range(struct device *dev, 1464 struct sdca_entity *entity, 1465 int sel, int cols, int rows); 1466 struct sdca_cluster *sdca_id_find_cluster(struct device *dev, 1467 struct sdca_function_data *function, 1468 const int id); 1469 1470 #endif 1471