linux/sound/core/compress_offload.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  compress_core.c - compress offload core
 *
 *  Copyright (C) 2011 Intel Corporation
 *  Authors:	Vinod Koul <[email protected]>
 *		Pierre-Louis Bossart <[email protected]>
 *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
#define FORMAT(fmt)
#define pr_fmt(fmt)

#include <linux/file.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/math64.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/uio.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/compat.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/info.h>
#include <sound/compress_params.h>
#include <sound/compress_offload.h>
#include <sound/compress_driver.h>

/* struct snd_compr_codec_caps overflows the ioctl bit size for some
 * architectures, so we need to disable the relevant ioctls.
 */
#if _IOC_SIZEBITS < 14
#define COMPR_CODEC_CAPS_OVERFLOW
#endif

/* TODO:
 * - add substream support for multiple devices in case of
 *	SND_DYNAMIC_MINORS is not used
 * - Multiple node representation
 *	driver should be able to register multiple nodes
 */

struct snd_compr_file {};

static void error_delayed_work(struct work_struct *work);

/*
 * a note on stream states used:
 * we use following states in the compressed core
 * SNDRV_PCM_STATE_OPEN: When stream has been opened.
 * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by
 *	calling SNDRV_COMPRESS_SET_PARAMS. Running streams will come to this
 *	state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain.
 * SNDRV_PCM_STATE_PREPARED: When a stream has been written to (for
 *	playback only). User after setting up stream writes the data buffer
 *	before starting the stream.
 * SNDRV_PCM_STATE_RUNNING: When stream has been started and is
 *	decoding/encoding and rendering/capturing data.
 * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done
 *	by calling SNDRV_COMPRESS_DRAIN.
 * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling
 *	SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling
 *	SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively.
 */
static int snd_compr_open(struct inode *inode, struct file *f)
{}

static int snd_compr_free(struct inode *inode, struct file *f)
{}

static int snd_compr_update_tstamp(struct snd_compr_stream *stream,
		struct snd_compr_tstamp *tstamp)
{}

static size_t snd_compr_calc_avail(struct snd_compr_stream *stream,
		struct snd_compr_avail *avail)
{}

static inline size_t snd_compr_get_avail(struct snd_compr_stream *stream)
{}

static int
snd_compr_ioctl_avail(struct snd_compr_stream *stream, unsigned long arg)
{}

static int snd_compr_write_data(struct snd_compr_stream *stream,
	       const char __user *buf, size_t count)
{}

static ssize_t snd_compr_write(struct file *f, const char __user *buf,
		size_t count, loff_t *offset)
{}


static ssize_t snd_compr_read(struct file *f, char __user *buf,
		size_t count, loff_t *offset)
{}

static int snd_compr_mmap(struct file *f, struct vm_area_struct *vma)
{}

static __poll_t snd_compr_get_poll(struct snd_compr_stream *stream)
{}

static __poll_t snd_compr_poll(struct file *f, poll_table *wait)
{}

static int
snd_compr_get_caps(struct snd_compr_stream *stream, unsigned long arg)
{}

#ifndef COMPR_CODEC_CAPS_OVERFLOW
static int
snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg)
{}
#endif /* !COMPR_CODEC_CAPS_OVERFLOW */

int snd_compr_malloc_pages(struct snd_compr_stream *stream, size_t size)
{}
EXPORT_SYMBOL();

int snd_compr_free_pages(struct snd_compr_stream *stream)
{}
EXPORT_SYMBOL();

/* revisit this with snd_pcm_preallocate_xxx */
static int snd_compr_allocate_buffer(struct snd_compr_stream *stream,
		struct snd_compr_params *params)
{}

static int snd_compress_check_input(struct snd_compr_params *params)
{}

static int
snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
{}

static int
snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg)
{}

static int
snd_compr_get_metadata(struct snd_compr_stream *stream, unsigned long arg)
{}

static int
snd_compr_set_metadata(struct snd_compr_stream *stream, unsigned long arg)
{}

static inline int
snd_compr_tstamp(struct snd_compr_stream *stream, unsigned long arg)
{}

static int snd_compr_pause(struct snd_compr_stream *stream)
{}

static int snd_compr_resume(struct snd_compr_stream *stream)
{}

static int snd_compr_start(struct snd_compr_stream *stream)
{}

static int snd_compr_stop(struct snd_compr_stream *stream)
{}

static void error_delayed_work(struct work_struct *work)
{}

/**
 * snd_compr_stop_error: Report a fatal error on a stream
 * @stream: pointer to stream
 * @state: state to transition the stream to
 *
 * Stop the stream and set its state.
 *
 * Should be called with compressed device lock held.
 *
 * Return: zero if successful, or a negative error code
 */
int snd_compr_stop_error(struct snd_compr_stream *stream,
			 snd_pcm_state_t state)
{}
EXPORT_SYMBOL_GPL();

static int snd_compress_wait_for_drain(struct snd_compr_stream *stream)
{}

static int snd_compr_drain(struct snd_compr_stream *stream)
{}

static int snd_compr_next_track(struct snd_compr_stream *stream)
{}

static int snd_compr_partial_drain(struct snd_compr_stream *stream)
{}

static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
{}

/* support of 32bit userspace on 64bit platforms */
#ifdef CONFIG_COMPAT
static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd,
						unsigned long arg)
{}
#endif

static const struct file_operations snd_compr_file_ops =;

static int snd_compress_dev_register(struct snd_device *device)
{}

static int snd_compress_dev_disconnect(struct snd_device *device)
{}

#ifdef CONFIG_SND_VERBOSE_PROCFS
static void snd_compress_proc_info_read(struct snd_info_entry *entry,
					struct snd_info_buffer *buffer)
{}

static int snd_compress_proc_init(struct snd_compr *compr)
{}

static void snd_compress_proc_done(struct snd_compr *compr)
{}

static inline void snd_compress_set_id(struct snd_compr *compr, const char *id)
{}
#else
static inline int snd_compress_proc_init(struct snd_compr *compr)
{
	return 0;
}

static inline void snd_compress_proc_done(struct snd_compr *compr)
{
}

static inline void snd_compress_set_id(struct snd_compr *compr, const char *id)
{
}
#endif

static int snd_compress_dev_free(struct snd_device *device)
{}

/**
 * snd_compress_new: create new compress device
 * @card: sound card pointer
 * @device: device number
 * @dirn: device direction, should be of type enum snd_compr_direction
 * @id: ID string
 * @compr: compress device pointer
 *
 * Return: zero if successful, or a negative error code
 */
int snd_compress_new(struct snd_card *card, int device,
			int dirn, const char *id, struct snd_compr *compr)
{}
EXPORT_SYMBOL_GPL();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();