linux/sound/soc/qcom/qdsp6/q6asm.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
// Copyright (c) 2018, Linaro Limited

#include <dt-bindings/sound/qcom,q6asm.h>
#include <linux/mutex.h>
#include <linux/wait.h>
#include <linux/module.h>
#include <linux/soc/qcom/apr.h>
#include <linux/device.h>
#include <linux/of_platform.h>
#include <linux/spinlock.h>
#include <linux/kref.h>
#include <linux/of.h>
#include <uapi/sound/asound.h>
#include <uapi/sound/compress_params.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include "q6asm.h"
#include "q6core.h"
#include "q6dsp-errno.h"
#include "q6dsp-common.h"

#define ASM_STREAM_CMD_CLOSE
#define ASM_STREAM_CMD_FLUSH
#define ASM_SESSION_CMD_PAUSE
#define ASM_DATA_CMD_EOS
#define ASM_DATA_EVENT_RENDERED_EOS
#define ASM_NULL_POPP_TOPOLOGY
#define ASM_STREAM_CMD_FLUSH_READBUFS
#define ASM_STREAM_CMD_SET_ENCDEC_PARAM
#define ASM_STREAM_POSTPROC_TOPO_ID_NONE
#define ASM_CMD_SHARED_MEM_MAP_REGIONS
#define ASM_CMDRSP_SHARED_MEM_MAP_REGIONS
#define ASM_CMD_SHARED_MEM_UNMAP_REGIONS
#define ASM_DATA_CMD_MEDIA_FMT_UPDATE_V2
#define ASM_DATA_EVENT_WRITE_DONE_V2
#define ASM_PARAM_ID_ENCDEC_ENC_CFG_BLK_V2
#define ASM_SESSION_CMD_RUN_V2
#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V2
#define ASM_MEDIA_FMT_MP3
#define ASM_MEDIA_FMT_FLAC
#define ASM_MEDIA_FMT_WMA_V9
#define ASM_MEDIA_FMT_WMA_V10
#define ASM_DATA_CMD_WRITE_V2
#define ASM_DATA_CMD_READ_V2
#define ASM_SESSION_CMD_SUSPEND
#define ASM_STREAM_CMD_OPEN_WRITE_V3
#define ASM_STREAM_CMD_OPEN_READ_V3
#define ASM_DATA_EVENT_READ_DONE_V2
#define ASM_STREAM_CMD_OPEN_READWRITE_V2
#define ASM_MEDIA_FMT_ALAC
#define ASM_MEDIA_FMT_APE
#define ASM_DATA_CMD_REMOVE_INITIAL_SILENCE
#define ASM_DATA_CMD_REMOVE_TRAILING_SILENCE


#define ASM_LEGACY_STREAM_SESSION
/* Bit shift for the stream_perf_mode subfield. */
#define ASM_SHIFT_STREAM_PERF_MODE_FLAG_IN_OPEN_READ
#define ASM_END_POINT_DEVICE_MATRIX
#define ASM_DEFAULT_APP_TYPE
#define ASM_SYNC_IO_MODE
#define ASM_ASYNC_IO_MODE
#define ASM_TUN_READ_IO_MODE
#define ASM_TUN_WRITE_IO_MODE
#define ASM_SHIFT_GAPLESS_MODE_FLAG
#define ADSP_MEMORY_MAP_SHMEM8_4K_POOL

struct avs_cmd_shared_mem_map_regions {} __packed;

struct avs_shared_map_region_payload {} __packed;

struct avs_cmd_shared_mem_unmap_regions {} __packed;

struct asm_data_cmd_media_fmt_update_v2 {} __packed;

struct asm_multi_channel_pcm_fmt_blk_v2 {} __packed;

struct asm_flac_fmt_blk_v2 {} __packed;

struct asm_wmastdv9_fmt_blk_v2 {} __packed;

struct asm_wmaprov10_fmt_blk_v2 {} __packed;

struct asm_alac_fmt_blk_v2 {} __packed;

struct asm_ape_fmt_blk_v2 {} __packed;

struct asm_stream_cmd_set_encdec_param {} __packed;

struct asm_enc_cfg_blk_param_v2 {} __packed;

struct asm_multi_channel_pcm_enc_cfg_v2 {} __packed;

struct asm_data_cmd_read_v2 {} __packed;

struct asm_data_cmd_read_v2_done {};

struct asm_stream_cmd_open_read_v3 {} __packed;

struct asm_data_cmd_write_v2 {} __packed;

struct asm_stream_cmd_open_write_v3 {} __packed;

struct asm_session_cmd_run_v2 {} __packed;

struct audio_buffer {};

struct audio_port_data {};

struct q6asm {};

struct audio_client {};

static inline void q6asm_add_hdr(struct audio_client *ac, struct apr_hdr *hdr,
				 uint32_t pkt_size, bool cmd_flg,
				 uint32_t stream_id)
{}

static int q6asm_apr_send_session_pkt(struct q6asm *a, struct audio_client *ac,
				      struct apr_pkt *pkt, uint32_t rsp_opcode)
{}

static int __q6asm_memory_unmap(struct audio_client *ac,
				phys_addr_t buf_add, int dir)
{}


static void q6asm_audio_client_free_buf(struct audio_client *ac,
					struct audio_port_data *port)
{}

/**
 * q6asm_unmap_memory_regions() - unmap memory regions in the dsp.
 *
 * @dir: direction of audio stream
 * @ac: audio client instanace
 *
 * Return: Will be an negative value on failure or zero on success
 */
int q6asm_unmap_memory_regions(unsigned int dir, struct audio_client *ac)
{}
EXPORT_SYMBOL_GPL();

static int __q6asm_memory_map_regions(struct audio_client *ac, int dir,
				      size_t period_sz, unsigned int periods,
				      bool is_contiguous)
{}

/**
 * q6asm_map_memory_regions() - map memory regions in the dsp.
 *
 * @dir: direction of audio stream
 * @ac: audio client instanace
 * @phys: physical address that needs mapping.
 * @period_sz: audio period size
 * @periods: number of periods
 *
 * Return: Will be an negative value on failure or zero on success
 */
int q6asm_map_memory_regions(unsigned int dir, struct audio_client *ac,
			     phys_addr_t phys,
			     size_t period_sz, unsigned int periods)
{}
EXPORT_SYMBOL_GPL();

static void q6asm_audio_client_release(struct kref *ref)
{}

/**
 * q6asm_audio_client_free() - Freee allocated audio client
 *
 * @ac: audio client to free
 */
void q6asm_audio_client_free(struct audio_client *ac)
{}
EXPORT_SYMBOL_GPL();

static struct audio_client *q6asm_get_audio_client(struct q6asm *a,
						   int session_id)
{}

static int32_t q6asm_stream_callback(struct apr_device *adev,
				     struct apr_resp_pkt *data,
				     int session_id)
{}

static int q6asm_srvc_callback(struct apr_device *adev,
			       struct apr_resp_pkt *data)
{}

/**
 * q6asm_get_session_id() - get session id for audio client
 *
 * @c: audio client pointer
 *
 * Return: Will be an session id of the audio client.
 */
int q6asm_get_session_id(struct audio_client *c)
{}
EXPORT_SYMBOL_GPL();

/**
 * q6asm_audio_client_alloc() - Allocate a new audio client
 *
 * @dev: Pointer to asm child device.
 * @cb: event callback.
 * @priv: private data associated with this client.
 * @session_id: session id
 * @perf_mode: performace mode for this client
 *
 * Return: Will be an error pointer on error or a valid audio client
 * on success.
 */
struct audio_client *q6asm_audio_client_alloc(struct device *dev, q6asm_cb cb,
					      void *priv, int session_id,
					      int perf_mode)
{}
EXPORT_SYMBOL_GPL();

static int q6asm_ac_send_cmd_sync(struct audio_client *ac, struct apr_pkt *pkt)
{}

/**
 * q6asm_open_write() - Open audio client for writing
 * @ac: audio client pointer
 * @stream_id: stream id of q6asm session
 * @format: audio sample format
 * @codec_profile: compressed format profile
 * @bits_per_sample: bits per sample
 * @is_gapless: flag to indicate if this is a gapless stream
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
		     uint32_t format, u32 codec_profile,
		     uint16_t bits_per_sample, bool is_gapless)
{}
EXPORT_SYMBOL_GPL();

static int __q6asm_run(struct audio_client *ac, uint32_t stream_id,
		       uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts,
		       bool wait)
{}

/**
 * q6asm_run() - start the audio client
 *
 * @ac: audio client pointer
 * @stream_id: stream id of q6asm session
 * @flags: flags associated with write
 * @msw_ts: timestamp msw
 * @lsw_ts: timestamp lsw
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_run(struct audio_client *ac, uint32_t stream_id, uint32_t flags,
	      uint32_t msw_ts, uint32_t lsw_ts)
{}
EXPORT_SYMBOL_GPL();

/**
 * q6asm_run_nowait() - start the audio client withou blocking
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @flags: flags associated with write
 * @msw_ts: timestamp msw
 * @lsw_ts: timestamp lsw
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_run_nowait(struct audio_client *ac, uint32_t stream_id,
		     uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts)
{}
EXPORT_SYMBOL_GPL();

/**
 * q6asm_media_format_block_multi_ch_pcm() - setup pcm configuration
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @rate: audio sample rate
 * @channels: number of audio channels.
 * @channel_map: channel map pointer
 * @bits_per_sample: bits per sample
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
					  uint32_t stream_id,
					  uint32_t rate, uint32_t channels,
					  u8 channel_map[PCM_MAX_NUM_CHANNEL],
					  uint16_t bits_per_sample)
{}
EXPORT_SYMBOL_GPL();

int q6asm_stream_media_format_block_flac(struct audio_client *ac,
					 uint32_t stream_id,
					 struct q6asm_flac_cfg *cfg)
{}
EXPORT_SYMBOL_GPL();

int q6asm_stream_media_format_block_wma_v9(struct audio_client *ac,
					   uint32_t stream_id,
					   struct q6asm_wma_cfg *cfg)
{}
EXPORT_SYMBOL_GPL();

int q6asm_stream_media_format_block_wma_v10(struct audio_client *ac,
					    uint32_t stream_id,
					    struct q6asm_wma_cfg *cfg)
{}
EXPORT_SYMBOL_GPL();

int q6asm_stream_media_format_block_alac(struct audio_client *ac,
					 uint32_t stream_id,
					 struct q6asm_alac_cfg *cfg)
{}
EXPORT_SYMBOL_GPL();

int q6asm_stream_media_format_block_ape(struct audio_client *ac,
					uint32_t stream_id,
					struct q6asm_ape_cfg *cfg)
{}
EXPORT_SYMBOL_GPL();

static int q6asm_stream_remove_silence(struct audio_client *ac, uint32_t stream_id,
				       uint32_t cmd,
				       uint32_t num_samples)
{}

int q6asm_stream_remove_initial_silence(struct audio_client *ac,
					uint32_t stream_id,
					uint32_t initial_samples)
{}
EXPORT_SYMBOL_GPL();

int q6asm_stream_remove_trailing_silence(struct audio_client *ac, uint32_t stream_id,
					 uint32_t trailing_samples)
{}
EXPORT_SYMBOL_GPL();

/**
 * q6asm_enc_cfg_blk_pcm_format_support() - setup pcm configuration for capture
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @rate: audio sample rate
 * @channels: number of audio channels.
 * @bits_per_sample: bits per sample
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
					 uint32_t stream_id, uint32_t rate,
					 uint32_t channels,
					 uint16_t bits_per_sample)
{}
EXPORT_SYMBOL_GPL();


/**
 * q6asm_read() - read data of period size from audio client
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_read(struct audio_client *ac, uint32_t stream_id)
{}
EXPORT_SYMBOL_GPL();

static int __q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
		uint32_t format, uint16_t bits_per_sample)
{}

/**
 * q6asm_open_read() - Open audio client for reading
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @format: audio sample format
 * @bits_per_sample: bits per sample
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
		    uint32_t format, uint16_t bits_per_sample)
{}
EXPORT_SYMBOL_GPL();

/**
 * q6asm_write_async() - non blocking write
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @len: length in bytes
 * @msw_ts: timestamp msw
 * @lsw_ts: timestamp lsw
 * @wflags: flags associated with write
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_write_async(struct audio_client *ac, uint32_t stream_id, uint32_t len,
		      uint32_t msw_ts, uint32_t lsw_ts, uint32_t wflags)
{}
EXPORT_SYMBOL_GPL();

static void q6asm_reset_buf_state(struct audio_client *ac)
{}

static int __q6asm_cmd(struct audio_client *ac, uint32_t stream_id, int cmd,
		       bool wait)
{}

/**
 * q6asm_cmd() - run cmd on audio client
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @cmd: command to run on audio client.
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_cmd(struct audio_client *ac, uint32_t stream_id, int cmd)
{}
EXPORT_SYMBOL_GPL();

/**
 * q6asm_cmd_nowait() - non blocking, run cmd on audio client
 *
 * @ac: audio client pointer
 * @stream_id: stream id
 * @cmd: command to run on audio client.
 *
 * Return: Will be an negative value on error or zero on success
 */
int q6asm_cmd_nowait(struct audio_client *ac, uint32_t stream_id, int cmd)
{}
EXPORT_SYMBOL_GPL();

static int q6asm_probe(struct apr_device *adev)
{}

#ifdef CONFIG_OF
static const struct of_device_id q6asm_device_id[]  =;
MODULE_DEVICE_TABLE(of, q6asm_device_id);
#endif

static struct apr_driver qcom_q6asm_driver =;

module_apr_driver();
MODULE_DESCRIPTION();
MODULE_LICENSE();