Lines Matching refs:compr

151 	struct wm_adsp_compr *compr;  member
1087 static inline int wm_adsp_compr_attached(struct wm_adsp_compr *compr) in wm_adsp_compr_attached() argument
1089 return compr->buf != NULL; in wm_adsp_compr_attached()
1092 static int wm_adsp_compr_attach(struct wm_adsp_compr *compr) in wm_adsp_compr_attach() argument
1096 if (compr->dsp->fatal_error) in wm_adsp_compr_attach()
1099 list_for_each_entry(tmp, &compr->dsp->buffer_list, list) { in wm_adsp_compr_attach()
1100 if (!tmp->name || !strcmp(compr->name, tmp->name)) { in wm_adsp_compr_attach()
1109 compr->buf = buf; in wm_adsp_compr_attach()
1110 buf->compr = compr; in wm_adsp_compr_attach()
1115 static void wm_adsp_compr_detach(struct wm_adsp_compr *compr) in wm_adsp_compr_detach() argument
1117 if (!compr) in wm_adsp_compr_detach()
1121 if (compr->stream) in wm_adsp_compr_detach()
1122 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_detach()
1124 if (wm_adsp_compr_attached(compr)) { in wm_adsp_compr_detach()
1125 compr->buf->compr = NULL; in wm_adsp_compr_detach()
1126 compr->buf = NULL; in wm_adsp_compr_detach()
1132 struct wm_adsp_compr *compr, *tmp; in wm_adsp_compr_open() local
1161 compr = kzalloc(sizeof(*compr), GFP_KERNEL); in wm_adsp_compr_open()
1162 if (!compr) { in wm_adsp_compr_open()
1167 compr->dsp = dsp; in wm_adsp_compr_open()
1168 compr->stream = stream; in wm_adsp_compr_open()
1169 compr->name = asoc_rtd_to_codec(rtd, 0)->name; in wm_adsp_compr_open()
1171 list_add_tail(&compr->list, &dsp->compr_list); in wm_adsp_compr_open()
1173 stream->runtime->private_data = compr; in wm_adsp_compr_open()
1185 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_free() local
1186 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_free()
1190 wm_adsp_compr_detach(compr); in wm_adsp_compr_free()
1191 list_del(&compr->list); in wm_adsp_compr_free()
1193 kfree(compr->raw_buf); in wm_adsp_compr_free()
1194 kfree(compr); in wm_adsp_compr_free()
1205 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_check_params() local
1206 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_check_params()
1216 compr_err(compr, "Invalid buffer fragsize=%d fragments=%d\n", in wm_adsp_compr_check_params()
1246 compr_err(compr, "Invalid params id=%u ch=%u,%u rate=%u fmt=%u\n", in wm_adsp_compr_check_params()
1252 static inline unsigned int wm_adsp_compr_frag_words(struct wm_adsp_compr *compr) in wm_adsp_compr_frag_words() argument
1254 return compr->size.fragment_size / CS_DSP_DATA_WORD_SIZE; in wm_adsp_compr_frag_words()
1261 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_set_params() local
1269 compr->size = params->buffer; in wm_adsp_compr_set_params()
1271 compr_dbg(compr, "fragment_size=%d fragments=%d\n", in wm_adsp_compr_set_params()
1272 compr->size.fragment_size, compr->size.fragments); in wm_adsp_compr_set_params()
1274 size = wm_adsp_compr_frag_words(compr) * sizeof(*compr->raw_buf); in wm_adsp_compr_set_params()
1275 compr->raw_buf = kmalloc(size, GFP_DMA | GFP_KERNEL); in wm_adsp_compr_set_params()
1276 if (!compr->raw_buf) in wm_adsp_compr_set_params()
1279 compr->sample_rate = params->codec.sample_rate; in wm_adsp_compr_set_params()
1289 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_get_caps() local
1290 int fw = compr->dsp->fw; in wm_adsp_compr_get_caps()
1550 wm_adsp_compr_detach(buf->compr); in wm_adsp_buffer_free()
1581 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_trigger() local
1582 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_trigger()
1585 compr_dbg(compr, "Trigger: %d\n", cmd); in wm_adsp_compr_trigger()
1591 if (!wm_adsp_compr_attached(compr)) { in wm_adsp_compr_trigger()
1592 ret = wm_adsp_compr_attach(compr); in wm_adsp_compr_trigger()
1594 compr_err(compr, "Failed to link buffer and stream: %d\n", in wm_adsp_compr_trigger()
1600 ret = wm_adsp_buffer_get_error(compr->buf); in wm_adsp_compr_trigger()
1605 ret = wm_adsp_buffer_write(compr->buf, in wm_adsp_compr_trigger()
1607 wm_adsp_compr_frag_words(compr)); in wm_adsp_compr_trigger()
1609 compr_err(compr, "Failed to set high water mark: %d\n", in wm_adsp_compr_trigger()
1615 if (wm_adsp_compr_attached(compr)) in wm_adsp_compr_trigger()
1616 wm_adsp_buffer_clear(compr->buf); in wm_adsp_compr_trigger()
1682 struct wm_adsp_compr *compr; in wm_adsp_compr_handle_irq() local
1695 compr = buf->compr; in wm_adsp_compr_handle_irq()
1718 if (compr && compr->stream) in wm_adsp_compr_handle_irq()
1719 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_compr_handle_irq()
1746 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_pointer() local
1747 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_pointer()
1751 compr_dbg(compr, "Pointer request\n"); in wm_adsp_compr_pointer()
1755 buf = compr->buf; in wm_adsp_compr_pointer()
1763 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1766 compr_err(compr, "Error reading avail: %d\n", ret); in wm_adsp_compr_pointer()
1774 if (buf->avail < wm_adsp_compr_frag_words(compr)) { in wm_adsp_compr_pointer()
1785 compr_err(compr, "Failed to re-enable buffer IRQ: %d\n", in wm_adsp_compr_pointer()
1792 tstamp->copied_total = compr->copied_total; in wm_adsp_compr_pointer()
1794 tstamp->sampling_rate = compr->sample_rate; in wm_adsp_compr_pointer()
1803 static int wm_adsp_buffer_capture_block(struct wm_adsp_compr *compr, int target) in wm_adsp_buffer_capture_block() argument
1805 struct wm_adsp_compr_buf *buf = compr->buf; in wm_adsp_buffer_capture_block()
1822 max_read = wm_adsp_compr_frag_words(compr); in wm_adsp_buffer_capture_block()
1836 nwords, (__be32 *)compr->raw_buf); in wm_adsp_buffer_capture_block()
1840 cs_dsp_remove_padding(compr->raw_buf, nwords); in wm_adsp_buffer_capture_block()
1858 static int wm_adsp_compr_read(struct wm_adsp_compr *compr, in wm_adsp_compr_read() argument
1861 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_read()
1865 compr_dbg(compr, "Requested read of %zu bytes\n", count); in wm_adsp_compr_read()
1867 if (dsp->fatal_error || !compr->buf || compr->buf->error) { in wm_adsp_compr_read()
1868 snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN); in wm_adsp_compr_read()
1875 nwords = wm_adsp_buffer_capture_block(compr, count); in wm_adsp_compr_read()
1877 compr_err(compr, "Failed to capture block: %d\n", in wm_adsp_compr_read()
1884 compr_dbg(compr, "Read %d bytes\n", nbytes); in wm_adsp_compr_read()
1886 if (copy_to_user(buf + ntotal, compr->raw_buf, nbytes)) { in wm_adsp_compr_read()
1887 compr_err(compr, "Failed to copy data to user: %d, %d\n", in wm_adsp_compr_read()
1896 compr->copied_total += ntotal; in wm_adsp_compr_read()
1905 struct wm_adsp_compr *compr = stream->runtime->private_data; in wm_adsp_compr_copy() local
1906 struct wm_adsp *dsp = compr->dsp; in wm_adsp_compr_copy()
1912 ret = wm_adsp_compr_read(compr, buf, count); in wm_adsp_compr_copy()
1925 struct wm_adsp_compr *compr; in wm_adsp_fatal_error() local
1929 list_for_each_entry(compr, &dsp->compr_list, list) { in wm_adsp_fatal_error()
1930 if (compr->stream) in wm_adsp_fatal_error()
1931 snd_compr_fragment_elapsed(compr->stream); in wm_adsp_fatal_error()