Lines Matching refs:compr
338 struct wm_adsp_compr *compr; member
710 if (dsp[e->shift_l].booted || dsp[e->shift_l].compr) in wm_adsp_fw_put()
2962 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr) in wm_adsp_compr_attached() argument
2964 return compr->buf != NULL; in wm_adsp_compr_attached()
2967 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) in wm_adsp_compr_attach() argument
2973 if (!compr->dsp->buffer) in wm_adsp_compr_attach()
2976 compr->buf = compr->dsp->buffer; in wm_adsp_compr_attach()
2977 compr->buf->compr = compr; in wm_adsp_compr_attach()
2982 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr) in wm_adsp_compr_detach() argument
2984 if (!compr) in wm_adsp_compr_detach()
2988 if (compr->stream) in wm_adsp_compr_detach()
2989 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_detach()
2991 if (wm_adsp_compr_attached(compr)) { in wm_adsp_compr_detach()
2992 compr->buf->compr = NULL; in wm_adsp_compr_detach()
2993 compr->buf = NULL; in wm_adsp_compr_detach()
2999 struct wm_adsp_compr *compr; in wm_adsp_compr_open() local
3016 if (dsp->compr) { in wm_adsp_compr_open()
3023 compr = kzalloc(sizeof(*compr), GFP_KERNEL); in wm_adsp_compr_open()
3024 if (!compr) { in wm_adsp_compr_open()
3029 compr->dsp = dsp; in wm_adsp_compr_open()
3030 compr->stream = stream; in wm_adsp_compr_open()
3032 dsp->compr = compr; in wm_adsp_compr_open()
3034 stream->runtime->private_data = compr; in wm_adsp_compr_open()
3045 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_free() local
3046 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free()
3050 wm_adsp_compr_detach(compr); in wm_adsp_compr_free()
3051 dsp->compr = NULL; in wm_adsp_compr_free()
3053 kfree(compr->raw_buf); in wm_adsp_compr_free()
3054 kfree(compr); in wm_adsp_compr_free()
3065 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_check_params() local
3066 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params()
3112 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr) in wm_adsp_compr_frag_words() argument
3114 return compr->size.fragment_size / WM_ADSP_DATA_WORD_SIZE; in wm_adsp_compr_frag_words()
3120 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_set_params() local
3128 compr->size = params->buffer; in wm_adsp_compr_set_params()
3130 adsp_dbg(compr->dsp, "fragment_size=%d fragments=%d\n", in wm_adsp_compr_set_params()
3131 compr->size.fragment_size, compr->size.fragments); in wm_adsp_compr_set_params()
3133 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf); in wm_adsp_compr_set_params()
3134 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL); in wm_adsp_compr_set_params()
3135 if (!compr->raw_buf) in wm_adsp_compr_set_params()
3138 compr->sample_rate = params->codec.sample_rate; in wm_adsp_compr_set_params()
3147 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_get_caps() local
3148 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
3409 wm_adsp_compr_detach(dsp->buffer->compr); in wm_adsp_buffer_free()
3422 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_trigger() local
3423 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger()
3432 if (!wm_adsp_compr_attached(compr)) { in wm_adsp_compr_trigger()
3433 ret = wm_adsp_compr_attach(compr); in wm_adsp_compr_trigger()
3441 wm_adsp_buffer_clear(compr->buf); in wm_adsp_compr_trigger()
3444 ret = wm_adsp_buffer_write(compr->buf, in wm_adsp_compr_trigger()
3446 wm_adsp_compr_frag_words(compr)); in wm_adsp_compr_trigger()
3536 struct wm_adsp_compr *compr; in wm_adsp_compr_handle_irq() local
3542 compr = dsp->compr; in wm_adsp_compr_handle_irq()
3572 if (compr && compr->stream) in wm_adsp_compr_handle_irq()
3573 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_handle_irq()
3599 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_pointer() local
3600 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer()
3608 buf = compr->buf; in wm_adsp_compr_pointer()
3610 if (!compr->buf || compr->buf->error) { in wm_adsp_compr_pointer()
3616 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
3627 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
3630 if (compr->buf->error) in wm_adsp_compr_pointer()
3646 tstamp->copied_total = compr->copied_total; in wm_adsp_compr_pointer()
3648 tstamp->sampling_rate = compr->sample_rate; in wm_adsp_compr_pointer()
3657 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target) in wm_adsp_buffer_capture_block() argument
3659 struct wm_adsp_compr_buf *buf = compr->buf; in wm_adsp_buffer_capture_block()
3660 u8 *pack_in = (u8 *)compr->raw_buf; in wm_adsp_buffer_capture_block()
3661 u8 *pack_out = (u8 *)compr->raw_buf; in wm_adsp_buffer_capture_block()
3678 max_read = wm_adsp_compr_frag_words(compr); in wm_adsp_buffer_capture_block()
3692 nwords, compr->raw_buf); in wm_adsp_buffer_capture_block()
3701 pack_in += sizeof(*(compr->raw_buf)) - WM_ADSP_DATA_WORD_SIZE; in wm_adsp_buffer_capture_block()
3720 static int wm_adsp_compr_read(struct wm_adsp_compr *compr, in wm_adsp_compr_read() argument
3723 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read()
3729 if (!compr->buf || compr->buf->error) { in wm_adsp_compr_read()
3730 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN); in wm_adsp_compr_read()
3737 nwords = wm_adsp_buffer_capture_block(compr, count); in wm_adsp_compr_read()
3747 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) { in wm_adsp_compr_read()
3757 compr->copied_total += ntotal; in wm_adsp_compr_read()
3765 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_copy() local
3766 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy()
3772 ret = wm_adsp_compr_read(compr, buf, count); in wm_adsp_compr_copy()