Lines Matching refs:compr

438 	struct wm_adsp_compr *compr;  member
3334 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr) in wm_adsp_compr_attached() argument
3336 return compr->buf != NULL; in wm_adsp_compr_attached()
3339 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) in wm_adsp_compr_attach() argument
3343 if (compr->dsp->fatal_error) in wm_adsp_compr_attach()
3346 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { in wm_adsp_compr_attach()
3347 if (!tmp->name || !strcmp(compr->name, tmp->name)) { in wm_adsp_compr_attach()
3356 compr->buf = buf; in wm_adsp_compr_attach()
3357 buf->compr = compr; in wm_adsp_compr_attach()
3362 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr) in wm_adsp_compr_detach() argument
3364 if (!compr) in wm_adsp_compr_detach()
3368 if (compr->stream) in wm_adsp_compr_detach()
3369 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_detach()
3371 if (wm_adsp_compr_attached(compr)) { in wm_adsp_compr_detach()
3372 compr->buf->compr = NULL; in wm_adsp_compr_detach()
3373 compr->buf = NULL; in wm_adsp_compr_detach()
3379 struct wm_adsp_compr *compr, *tmp; in wm_adsp_compr_open() local
3408 compr = kzalloc(sizeof(*compr), GFP_KERNEL); in wm_adsp_compr_open()
3409 if (!compr) { in wm_adsp_compr_open()
3414 compr->dsp = dsp; in wm_adsp_compr_open()
3415 compr->stream = stream; in wm_adsp_compr_open()
3416 compr->name = rtd->codec_dai->name; in wm_adsp_compr_open()
3418 list_add_tail(&compr->list, &dsp->compr_list); in wm_adsp_compr_open()
3420 stream->runtime->private_data = compr; in wm_adsp_compr_open()
3431 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_free() local
3432 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free()
3436 wm_adsp_compr_detach(compr); in wm_adsp_compr_free()
3437 list_del(&compr->list); in wm_adsp_compr_free()
3439 kfree(compr->raw_buf); in wm_adsp_compr_free()
3440 kfree(compr); in wm_adsp_compr_free()
3451 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_check_params() local
3452 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params()
3462 compr_err(compr, "Invalid buffer fragsize=%d fragments=%d\n", in wm_adsp_compr_check_params()
3492 compr_err(compr, "Invalid params id=%u ch=%u,%u rate=%u fmt=%u\n", in wm_adsp_compr_check_params()
3498 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr) in wm_adsp_compr_frag_words() argument
3500 return compr->size.fragment_size / WM_ADSP_DATA_WORD_SIZE; in wm_adsp_compr_frag_words()
3506 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_set_params() local
3514 compr->size = params->buffer; in wm_adsp_compr_set_params()
3516 compr_dbg(compr, "fragment_size=%d fragments=%d\n", in wm_adsp_compr_set_params()
3517 compr->size.fragment_size, compr->size.fragments); in wm_adsp_compr_set_params()
3519 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf); in wm_adsp_compr_set_params()
3520 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL); in wm_adsp_compr_set_params()
3521 if (!compr->raw_buf) in wm_adsp_compr_set_params()
3524 compr->sample_rate = params->codec.sample_rate; in wm_adsp_compr_set_params()
3533 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_get_caps() local
3534 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
3868 wm_adsp_compr_detach(buf->compr); in wm_adsp_buffer_free()
3898 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_trigger() local
3899 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger()
3902 compr_dbg(compr, "Trigger: %d\n", cmd); in wm_adsp_compr_trigger()
3908 if (!wm_adsp_compr_attached(compr)) { in wm_adsp_compr_trigger()
3909 ret = wm_adsp_compr_attach(compr); in wm_adsp_compr_trigger()
3911 compr_err(compr, "Failed to link buffer and stream: %d\n", in wm_adsp_compr_trigger()
3917 ret = wm_adsp_buffer_get_error(compr->buf); in wm_adsp_compr_trigger()
3922 ret = wm_adsp_buffer_write(compr->buf, in wm_adsp_compr_trigger()
3924 wm_adsp_compr_frag_words(compr)); in wm_adsp_compr_trigger()
3926 compr_err(compr, "Failed to set high water mark: %d\n", in wm_adsp_compr_trigger()
3932 if (wm_adsp_compr_attached(compr)) in wm_adsp_compr_trigger()
3933 wm_adsp_buffer_clear(compr->buf); in wm_adsp_compr_trigger()
3999 struct wm_adsp_compr *compr; in wm_adsp_compr_handle_irq() local
4012 compr = buf->compr; in wm_adsp_compr_handle_irq()
4035 if (compr && compr->stream) in wm_adsp_compr_handle_irq()
4036 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_handle_irq()
4062 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_pointer() local
4063 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer()
4067 compr_dbg(compr, "Pointer request\n"); in wm_adsp_compr_pointer()
4071 buf = compr->buf; in wm_adsp_compr_pointer()
4079 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
4082 compr_err(compr, "Error reading avail: %d\n", ret); in wm_adsp_compr_pointer()
4090 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
4101 compr_err(compr, "Failed to re-enable buffer IRQ: %d\n", in wm_adsp_compr_pointer()
4108 tstamp->copied_total = compr->copied_total; in wm_adsp_compr_pointer()
4110 tstamp->sampling_rate = compr->sample_rate; in wm_adsp_compr_pointer()
4119 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target) in wm_adsp_buffer_capture_block() argument
4121 struct wm_adsp_compr_buf *buf = compr->buf; in wm_adsp_buffer_capture_block()
4138 max_read = wm_adsp_compr_frag_words(compr); in wm_adsp_buffer_capture_block()
4152 nwords, compr->raw_buf); in wm_adsp_buffer_capture_block()
4156 wm_adsp_remove_padding(compr->raw_buf, nwords, WM_ADSP_DATA_WORD_SIZE); in wm_adsp_buffer_capture_block()
4174 static int wm_adsp_compr_read(struct wm_adsp_compr *compr, in wm_adsp_compr_read() argument
4177 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read()
4181 compr_dbg(compr, "Requested read of %zu bytes\n", count); in wm_adsp_compr_read()
4183 if (dsp->fatal_error || !compr->buf || compr->buf->error) { in wm_adsp_compr_read()
4184 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN); in wm_adsp_compr_read()
4191 nwords = wm_adsp_buffer_capture_block(compr, count); in wm_adsp_compr_read()
4193 compr_err(compr, "Failed to capture block: %d\n", in wm_adsp_compr_read()
4200 compr_dbg(compr, "Read %d bytes\n", nbytes); in wm_adsp_compr_read()
4202 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) { in wm_adsp_compr_read()
4203 compr_err(compr, "Failed to copy data to user: %d, %d\n", in wm_adsp_compr_read()
4212 compr->copied_total += ntotal; in wm_adsp_compr_read()
4220 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_copy() local
4221 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy()
4227 ret = wm_adsp_compr_read(compr, buf, count); in wm_adsp_compr_copy()
4239 struct wm_adsp_compr *compr; in wm_adsp_fatal_error() local
4243 list_for_each_entry(compr, &dsp->compr_list, list) { in wm_adsp_fatal_error()
4244 if (compr->stream) in wm_adsp_fatal_error()
4245 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_fatal_error()