Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: sigmadsp: Add support for fw v2

This patch adds support for the v2 version of the SigmaDSP firmware file
format. The new format has support for having different program and
parameter settings for different samplerates. In addition it stores metadata
describing the firmware. This metadata includes the set of supported
samplerates which will be used to restrict the samplerates that can be
selected by userspace. Also included is information about the modifiable
parameters. Those will be exposed as ALSA controls so they can be changed at
runtime.

The new format is based on a binary type-length-value structure that makes
it both forward and backwards compatible.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Lars-Peter Clausen and committed by
Mark Brown
a35daac7 d48b088e

+504 -2
+29
sound/soc/codecs/sigmadsp-i2c.c
··· 34 34 return ret; 35 35 } 36 36 37 + static int sigmadsp_read_i2c(void *control_data, 38 + unsigned int addr, uint8_t data[], size_t len) 39 + { 40 + struct i2c_client *client = control_data; 41 + struct i2c_msg msgs[2]; 42 + uint8_t buf[2]; 43 + int ret; 44 + 45 + put_unaligned_be16(addr, buf); 46 + 47 + msgs[0].addr = client->addr; 48 + msgs[0].len = sizeof(buf); 49 + msgs[0].buf = buf; 50 + msgs[0].flags = 0; 51 + 52 + msgs[1].addr = client->addr; 53 + msgs[1].len = len; 54 + msgs[1].buf = data; 55 + msgs[1].flags = I2C_M_RD; 56 + 57 + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); 58 + if (ret < 0) 59 + return ret; 60 + else if (ret != ARRAY_SIZE(msgs)) 61 + return -EIO; 62 + return 0; 63 + } 64 + 37 65 /** 38 66 * devm_sigmadsp_init_i2c() - Initialize SigmaDSP instance 39 67 * @client: The parent I2C device ··· 83 55 84 56 sigmadsp->control_data = client; 85 57 sigmadsp->write = sigmadsp_write_i2c; 58 + sigmadsp->read = sigmadsp_read_i2c; 86 59 87 60 return sigmadsp; 88 61 }
+8
sound/soc/codecs/sigmadsp-regmap.c
··· 19 19 data, len); 20 20 } 21 21 22 + static int sigmadsp_read_regmap(void *control_data, 23 + unsigned int addr, uint8_t data[], size_t len) 24 + { 25 + return regmap_raw_read(control_data, addr, 26 + data, len); 27 + } 28 + 22 29 /** 23 30 * devm_sigmadsp_init_i2c() - Initialize SigmaDSP instance 24 31 * @dev: The parent device ··· 49 42 50 43 sigmadsp->control_data = regmap; 51 44 sigmadsp->write = sigmadsp_write_regmap; 45 + sigmadsp->read = sigmadsp_read_regmap; 52 46 53 47 return sigmadsp; 54 48 }
+461 -2
sound/soc/codecs/sigmadsp.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/slab.h> 16 16 17 + #include <sound/control.h> 17 18 #include <sound/soc.h> 18 19 19 20 #include "sigmadsp.h" 20 21 21 22 #define SIGMA_MAGIC "ADISIGM" 22 23 24 + #define SIGMA_FW_CHUNK_TYPE_DATA 0 25 + #define SIGMA_FW_CHUNK_TYPE_CONTROL 1 26 + #define SIGMA_FW_CHUNK_TYPE_SAMPLERATES 2 27 + 28 + struct sigmadsp_control { 29 + struct list_head head; 30 + uint32_t samplerates; 31 + unsigned int addr; 32 + unsigned int num_bytes; 33 + const char *name; 34 + struct snd_kcontrol *kcontrol; 35 + bool cached; 36 + uint8_t cache[]; 37 + }; 38 + 23 39 struct sigmadsp_data { 24 40 struct list_head head; 41 + uint32_t samplerates; 25 42 unsigned int addr; 26 43 unsigned int length; 27 44 uint8_t data[]; 28 45 }; 46 + 47 + struct sigma_fw_chunk { 48 + __le32 length; 49 + __le32 tag; 50 + __le32 samplerates; 51 + } __packed; 52 + 53 + struct sigma_fw_chunk_data { 54 + struct sigma_fw_chunk chunk; 55 + __le16 addr; 56 + uint8_t data[]; 57 + } __packed; 58 + 59 + struct sigma_fw_chunk_control { 60 + struct sigma_fw_chunk chunk; 61 + __le16 type; 62 + __le16 addr; 63 + __le16 num_bytes; 64 + const char name[]; 65 + } __packed; 66 + 67 + struct sigma_fw_chunk_samplerate { 68 + struct sigma_fw_chunk chunk; 69 + __le32 samplerates[]; 70 + } __packed; 29 71 30 72 struct sigma_firmware_header { 31 73 unsigned char magic[7]; ··· 94 52 const uint8_t data[], size_t len) 95 53 { 96 54 return sigmadsp->write(sigmadsp->control_data, addr, data, len); 55 + } 56 + 57 + static int sigmadsp_read(struct sigmadsp *sigmadsp, unsigned int addr, 58 + uint8_t data[], size_t len) 59 + { 60 + return sigmadsp->read(sigmadsp->control_data, addr, data, len); 61 + } 62 + 63 + static int sigmadsp_ctrl_info(struct snd_kcontrol *kcontrol, 64 + struct snd_ctl_elem_info *info) 65 + { 66 + struct sigmadsp_control *ctrl = (void *)kcontrol->private_value; 67 + 68 + info->type = SNDRV_CTL_ELEM_TYPE_BYTES; 69 + info->count = ctrl->num_bytes; 70 + 71 + return 0; 72 + } 73 + 74 + static int sigmadsp_ctrl_write(struct sigmadsp *sigmadsp, 75 + struct sigmadsp_control *ctrl, void *data) 76 + { 77 + /* safeload loads up to 20 bytes in a atomic operation */ 78 + if (ctrl->num_bytes > 4 && ctrl->num_bytes <= 20 && sigmadsp->ops && 79 + sigmadsp->ops->safeload) 80 + return sigmadsp->ops->safeload(sigmadsp, ctrl->addr, data, 81 + ctrl->num_bytes); 82 + else 83 + return sigmadsp_write(sigmadsp, ctrl->addr, data, 84 + ctrl->num_bytes); 85 + } 86 + 87 + static int sigmadsp_ctrl_put(struct snd_kcontrol *kcontrol, 88 + struct snd_ctl_elem_value *ucontrol) 89 + { 90 + struct sigmadsp_control *ctrl = (void *)kcontrol->private_value; 91 + struct sigmadsp *sigmadsp = snd_kcontrol_chip(kcontrol); 92 + uint8_t *data; 93 + int ret = 0; 94 + 95 + mutex_lock(&sigmadsp->lock); 96 + 97 + data = ucontrol->value.bytes.data; 98 + 99 + if (!(kcontrol->vd[0].access & SNDRV_CTL_ELEM_ACCESS_INACTIVE)) 100 + ret = sigmadsp_ctrl_write(sigmadsp, ctrl, data); 101 + 102 + if (ret == 0) { 103 + memcpy(ctrl->cache, data, ctrl->num_bytes); 104 + ctrl->cached = true; 105 + } 106 + 107 + mutex_unlock(&sigmadsp->lock); 108 + 109 + return ret; 110 + } 111 + 112 + static int sigmadsp_ctrl_get(struct snd_kcontrol *kcontrol, 113 + struct snd_ctl_elem_value *ucontrol) 114 + { 115 + struct sigmadsp_control *ctrl = (void *)kcontrol->private_value; 116 + struct sigmadsp *sigmadsp = snd_kcontrol_chip(kcontrol); 117 + int ret = 0; 118 + 119 + mutex_lock(&sigmadsp->lock); 120 + 121 + if (!ctrl->cached) { 122 + ret = sigmadsp_read(sigmadsp, ctrl->addr, ctrl->cache, 123 + ctrl->num_bytes); 124 + } 125 + 126 + if (ret == 0) { 127 + ctrl->cached = true; 128 + memcpy(ucontrol->value.bytes.data, ctrl->cache, 129 + ctrl->num_bytes); 130 + } 131 + 132 + mutex_unlock(&sigmadsp->lock); 133 + 134 + return ret; 135 + } 136 + 137 + static void sigmadsp_control_free(struct snd_kcontrol *kcontrol) 138 + { 139 + struct sigmadsp_control *ctrl = (void *)kcontrol->private_value; 140 + 141 + ctrl->kcontrol = NULL; 142 + } 143 + 144 + static bool sigma_fw_validate_control_name(const char *name, unsigned int len) 145 + { 146 + unsigned int i; 147 + 148 + for (i = 0; i < len; i++) { 149 + /* Normal ASCII characters are valid */ 150 + if (name[i] < ' ' || name[i] > '~') 151 + return false; 152 + } 153 + 154 + return true; 155 + } 156 + 157 + static int sigma_fw_load_control(struct sigmadsp *sigmadsp, 158 + const struct sigma_fw_chunk *chunk, unsigned int length) 159 + { 160 + const struct sigma_fw_chunk_control *ctrl_chunk; 161 + struct sigmadsp_control *ctrl; 162 + unsigned int num_bytes; 163 + size_t name_len; 164 + char *name; 165 + int ret; 166 + 167 + if (length <= sizeof(*ctrl_chunk)) 168 + return -EINVAL; 169 + 170 + ctrl_chunk = (const struct sigma_fw_chunk_control *)chunk; 171 + 172 + name_len = length - sizeof(*ctrl_chunk); 173 + if (name_len >= SNDRV_CTL_ELEM_ID_NAME_MAXLEN) 174 + name_len = SNDRV_CTL_ELEM_ID_NAME_MAXLEN - 1; 175 + 176 + /* Make sure there are no non-displayable characaters in the string */ 177 + if (!sigma_fw_validate_control_name(ctrl_chunk->name, name_len)) 178 + return -EINVAL; 179 + 180 + num_bytes = le16_to_cpu(ctrl_chunk->num_bytes); 181 + ctrl = kzalloc(sizeof(*ctrl) + num_bytes, GFP_KERNEL); 182 + if (!ctrl) 183 + return -ENOMEM; 184 + 185 + name = kzalloc(name_len + 1, GFP_KERNEL); 186 + if (!name) { 187 + ret = -ENOMEM; 188 + goto err_free_ctrl; 189 + } 190 + memcpy(name, ctrl_chunk->name, name_len); 191 + name[name_len] = '\0'; 192 + ctrl->name = name; 193 + 194 + ctrl->addr = le16_to_cpu(ctrl_chunk->addr); 195 + ctrl->num_bytes = num_bytes; 196 + ctrl->samplerates = chunk->samplerates; 197 + 198 + list_add_tail(&ctrl->head, &sigmadsp->ctrl_list); 199 + 200 + return 0; 201 + 202 + err_free_ctrl: 203 + kfree(ctrl); 204 + 205 + return ret; 206 + } 207 + 208 + static int sigma_fw_load_data(struct sigmadsp *sigmadsp, 209 + const struct sigma_fw_chunk *chunk, unsigned int length) 210 + { 211 + const struct sigma_fw_chunk_data *data_chunk; 212 + struct sigmadsp_data *data; 213 + 214 + if (length <= sizeof(*data_chunk)) 215 + return -EINVAL; 216 + 217 + data_chunk = (struct sigma_fw_chunk_data *)chunk; 218 + 219 + length -= sizeof(*data_chunk); 220 + 221 + data = kzalloc(sizeof(*data) + length, GFP_KERNEL); 222 + if (!data) 223 + return -ENOMEM; 224 + 225 + data->addr = le16_to_cpu(data_chunk->addr); 226 + data->length = length; 227 + data->samplerates = chunk->samplerates; 228 + memcpy(data->data, data_chunk->data, length); 229 + list_add_tail(&data->head, &sigmadsp->data_list); 230 + 231 + return 0; 232 + } 233 + 234 + static int sigma_fw_load_samplerates(struct sigmadsp *sigmadsp, 235 + const struct sigma_fw_chunk *chunk, unsigned int length) 236 + { 237 + const struct sigma_fw_chunk_samplerate *rate_chunk; 238 + unsigned int num_rates; 239 + unsigned int *rates; 240 + unsigned int i; 241 + 242 + rate_chunk = (const struct sigma_fw_chunk_samplerate *)chunk; 243 + 244 + num_rates = (length - sizeof(*rate_chunk)) / sizeof(__le32); 245 + 246 + if (num_rates > 32 || num_rates == 0) 247 + return -EINVAL; 248 + 249 + /* We only allow one samplerates block per file */ 250 + if (sigmadsp->rate_constraints.count) 251 + return -EINVAL; 252 + 253 + rates = kcalloc(num_rates, sizeof(*rates), GFP_KERNEL); 254 + if (!rates) 255 + return -ENOMEM; 256 + 257 + for (i = 0; i < num_rates; i++) 258 + rates[i] = le32_to_cpu(rate_chunk->samplerates[i]); 259 + 260 + sigmadsp->rate_constraints.count = num_rates; 261 + sigmadsp->rate_constraints.list = rates; 262 + 263 + return 0; 264 + } 265 + 266 + static int sigmadsp_fw_load_v2(struct sigmadsp *sigmadsp, 267 + const struct firmware *fw) 268 + { 269 + struct sigma_fw_chunk *chunk; 270 + unsigned int length, pos; 271 + int ret; 272 + 273 + /* 274 + * Make sure that there is at least one chunk to avoid integer 275 + * underflows later on. Empty firmware is still valid though. 276 + */ 277 + if (fw->size < sizeof(*chunk) + sizeof(struct sigma_firmware_header)) 278 + return 0; 279 + 280 + pos = sizeof(struct sigma_firmware_header); 281 + 282 + while (pos < fw->size - sizeof(*chunk)) { 283 + chunk = (struct sigma_fw_chunk *)(fw->data + pos); 284 + 285 + length = le32_to_cpu(chunk->length); 286 + 287 + if (length > fw->size - pos || length < sizeof(*chunk)) 288 + return -EINVAL; 289 + 290 + switch (chunk->tag) { 291 + case SIGMA_FW_CHUNK_TYPE_DATA: 292 + ret = sigma_fw_load_data(sigmadsp, chunk, length); 293 + break; 294 + case SIGMA_FW_CHUNK_TYPE_CONTROL: 295 + ret = sigma_fw_load_control(sigmadsp, chunk, length); 296 + break; 297 + case SIGMA_FW_CHUNK_TYPE_SAMPLERATES: 298 + ret = sigma_fw_load_samplerates(sigmadsp, chunk, length); 299 + break; 300 + default: 301 + dev_warn(sigmadsp->dev, "Unknown chunk type: %d\n", 302 + chunk->tag); 303 + ret = 0; 304 + break; 305 + } 306 + 307 + if (ret) 308 + return ret; 309 + 310 + /* 311 + * This can not overflow since if length is larger than the 312 + * maximum firmware size (0x4000000) we'll error out earilier. 313 + */ 314 + pos += ALIGN(length, sizeof(__le32)); 315 + } 316 + 317 + return 0; 97 318 } 98 319 99 320 static inline u32 sigma_action_len(struct sigma_action *sa) ··· 454 149 455 150 static void sigmadsp_firmware_release(struct sigmadsp *sigmadsp) 456 151 { 152 + struct sigmadsp_control *ctrl, *_ctrl; 457 153 struct sigmadsp_data *data, *_data; 154 + 155 + list_for_each_entry_safe(ctrl, _ctrl, &sigmadsp->ctrl_list, head) { 156 + kfree(ctrl->name); 157 + kfree(ctrl); 158 + } 458 159 459 160 list_for_each_entry_safe(data, _data, &sigmadsp->data_list, head) 460 161 kfree(data); 461 162 163 + INIT_LIST_HEAD(&sigmadsp->ctrl_list); 462 164 INIT_LIST_HEAD(&sigmadsp->data_list); 463 165 } 464 166 ··· 521 209 case 1: 522 210 ret = sigmadsp_fw_load_v1(sigmadsp, fw); 523 211 break; 212 + case 2: 213 + ret = sigmadsp_fw_load_v2(sigmadsp, fw); 214 + break; 524 215 default: 525 216 dev_err(sigmadsp->dev, 526 - "Failed to load firmware: Invalid version %d. Supported firmware versions: 1\n", 217 + "Failed to load firmware: Invalid version %d. Supported firmware versions: 1, 2\n", 527 218 ssfw_head->version); 528 219 ret = -EINVAL; 529 220 break; ··· 547 232 sigmadsp->ops = ops; 548 233 sigmadsp->dev = dev; 549 234 235 + INIT_LIST_HEAD(&sigmadsp->ctrl_list); 550 236 INIT_LIST_HEAD(&sigmadsp->data_list); 237 + mutex_init(&sigmadsp->lock); 551 238 552 239 return sigmadsp_firmware_load(sigmadsp, firmware_name); 553 240 } ··· 587 270 } 588 271 EXPORT_SYMBOL_GPL(devm_sigmadsp_init); 589 272 273 + static int sigmadsp_rate_to_index(struct sigmadsp *sigmadsp, unsigned int rate) 274 + { 275 + unsigned int i; 276 + 277 + for (i = 0; i < sigmadsp->rate_constraints.count; i++) { 278 + if (sigmadsp->rate_constraints.list[i] == rate) 279 + return i; 280 + } 281 + 282 + return -EINVAL; 283 + } 284 + 285 + static unsigned int sigmadsp_get_samplerate_mask(struct sigmadsp *sigmadsp, 286 + unsigned int samplerate) 287 + { 288 + int samplerate_index; 289 + 290 + if (samplerate == 0) 291 + return 0; 292 + 293 + if (sigmadsp->rate_constraints.count) { 294 + samplerate_index = sigmadsp_rate_to_index(sigmadsp, samplerate); 295 + if (samplerate_index < 0) 296 + return 0; 297 + 298 + return BIT(samplerate_index); 299 + } else { 300 + return ~0; 301 + } 302 + } 303 + 304 + static bool sigmadsp_samplerate_valid(unsigned int supported, 305 + unsigned int requested) 306 + { 307 + /* All samplerates are supported */ 308 + if (!supported) 309 + return true; 310 + 311 + return supported & requested; 312 + } 313 + 314 + static int sigmadsp_alloc_control(struct sigmadsp *sigmadsp, 315 + struct sigmadsp_control *ctrl, unsigned int samplerate_mask) 316 + { 317 + struct snd_kcontrol_new template; 318 + struct snd_kcontrol *kcontrol; 319 + int ret; 320 + 321 + memset(&template, 0, sizeof(template)); 322 + template.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 323 + template.name = ctrl->name; 324 + template.info = sigmadsp_ctrl_info; 325 + template.get = sigmadsp_ctrl_get; 326 + template.put = sigmadsp_ctrl_put; 327 + template.private_value = (unsigned long)ctrl; 328 + template.access = SNDRV_CTL_ELEM_ACCESS_READWRITE; 329 + if (!sigmadsp_samplerate_valid(ctrl->samplerates, samplerate_mask)) 330 + template.access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; 331 + 332 + kcontrol = snd_ctl_new1(&template, sigmadsp); 333 + if (!kcontrol) 334 + return -ENOMEM; 335 + 336 + kcontrol->private_free = sigmadsp_control_free; 337 + ctrl->kcontrol = kcontrol; 338 + 339 + ret = snd_ctl_add(sigmadsp->component->card->snd_card, kcontrol); 340 + if (ret) 341 + return ret; 342 + 343 + return 0; 344 + } 345 + 346 + static void sigmadsp_activate_ctrl(struct sigmadsp *sigmadsp, 347 + struct sigmadsp_control *ctrl, unsigned int samplerate_mask) 348 + { 349 + struct snd_card *card = sigmadsp->component->card->snd_card; 350 + struct snd_kcontrol_volatile *vd; 351 + struct snd_ctl_elem_id id; 352 + bool active, changed; 353 + 354 + active = sigmadsp_samplerate_valid(ctrl->samplerates, samplerate_mask); 355 + 356 + down_write(&card->controls_rwsem); 357 + if (!ctrl->kcontrol) { 358 + up_write(&card->controls_rwsem); 359 + return; 360 + } 361 + 362 + id = ctrl->kcontrol->id; 363 + vd = &ctrl->kcontrol->vd[0]; 364 + if (active == (bool)(vd->access & SNDRV_CTL_ELEM_ACCESS_INACTIVE)) { 365 + vd->access ^= SNDRV_CTL_ELEM_ACCESS_INACTIVE; 366 + changed = true; 367 + } 368 + up_write(&card->controls_rwsem); 369 + 370 + if (active && changed) { 371 + mutex_lock(&sigmadsp->lock); 372 + if (ctrl->cached) 373 + sigmadsp_ctrl_write(sigmadsp, ctrl, ctrl->cache); 374 + mutex_unlock(&sigmadsp->lock); 375 + } 376 + 377 + if (changed) 378 + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &id); 379 + } 380 + 590 381 /** 591 382 * sigmadsp_attach() - Attach a sigmadsp instance to a ASoC component 592 383 * @sigmadsp: The sigmadsp instance to attach ··· 709 284 int sigmadsp_attach(struct sigmadsp *sigmadsp, 710 285 struct snd_soc_component *component) 711 286 { 287 + struct sigmadsp_control *ctrl; 288 + unsigned int samplerate_mask; 289 + int ret; 290 + 712 291 sigmadsp->component = component; 292 + 293 + samplerate_mask = sigmadsp_get_samplerate_mask(sigmadsp, 294 + sigmadsp->current_samplerate); 295 + 296 + list_for_each_entry(ctrl, &sigmadsp->ctrl_list, head) { 297 + ret = sigmadsp_alloc_control(sigmadsp, ctrl, samplerate_mask); 298 + if (ret) 299 + return ret; 300 + } 713 301 714 302 return 0; 715 303 } ··· 741 303 */ 742 304 int sigmadsp_setup(struct sigmadsp *sigmadsp, unsigned int samplerate) 743 305 { 306 + struct sigmadsp_control *ctrl; 307 + unsigned int samplerate_mask; 744 308 struct sigmadsp_data *data; 745 309 int ret; 746 310 747 311 if (sigmadsp->current_samplerate == samplerate) 748 312 return 0; 749 313 314 + samplerate_mask = sigmadsp_get_samplerate_mask(sigmadsp, samplerate); 315 + if (samplerate_mask == 0) 316 + return -EINVAL; 317 + 750 318 list_for_each_entry(data, &sigmadsp->data_list, head) { 319 + if (!sigmadsp_samplerate_valid(data->samplerates, 320 + samplerate_mask)) 321 + continue; 751 322 ret = sigmadsp_write(sigmadsp, data->addr, data->data, 752 323 data->length); 753 324 if (ret) 754 325 goto err; 755 326 } 327 + 328 + list_for_each_entry(ctrl, &sigmadsp->ctrl_list, head) 329 + sigmadsp_activate_ctrl(sigmadsp, ctrl, samplerate_mask); 756 330 757 331 sigmadsp->current_samplerate = samplerate; 758 332 ··· 785 335 */ 786 336 void sigmadsp_reset(struct sigmadsp *sigmadsp) 787 337 { 338 + struct sigmadsp_control *ctrl; 339 + 340 + list_for_each_entry(ctrl, &sigmadsp->ctrl_list, head) 341 + sigmadsp_activate_ctrl(sigmadsp, ctrl, false); 342 + 788 343 sigmadsp->current_samplerate = 0; 789 344 } 790 345 EXPORT_SYMBOL_GPL(sigmadsp_reset); ··· 807 352 int sigmadsp_restrict_params(struct sigmadsp *sigmadsp, 808 353 struct snd_pcm_substream *substream) 809 354 { 810 - return 0; 355 + if (sigmadsp->rate_constraints.count == 0) 356 + return 0; 357 + 358 + return snd_pcm_hw_constraint_list(substream->runtime, 0, 359 + SNDRV_PCM_HW_PARAM_RATE, &sigmadsp->rate_constraints); 811 360 } 812 361 EXPORT_SYMBOL_GPL(sigmadsp_restrict_params); 813 362
+6
sound/soc/codecs/sigmadsp.h
··· 27 27 struct sigmadsp { 28 28 const struct sigmadsp_ops *ops; 29 29 30 + struct list_head ctrl_list; 30 31 struct list_head data_list; 32 + 33 + struct snd_pcm_hw_constraint_list rate_constraints; 31 34 32 35 unsigned int current_samplerate; 33 36 struct snd_soc_component *component; 34 37 struct device *dev; 35 38 39 + struct mutex lock; 40 + 36 41 void *control_data; 37 42 int (*write)(void *, unsigned int, const uint8_t *, size_t); 43 + int (*read)(void *, unsigned int, uint8_t *, size_t); 38 44 }; 39 45 40 46 struct sigmadsp *devm_sigmadsp_init(struct device *dev,