Lines Matching +full:burst +full:- +full:wrap
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
22 #include "../sof-audio.h"
27 #define SDnFMT_MULT(x) (((x) - 1) << 11)
28 #define SDnFMT_DIV(x) (((x) - 1) << 8)
68 dev_warn(sdev->dev, "can't find div rate %d using 48kHz\n", in hda_dsp_get_mult_div()
88 dev_warn(sdev->dev, "can't find %d bits using 16bit\n", in hda_dsp_get_bits()
99 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_hw_params()
101 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_pcm_hw_params()
105 hstream->substream = substream; in hda_dsp_pcm_hw_params()
107 dmab = substream->runtime->dma_buffer_p; in hda_dsp_pcm_hw_params()
113 if (!sdev->dspless_mode_selected) { in hda_dsp_pcm_hw_params()
117 hstream->format_val = rate | bits | (params_channels(params) - 1); in hda_dsp_pcm_hw_params()
120 hstream->bufsize = params_buffer_bytes(params); in hda_dsp_pcm_hw_params()
121 hstream->period_bytes = params_period_bytes(params); in hda_dsp_pcm_hw_params()
122 hstream->no_period_wakeup = in hda_dsp_pcm_hw_params()
123 (params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP) && in hda_dsp_pcm_hw_params()
124 (params->flags & SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP); in hda_dsp_pcm_hw_params()
128 dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret); in hda_dsp_pcm_hw_params()
139 platform_params->no_ipc_position = hda->no_ipc_position; in hda_dsp_pcm_hw_params()
141 platform_params->stream_tag = hstream->stream_tag; in hda_dsp_pcm_hw_params()
150 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_ack()
151 struct snd_pcm_runtime *runtime = substream->runtime; in hda_dsp_pcm_ack()
155 appl_pos = frames_to_bytes(runtime, runtime->control->appl_ptr); in hda_dsp_pcm_ack()
156 buf_size = frames_to_bytes(runtime, runtime->buffer_size); in hda_dsp_pcm_ack()
164 sof_io_write(sdev, hstream->spib_addr, spib); in hda_dsp_pcm_ack()
173 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_trigger()
184 struct snd_soc_component *scomp = sdev->component; in hda_dsp_pcm_pointer()
185 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_pointer()
186 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_pcm_pointer()
192 dev_warn_ratelimited(sdev->dev, "warn: can't find PCM with DAI ID %d\n", in hda_dsp_pcm_pointer()
193 rtd->dai_link->id); in hda_dsp_pcm_pointer()
197 if (hda && !hda->no_ipc_position) { in hda_dsp_pcm_pointer()
199 pos = spcm->stream[substream->stream].posn.host_posn; in hda_dsp_pcm_pointer()
203 pos = hda_dsp_stream_get_position(hstream, substream->stream, true); in hda_dsp_pcm_pointer()
205 pos = bytes_to_frames(substream->runtime, pos); in hda_dsp_pcm_pointer()
216 struct snd_pcm_runtime *runtime = substream->runtime; in hda_dsp_pcm_open()
217 struct snd_soc_component *scomp = sdev->component; in hda_dsp_pcm_open()
220 int direction = substream->stream; in hda_dsp_pcm_open()
225 dev_err(sdev->dev, "error: can't find PCM with DAI ID %d\n", rtd->dai_link->id); in hda_dsp_pcm_open()
226 return -EINVAL; in hda_dsp_pcm_open()
234 runtime->hw.info |= SNDRV_PCM_INFO_NO_REWINDS | SNDRV_PCM_INFO_SYNC_APPLPTR; in hda_dsp_pcm_open()
241 runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE; in hda_dsp_pcm_open()
245 spcm->stream[substream->stream].d0i3_compatible) in hda_dsp_pcm_open()
250 dev_err(sdev->dev, "error: no stream available\n"); in hda_dsp_pcm_open()
251 return -ENODEV; in hda_dsp_pcm_open()
255 snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4); in hda_dsp_pcm_open()
257 /* avoid circular buffer wrap in middle of period */ in hda_dsp_pcm_open()
258 snd_pcm_hw_constraint_integer(substream->runtime, in hda_dsp_pcm_open()
262 if (runtime->hw.periods_max > HDA_DSP_MAX_BDL_ENTRIES) in hda_dsp_pcm_open()
264 runtime->hw.periods_min, in hda_dsp_pcm_open()
268 if (sdev->dspless_mode_selected) in hda_dsp_pcm_open()
269 snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT, in hda_dsp_pcm_open()
273 * The dsp_max_burst_size_in_ms is the length of the maximum burst size in hda_dsp_pcm_open()
277 * amount of data in one initial burst to fill up the host DMA buffer. in hda_dsp_pcm_open()
278 * Consequent DMA burst sizes are shorter and their length can vary. in hda_dsp_pcm_open()
287 if (spcm->stream[direction].dsp_max_burst_size_in_ms) in hda_dsp_pcm_open()
288 snd_pcm_hw_constraint_minmax(substream->runtime, in hda_dsp_pcm_open()
290 spcm->stream[direction].dsp_max_burst_size_in_ms * USEC_PER_MSEC * 2, in hda_dsp_pcm_open()
294 substream->runtime->private_data = &dsp_stream->hstream; in hda_dsp_pcm_open()
300 dsp_stream->pplcllpl = 0; in hda_dsp_pcm_open()
301 dsp_stream->pplcllpu = 0; in hda_dsp_pcm_open()
310 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_close()
311 int direction = substream->stream; in hda_dsp_pcm_close()
314 ret = hda_dsp_stream_put(sdev, direction, hstream->stream_tag); in hda_dsp_pcm_close()
317 dev_dbg(sdev->dev, "stream %s not opened!\n", substream->name); in hda_dsp_pcm_close()
318 return -ENODEV; in hda_dsp_pcm_close()
322 substream->runtime->private_data = NULL; in hda_dsp_pcm_close()