/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * compress_offload.h - compress offload header definations * * Copyright (C) 2011 Intel Corporation * Authors: Vinod Koul <[email protected]> * Pierre-Louis Bossart <[email protected]> */ #ifndef __COMPRESS_OFFLOAD_H #define __COMPRESS_OFFLOAD_H #include <linux/types.h> #include <sound/asound.h> #include <sound/compress_params.h> #define SNDRV_COMPRESS_VERSION … /** * struct snd_compressed_buffer - compressed buffer * @fragment_size: size of buffer fragment in bytes * @fragments: number of such fragments */ struct snd_compressed_buffer { … } __attribute__((packed, aligned …)); /** * struct snd_compr_params - compressed stream params * @buffer: buffer description * @codec: codec parameters * @no_wake_mode: dont wake on fragment elapsed */ struct snd_compr_params { … } __attribute__((packed, aligned …)); /** * struct snd_compr_tstamp - timestamp descriptor * @byte_offset: Byte offset in ring buffer to DSP * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by * large steps and should only be used to monitor encoding/decoding * progress. It shall not be used for timing estimates. * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio * output/input. This field should be used for A/V sync or time estimates. * @sampling_rate: sampling rate of audio */ struct snd_compr_tstamp { … } __attribute__((packed, aligned …)); /** * struct snd_compr_avail - avail descriptor * @avail: Number of bytes available in ring buffer for writing/reading * @tstamp: timestamp information */ struct snd_compr_avail { … } __attribute__((packed, aligned …)); enum snd_compr_direction { … }; /** * struct snd_compr_caps - caps descriptor * @codecs: pointer to array of codecs * @direction: direction supported. Of type snd_compr_direction * @min_fragment_size: minimum fragment supported by DSP * @max_fragment_size: maximum fragment supported by DSP * @min_fragments: min fragments supported by DSP * @max_fragments: max fragments supported by DSP * @num_codecs: number of codecs supported * @reserved: reserved field */ struct snd_compr_caps { … } __attribute__((packed, aligned …)); /** * struct snd_compr_codec_caps - query capability of codec * @codec: codec for which capability is queried * @num_descriptors: number of codec descriptors * @descriptor: array of codec capability descriptor */ struct snd_compr_codec_caps { … } __attribute__((packed, aligned …)); /** * enum sndrv_compress_encoder - encoder metadata key * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the * end of the track * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the * beginning of the track */ enum sndrv_compress_encoder { … }; /** * struct snd_compr_metadata - compressed stream metadata * @key: key id * @value: key value */ struct snd_compr_metadata { … } __attribute__((packed, aligned …)); /* * compress path ioctl definitions * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters * Note: only codec params can be changed runtime and stream params cant be * SNDRV_COMPRESS_GET_PARAMS: Query codec params * SNDRV_COMPRESS_TSTAMP: get the current timestamp value * SNDRV_COMPRESS_AVAIL: get the current buffer avail value. * This also queries the tstamp properties * SNDRV_COMPRESS_PAUSE: Pause the running stream * SNDRV_COMPRESS_RESUME: resume a paused stream * SNDRV_COMPRESS_START: Start a stream * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content * and the buffers currently with DSP * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version */ #define SNDRV_COMPRESS_IOCTL_VERSION … #define SNDRV_COMPRESS_GET_CAPS … #define SNDRV_COMPRESS_GET_CODEC_CAPS … #define SNDRV_COMPRESS_SET_PARAMS … #define SNDRV_COMPRESS_GET_PARAMS … #define SNDRV_COMPRESS_SET_METADATA … #define SNDRV_COMPRESS_GET_METADATA … #define SNDRV_COMPRESS_TSTAMP … #define SNDRV_COMPRESS_AVAIL … #define SNDRV_COMPRESS_PAUSE … #define SNDRV_COMPRESS_RESUME … #define SNDRV_COMPRESS_START … #define SNDRV_COMPRESS_STOP … #define SNDRV_COMPRESS_DRAIN … #define SNDRV_COMPRESS_NEXT_TRACK … #define SNDRV_COMPRESS_PARTIAL_DRAIN … /* * TODO * 1. add mmap support * */ #define SND_COMPR_TRIGGER_DRAIN … #define SND_COMPR_TRIGGER_NEXT_TRACK … #define SND_COMPR_TRIGGER_PARTIAL_DRAIN … #endif