Lines Matching refs:compr

151 	struct wm_adsp_compr *compr;  member
1195 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr) in wm_adsp_compr_attached() argument
1197 return compr->buf != NULL; in wm_adsp_compr_attached()
1200 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) in wm_adsp_compr_attach() argument
1204 if (compr->dsp->fatal_error) in wm_adsp_compr_attach()
1207 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { in wm_adsp_compr_attach()
1208 if (!tmp->name || !strcmp(compr->name, tmp->name)) { in wm_adsp_compr_attach()
1217 compr->buf = buf; in wm_adsp_compr_attach()
1218 buf->compr = compr; in wm_adsp_compr_attach()
1223 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr) in wm_adsp_compr_detach() argument
1225 if (!compr) in wm_adsp_compr_detach()
1229 if (compr->stream) in wm_adsp_compr_detach()
1230 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_detach()
1232 if (wm_adsp_compr_attached(compr)) { in wm_adsp_compr_detach()
1233 compr->buf->compr = NULL; in wm_adsp_compr_detach()
1234 compr->buf = NULL; in wm_adsp_compr_detach()
1240 struct wm_adsp_compr *compr, *tmp; in wm_adsp_compr_open() local
1269 compr = kzalloc(sizeof(*compr), GFP_KERNEL); in wm_adsp_compr_open()
1270 if (!compr) { in wm_adsp_compr_open()
1275 compr->dsp = dsp; in wm_adsp_compr_open()
1276 compr->stream = stream; in wm_adsp_compr_open()
1277 compr->name = asoc_rtd_to_codec(rtd, 0)->name; in wm_adsp_compr_open()
1279 list_add_tail(&compr->list, &dsp->compr_list); in wm_adsp_compr_open()
1281 stream->runtime->private_data = compr; in wm_adsp_compr_open()
1293 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_free() local
1294 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free()
1298 wm_adsp_compr_detach(compr); in wm_adsp_compr_free()
1299 list_del(&compr->list); in wm_adsp_compr_free()
1301 kfree(compr->raw_buf); in wm_adsp_compr_free()
1302 kfree(compr); in wm_adsp_compr_free()
1313 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_check_params() local
1314 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params()
1324 compr_err(compr, "Invalid buffer fragsize=%d fragments=%d\n", in wm_adsp_compr_check_params()
1354 compr_err(compr, "Invalid params id=%u ch=%u,%u rate=%u fmt=%u\n", in wm_adsp_compr_check_params()
1360 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr) in wm_adsp_compr_frag_words() argument
1362 return compr->size.fragment_size / CS_DSP_DATA_WORD_SIZE; in wm_adsp_compr_frag_words()
1369 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_set_params() local
1377 compr->size = params->buffer; in wm_adsp_compr_set_params()
1379 compr_dbg(compr, "fragment_size=%d fragments=%d\n", in wm_adsp_compr_set_params()
1380 compr->size.fragment_size, compr->size.fragments); in wm_adsp_compr_set_params()
1382 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf); in wm_adsp_compr_set_params()
1383 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL); in wm_adsp_compr_set_params()
1384 if (!compr->raw_buf) in wm_adsp_compr_set_params()
1387 compr->sample_rate = params->codec.sample_rate; in wm_adsp_compr_set_params()
1397 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_get_caps() local
1398 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
1673 wm_adsp_compr_detach(buf->compr); in wm_adsp_buffer_free()
1704 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_trigger() local
1705 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger()
1708 compr_dbg(compr, "Trigger: %d\n", cmd); in wm_adsp_compr_trigger()
1714 if (!wm_adsp_compr_attached(compr)) { in wm_adsp_compr_trigger()
1715 ret = wm_adsp_compr_attach(compr); in wm_adsp_compr_trigger()
1717 compr_err(compr, "Failed to link buffer and stream: %d\n", in wm_adsp_compr_trigger()
1723 ret = wm_adsp_buffer_get_error(compr->buf); in wm_adsp_compr_trigger()
1728 ret = wm_adsp_buffer_write(compr->buf, in wm_adsp_compr_trigger()
1730 wm_adsp_compr_frag_words(compr)); in wm_adsp_compr_trigger()
1732 compr_err(compr, "Failed to set high water mark: %d\n", in wm_adsp_compr_trigger()
1738 if (wm_adsp_compr_attached(compr)) in wm_adsp_compr_trigger()
1739 wm_adsp_buffer_clear(compr->buf); in wm_adsp_compr_trigger()
1805 struct wm_adsp_compr *compr; in wm_adsp_compr_handle_irq() local
1818 compr = buf->compr; in wm_adsp_compr_handle_irq()
1841 if (compr && compr->stream) in wm_adsp_compr_handle_irq()
1842 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_handle_irq()
1869 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_pointer() local
1870 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer()
1874 compr_dbg(compr, "Pointer request\n"); in wm_adsp_compr_pointer()
1878 buf = compr->buf; in wm_adsp_compr_pointer()
1886 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1889 compr_err(compr, "Error reading avail: %d\n", ret); in wm_adsp_compr_pointer()
1897 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1908 compr_err(compr, "Failed to re-enable buffer IRQ: %d\n", in wm_adsp_compr_pointer()
1915 tstamp->copied_total = compr->copied_total; in wm_adsp_compr_pointer()
1917 tstamp->sampling_rate = compr->sample_rate; in wm_adsp_compr_pointer()
1926 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target) in wm_adsp_buffer_capture_block() argument
1928 struct wm_adsp_compr_buf *buf = compr->buf; in wm_adsp_buffer_capture_block()
1945 max_read = wm_adsp_compr_frag_words(compr); in wm_adsp_buffer_capture_block()
1959 nwords, (__be32 *)compr->raw_buf); in wm_adsp_buffer_capture_block()
1963 cs_dsp_remove_padding(compr->raw_buf, nwords); in wm_adsp_buffer_capture_block()
1981 static int wm_adsp_compr_read(struct wm_adsp_compr *compr, in wm_adsp_compr_read() argument
1984 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read()
1988 compr_dbg(compr, "Requested read of %zu bytes\n", count); in wm_adsp_compr_read()
1990 if (dsp->fatal_error || !compr->buf || compr->buf->error) { in wm_adsp_compr_read()
1991 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN); in wm_adsp_compr_read()
1998 nwords = wm_adsp_buffer_capture_block(compr, count); in wm_adsp_compr_read()
2000 compr_err(compr, "Failed to capture block: %d\n", in wm_adsp_compr_read()
2007 compr_dbg(compr, "Read %d bytes\n", nbytes); in wm_adsp_compr_read()
2009 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) { in wm_adsp_compr_read()
2010 compr_err(compr, "Failed to copy data to user: %d, %d\n", in wm_adsp_compr_read()
2019 compr->copied_total += ntotal; in wm_adsp_compr_read()
2028 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_copy() local
2029 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy()
2035 ret = wm_adsp_compr_read(compr, buf, count); in wm_adsp_compr_copy()
2048 struct wm_adsp_compr *compr; in wm_adsp_fatal_error() local
2052 list_for_each_entry(compr, &dsp->compr_list, list) { in wm_adsp_fatal_error()
2053 if (compr->stream) in wm_adsp_fatal_error()
2054 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_fatal_error()