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