Lines Matching refs:compr

153 	struct wm_adsp_compr *compr;  member
1187 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr) in wm_adsp_compr_attached() argument
1189 return compr->buf != NULL; in wm_adsp_compr_attached()
1192 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) in wm_adsp_compr_attach() argument
1196 if (compr->dsp->fatal_error) in wm_adsp_compr_attach()
1199 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { in wm_adsp_compr_attach()
1200 if (!tmp->name || !strcmp(compr->name, tmp->name)) { in wm_adsp_compr_attach()
1209 compr->buf = buf; in wm_adsp_compr_attach()
1210 buf->compr = compr; in wm_adsp_compr_attach()
1215 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr) in wm_adsp_compr_detach() argument
1217 if (!compr) in wm_adsp_compr_detach()
1221 if (compr->stream) in wm_adsp_compr_detach()
1222 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_detach()
1224 if (wm_adsp_compr_attached(compr)) { in wm_adsp_compr_detach()
1225 compr->buf->compr = NULL; in wm_adsp_compr_detach()
1226 compr->buf = NULL; in wm_adsp_compr_detach()
1232 struct wm_adsp_compr *compr, *tmp; in wm_adsp_compr_open() local
1261 compr = kzalloc(sizeof(*compr), GFP_KERNEL); in wm_adsp_compr_open()
1262 if (!compr) { in wm_adsp_compr_open()
1267 compr->dsp = dsp; in wm_adsp_compr_open()
1268 compr->stream = stream; in wm_adsp_compr_open()
1269 compr->name = snd_soc_rtd_to_codec(rtd, 0)->name; in wm_adsp_compr_open()
1271 list_add_tail(&compr->list, &dsp->compr_list); in wm_adsp_compr_open()
1273 stream->runtime->private_data = compr; in wm_adsp_compr_open()
1285 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_free() local
1286 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free()
1290 wm_adsp_compr_detach(compr); in wm_adsp_compr_free()
1291 list_del(&compr->list); in wm_adsp_compr_free()
1293 kfree(compr->raw_buf); in wm_adsp_compr_free()
1294 kfree(compr); in wm_adsp_compr_free()
1305 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_check_params() local
1306 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params()
1316 compr_err(compr, "Invalid buffer fragsize=%d fragments=%d\n", in wm_adsp_compr_check_params()
1346 compr_err(compr, "Invalid params id=%u ch=%u,%u rate=%u fmt=%u\n", in wm_adsp_compr_check_params()
1352 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr) in wm_adsp_compr_frag_words() argument
1354 return compr->size.fragment_size / CS_DSP_DATA_WORD_SIZE; in wm_adsp_compr_frag_words()
1361 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_set_params() local
1369 compr->size = params->buffer; in wm_adsp_compr_set_params()
1371 compr_dbg(compr, "fragment_size=%d fragments=%d\n", in wm_adsp_compr_set_params()
1372 compr->size.fragment_size, compr->size.fragments); in wm_adsp_compr_set_params()
1374 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf); in wm_adsp_compr_set_params()
1375 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL); in wm_adsp_compr_set_params()
1376 if (!compr->raw_buf) in wm_adsp_compr_set_params()
1379 compr->sample_rate = params->codec.sample_rate; in wm_adsp_compr_set_params()
1389 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_get_caps() local
1390 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
1669 wm_adsp_compr_detach(buf->compr); in wm_adsp_buffer_free()
1700 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_trigger() local
1701 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger()
1704 compr_dbg(compr, "Trigger: %d\n", cmd); in wm_adsp_compr_trigger()
1710 if (!wm_adsp_compr_attached(compr)) { in wm_adsp_compr_trigger()
1711 ret = wm_adsp_compr_attach(compr); in wm_adsp_compr_trigger()
1713 compr_err(compr, "Failed to link buffer and stream: %d\n", in wm_adsp_compr_trigger()
1719 ret = wm_adsp_buffer_get_error(compr->buf); in wm_adsp_compr_trigger()
1724 ret = wm_adsp_buffer_write(compr->buf, in wm_adsp_compr_trigger()
1726 wm_adsp_compr_frag_words(compr)); in wm_adsp_compr_trigger()
1728 compr_err(compr, "Failed to set high water mark: %d\n", in wm_adsp_compr_trigger()
1734 if (wm_adsp_compr_attached(compr)) in wm_adsp_compr_trigger()
1735 wm_adsp_buffer_clear(compr->buf); in wm_adsp_compr_trigger()
1801 struct wm_adsp_compr *compr; in wm_adsp_compr_handle_irq() local
1814 compr = buf->compr; in wm_adsp_compr_handle_irq()
1837 if (compr && compr->stream) in wm_adsp_compr_handle_irq()
1838 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_handle_irq()
1865 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_pointer() local
1866 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer()
1870 compr_dbg(compr, "Pointer request\n"); in wm_adsp_compr_pointer()
1874 buf = compr->buf; in wm_adsp_compr_pointer()
1882 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1885 compr_err(compr, "Error reading avail: %d\n", ret); in wm_adsp_compr_pointer()
1893 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1904 compr_err(compr, "Failed to re-enable buffer IRQ: %d\n", in wm_adsp_compr_pointer()
1911 tstamp->copied_total = compr->copied_total; in wm_adsp_compr_pointer()
1913 tstamp->sampling_rate = compr->sample_rate; in wm_adsp_compr_pointer()
1922 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target) in wm_adsp_buffer_capture_block() argument
1924 struct wm_adsp_compr_buf *buf = compr->buf; in wm_adsp_buffer_capture_block()
1941 max_read = wm_adsp_compr_frag_words(compr); in wm_adsp_buffer_capture_block()
1955 nwords, (__be32 *)compr->raw_buf); in wm_adsp_buffer_capture_block()
1959 cs_dsp_remove_padding(compr->raw_buf, nwords); in wm_adsp_buffer_capture_block()
1977 static int wm_adsp_compr_read(struct wm_adsp_compr *compr, in wm_adsp_compr_read() argument
1980 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read()
1984 compr_dbg(compr, "Requested read of %zu bytes\n", count); in wm_adsp_compr_read()
1986 if (dsp->fatal_error || !compr->buf || compr->buf->error) { in wm_adsp_compr_read()
1987 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN); in wm_adsp_compr_read()
1994 nwords = wm_adsp_buffer_capture_block(compr, count); in wm_adsp_compr_read()
1996 compr_err(compr, "Failed to capture block: %d\n", in wm_adsp_compr_read()
2003 compr_dbg(compr, "Read %d bytes\n", nbytes); in wm_adsp_compr_read()
2005 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) { in wm_adsp_compr_read()
2006 compr_err(compr, "Failed to copy data to user: %d, %d\n", in wm_adsp_compr_read()
2015 compr->copied_total += ntotal; in wm_adsp_compr_read()
2024 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_copy() local
2025 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy()
2031 ret = wm_adsp_compr_read(compr, buf, count); in wm_adsp_compr_copy()
2044 struct wm_adsp_compr *compr; in wm_adsp_fatal_error() local
2048 list_for_each_entry(compr, &dsp->compr_list, list) { in wm_adsp_fatal_error()
2049 if (compr->stream) in wm_adsp_fatal_error()
2050 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_fatal_error()