Lines Matching refs:compr

152 	struct wm_adsp_compr *compr;  member
1188 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr) in wm_adsp_compr_attached() argument
1190 return compr->buf != NULL; in wm_adsp_compr_attached()
1193 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) in wm_adsp_compr_attach() argument
1197 if (compr->dsp->fatal_error) in wm_adsp_compr_attach()
1200 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { in wm_adsp_compr_attach()
1201 if (!tmp->name || !strcmp(compr->name, tmp->name)) { in wm_adsp_compr_attach()
1210 compr->buf = buf; in wm_adsp_compr_attach()
1211 buf->compr = compr; in wm_adsp_compr_attach()
1216 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr) in wm_adsp_compr_detach() argument
1218 if (!compr) in wm_adsp_compr_detach()
1222 if (compr->stream) in wm_adsp_compr_detach()
1223 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_detach()
1225 if (wm_adsp_compr_attached(compr)) { in wm_adsp_compr_detach()
1226 compr->buf->compr = NULL; in wm_adsp_compr_detach()
1227 compr->buf = NULL; in wm_adsp_compr_detach()
1233 struct wm_adsp_compr *compr, *tmp; in wm_adsp_compr_open() local
1262 compr = kzalloc(sizeof(*compr), GFP_KERNEL); in wm_adsp_compr_open()
1263 if (!compr) { in wm_adsp_compr_open()
1268 compr->dsp = dsp; in wm_adsp_compr_open()
1269 compr->stream = stream; in wm_adsp_compr_open()
1270 compr->name = snd_soc_rtd_to_codec(rtd, 0)->name; in wm_adsp_compr_open()
1272 list_add_tail(&compr->list, &dsp->compr_list); in wm_adsp_compr_open()
1274 stream->runtime->private_data = compr; in wm_adsp_compr_open()
1286 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_free() local
1287 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free()
1291 wm_adsp_compr_detach(compr); in wm_adsp_compr_free()
1292 list_del(&compr->list); in wm_adsp_compr_free()
1294 kfree(compr->raw_buf); in wm_adsp_compr_free()
1295 kfree(compr); in wm_adsp_compr_free()
1306 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_check_params() local
1307 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params()
1317 compr_err(compr, "Invalid buffer fragsize=%d fragments=%d\n", in wm_adsp_compr_check_params()
1347 compr_err(compr, "Invalid params id=%u ch=%u,%u rate=%u fmt=%u\n", in wm_adsp_compr_check_params()
1353 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr) in wm_adsp_compr_frag_words() argument
1355 return compr->size.fragment_size / CS_DSP_DATA_WORD_SIZE; in wm_adsp_compr_frag_words()
1362 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_set_params() local
1370 compr->size = params->buffer; in wm_adsp_compr_set_params()
1372 compr_dbg(compr, "fragment_size=%d fragments=%d\n", in wm_adsp_compr_set_params()
1373 compr->size.fragment_size, compr->size.fragments); in wm_adsp_compr_set_params()
1375 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf); in wm_adsp_compr_set_params()
1376 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL); in wm_adsp_compr_set_params()
1377 if (!compr->raw_buf) in wm_adsp_compr_set_params()
1380 compr->sample_rate = params->codec.sample_rate; in wm_adsp_compr_set_params()
1390 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_get_caps() local
1391 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
1670 wm_adsp_compr_detach(buf->compr); in wm_adsp_buffer_free()
1701 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_trigger() local
1702 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger()
1705 compr_dbg(compr, "Trigger: %d\n", cmd); in wm_adsp_compr_trigger()
1711 if (!wm_adsp_compr_attached(compr)) { in wm_adsp_compr_trigger()
1712 ret = wm_adsp_compr_attach(compr); in wm_adsp_compr_trigger()
1714 compr_err(compr, "Failed to link buffer and stream: %d\n", in wm_adsp_compr_trigger()
1720 ret = wm_adsp_buffer_get_error(compr->buf); in wm_adsp_compr_trigger()
1725 ret = wm_adsp_buffer_write(compr->buf, in wm_adsp_compr_trigger()
1727 wm_adsp_compr_frag_words(compr)); in wm_adsp_compr_trigger()
1729 compr_err(compr, "Failed to set high water mark: %d\n", in wm_adsp_compr_trigger()
1735 if (wm_adsp_compr_attached(compr)) in wm_adsp_compr_trigger()
1736 wm_adsp_buffer_clear(compr->buf); in wm_adsp_compr_trigger()
1802 struct wm_adsp_compr *compr; in wm_adsp_compr_handle_irq() local
1815 compr = buf->compr; in wm_adsp_compr_handle_irq()
1838 if (compr && compr->stream) in wm_adsp_compr_handle_irq()
1839 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_handle_irq()
1866 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_pointer() local
1867 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer()
1871 compr_dbg(compr, "Pointer request\n"); in wm_adsp_compr_pointer()
1875 buf = compr->buf; in wm_adsp_compr_pointer()
1883 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1886 compr_err(compr, "Error reading avail: %d\n", ret); in wm_adsp_compr_pointer()
1894 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1905 compr_err(compr, "Failed to re-enable buffer IRQ: %d\n", in wm_adsp_compr_pointer()
1912 tstamp->copied_total = compr->copied_total; in wm_adsp_compr_pointer()
1914 tstamp->sampling_rate = compr->sample_rate; in wm_adsp_compr_pointer()
1923 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target) in wm_adsp_buffer_capture_block() argument
1925 struct wm_adsp_compr_buf *buf = compr->buf; in wm_adsp_buffer_capture_block()
1942 max_read = wm_adsp_compr_frag_words(compr); in wm_adsp_buffer_capture_block()
1956 nwords, (__be32 *)compr->raw_buf); in wm_adsp_buffer_capture_block()
1960 cs_dsp_remove_padding(compr->raw_buf, nwords); in wm_adsp_buffer_capture_block()
1978 static int wm_adsp_compr_read(struct wm_adsp_compr *compr, in wm_adsp_compr_read() argument
1981 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read()
1985 compr_dbg(compr, "Requested read of %zu bytes\n", count); in wm_adsp_compr_read()
1987 if (dsp->fatal_error || !compr->buf || compr->buf->error) { in wm_adsp_compr_read()
1988 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN); in wm_adsp_compr_read()
1995 nwords = wm_adsp_buffer_capture_block(compr, count); in wm_adsp_compr_read()
1997 compr_err(compr, "Failed to capture block: %d\n", in wm_adsp_compr_read()
2004 compr_dbg(compr, "Read %d bytes\n", nbytes); in wm_adsp_compr_read()
2006 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) { in wm_adsp_compr_read()
2007 compr_err(compr, "Failed to copy data to user: %d, %d\n", in wm_adsp_compr_read()
2016 compr->copied_total += ntotal; in wm_adsp_compr_read()
2025 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_copy() local
2026 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy()
2032 ret = wm_adsp_compr_read(compr, buf, count); in wm_adsp_compr_copy()
2045 struct wm_adsp_compr *compr; in wm_adsp_fatal_error() local
2049 list_for_each_entry(compr, &dsp->compr_list, list) { in wm_adsp_fatal_error()
2050 if (compr->stream) in wm_adsp_fatal_error()
2051 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_fatal_error()