wm_adsp.h (2dd044641ec3672433b9fe3ec47b236621757aa8) | wm_adsp.h (f6bc909e7673c30abcbdb329e7d0aa2e83c103d7) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * wm_adsp.h -- Wolfson ADSP support 4 * 5 * Copyright 2012 Wolfson Microelectronics plc 6 * 7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 8 */ 9 10#ifndef __WM_ADSP_H 11#define __WM_ADSP_H 12 | 1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * wm_adsp.h -- Wolfson ADSP support 4 * 5 * Copyright 2012 Wolfson Microelectronics plc 6 * 7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 8 */ 9 10#ifndef __WM_ADSP_H 11#define __WM_ADSP_H 12 |
13#include <linux/firmware/cirrus/cs_dsp.h> 14#include <linux/firmware/cirrus/wmfw.h> 15 |
|
13#include <sound/soc.h> 14#include <sound/soc-dapm.h> 15#include <sound/compress_driver.h> 16 | 16#include <sound/soc.h> 17#include <sound/soc-dapm.h> 18#include <sound/compress_driver.h> 19 |
17#include "wmfw.h" 18 | |
19/* Return values for wm_adsp_compr_handle_irq */ 20#define WM_ADSP_COMPR_OK 0 21#define WM_ADSP_COMPR_VOICE_TRIGGER 1 22 | 20/* Return values for wm_adsp_compr_handle_irq */ 21#define WM_ADSP_COMPR_OK 0 22#define WM_ADSP_COMPR_VOICE_TRIGGER 1 23 |
23#define CS_ADSP2_REGION_0 BIT(0) 24#define CS_ADSP2_REGION_1 BIT(1) 25#define CS_ADSP2_REGION_2 BIT(2) 26#define CS_ADSP2_REGION_3 BIT(3) 27#define CS_ADSP2_REGION_4 BIT(4) 28#define CS_ADSP2_REGION_5 BIT(5) 29#define CS_ADSP2_REGION_6 BIT(6) 30#define CS_ADSP2_REGION_7 BIT(7) 31#define CS_ADSP2_REGION_8 BIT(8) 32#define CS_ADSP2_REGION_9 BIT(9) 33#define CS_ADSP2_REGION_1_9 (CS_ADSP2_REGION_1 | \ 34 CS_ADSP2_REGION_2 | CS_ADSP2_REGION_3 | \ 35 CS_ADSP2_REGION_4 | CS_ADSP2_REGION_5 | \ 36 CS_ADSP2_REGION_6 | CS_ADSP2_REGION_7 | \ 37 CS_ADSP2_REGION_8 | CS_ADSP2_REGION_9) 38#define CS_ADSP2_REGION_ALL (CS_ADSP2_REGION_0 | CS_ADSP2_REGION_1_9) 39 40struct cs_dsp_region { 41 int type; 42 unsigned int base; 43}; 44 45struct cs_dsp_alg_region { 46 struct list_head list; 47 unsigned int alg; 48 int type; 49 unsigned int base; 50}; 51 | |
52struct wm_adsp_compr; 53struct wm_adsp_compr_buf; | 24struct wm_adsp_compr; 25struct wm_adsp_compr_buf; |
54struct cs_dsp_ops; 55struct cs_dsp_client_ops; | |
56 | 26 |
57struct cs_dsp_coeff_ctl { 58 const char *fw_name; 59 /* Subname is needed to match with firmware */ 60 const char *subname; 61 unsigned int subname_len; 62 struct cs_dsp_alg_region alg_region; 63 struct cs_dsp *dsp; 64 unsigned int enabled:1; 65 struct list_head list; 66 void *cache; 67 unsigned int offset; 68 size_t len; 69 unsigned int set:1; 70 unsigned int flags; 71 unsigned int type; 72 73 void *priv; 74}; 75 76struct cs_dsp { 77 const char *name; 78 int rev; 79 int num; 80 int type; 81 struct device *dev; 82 struct regmap *regmap; 83 84 const struct cs_dsp_ops *ops; 85 const struct cs_dsp_client_ops *client_ops; 86 87 unsigned int base; 88 unsigned int base_sysinfo; 89 unsigned int sysclk_reg; 90 unsigned int sysclk_mask; 91 unsigned int sysclk_shift; 92 93 struct list_head alg_regions; 94 95 const char *fw_name; 96 unsigned int fw_id; 97 unsigned int fw_id_version; 98 unsigned int fw_vendor_id; 99 100 const struct cs_dsp_region *mem; 101 int num_mems; 102 103 int fw_ver; 104 105 bool booted; 106 bool running; 107 108 struct list_head ctl_list; 109 110 struct mutex pwr_lock; 111 112 unsigned int lock_regions; 113 114#ifdef CONFIG_DEBUG_FS 115 struct dentry *debugfs_root; 116 char *wmfw_file_name; 117 char *bin_file_name; 118#endif 119}; 120 | |
121struct wm_adsp { 122 struct cs_dsp cs_dsp; 123 const char *part; 124 const char *fwf_name; 125 struct snd_soc_component *component; 126 127 unsigned int sys_config_size; 128 129 int fw; 130 131 struct work_struct boot_work; 132 133 bool preloaded; 134 bool fatal_error; 135 136 struct list_head compr_list; 137 struct list_head buffer_list; 138}; 139 | 27struct wm_adsp { 28 struct cs_dsp cs_dsp; 29 const char *part; 30 const char *fwf_name; 31 struct snd_soc_component *component; 32 33 unsigned int sys_config_size; 34 35 int fw; 36 37 struct work_struct boot_work; 38 39 bool preloaded; 40 bool fatal_error; 41 42 struct list_head compr_list; 43 struct list_head buffer_list; 44}; 45 |
140struct cs_dsp_ops { 141 bool (*validate_version)(struct cs_dsp *dsp, unsigned int version); 142 unsigned int (*parse_sizes)(struct cs_dsp *dsp, 143 const char * const file, 144 unsigned int pos, 145 const struct firmware *firmware); 146 int (*setup_algs)(struct cs_dsp *dsp); 147 unsigned int (*region_to_reg)(struct cs_dsp_region const *mem, 148 unsigned int offset); 149 150 void (*show_fw_status)(struct cs_dsp *dsp); 151 void (*stop_watchdog)(struct cs_dsp *dsp); 152 153 int (*enable_memory)(struct cs_dsp *dsp); 154 void (*disable_memory)(struct cs_dsp *dsp); 155 int (*lock_memory)(struct cs_dsp *dsp, unsigned int lock_regions); 156 157 int (*enable_core)(struct cs_dsp *dsp); 158 void (*disable_core)(struct cs_dsp *dsp); 159 160 int (*start_core)(struct cs_dsp *dsp); 161 void (*stop_core)(struct cs_dsp *dsp); 162}; 163 | |
164#define WM_ADSP1(wname, num) \ 165 SND_SOC_DAPM_PGA_E(wname, SND_SOC_NOPM, num, 0, NULL, 0, \ 166 wm_adsp1_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD) 167 168#define WM_ADSP2_PRELOAD_SWITCH(wname, num) \ 169 SOC_SINGLE_EXT(wname " Preload Switch", SND_SOC_NOPM, num, 1, 0, \ 170 wm_adsp2_preloader_get, wm_adsp2_preloader_put) 171 --- 62 unchanged lines hidden (view full) --- 234int wm_adsp_compr_copy(struct snd_soc_component *component, 235 struct snd_compr_stream *stream, 236 char __user *buf, size_t count); 237int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type, 238 unsigned int alg, void *buf, size_t len); 239int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type, 240 unsigned int alg, void *buf, size_t len); 241 | 46#define WM_ADSP1(wname, num) \ 47 SND_SOC_DAPM_PGA_E(wname, SND_SOC_NOPM, num, 0, NULL, 0, \ 48 wm_adsp1_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD) 49 50#define WM_ADSP2_PRELOAD_SWITCH(wname, num) \ 51 SOC_SINGLE_EXT(wname " Preload Switch", SND_SOC_NOPM, num, 1, 0, \ 52 wm_adsp2_preloader_get, wm_adsp2_preloader_put) 53 --- 62 unchanged lines hidden (view full) --- 116int wm_adsp_compr_copy(struct snd_soc_component *component, 117 struct snd_compr_stream *stream, 118 char __user *buf, size_t count); 119int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type, 120 unsigned int alg, void *buf, size_t len); 121int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type, 122 unsigned int alg, void *buf, size_t len); 123 |
242struct cs_dsp_client_ops { 243 int (*control_add)(struct cs_dsp_coeff_ctl *ctl); 244 void (*control_remove)(struct cs_dsp_coeff_ctl *ctl); 245 int (*post_run)(struct cs_dsp *dsp); 246 void (*post_stop)(struct cs_dsp *dsp); 247 void (*watchdog_expired)(struct cs_dsp *dsp); 248}; 249 | |
250#endif | 124#endif |