Lines Matching +full:use +full:- +full:case
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
21 #include "../sof-audio.h"
26 #define SDnFMT_MULT(x) (((x) - 1) << 11)
27 #define SDnFMT_DIV(x) (((x) - 1) << 8)
38 case 8000: in hda_dsp_get_mult_div()
40 case 9600: in hda_dsp_get_mult_div()
42 case 11025: in hda_dsp_get_mult_div()
44 case 16000: in hda_dsp_get_mult_div()
46 case 22050: in hda_dsp_get_mult_div()
48 case 32000: in hda_dsp_get_mult_div()
50 case 44100: in hda_dsp_get_mult_div()
52 case 48000: in hda_dsp_get_mult_div()
54 case 88200: in hda_dsp_get_mult_div()
56 case 96000: in hda_dsp_get_mult_div()
58 case 176400: in hda_dsp_get_mult_div()
60 case 192000: in hda_dsp_get_mult_div()
63 dev_warn(sdev->dev, "can't find div rate %d using 48kHz\n", in hda_dsp_get_mult_div()
65 return 0; /* use 48KHz if not found */ in hda_dsp_get_mult_div()
72 case 8: in hda_dsp_get_bits()
74 case 16: in hda_dsp_get_bits()
76 case 20: in hda_dsp_get_bits()
78 case 24: in hda_dsp_get_bits()
80 case 32: in hda_dsp_get_bits()
83 dev_warn(sdev->dev, "can't find %d bits using 16bit\n", in hda_dsp_get_bits()
85 return SDnFMT_BITS(1); /* use 16bits format if not found */ in hda_dsp_get_bits()
94 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_hw_params()
96 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_pcm_hw_params()
98 struct sof_ipc_fw_version *v = &sdev->fw_ready.version; in hda_dsp_pcm_hw_params()
106 hstream->substream = substream; in hda_dsp_pcm_hw_params()
108 dmab = substream->runtime->dma_buffer_p; in hda_dsp_pcm_hw_params()
110 hstream->format_val = rate | bits | (params_channels(params) - 1); in hda_dsp_pcm_hw_params()
111 hstream->bufsize = size; in hda_dsp_pcm_hw_params()
112 hstream->period_bytes = params_period_bytes(params); in hda_dsp_pcm_hw_params()
113 hstream->no_period_wakeup = in hda_dsp_pcm_hw_params()
114 (params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP) && in hda_dsp_pcm_hw_params()
115 (params->flags & SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP); in hda_dsp_pcm_hw_params()
119 dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret); in hda_dsp_pcm_hw_params()
127 if (hda && hda->no_ipc_position) { in hda_dsp_pcm_hw_params()
129 * FW we don't want position updates. Newer versions use in hda_dsp_pcm_hw_params()
132 if (v->abi_version < SOF_ABI_VER(3, 10, 0)) in hda_dsp_pcm_hw_params()
133 ipc_params->host_period_bytes = 0; in hda_dsp_pcm_hw_params()
135 ipc_params->no_stream_position = 1; in hda_dsp_pcm_hw_params()
138 ipc_params->stream_tag = hstream->stream_tag; in hda_dsp_pcm_hw_params()
146 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_trigger()
156 struct snd_soc_component *scomp = sdev->component; in hda_dsp_pcm_pointer()
157 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_pointer()
158 struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; in hda_dsp_pcm_pointer()
164 dev_warn_ratelimited(sdev->dev, "warn: can't find PCM with DAI ID %d\n", in hda_dsp_pcm_pointer()
165 rtd->dai_link->id); in hda_dsp_pcm_pointer()
169 if (hda && !hda->no_ipc_position) { in hda_dsp_pcm_pointer()
171 pos = spcm->stream[substream->stream].posn.host_posn; in hda_dsp_pcm_pointer()
177 * For Playback, Use DPIB register from HDA space which in hda_dsp_pcm_pointer()
179 * For Capture, Use the position buffer for pointer, as DPIB in hda_dsp_pcm_pointer()
183 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in hda_dsp_pcm_pointer()
187 hstream->index)); in hda_dsp_pcm_pointer()
205 hstream->index)); in hda_dsp_pcm_pointer()
209 if (pos >= hstream->bufsize) in hda_dsp_pcm_pointer()
213 pos = bytes_to_frames(substream->runtime, pos); in hda_dsp_pcm_pointer()
215 dev_vdbg(sdev->dev, "PCM: stream %d dir %d position %lu\n", in hda_dsp_pcm_pointer()
216 hstream->index, substream->stream, pos); in hda_dsp_pcm_pointer()
224 struct snd_pcm_runtime *runtime = substream->runtime; in hda_dsp_pcm_open()
225 struct snd_soc_component *scomp = sdev->component; in hda_dsp_pcm_open()
228 int direction = substream->stream; in hda_dsp_pcm_open()
233 dev_err(sdev->dev, "error: can't find PCM with DAI ID %d\n", rtd->dai_link->id); in hda_dsp_pcm_open()
234 return -EINVAL; in hda_dsp_pcm_open()
242 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()
258 snd_pcm_hw_constraint_integer(substream->runtime, in hda_dsp_pcm_open()
262 substream->runtime->private_data = &dsp_stream->hstream; in hda_dsp_pcm_open()
269 struct hdac_stream *hstream = substream->runtime->private_data; in hda_dsp_pcm_close()
270 int direction = substream->stream; in hda_dsp_pcm_close()
273 ret = hda_dsp_stream_put(sdev, direction, hstream->stream_tag); in hda_dsp_pcm_close()
276 dev_dbg(sdev->dev, "stream %s not opened!\n", substream->name); in hda_dsp_pcm_close()
277 return -ENODEV; in hda_dsp_pcm_close()
281 substream->runtime->private_data = NULL; in hda_dsp_pcm_close()