| 1 | /* |
| 2 | * |
| 3 | * This library is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU Lesser General Public License as |
| 5 | * published by the Free Software Foundation; either version 2.1 of |
| 6 | * the License, or (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public |
| 14 | * License along with this library; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 16 | * |
| 17 | * Copyright (C) 2015 Intel Corporation |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef __ALSA_TOPOLOGY_H |
| 22 | #define __ALSA_TOPOLOGY_H |
| 23 | |
| 24 | #include <stdint.h> |
| 25 | |
| 26 | #ifdef __cplusplus |
| 27 | extern "C" { |
| 28 | #endif |
| 29 | |
| 30 | /** |
| 31 | * \defgroup topology Topology Interface |
| 32 | * \{ |
| 33 | */ |
| 34 | |
| 35 | /*! \page topology ALSA Topology Interface |
| 36 | * |
| 37 | * The topology interface allows developers to define DSP topologies in a text |
| 38 | * file format and to convert the text topology to a binary topology |
| 39 | * representation that can be understood by the kernel. The topology core |
| 40 | * currently recognises the following object types :- |
| 41 | * |
| 42 | * * Controls (mixer, enumerated and byte) including TLV data. |
| 43 | * * PCMs (Front End DAI & DAI link) |
| 44 | * * DAPM widgets |
| 45 | * * DAPM graph elements. |
| 46 | * * Physical DAI & DAI links |
| 47 | * * Private data for each object type. |
| 48 | * * Manifest (containing count of each object type) |
| 49 | * |
| 50 | * <h3>Topology File Format</h3> |
| 51 | * |
| 52 | * The topology text format uses the standard ALSA configuration file format to |
| 53 | * describe each topology object type. This allows topology objects to include |
| 54 | * other topology objects as part of their definition. i.e. a TLV data object |
| 55 | * can be shared amongst many control objects that use the same TLV data. |
| 56 | * |
| 57 | * |
| 58 | * <h4>Controls</h4> |
| 59 | * Topology audio controls can belong to three different types :- |
| 60 | * * Mixer control |
| 61 | * * Enumerated control |
| 62 | * * Byte control |
| 63 | * |
| 64 | * Each control type can contain TLV data, private data, operations and also |
| 65 | * belong to widget objects.<br> |
| 66 | * |
| 67 | * <h5>Control Operations</h5> |
| 68 | * Driver Kcontrol callback info(), get() and put() operations are mapped with |
| 69 | * the CTL ops section in topology configuration files. The ctl ops section can |
| 70 | * assign operations using the standard names (listed below) for the standard |
| 71 | * kcontrol types or use ID numbers (>256) to map to bespoke driver controls.<br> |
| 72 | * |
| 73 | * <pre> |
| 74 | * |
| 75 | * ops."ctl" { |
| 76 | * info "volsw" |
| 77 | * get "257" |
| 78 | * put "257" |
| 79 | * } |
| 80 | * |
| 81 | * </pre> |
| 82 | * |
| 83 | * This mapping shows info() using the standard "volsw" info callback whilst |
| 84 | * the get() and put() are mapped to bespoke driver callbacks. <br> |
| 85 | * |
| 86 | * The Standard operations names for control get(), put() and info calls |
| 87 | * are :- |
| 88 | * * volsw |
| 89 | * * volsw_sx |
| 90 | * * volsw_xr_sx |
| 91 | * * enum |
| 92 | * * bytes |
| 93 | * * enum_value |
| 94 | * * range |
| 95 | * * strobe |
| 96 | * |
| 97 | * <h5>Control Access</h5> |
| 98 | * Controls access can be specified using the "access" section. If no "access" |
| 99 | * section is defined then default RW access flags are set for normal and TLV |
| 100 | * controls. |
| 101 | * |
| 102 | * <pre> |
| 103 | * access [ |
| 104 | * read |
| 105 | * write |
| 106 | * tlv_command |
| 107 | * ] |
| 108 | * </pre> |
| 109 | * |
| 110 | * The standard access flags are as follows :- |
| 111 | * * read |
| 112 | * * write |
| 113 | * * read_write |
| 114 | * * volatile |
| 115 | * * timestamp |
| 116 | * * tlv_read |
| 117 | * * tlv_write |
| 118 | * * tlv_read_write |
| 119 | * * tlv_command |
| 120 | * * inactive |
| 121 | * * lock |
| 122 | * * owner |
| 123 | * * tlv_callback |
| 124 | * * user |
| 125 | * |
| 126 | * <h5>Control TLV Data</h5> |
| 127 | * Controls can also use TLV data to represent dB information. This can be done |
| 128 | * by defining a TLV section and using the TLV section within the control. |
| 129 | * The TLV data for DBScale types are defined as follows :- |
| 130 | * |
| 131 | * <pre> |
| 132 | * scale { |
| 133 | * min "-9000" |
| 134 | * step "300" |
| 135 | * mute "1" |
| 136 | * } |
| 137 | * </pre> |
| 138 | * |
| 139 | * Where the meanings and values for min, step and mute are exactly the same |
| 140 | * as defined in driver code. |
| 141 | * |
| 142 | * <h5>Control Channel Mapping</h5> |
| 143 | * Controls can also specify which channels they are mapped with. This is useful |
| 144 | * for userspace as it allows applications to determine the correct control |
| 145 | * channel for Left and Right etc. Channel maps are defined as follows :- |
| 146 | * |
| 147 | * <pre> |
| 148 | * channel."name" { |
| 149 | * reg "0" |
| 150 | * shift "0" |
| 151 | * } |
| 152 | * </pre> |
| 153 | * |
| 154 | * The channel map reg is the register offset for the control, shift is the |
| 155 | * bit shift within the register for the channel and the section name is the |
| 156 | * channel name and can be one of the following :- |
| 157 | * |
| 158 | * <pre> |
| 159 | * * mono # mono stream |
| 160 | * * fl # front left |
| 161 | * * fr # front right |
| 162 | * * rl # rear left |
| 163 | * * rr # rear right |
| 164 | * * fc # front center |
| 165 | * * lfe # LFE |
| 166 | * * sl # side left |
| 167 | * * sr # side right |
| 168 | * * rc # rear center |
| 169 | * * flc # front left center |
| 170 | * * frc # front right center |
| 171 | * * rlc # rear left center |
| 172 | * * rrc # rear right center |
| 173 | * * flw # front left wide |
| 174 | * * frw # front right wide |
| 175 | * * flh # front left high |
| 176 | * * fch # front center high |
| 177 | * * frh # front right high |
| 178 | * * tc # top center |
| 179 | * * tfl # top front left |
| 180 | * * tfr # top front right |
| 181 | * * tfc # top front center |
| 182 | * * trl # top rear left |
| 183 | * * trr # top rear right |
| 184 | * * trc # top rear center |
| 185 | * * tflc # top front left center |
| 186 | * * tfrc # top front right center |
| 187 | * * tsl # top side left |
| 188 | * * tsr # top side right |
| 189 | * * llfe # left LFE |
| 190 | * * rlfe # right LFE |
| 191 | * * bc # bottom center |
| 192 | * * blc # bottom left center |
| 193 | * * brc # bottom right center |
| 194 | * </pre> |
| 195 | * |
| 196 | * <h5>Control Private Data</h5> |
| 197 | * Controls can also have private data. This can be done by defining a private |
| 198 | * data section and including the section within the control. The private data |
| 199 | * section is defined as follows :- |
| 200 | * |
| 201 | * <pre> |
| 202 | * SectionData."pdata for EQU1" { |
| 203 | * file "/path/to/file" |
| 204 | * bytes "0x12,0x34,0x56,0x78" |
| 205 | * shorts "0x1122,0x3344,0x5566,0x7788" |
| 206 | * words "0xaabbccdd,0x11223344,0x66aa77bb,0xefef1234" |
| 207 | * tuples "section id of the vendor tuples" |
| 208 | * }; |
| 209 | * </pre> |
| 210 | * The file, bytes, shorts, words and tuples keywords are all mutually |
| 211 | * exclusive as the private data should only be taken from one source. |
| 212 | * The private data can either be read from a separate file or defined in |
| 213 | * the topology file using the bytes, shorts, words or tuples keywords. |
| 214 | * The keyword tuples is to define vendor specific tuples. Please refer to |
| 215 | * section Vendor Tokens and Vendor tuples. |
| 216 | * |
| 217 | * <h5>How to define an element with private data</h5> |
| 218 | * An element can refer to a single data section or multiple data |
| 219 | * sections. |
| 220 | * |
| 221 | * <h6>To refer to a single data section:</h6> |
| 222 | * <pre> |
| 223 | * Sectionxxx."element name" { |
| 224 | * ... |
| 225 | * data "name of data section" # optional private data |
| 226 | * } |
| 227 | * </pre> |
| 228 | * |
| 229 | * <h6>To refer to multiple data sections:</h6> |
| 230 | * <pre> |
| 231 | * Sectionxxx."element name" { |
| 232 | * ... |
| 233 | * data [ # optional private data |
| 234 | * "name of 1st data section" |
| 235 | * "name of 2nd data section" |
| 236 | * ... |
| 237 | * ] |
| 238 | * } |
| 239 | * </pre> |
| 240 | * And data of these sections will be merged in the same order as they are |
| 241 | * in the list, as the element's private data for kernel. |
| 242 | * |
| 243 | * </pre> |
| 244 | * |
| 245 | * <h6>Vendor Tokens</h6> |
| 246 | * A vendor token list is defined as a new section. Each token element is |
| 247 | * a pair of string ID and integer value. And both the ID and value are |
| 248 | * vendor-specific. |
| 249 | * |
| 250 | * <pre> |
| 251 | * SectionVendorTokens."id of the vendor tokens" { |
| 252 | * comment "optional comments" |
| 253 | * VENDOR_TOKEN_ID1 "1" |
| 254 | * VENDOR_TOKEN_ID2 "2" |
| 255 | * VENDOR_TOKEN_ID3 "3" |
| 256 | * ... |
| 257 | * } |
| 258 | * </pre> |
| 259 | * |
| 260 | * <h6>Vendor Tuples</h6> |
| 261 | * Vendor tuples are defined as a new section. It contains a reference to |
| 262 | * a vendor token list and several tuple arrays. |
| 263 | * All arrays share a vendor token list, defined by the tokens keyword. |
| 264 | * Each tuple array is for a specific type, defined by the string following |
| 265 | * the tuples keyword. Supported types are: string, uuid, bool, byte, |
| 266 | * short and word. |
| 267 | * |
| 268 | * <pre> |
| 269 | * SectionVendorTuples."id of the vendor tuples" { |
| 270 | * tokens "id of the vendor tokens" |
| 271 | * |
| 272 | * tuples."string" { |
| 273 | * VENDOR_TOKEN_ID1 "character string" |
| 274 | * ... |
| 275 | * } |
| 276 | * |
| 277 | * tuples."uuid" { # 16 characters separated by commas |
| 278 | * VENDOR_TOKEN_ID2 "0x01,0x02,...,0x0f" |
| 279 | * ... |
| 280 | * } |
| 281 | * |
| 282 | * tuples."bool" { |
| 283 | * VENDOR_TOKEN_ID3 "true/false" |
| 284 | * ... |
| 285 | * } |
| 286 | * |
| 287 | * tuples."byte" { |
| 288 | * VENDOR_TOKEN_ID4 "0x11" |
| 289 | * VENDOR_TOKEN_ID5 "0x22" |
| 290 | * ... |
| 291 | * } |
| 292 | * |
| 293 | * tuples."short" { |
| 294 | * VENDOR_TOKEN_ID6 "0x1122" |
| 295 | * VENDOR_TOKEN_ID7 "0x3344" |
| 296 | * ... |
| 297 | * } |
| 298 | * |
| 299 | * tuples."word" { |
| 300 | * VENDOR_TOKEN_ID8 "0x11223344" |
| 301 | * VENDOR_TOKEN_ID9 "0x55667788" |
| 302 | * ... |
| 303 | * } |
| 304 | * } |
| 305 | * </pre> |
| 306 | * To define multiple vendor tuples of same type, please append some |
| 307 | * characters after the type string ("string", "uuid", "bool", "byte", "short" |
| 308 | * or "word"), to avoid ID duplication in the SectionVendorTuples.<br> |
| 309 | * The parser will check the first few characters in ID to get the tuple type. |
| 310 | * Here is an example: |
| 311 | * <pre> |
| 312 | * SectionVendorTuples."id of the vendor tuples" { |
| 313 | * ... |
| 314 | * tuples."word.module0" { |
| 315 | * VENDOR_TOKEN_PARAM_ID1 "0x00112233" |
| 316 | * VENDOR_TOKEN_PARAM_ID2 "0x44556677" |
| 317 | * ... |
| 318 | * } |
| 319 | * |
| 320 | * tuples."word.module2" { |
| 321 | * VENDOR_TOKEN_PARAM_ID1 "0x11223344" |
| 322 | * VENDOR_TOKEN_PARAM_ID2 "0x55667788" |
| 323 | * ... |
| 324 | * } |
| 325 | * ... |
| 326 | * } |
| 327 | * |
| 328 | * </pre> |
| 329 | * |
| 330 | * <h5>Mixer Controls</h5> |
| 331 | * A mixer control is defined as a new section that can include channel mapping, |
| 332 | * TLV data, callback operations and private data. The mixer section also |
| 333 | * includes a few other config options that are shown here :- |
| 334 | * |
| 335 | * <pre> |
| 336 | * SectionControlMixer."mixer name" { |
| 337 | * comment "optional comments" |
| 338 | * |
| 339 | * index "1" # Index number |
| 340 | * |
| 341 | * channel."name" { # Channel maps |
| 342 | * .... |
| 343 | * } |
| 344 | * |
| 345 | * ops."ctl" { # Ops callback functions |
| 346 | * .... |
| 347 | * } |
| 348 | * |
| 349 | * max "32" # Max control value |
| 350 | * invert "0" # Whether control values are inverted |
| 351 | * |
| 352 | * tlv "tld_data" # optional TLV data |
| 353 | * |
| 354 | * data "pdata for mixer1" # optional private data |
| 355 | * } |
| 356 | * </pre> |
| 357 | * |
| 358 | * The section name is used to define the mixer name. The index number can be |
| 359 | * used to identify topology objects groups. This allows driver operations on |
| 360 | * objects with index number N and can be used to add/remove pipelines of |
| 361 | * objects whilst other objects are unaffected. |
| 362 | * |
| 363 | * <h5>Byte Controls</h5> |
| 364 | * A byte control is defined as a new section that can include channel mapping, |
| 365 | * TLV data, callback operations and private data. The bytes section also |
| 366 | * includes a few other config options that are shown here :- |
| 367 | * |
| 368 | * <pre> |
| 369 | * SectionControlBytes."name" { |
| 370 | * comment "optional comments" |
| 371 | * |
| 372 | * index "1" # Index number |
| 373 | * |
| 374 | * channel."name" { # Channel maps |
| 375 | * .... |
| 376 | * } |
| 377 | * |
| 378 | * ops."ctl" { # Ops callback functions |
| 379 | * .... |
| 380 | * } |
| 381 | * |
| 382 | * base "0" # Register base |
| 383 | * num_regs "16" # Number of registers |
| 384 | * mask "0xff" # Mask |
| 385 | * max "255" # Maximum value |
| 386 | * |
| 387 | * tlv "tld_data" # optional TLV data |
| 388 | * |
| 389 | * data "pdata for mixer1" # optional private data |
| 390 | * } |
| 391 | * </pre> |
| 392 | * |
| 393 | * <h5>Enumerated Controls</h5> |
| 394 | * A enumerated control is defined as a new section (like mixer and byte) that |
| 395 | * can include channel mapping, callback operations, private data and |
| 396 | * text strings to represent the enumerated control options.<br> |
| 397 | * |
| 398 | * The text strings for the enumerated controls are defined in a separate |
| 399 | * section as follows :- |
| 400 | * |
| 401 | * <pre> |
| 402 | * SectionText."name" { |
| 403 | * |
| 404 | * Values [ |
| 405 | * "value1" |
| 406 | * "value2" |
| 407 | "value3" |
| 408 | * ] |
| 409 | * } |
| 410 | * </pre> |
| 411 | * |
| 412 | * All the enumerated text values are listed in the values list.<br> |
| 413 | * The enumerated control is similar to the other controls and defined as |
| 414 | * follows :- |
| 415 | * |
| 416 | * <pre> |
| 417 | * SectionControlMixer."name" { |
| 418 | * comment "optional comments" |
| 419 | * |
| 420 | * index "1" # Index number |
| 421 | * |
| 422 | * texts "EQU1" # Enumerated text items |
| 423 | * |
| 424 | * channel."name" { # Channel maps |
| 425 | * .... |
| 426 | * } |
| 427 | * |
| 428 | * ops."ctl" { # Ops callback functions |
| 429 | * .... |
| 430 | * } |
| 431 | * |
| 432 | * data "pdata for mixer1" # optional private data |
| 433 | * } |
| 434 | * </pre> |
| 435 | * |
| 436 | * <h4>DAPM Graph</h4> |
| 437 | * DAPM graphs can easily be defined using the topology file. The format is |
| 438 | * very similar to the DAPM graph kernel format. :- |
| 439 | * |
| 440 | * <pre> |
| 441 | * SectionGraph."dsp" { |
| 442 | * index "1" # Index number |
| 443 | * |
| 444 | * lines [ |
| 445 | * "sink1, control, source1" |
| 446 | * "sink2, , source2" |
| 447 | * ] |
| 448 | * } |
| 449 | * </pre> |
| 450 | * |
| 451 | * The lines in the graph are defined as a variable size list of sinks, |
| 452 | * controls and sources. The control name is optional as some graph lines have |
| 453 | * no associated controls. The section name can be used to differentiate the |
| 454 | * graph with other graphs, it's not used by the kernel atm. |
| 455 | * |
| 456 | * <h4>DAPM Widgets</h4> |
| 457 | * DAPM widgets are similar to controls in that they can include many other |
| 458 | * objects. Widgets can contain private data, mixer controls and enum controls. |
| 459 | * |
| 460 | * The following widget types are supported and match the driver types :- |
| 461 | * |
| 462 | * * input |
| 463 | * * output |
| 464 | * * mux |
| 465 | * * mixer |
| 466 | * * pga |
| 467 | * * out_drv |
| 468 | * * adc |
| 469 | * * dac |
| 470 | * * switch |
| 471 | * * pre |
| 472 | * * post |
| 473 | * * aif_in |
| 474 | * * aif_out |
| 475 | * * dai_in |
| 476 | * * dai_out |
| 477 | * * dai_link |
| 478 | * |
| 479 | * Widgets are defined as follows :- |
| 480 | * |
| 481 | * <pre> |
| 482 | * SectionWidget."name" { |
| 483 | * |
| 484 | * index "1" # Index number |
| 485 | * |
| 486 | * type "aif_in" # Widget type - detailed above |
| 487 | * stream_name "name" # Stream name |
| 488 | * |
| 489 | * no_pm "true" # No PM control bit. |
| 490 | * reg "20" # PM bit register offset |
| 491 | * shift "0" # PM bit register shift |
| 492 | * invert "1 # PM bit is inverted |
| 493 | * subseq "8" # subsequence number |
| 494 | * |
| 495 | * event_type "1" # DAPM widget event type |
| 496 | * event_flags "1" # DAPM widget event flags |
| 497 | * |
| 498 | * mixer "name" # Optional Mixer Control |
| 499 | * enum "name" # Optional Enum Control |
| 500 | * |
| 501 | * data "name" # optional private data |
| 502 | * } |
| 503 | * </pre> |
| 504 | * |
| 505 | * The section name is the widget name. The mixer and enum fields are mutually |
| 506 | * exclusive and used to include controls into the widget. The index and data |
| 507 | * fields are the same for widgets as they are for controls whilst the other |
| 508 | * fields map on very closely to the driver widget fields. |
| 509 | * |
| 510 | * <h5>Widget Private Data</h5> |
| 511 | * Widget can have private data. For the format of the private data, please |
| 512 | * refer to section Control Private Data. |
| 513 | * |
| 514 | * <h4>PCM Capabilities</h4> |
| 515 | * Topology can also define the PCM capabilities of front end or physical DAIs. |
| 516 | * Capabilities can be defined with the following section :- |
| 517 | * |
| 518 | * <pre> |
| 519 | * SectionPCMCapabilities."name" { |
| 520 | * |
| 521 | * formats "S24_LE,S16_LE" # Supported formats |
| 522 | * rate_min "48000" # Max supported sample rate |
| 523 | * rate_max "48000" # Min supported sample rate |
| 524 | * channels_min "2" # Min number of channels |
| 525 | * channels_max "2" # max number of channels |
| 526 | * } |
| 527 | * </pre> |
| 528 | * The supported formats use the same naming convention as the driver macros. |
| 529 | * The PCM capabilities name can be referred to and included by PCM and |
| 530 | * physical DAI sections. |
| 531 | * |
| 532 | * <h4>PCM Configurations</h4> |
| 533 | * PCM runtime configurations can be defined for playback and capture stream |
| 534 | * directions with the following section :- |
| 535 | * |
| 536 | * <pre> |
| 537 | * SectionPCMConfig."name" { |
| 538 | * |
| 539 | * config."playback" { # playback config |
| 540 | * format "S16_LE" # playback format |
| 541 | * rate "48000" # playback sample rate |
| 542 | * channels "2" # playback channels |
| 543 | * tdm_slot "0xf" # playback TDM slot |
| 544 | * } |
| 545 | * |
| 546 | * config."capture" { # capture config |
| 547 | * format "S16_LE" # capture format |
| 548 | * rate "48000" # capture sample rate |
| 549 | * channels "2" # capture channels |
| 550 | * tdm_slot "0xf" # capture TDM slot |
| 551 | * } |
| 552 | * } |
| 553 | * </pre> |
| 554 | * |
| 555 | * The supported formats use the same naming convention as the driver macros. |
| 556 | * The PCM configuration name can be referred to and included by PCM and |
| 557 | * physical link sections. |
| 558 | * |
| 559 | * <h4>PCM (Front-end DAI & DAI link) </h4> |
| 560 | * PCM sections define the supported capabilities and configurations for |
| 561 | * supported playback and capture streams, names and flags for front end |
| 562 | * DAI & DAI links. Topology kernel driver will use a PCM object to create |
| 563 | * a pair of FE DAI & DAI links. |
| 564 | * |
| 565 | * <pre> |
| 566 | * SectionPCM."name" { |
| 567 | * |
| 568 | * index "1" # Index number |
| 569 | * |
| 570 | * id "0" # used for binding to the PCM |
| 571 | * |
| 572 | * dai."name of front-end DAI" { |
| 573 | * id "0" # used for binding to the front-end DAI |
| 574 | * } |
| 575 | * |
| 576 | * pcm."playback" { |
| 577 | * capabilities "capabilities1" # capabilities for playback |
| 578 | * |
| 579 | * configs [ # supported configs for playback |
| 580 | * "config1" |
| 581 | * "config2" |
| 582 | * ] |
| 583 | * } |
| 584 | * |
| 585 | * pcm."capture" { |
| 586 | * capabilities "capabilities2" # capabilities for capture |
| 587 | * |
| 588 | * configs [ # supported configs for capture |
| 589 | * "config1" |
| 590 | * "config2" |
| 591 | * "config3" |
| 592 | * ] |
| 593 | * } |
| 594 | * |
| 595 | * # Optional boolean flags |
| 596 | * symmetric_rates "true" |
| 597 | * symmetric_channels "true" |
| 598 | * symmetric_sample_bits "false" |
| 599 | * |
| 600 | * data "name" # optional private data |
| 601 | * } |
| 602 | * </pre> |
| 603 | * |
| 604 | * <h4>Physical DAI Link Configurations</h4> |
| 605 | * The runtime configurations of a physical DAI link can be defined by |
| 606 | * SectionLink. <br> Backend DAI links belong to physical links, and can |
| 607 | * be configured by either SectionLink or SectionBE, with same syntax. |
| 608 | * But SectionBE is deprecated atm since the internal processing is |
| 609 | * actually same. |
| 610 | * |
| 611 | * <pre> |
| 612 | * SectionLink."name" { |
| 613 | * |
| 614 | * index "1" # Index number |
| 615 | * |
| 616 | * id "0" # used for binding to the link |
| 617 | * |
| 618 | * stream_name "name" # used for binding to the link |
| 619 | * |
| 620 | * hw_configs [ # runtime supported HW configurations, optional |
| 621 | * "config1" |
| 622 | * "config2" |
| 623 | * ... |
| 624 | * ] |
| 625 | * |
| 626 | * default_hw_conf_id "1" #default HW config ID for init |
| 627 | * |
| 628 | * # Optional boolean flags |
| 629 | * symmetric_rates "true" |
| 630 | * symmetric_channels "false" |
| 631 | * symmetric_sample_bits "true" |
| 632 | * |
| 633 | * data "name" # optional private data |
| 634 | * } |
| 635 | * </pre> |
| 636 | * |
| 637 | * A physical link can refer to multiple runtime supported hardware |
| 638 | * configurations, which is defined by SectionHWConfig. |
| 639 | * |
| 640 | * <pre> |
| 641 | * SectionHWConfig."name" { |
| 642 | * |
| 643 | * id "1" # used for binding to the config |
| 644 | * format "I2S" # physical audio format. |
| 645 | * bclk "master" # Platform is master of bit clock |
| 646 | * fsync "slave" # Platform is slave of fsync |
| 647 | * } |
| 648 | * </pre> |
| 649 | * |
| 650 | * <h4>Physical DAI</h4> |
| 651 | * A physical DAI (e.g. backend DAI for DPCM) is defined as a new section |
| 652 | * that can include a unique ID, playback and capture stream capabilities, |
| 653 | * optional flags, and private data. <br> |
| 654 | * Its PCM stream capablities are same as those for PCM objects, |
| 655 | * please refer to section 'PCM Capabilities'. |
| 656 | * |
| 657 | * <pre> |
| 658 | * SectionDAI."name" { |
| 659 | * |
| 660 | * index "1" # Index number |
| 661 | * |
| 662 | * id "0" # used for binding to the Backend DAI |
| 663 | * |
| 664 | * pcm."playback" { |
| 665 | * capabilities "capabilities1" # capabilities for playback |
| 666 | * } |
| 667 | * |
| 668 | * pcm."capture" { |
| 669 | * capabilities "capabilities2" # capabilities for capture |
| 670 | * } |
| 671 | * |
| 672 | * symmetric_rates "true" # optional flags |
| 673 | * symmetric_channels "true" |
| 674 | * symmetric_sample_bits "false" |
| 675 | * |
| 676 | * data "name" # optional private data |
| 677 | * } |
| 678 | * </pre> |
| 679 | * |
| 680 | * <h4>Manifest Private Data</h4> |
| 681 | * Manfiest may have private data. Users need to define a manifest section |
| 682 | * and add the references to 1 or multiple data sections. Please refer to |
| 683 | * section 'How to define an element with private data'. <br> |
| 684 | * And the text conf file can have at most 1 manifest section. <br><br> |
| 685 | * |
| 686 | * Manifest section is defined as follows :- |
| 687 | * |
| 688 | * <pre> |
| 689 | * SectionManifest"name" { |
| 690 | * |
| 691 | * data "name" # optional private data |
| 692 | * } |
| 693 | * </pre> |
| 694 | * |
| 695 | * <h4>Include other files</h4> |
| 696 | * Users may include other files in a text conf file via alsaconf syntax |
| 697 | * <path/to/configuration-file>. This allows users to define common info |
| 698 | * in separate files (e.g. vendor tokens, tuples) and share them for |
| 699 | * different platforms, thus save the total size of config files. <br> |
| 700 | * Users can also specifiy additional configuraiton directories relative |
| 701 | * to "/usr/share/alsa/" to search the included files, via alsaconf syntax |
| 702 | * <searchfdir:/relative-path/to/usr/share/alsa>. <br><br> |
| 703 | * |
| 704 | * For example, file A and file B are two text conf files for platform X, |
| 705 | * they will be installed to /usr/share/alsa/topology/platformx. If we |
| 706 | * need file A to include file B, in file A we can add: <br> |
| 707 | * |
| 708 | * <searchdir:topology/platformx> <br> |
| 709 | * <name-of-file-B> <br><br> |
| 710 | * |
| 711 | * ALSA conf will search and open an included file in the following order |
| 712 | * of priority: |
| 713 | * 1. directly open the file by its name; |
| 714 | * 2. search for the file name in "/usr/share/alsa"; |
| 715 | * 3. search for the file name in user specified subdirectories under |
| 716 | * "/usr/share/alsa". |
| 717 | * |
| 718 | * The order of the included files need not to be same as their |
| 719 | * dependencies, since the topology library will load them all before |
| 720 | * parsing their dependencies. <br> |
| 721 | * |
| 722 | * The configuration directories defined by a file will only be used to search |
| 723 | * the files included by this file. |
| 724 | */ |
| 725 | |
| 726 | /** Maximum number of channels supported in one control */ |
| 727 | #define SND_TPLG_MAX_CHAN 8 |
| 728 | |
| 729 | /** Topology context */ |
| 730 | typedef struct snd_tplg snd_tplg_t; |
| 731 | |
| 732 | /** Topology object types */ |
| 733 | enum snd_tplg_type { |
| 734 | SND_TPLG_TYPE_TLV = 0, /*!< TLV Data */ |
| 735 | SND_TPLG_TYPE_MIXER, /*!< Mixer control*/ |
| 736 | SND_TPLG_TYPE_ENUM, /*!< Enumerated control */ |
| 737 | SND_TPLG_TYPE_TEXT, /*!< Text data */ |
| 738 | SND_TPLG_TYPE_DATA, /*!< Private data */ |
| 739 | SND_TPLG_TYPE_BYTES, /*!< Byte control */ |
| 740 | SND_TPLG_TYPE_STREAM_CONFIG, /*!< PCM Stream configuration */ |
| 741 | SND_TPLG_TYPE_STREAM_CAPS, /*!< PCM Stream capabilities */ |
| 742 | SND_TPLG_TYPE_PCM, /*!< PCM stream device */ |
| 743 | SND_TPLG_TYPE_DAPM_WIDGET, /*!< DAPM widget */ |
| 744 | SND_TPLG_TYPE_DAPM_GRAPH, /*!< DAPM graph elements */ |
| 745 | SND_TPLG_TYPE_BE, /*!< BE DAI link */ |
| 746 | SND_TPLG_TYPE_CC, /*!< Hostless codec <-> codec link */ |
| 747 | SND_TPLG_TYPE_MANIFEST, /*!< Topology manifest */ |
| 748 | SND_TPLG_TYPE_TOKEN, /*!< Vendor tokens */ |
| 749 | SND_TPLG_TYPE_TUPLE, /*!< Vendor tuples */ |
| 750 | SND_TPLG_TYPE_LINK, /*!< Physical DAI link */ |
| 751 | SND_TPLG_TYPE_HW_CONFIG, /*!< Link HW config */ |
| 752 | SND_TPLG_TYPE_DAI, /*!< Physical DAI */ |
| 753 | }; |
| 754 | |
| 755 | /** |
| 756 | * \brief Create a new topology parser instance. |
| 757 | * \return New topology parser instance |
| 758 | */ |
| 759 | snd_tplg_t *snd_tplg_new(void); |
| 760 | |
| 761 | /** |
| 762 | * \brief Free a topology parser instance. |
| 763 | * \param tplg Topology parser instance |
| 764 | */ |
| 765 | void snd_tplg_free(snd_tplg_t *tplg); |
| 766 | |
| 767 | /** |
| 768 | * \brief Parse and build topology text file into binary file. |
| 769 | * \param tplg Topology instance. |
| 770 | * \param infile Topology text input file to be parsed |
| 771 | * \param outfile Binary topology output file. |
| 772 | * \return Zero on success, otherwise a negative error code |
| 773 | */ |
| 774 | int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, |
| 775 | const char *outfile); |
| 776 | |
| 777 | /** |
| 778 | * \brief Enable verbose reporting of binary file output |
| 779 | * \param tplg Topology Instance |
| 780 | * \param verbose Enable verbose output level if non zero |
| 781 | */ |
| 782 | void snd_tplg_verbose(snd_tplg_t *tplg, int verbose); |
| 783 | |
| 784 | /** \struct snd_tplg_tlv_template |
| 785 | * \brief Template type for all TLV objects. |
| 786 | */ |
| 787 | struct snd_tplg_tlv_template { |
| 788 | int type; /*!< TLV type SNDRV_CTL_TLVT_ */ |
| 789 | }; |
| 790 | |
| 791 | /** \struct snd_tplg_tlv_dbscale_template |
| 792 | * \brief Template type for TLV Scale objects. |
| 793 | */ |
| 794 | struct snd_tplg_tlv_dbscale_template { |
| 795 | struct snd_tplg_tlv_template hdr; /*!< TLV type header */ |
| 796 | int min; /*!< dB minimum value in 0.1dB */ |
| 797 | int step; /*!< dB step size in 0.1dB */ |
| 798 | int mute; /*!< is min dB value mute ? */ |
| 799 | }; |
| 800 | |
| 801 | /** \struct snd_tplg_channel_template |
| 802 | * \brief Template type for single channel mapping. |
| 803 | */ |
| 804 | struct snd_tplg_channel_elem { |
| 805 | int size; /*!< size in bytes of this structure */ |
| 806 | int reg; /*!< channel control register */ |
| 807 | int shift; /*!< channel shift for control bits */ |
| 808 | int id; /*!< ID maps to Left, Right, LFE etc */ |
| 809 | }; |
| 810 | |
| 811 | /** \struct snd_tplg_channel_map_template |
| 812 | * \brief Template type for channel mapping. |
| 813 | */ |
| 814 | struct snd_tplg_channel_map_template { |
| 815 | int num_channels; /*!< number of channel mappings */ |
| 816 | struct snd_tplg_channel_elem channel[SND_TPLG_MAX_CHAN]; /*!< mapping */ |
| 817 | }; |
| 818 | |
| 819 | /** \struct snd_tplg_pdata_template |
| 820 | * \brief Template type for private data objects. |
| 821 | */ |
| 822 | struct snd_tplg_pdata_template { |
| 823 | unsigned int length; /*!< data length */ |
| 824 | const void *data; /*!< data */ |
| 825 | }; |
| 826 | |
| 827 | /** \struct snd_tplg_io_ops_template |
| 828 | * \brief Template type for object operations mapping. |
| 829 | */ |
| 830 | struct snd_tplg_io_ops_template { |
| 831 | int get; /*!< get callback ID */ |
| 832 | int put; /*!< put callback ID */ |
| 833 | int info; /*!< info callback ID */ |
| 834 | }; |
| 835 | |
| 836 | /** \struct snd_tplg_ctl_template |
| 837 | * \brief Template type for control objects. |
| 838 | */ |
| 839 | struct snd_tplg_ctl_template { |
| 840 | int type; /*!< Control type */ |
| 841 | const char *name; /*!< Control name */ |
| 842 | int access; /*!< Control access */ |
| 843 | struct snd_tplg_io_ops_template ops; /*!< operations */ |
| 844 | struct snd_tplg_tlv_template *tlv; /*!< non NULL means we have TLV data */ |
| 845 | }; |
| 846 | |
| 847 | /** \struct snd_tplg_mixer_template |
| 848 | * \brief Template type for mixer control objects. |
| 849 | */ |
| 850 | struct snd_tplg_mixer_template { |
| 851 | struct snd_tplg_ctl_template hdr; /*!< control type header */ |
| 852 | struct snd_tplg_channel_map_template *map; /*!< channel map */ |
| 853 | int min; /*!< min value for mixer */ |
| 854 | int max; /*!< max value for mixer */ |
| 855 | int platform_max; /*!< max value for platform control */ |
| 856 | int invert; /*!< whether controls bits are inverted */ |
| 857 | struct snd_soc_tplg_private *priv; /*!< control private data */ |
| 858 | }; |
| 859 | |
| 860 | /** \struct snd_tplg_enum_template |
| 861 | * \brief Template type for enumerated control objects. |
| 862 | */ |
| 863 | struct snd_tplg_enum_template { |
| 864 | struct snd_tplg_ctl_template hdr; /*!< control type header */ |
| 865 | struct snd_tplg_channel_map_template *map; /*!< channel map */ |
| 866 | int items; /*!< number of enumerated items in control */ |
| 867 | int mask; /*!< register mask size */ |
| 868 | const char **texts; /*!< control text items */ |
| 869 | const int **values; /*!< control value items */ |
| 870 | struct snd_soc_tplg_private *priv; /*!< control private data */ |
| 871 | }; |
| 872 | |
| 873 | /** \struct snd_tplg_bytes_template |
| 874 | * \brief Template type for TLV Scale objects. |
| 875 | */ |
| 876 | struct snd_tplg_bytes_template { |
| 877 | struct snd_tplg_ctl_template hdr; /*!< control type header */ |
| 878 | int max; /*!< max byte control value */ |
| 879 | int mask; /*!< byte control mask */ |
| 880 | int base; /*!< base register */ |
| 881 | int num_regs; /*!< number of registers */ |
| 882 | struct snd_tplg_io_ops_template ext_ops; /*!< ops mapping */ |
| 883 | struct snd_soc_tplg_private *priv; /*!< control private data */ |
| 884 | }; |
| 885 | |
| 886 | /** \struct snd_tplg_graph_elem |
| 887 | * \brief Template type for single DAPM graph element. |
| 888 | */ |
| 889 | struct snd_tplg_graph_elem { |
| 890 | const char *src; /*!< source widget name */ |
| 891 | const char *ctl; /*!< control name or NULL if no control */ |
| 892 | const char *sink; /*!< sink widget name */ |
| 893 | }; |
| 894 | |
| 895 | /** \struct snd_tplg_graph_template |
| 896 | * \brief Template type for array of DAPM graph elements. |
| 897 | */ |
| 898 | struct snd_tplg_graph_template { |
| 899 | int count; /*!< Number of graph elements */ |
| 900 | struct snd_tplg_graph_elem elem[0]; /*!< graph elements */ |
| 901 | }; |
| 902 | |
| 903 | /** \struct snd_tplg_widget_template |
| 904 | * \brief Template type for DAPM widget objects. |
| 905 | */ |
| 906 | struct snd_tplg_widget_template { |
| 907 | int id; /*!< SND_SOC_DAPM_CTL */ |
| 908 | const char *name; /*!< widget name */ |
| 909 | const char *sname; /*!< stream name (certain widgets only) */ |
| 910 | int reg; /*!< negative reg = no direct dapm */ |
| 911 | int shift; /*!< bits to shift */ |
| 912 | int mask; /*!< non-shifted mask */ |
| 913 | int subseq; /*!< sort within widget type */ |
| 914 | unsigned int invert; /*!< invert the power bit */ |
| 915 | unsigned int ignore_suspend; /*!< kept enabled over suspend */ |
| 916 | unsigned short event_flags; /*!< PM event sequence flags */ |
| 917 | unsigned short event_type; /*!< PM event sequence type */ |
| 918 | struct snd_soc_tplg_private *priv; /*!< widget private data */ |
| 919 | int num_ctls; /*!< Number of controls used by widget */ |
| 920 | struct snd_tplg_ctl_template *ctl[0]; /*!< array of widget controls */ |
| 921 | }; |
| 922 | |
| 923 | /** \struct snd_tplg_stream_template |
| 924 | * \brief Stream configurations. |
| 925 | */ |
| 926 | struct snd_tplg_stream_template { |
| 927 | const char *name; /*!< name of the stream config */ |
| 928 | int format; /*!< SNDRV_PCM_FMTBIT_* */ |
| 929 | int rate; /*!< SNDRV_PCM_RATE_* */ |
| 930 | int period_bytes; /*!< size of period in bytes */ |
| 931 | int buffer_bytes; /*!< size of buffer in bytes. */ |
| 932 | int channels; /*!< number of channels */ |
| 933 | }; |
| 934 | |
| 935 | /** \struct snd_tplg_stream_caps_template |
| 936 | * \brief Stream Capabilities. |
| 937 | */ |
| 938 | struct snd_tplg_stream_caps_template { |
| 939 | const char *name; /*!< name of the stream caps */ |
| 940 | uint64_t formats; /*!< supported formats SNDRV_PCM_FMTBIT_* */ |
| 941 | unsigned int rates; /*!< supported rates SNDRV_PCM_RATE_* */ |
| 942 | unsigned int rate_min; /*!< min rate */ |
| 943 | unsigned int rate_max; /*!< max rate */ |
| 944 | unsigned int channels_min; /*!< min channels */ |
| 945 | unsigned int channels_max; /*!< max channels */ |
| 946 | unsigned int periods_min; /*!< min number of periods */ |
| 947 | unsigned int periods_max; /*!< max number of periods */ |
| 948 | unsigned int period_size_min; /*!< min period size bytes */ |
| 949 | unsigned int period_size_max; /*!< max period size bytes */ |
| 950 | unsigned int buffer_size_min; /*!< min buffer size bytes */ |
| 951 | unsigned int buffer_size_max; /*!< max buffer size bytes */ |
| 952 | unsigned int sig_bits; /*!< number of bits of content */ |
| 953 | }; |
| 954 | |
| 955 | /** \struct snd_tplg_pcm_template |
| 956 | * \brief Template type for PCM (FE DAI & DAI links). |
| 957 | */ |
| 958 | struct snd_tplg_pcm_template { |
| 959 | const char *pcm_name; /*!< PCM stream name */ |
| 960 | const char *dai_name; /*!< DAI name */ |
| 961 | unsigned int pcm_id; /*!< unique ID - used to match */ |
| 962 | unsigned int dai_id; /*!< unique ID - used to match */ |
| 963 | unsigned int playback; /*!< supports playback mode */ |
| 964 | unsigned int capture; /*!< supports capture mode */ |
| 965 | unsigned int compress; /*!< 1 = compressed; 0 = PCM */ |
| 966 | struct snd_tplg_stream_caps_template *caps[2]; /*!< playback & capture for DAI */ |
| 967 | unsigned int flag_mask; /*!< bitmask of flags to configure */ |
| 968 | unsigned int flags; /*!< flag value SND_SOC_TPLG_LNK_FLGBIT_* */ |
| 969 | struct snd_soc_tplg_private *priv; /*!< private data */ |
| 970 | int num_streams; /*!< number of supported configs */ |
| 971 | struct snd_tplg_stream_template stream[0]; /*!< supported configs */ |
| 972 | }; |
| 973 | |
| 974 | /** \struct snd_tplg_hw_config_template |
| 975 | * \brief Template type to describe a physical link runtime supported |
| 976 | * hardware config, i.e. hardware audio formats. |
| 977 | */ |
| 978 | struct snd_tplg_hw_config_template { |
| 979 | int id; /* unique ID - - used to match */ |
| 980 | unsigned int fmt; /* SND_SOC_DAI_FORMAT_ format value */ |
| 981 | unsigned char clock_gated; /* 1 if clock can be gated to save power */ |
| 982 | unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */ |
| 983 | unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ |
| 984 | unsigned char bclk_master; /* 1 for master of BCLK, 0 for slave */ |
| 985 | unsigned char fsync_master; /* 1 for master of FSYNC, 0 for slave */ |
| 986 | unsigned char mclk_direction; /* 0 for input, 1 for output */ |
| 987 | unsigned short reserved; /* for 32bit alignment */ |
| 988 | unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */ |
| 989 | unsigned int bclk_rate; /* BCLK freqency in Hz */ |
| 990 | unsigned int fsync_rate; /* frame clock in Hz */ |
| 991 | unsigned int tdm_slots; /* number of TDM slots in use */ |
| 992 | unsigned int tdm_slot_width; /* width in bits for each slot */ |
| 993 | unsigned int tx_slots; /* bit mask for active Tx slots */ |
| 994 | unsigned int rx_slots; /* bit mask for active Rx slots */ |
| 995 | unsigned int tx_channels; /* number of Tx channels */ |
| 996 | unsigned int *tx_chanmap; /* array of slot number */ |
| 997 | unsigned int rx_channels; /* number of Rx channels */ |
| 998 | unsigned int *rx_chanmap; /* array of slot number */ |
| 999 | }; |
| 1000 | |
| 1001 | /** \struct snd_tplg_dai_template |
| 1002 | * \brief Template type for physical DAI. |
| 1003 | * It can be used to configure backend DAIs for DPCM. |
| 1004 | */ |
| 1005 | struct snd_tplg_dai_template { |
| 1006 | const char *dai_name; /*!< DAI name */ |
| 1007 | unsigned int dai_id; /*!< unique ID - used to match */ |
| 1008 | unsigned int playback; /*!< supports playback mode */ |
| 1009 | unsigned int capture; /*!< supports capture mode */ |
| 1010 | struct snd_tplg_stream_caps_template *caps[2]; /*!< playback & capture for DAI */ |
| 1011 | unsigned int flag_mask; /*!< bitmask of flags to configure */ |
| 1012 | unsigned int flags; /*!< SND_SOC_TPLG_DAI_FLGBIT_* */ |
| 1013 | struct snd_soc_tplg_private *priv; /*!< private data */ |
| 1014 | |
| 1015 | }; |
| 1016 | |
| 1017 | /** \struct snd_tplg_link_template |
| 1018 | * \brief Template type for physical DAI Links. |
| 1019 | */ |
| 1020 | struct snd_tplg_link_template { |
| 1021 | const char *name; /*!< link name, used to match */ |
| 1022 | int id; /*!< unique ID - used to match with existing physical links */ |
| 1023 | const char *stream_name; /*!< link stream name, used to match */ |
| 1024 | |
| 1025 | int num_streams; /*!< number of configs */ |
| 1026 | struct snd_tplg_stream_template *stream; /*!< supported configs */ |
| 1027 | |
| 1028 | struct snd_tplg_hw_config_template *hw_config; /*!< supported HW configs */ |
| 1029 | int num_hw_configs; /* number of hw configs */ |
| 1030 | int default_hw_config_id; /* default hw config ID for init */ |
| 1031 | |
| 1032 | unsigned int flag_mask; /* bitmask of flags to configure */ |
| 1033 | unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ |
| 1034 | struct snd_soc_tplg_private *priv; /*!< private data */ |
| 1035 | }; |
| 1036 | |
| 1037 | /** \struct snd_tplg_obj_template |
| 1038 | * \brief Generic Template Object |
| 1039 | */ |
| 1040 | typedef struct snd_tplg_obj_template { |
| 1041 | enum snd_tplg_type type; /*!< template object type */ |
| 1042 | int index; /*!< group index for object */ |
| 1043 | int version; /*!< optional vendor specific version details */ |
| 1044 | int vendor_type; /*!< optional vendor specific type info */ |
| 1045 | union { |
| 1046 | struct snd_tplg_widget_template *widget; /*!< DAPM widget */ |
| 1047 | struct snd_tplg_mixer_template *mixer; /*!< Mixer control */ |
| 1048 | struct snd_tplg_bytes_template *bytes_ctl; /*!< Bytes control */ |
| 1049 | struct snd_tplg_enum_template *enum_ctl; /*!< Enum control */ |
| 1050 | struct snd_tplg_graph_template *graph; /*!< Graph elements */ |
| 1051 | struct snd_tplg_pcm_template *pcm; /*!< PCM elements */ |
| 1052 | struct snd_tplg_link_template *link; /*!< physical DAI Links */ |
| 1053 | struct snd_tplg_dai_template *dai; /*!< Physical DAI */ |
| 1054 | }; |
| 1055 | } snd_tplg_obj_template_t; |
| 1056 | |
| 1057 | /** |
| 1058 | * \brief Register topology template object. |
| 1059 | * \param tplg Topology instance. |
| 1060 | * \param t Template object. |
| 1061 | * \return Zero on success, otherwise a negative error code |
| 1062 | */ |
| 1063 | int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t); |
| 1064 | |
| 1065 | /** |
| 1066 | * \brief Build all registered topology data into binary file. |
| 1067 | * \param tplg Topology instance. |
| 1068 | * \param outfile Binary topology output file. |
| 1069 | * \return Zero on success, otherwise a negative error code |
| 1070 | */ |
| 1071 | int snd_tplg_build(snd_tplg_t *tplg, const char *outfile); |
| 1072 | |
| 1073 | /** |
| 1074 | * \brief Attach private data to topology manifest. |
| 1075 | * \param tplg Topology instance. |
| 1076 | * \param data Private data. |
| 1077 | * \param len Length of data in bytes. |
| 1078 | * \return Zero on success, otherwise a negative error code |
| 1079 | */ |
| 1080 | int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len); |
| 1081 | |
| 1082 | /** |
| 1083 | * \brief Set an optional vendor specific version number. |
| 1084 | * \param tplg Topology instance. |
| 1085 | * \param version Vendor specific version number. |
| 1086 | * \return Zero on success, otherwise a negative error code |
| 1087 | */ |
| 1088 | int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version); |
| 1089 | |
| 1090 | /* \} */ |
| 1091 | |
| 1092 | #ifdef __cplusplus |
| 1093 | } |
| 1094 | #endif |
| 1095 | |
| 1096 | #endif /* __ALSA_TOPOLOGY_H */ |