Lines Matching refs:compr

151 	struct wm_adsp_compr *compr;
1190 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr)
1192 return compr->buf != NULL;
1195 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr)
1199 if (compr->dsp->fatal_error)
1202 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) {
1203 if (!tmp->name || !strcmp(compr->name, tmp->name)) {
1212 compr->buf = buf;
1213 buf->compr = compr;
1218 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr)
1220 if (!compr)
1224 if (compr->stream)
1225 snd_compr_fragment_elapsed(compr->stream);
1227 if (wm_adsp_compr_attached(compr)) {
1228 compr->buf->compr = NULL;
1229 compr->buf = NULL;
1235 struct wm_adsp_compr *compr, *tmp;
1264 compr = kzalloc(sizeof(*compr), GFP_KERNEL);
1265 if (!compr) {
1270 compr->dsp = dsp;
1271 compr->stream = stream;
1272 compr->name = asoc_rtd_to_codec(rtd, 0)->name;
1274 list_add_tail(&compr->list, &dsp->compr_list);
1276 stream->runtime->private_data = compr;
1288 struct wm_adsp_compr *compr = stream->runtime->private_data;
1289 struct wm_adsp *dsp = compr->dsp;
1293 wm_adsp_compr_detach(compr);
1294 list_del(&compr->list);
1296 kfree(compr->raw_buf);
1297 kfree(compr);
1308 struct wm_adsp_compr *compr = stream->runtime->private_data;
1309 struct wm_adsp *dsp = compr->dsp;
1319 compr_err(compr, "Invalid buffer fragsize=%d fragments=%d\n",
1349 compr_err(compr, "Invalid params id=%u ch=%u,%u rate=%u fmt=%u\n",
1355 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr)
1357 return compr->size.fragment_size / CS_DSP_DATA_WORD_SIZE;
1364 struct wm_adsp_compr *compr = stream->runtime->private_data;
1372 compr->size = params->buffer;
1374 compr_dbg(compr, "fragment_size=%d fragments=%d\n",
1375 compr->size.fragment_size, compr->size.fragments);
1377 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf);
1378 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL);
1379 if (!compr->raw_buf)
1382 compr->sample_rate = params->codec.sample_rate;
1392 struct wm_adsp_compr *compr = stream->runtime->private_data;
1393 int fw = compr->dsp->fw;
1672 wm_adsp_compr_detach(buf->compr);
1703 struct wm_adsp_compr *compr = stream->runtime->private_data;
1704 struct wm_adsp *dsp = compr->dsp;
1707 compr_dbg(compr, "Trigger: %d\n", cmd);
1713 if (!wm_adsp_compr_attached(compr)) {
1714 ret = wm_adsp_compr_attach(compr);
1716 compr_err(compr, "Failed to link buffer and stream: %d\n",
1722 ret = wm_adsp_buffer_get_error(compr->buf);
1727 ret = wm_adsp_buffer_write(compr->buf,
1729 wm_adsp_compr_frag_words(compr));
1731 compr_err(compr, "Failed to set high water mark: %d\n",
1737 if (wm_adsp_compr_attached(compr))
1738 wm_adsp_buffer_clear(compr->buf);
1804 struct wm_adsp_compr *compr;
1817 compr = buf->compr;
1840 if (compr && compr->stream)
1841 snd_compr_fragment_elapsed(compr->stream);
1868 struct wm_adsp_compr *compr = stream->runtime->private_data;
1869 struct wm_adsp *dsp = compr->dsp;
1873 compr_dbg(compr, "Pointer request\n");
1877 buf = compr->buf;
1885 if (buf->avail < wm_adsp_compr_frag_words(compr)) {
1888 compr_err(compr, "Error reading avail: %d\n", ret);
1896 if (buf->avail < wm_adsp_compr_frag_words(compr)) {
1907 compr_err(compr, "Failed to re-enable buffer IRQ: %d\n",
1914 tstamp->copied_total = compr->copied_total;
1916 tstamp->sampling_rate = compr->sample_rate;
1925 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target)
1927 struct wm_adsp_compr_buf *buf = compr->buf;
1944 max_read = wm_adsp_compr_frag_words(compr);
1958 nwords, (__be32 *)compr->raw_buf);
1962 cs_dsp_remove_padding(compr->raw_buf, nwords);
1980 static int wm_adsp_compr_read(struct wm_adsp_compr *compr,
1983 struct wm_adsp *dsp = compr->dsp;
1987 compr_dbg(compr, "Requested read of %zu bytes\n", count);
1989 if (dsp->fatal_error || !compr->buf || compr->buf->error) {
1990 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN);
1997 nwords = wm_adsp_buffer_capture_block(compr, count);
1999 compr_err(compr, "Failed to capture block: %d\n",
2006 compr_dbg(compr, "Read %d bytes\n", nbytes);
2008 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) {
2009 compr_err(compr, "Failed to copy data to user: %d, %d\n",
2018 compr->copied_total += ntotal;
2027 struct wm_adsp_compr *compr = stream->runtime->private_data;
2028 struct wm_adsp *dsp = compr->dsp;
2034 ret = wm_adsp_compr_read(compr, buf, count);
2047 struct wm_adsp_compr *compr;
2051 list_for_each_entry(compr, &dsp->compr_list, list) {
2052 if (compr->stream)
2053 snd_compr_fragment_elapsed(compr->stream);