Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: compress: Add output rate and output format support

Add 'pcm_format' for struct snd_codec, add 'pcm_formats' for
struct snd_codec_desc, these are used for accelerator usage.

Current accelerator example is sample rate converter (SRC).
Define struct snd_codec_desc_src for descript minmum and maxmum
sample rates. And add 'src_d' in union snd_codec_options
structure. These are mainly used for capbility query.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Acked-by: Vinod Koul <vkoul@kernel.org>
Link: https://patch.msgid.link/20241212074509.3445859-2-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Shengjiu Wang and committed by
Mark Brown
f4425e3a fac04efc

+21 -2
+21 -2
include/uapi/sound/compress_params.h
··· 334 334 struct snd_dec_wma wma_d; 335 335 struct snd_dec_alac alac_d; 336 336 struct snd_dec_ape ape_d; 337 + struct { 338 + __u32 out_sample_rate; 339 + } src_d; 340 + } __attribute__((packed, aligned(4))); 341 + 342 + struct snd_codec_desc_src { 343 + __u32 out_sample_rate_min; 344 + __u32 out_sample_rate_max; 337 345 } __attribute__((packed, aligned(4))); 338 346 339 347 /** struct snd_codec_desc - description of codec capabilities ··· 355 347 * @modes: Supported modes. See SND_AUDIOMODE defines 356 348 * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines 357 349 * @min_buffer: Minimum buffer size handled by codec implementation 350 + * @pcm_formats: Output (for decoders) or input (for encoders) 351 + * PCM formats (required to accel mode, 0 for other modes) 352 + * @u_space: union space (for codec dependent data) 358 353 * @reserved: reserved for future use 359 354 * 360 355 * This structure provides a scalar value for profiles, modes and stream ··· 381 370 __u32 modes; 382 371 __u32 formats; 383 372 __u32 min_buffer; 384 - __u32 reserved[15]; 373 + __u32 pcm_formats; 374 + union { 375 + __u32 u_space[6]; 376 + struct snd_codec_desc_src src; 377 + } __attribute__((packed, aligned(4))); 378 + __u32 reserved[8]; 385 379 } __attribute__((packed, aligned(4))); 386 380 387 381 /** struct snd_codec ··· 411 395 * @align: Block alignment in bytes of an audio sample. 412 396 * Only required for PCM or IEC formats. 413 397 * @options: encoder-specific settings 398 + * @pcm_format: Output (for decoders) or input (for encoders) 399 + * PCM formats (required to accel mode, 0 for other modes) 414 400 * @reserved: reserved for future use 415 401 */ 416 402 ··· 429 411 __u32 format; 430 412 __u32 align; 431 413 union snd_codec_options options; 432 - __u32 reserved[3]; 414 + __u32 pcm_format; 415 + __u32 reserved[2]; 433 416 } __attribute__((packed, aligned(4))); 434 417 435 418 #endif