#include <linux/array_size.h>
#include <linux/ctype.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/list.h>
#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include "wm_adsp.h"
#define adsp_crit(_dsp, fmt, ...) …
#define adsp_err(_dsp, fmt, ...) …
#define adsp_warn(_dsp, fmt, ...) …
#define adsp_info(_dsp, fmt, ...) …
#define adsp_dbg(_dsp, fmt, ...) …
#define compr_err(_obj, fmt, ...) …
#define compr_dbg(_obj, fmt, ...) …
#define ADSP_MAX_STD_CTRL_SIZE …
static const struct cs_dsp_client_ops wm_adsp1_client_ops;
static const struct cs_dsp_client_ops wm_adsp2_client_ops;
#define WM_ADSP_FW_MBC_VSS …
#define WM_ADSP_FW_HIFI …
#define WM_ADSP_FW_TX …
#define WM_ADSP_FW_TX_SPK …
#define WM_ADSP_FW_RX …
#define WM_ADSP_FW_RX_ANC …
#define WM_ADSP_FW_CTRL …
#define WM_ADSP_FW_ASR …
#define WM_ADSP_FW_TRACE …
#define WM_ADSP_FW_SPK_PROT …
#define WM_ADSP_FW_SPK_CALI …
#define WM_ADSP_FW_SPK_DIAG …
#define WM_ADSP_FW_MISC …
#define WM_ADSP_NUM_FW …
static const char *wm_adsp_fw_text[WM_ADSP_NUM_FW] = …;
struct wm_adsp_system_config_xm_hdr { … } __packed;
struct wm_halo_system_config_xm_hdr { … } __packed;
struct wm_adsp_alg_xm_struct { … } __packed;
struct wm_adsp_host_buf_coeff_v1 { … } __packed;
struct wm_adsp_buffer { … } __packed;
struct wm_adsp_compr;
struct wm_adsp_compr_buf { … };
struct wm_adsp_compr { … };
#define WM_ADSP_MIN_FRAGMENTS …
#define WM_ADSP_MAX_FRAGMENTS …
#define WM_ADSP_MIN_FRAGMENT_SIZE …
#define WM_ADSP_MAX_FRAGMENT_SIZE …
#define WM_ADSP_ALG_XM_STRUCT_MAGIC …
#define HOST_BUFFER_FIELD(field) …
#define ALG_XM_FIELD(field) …
#define HOST_BUF_COEFF_SUPPORTED_COMPAT_VER …
#define HOST_BUF_COEFF_COMPAT_VER_MASK …
#define HOST_BUF_COEFF_COMPAT_VER_SHIFT …
static int wm_adsp_buffer_init(struct wm_adsp *dsp);
static int wm_adsp_buffer_free(struct wm_adsp *dsp);
struct wm_adsp_buffer_region { … };
struct wm_adsp_buffer_region_def { … };
static const struct wm_adsp_buffer_region_def default_regions[] = …;
struct wm_adsp_fw_caps { … };
static const struct wm_adsp_fw_caps ctrl_caps[] = …;
static const struct wm_adsp_fw_caps trace_caps[] = …;
static const struct { … } wm_adsp_fw[WM_ADSP_NUM_FW] = …;
struct wm_coeff_ctl { … };
int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
EXPORT_SYMBOL_GPL(…);
const struct soc_enum wm_adsp_fw_enum[] = …;
EXPORT_SYMBOL_GPL(…);
static inline struct wm_coeff_ctl *bytes_ext_to_ctl(struct soc_bytes_ext *ext)
{ … }
static int wm_coeff_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *uinfo)
{ … }
static int wm_coeff_put(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
const unsigned int __user *bytes, unsigned int size)
{ … }
static int wm_coeff_put_acked(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm_coeff_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *ucontrol)
{ … }
static int wm_coeff_tlv_get(struct snd_kcontrol *kctl,
unsigned int __user *bytes, unsigned int size)
{ … }
static int wm_coeff_get_acked(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len)
{ … }
static void wm_adsp_ctl_work(struct work_struct *work)
{ … }
int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wm_adsp_control_add_cb(struct cs_dsp_coeff_ctl *cs_ctl)
{ … }
static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl)
{ … }
int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,
unsigned int alg, void *buf, size_t len)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type,
unsigned int alg, void *buf, size_t len)
{ … }
EXPORT_SYMBOL_GPL(…);
static void wm_adsp_release_firmware_files(struct wm_adsp *dsp,
const struct firmware *wmfw_firmware,
char *wmfw_filename,
const struct firmware *coeff_firmware,
char *coeff_filename)
{ … }
static int wm_adsp_request_firmware_file(struct wm_adsp *dsp,
const struct firmware **firmware, char **filename,
const char *dir, const char *system_name,
const char *asoc_component_prefix,
const char *filetype)
{ … }
static const char *cirrus_dir = …;
static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,
const struct firmware **wmfw_firmware,
char **wmfw_filename,
const struct firmware **coeff_firmware,
char **coeff_filename)
{ … }
static int wm_adsp_common_init(struct wm_adsp *dsp)
{ … }
int wm_adsp1_init(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp1_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol,
int event)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp2_set_dspclk(struct snd_soc_dapm_widget *w, unsigned int freq)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp2_preloader_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp_power_up(struct wm_adsp *dsp, bool load_firmware)
{ … }
EXPORT_SYMBOL_GPL(…);
void wm_adsp_power_down(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
static void wm_adsp_boot_work(struct work_struct *work)
{ … }
int wm_adsp_early_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wm_adsp_pre_run(struct cs_dsp *cs_dsp)
{ … }
static int wm_adsp_event_post_run(struct cs_dsp *cs_dsp)
{ … }
static void wm_adsp_event_post_stop(struct cs_dsp *cs_dsp)
{ … }
int wm_adsp_run(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
void wm_adsp_stop(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *component)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp2_component_remove(struct wm_adsp *dsp, struct snd_soc_component *component)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp2_init(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_halo_init(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
void wm_adsp2_remove(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr)
{ … }
static int wm_adsp_compr_attach(struct wm_adsp_compr *compr)
{ … }
static void wm_adsp_compr_detach(struct wm_adsp_compr *compr)
{ … }
int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp_compr_free(struct snd_soc_component *component,
struct snd_compr_stream *stream)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wm_adsp_compr_check_params(struct snd_compr_stream *stream,
struct snd_compr_params *params)
{ … }
static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr)
{ … }
int wm_adsp_compr_set_params(struct snd_soc_component *component,
struct snd_compr_stream *stream,
struct snd_compr_params *params)
{ … }
EXPORT_SYMBOL_GPL(…);
int wm_adsp_compr_get_caps(struct snd_soc_component *component,
struct snd_compr_stream *stream,
struct snd_compr_caps *caps)
{ … }
EXPORT_SYMBOL_GPL(…);
static inline int wm_adsp_buffer_read(struct wm_adsp_compr_buf *buf,
unsigned int field_offset, u32 *data)
{ … }
static inline int wm_adsp_buffer_write(struct wm_adsp_compr_buf *buf,
unsigned int field_offset, u32 data)
{ … }
static int wm_adsp_buffer_populate(struct wm_adsp_compr_buf *buf)
{ … }
static void wm_adsp_buffer_clear(struct wm_adsp_compr_buf *buf)
{ … }
static struct wm_adsp_compr_buf *wm_adsp_buffer_alloc(struct wm_adsp *dsp)
{ … }
static int wm_adsp_buffer_parse_legacy(struct wm_adsp *dsp)
{ … }
static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl)
{ … }
static int wm_adsp_buffer_init(struct wm_adsp *dsp)
{ … }
static int wm_adsp_buffer_free(struct wm_adsp *dsp)
{ … }
static int wm_adsp_buffer_get_error(struct wm_adsp_compr_buf *buf)
{ … }
int wm_adsp_compr_trigger(struct snd_soc_component *component,
struct snd_compr_stream *stream, int cmd)
{ … }
EXPORT_SYMBOL_GPL(…);
static inline int wm_adsp_buffer_size(struct wm_adsp_compr_buf *buf)
{ … }
static int wm_adsp_buffer_update_avail(struct wm_adsp_compr_buf *buf)
{ … }
int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wm_adsp_buffer_reenable_irq(struct wm_adsp_compr_buf *buf)
{ … }
int wm_adsp_compr_pointer(struct snd_soc_component *component,
struct snd_compr_stream *stream,
struct snd_compr_tstamp *tstamp)
{ … }
EXPORT_SYMBOL_GPL(…);
static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target)
{ … }
static int wm_adsp_compr_read(struct wm_adsp_compr *compr,
char __user *buf, size_t count)
{ … }
int wm_adsp_compr_copy(struct snd_soc_component *component,
struct snd_compr_stream *stream, char __user *buf,
size_t count)
{ … }
EXPORT_SYMBOL_GPL(…);
static void wm_adsp_fatal_error(struct cs_dsp *cs_dsp)
{ … }
irqreturn_t wm_adsp2_bus_error(int irq, void *data)
{ … }
EXPORT_SYMBOL_GPL(…);
irqreturn_t wm_halo_bus_error(int irq, void *data)
{ … }
EXPORT_SYMBOL_GPL(…);
irqreturn_t wm_halo_wdt_expire(int irq, void *data)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct cs_dsp_client_ops wm_adsp1_client_ops = …;
static const struct cs_dsp_client_ops wm_adsp2_client_ops = …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);