Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  compress_driver.h - compress offload driver definations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 2011 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *  Authors:	Vinod Koul <vinod.koul@linux.intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *		Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifndef __COMPRESS_DRIVER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #define __COMPRESS_DRIVER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/android_kabi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <sound/compress_offload.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <sound/asound.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) struct snd_compr_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * struct snd_compr_runtime: runtime stream description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * @state: stream state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * @ops: pointer to DSP callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @buffer: pointer to kernel buffer, valid only when not in mmap mode or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *	DSP doesn't implement copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * @buffer_size: size of the above buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * @fragment_size: size of buffer fragment in bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * @fragments: number of such fragments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * @total_bytes_available: cumulative number of bytes made available in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *	the ring buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * @total_bytes_transferred: cumulative bytes transferred by offload DSP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * @sleep: poll sleep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * @private_data: driver private data pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  * @dma_area: virtual buffer address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * @dma_addr: physical buffer address (not accessible from main CPU)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * @dma_bytes: size of DMA area
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * @dma_buffer_p: runtime dma buffer pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct snd_compr_runtime {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	snd_pcm_state_t state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	struct snd_compr_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	void *buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	u64 buffer_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u32 fragment_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u32 fragments;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	u64 total_bytes_available;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	u64 total_bytes_transferred;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	wait_queue_head_t sleep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	unsigned char *dma_area;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	dma_addr_t dma_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	size_t dma_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	struct snd_dma_buffer *dma_buffer_p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * struct snd_compr_stream: compressed stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * @name: device name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * @ops: pointer to DSP callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * @runtime: pointer to runtime structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * @device: device pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * @error_work: delayed work used when closing the stream due to an error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * @direction: stream direction, playback/recording
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * @metadata_set: metadata set flag, true when set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * @next_track: has userspace signal next track transition, true when set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * @partial_drain: undergoing partial_drain for stream, true when set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * @private_data: pointer to DSP private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  * @dma_buffer: allocated buffer if any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) struct snd_compr_stream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	struct snd_compr_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	struct snd_compr_runtime *runtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct snd_compr *device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	struct delayed_work error_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	enum snd_compr_direction direction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	bool metadata_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	bool next_track;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	bool partial_drain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	struct snd_dma_buffer dma_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * struct snd_compr_ops: compressed path DSP operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * @open: Open the compressed stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * This callback is mandatory and shall keep dsp ready to receive the stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  * parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * @free: Close the compressed stream, mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  * @set_params: Sets the compressed stream parameters, mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * This can be called in during stream creation only to set codec params
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  * and the stream properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * @get_params: retrieve the codec parameters, mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  * @set_metadata: Set the metadata values for a stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * @get_metadata: retrieves the requested metadata values from stream
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  * @trigger: Trigger operations like start, pause, resume, drain, stop.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * This callback is mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * @pointer: Retrieve current h/w pointer information. Mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * @copy: Copy the compressed data to/from userspace, Optional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * Can't be implemented if DSP supports mmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * @mmap: DSP mmap method to mmap DSP memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  * @ack: Ack for DSP when data is written to audio buffer, Optional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * Not valid if copy is implemented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * @get_caps: Retrieve DSP capabilities, mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  * @get_codec_caps: Retrieve capabilities for a specific codec, mandatory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct snd_compr_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	int (*open)(struct snd_compr_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	int (*free)(struct snd_compr_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	int (*set_params)(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			struct snd_compr_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	int (*get_params)(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 			struct snd_codec *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	int (*set_metadata)(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			struct snd_compr_metadata *metadata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	int (*get_metadata)(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			struct snd_compr_metadata *metadata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	int (*trigger)(struct snd_compr_stream *stream, int cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	int (*pointer)(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			struct snd_compr_tstamp *tstamp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	int (*copy)(struct snd_compr_stream *stream, char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		       size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	int (*mmap)(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			struct vm_area_struct *vma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	int (*ack)(struct snd_compr_stream *stream, size_t bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	int (*get_caps) (struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			struct snd_compr_caps *caps);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	int (*get_codec_caps) (struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			struct snd_compr_codec_caps *codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * struct snd_compr: Compressed device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  * @name: DSP device name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * @dev: associated device instance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * @ops: pointer to DSP callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * @private_data: pointer to DSP pvt data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * @card: sound card pointer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * @direction: Playback or capture direction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * @lock: device lock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  * @device: device id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct snd_compr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct device dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	struct snd_compr_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	struct snd_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	unsigned int direction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	int device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #ifdef CONFIG_SND_VERBOSE_PROCFS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	/* private: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	char id[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	struct snd_info_entry *proc_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct snd_info_entry *proc_info_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /* compress device register APIs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) int snd_compress_register(struct snd_compr *device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) int snd_compress_deregister(struct snd_compr *device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) int snd_compress_new(struct snd_card *card, int device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 			int type, const char *id, struct snd_compr *compr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* dsp driver callback apis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * For playback: driver should call snd_compress_fragment_elapsed() to let the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  * framework know that a fragment has been consumed from the ring buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * For recording: we want to know when a frame is available or when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  * at least one frame is available so snd_compress_frame_elapsed()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * callback should be called when a encodeded frame is available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	wake_up(&stream->runtime->sleep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	if (snd_BUG_ON(!stream))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	/* for partial_drain case we are back to running state on success */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	if (stream->partial_drain) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		stream->partial_drain = false; /* clear this flag as well */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		stream->runtime->state = SNDRV_PCM_STATE_SETUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	wake_up(&stream->runtime->sleep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)  * snd_compr_set_runtime_buffer - Set the Compress runtime buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * @stream: compress stream to set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  * @bufp: the buffer information, NULL to clear
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  * Copy the buffer information to runtime buffer when @bufp is non-NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * Otherwise it clears the current buffer information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) snd_compr_set_runtime_buffer(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			     struct snd_dma_buffer *bufp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	struct snd_compr_runtime *runtime = stream->runtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	if (bufp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		runtime->dma_buffer_p = bufp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		runtime->dma_area = bufp->area;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		runtime->dma_addr = bufp->addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		runtime->dma_bytes = bufp->bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		runtime->dma_buffer_p = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		runtime->dma_area = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		runtime->dma_addr = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		runtime->dma_bytes = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) int snd_compr_malloc_pages(struct snd_compr_stream *stream, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) int snd_compr_free_pages(struct snd_compr_stream *stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int snd_compr_stop_error(struct snd_compr_stream *stream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			 snd_pcm_state_t state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #endif