Lines Matching +full:cam +full:- +full:if

1 // SPDX-License-Identifier: GPL-2.0
11 // FIXME: little-endian only for now
17 #include <linux/dma-mapping.h>
73 #define BRGREG(x) (*(unsigned long *)(cam->mmio + (x)))
76 * set a minimum of 16kb per period, to avoid interrupt-"storm" and
81 * is 8 bytes; 16kbytes are enough to get skip-free playback of a
106 struct camelot_pcm *cam = data; in camelot_txdma() local
107 cam->tx_period ^= 1; in camelot_txdma()
108 snd_pcm_period_elapsed(cam->tx_ss); in camelot_txdma()
113 struct camelot_pcm *cam = data; in camelot_rxdma() local
114 cam->rx_period ^= 1; in camelot_rxdma()
115 snd_pcm_period_elapsed(cam->rx_ss); in camelot_rxdma()
122 struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id]; in camelot_pcm_open() local
123 int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; in camelot_pcm_open()
129 dmairq = (recv) ? cam->txid + 2 : cam->txid; in camelot_pcm_open()
130 if (recv) { in camelot_pcm_open()
131 cam->rx_ss = substream; in camelot_pcm_open()
132 ret = dmabrg_request_irq(dmairq, camelot_rxdma, cam); in camelot_pcm_open()
133 if (unlikely(ret)) { in camelot_pcm_open()
135 snd_soc_rtd_to_cpu(rtd, 0)->id); in camelot_pcm_open()
136 return -EBUSY; in camelot_pcm_open()
138 (void)dmabrg_request_irq(dmairq + 1,camelot_rxdma, cam); in camelot_pcm_open()
140 cam->tx_ss = substream; in camelot_pcm_open()
141 ret = dmabrg_request_irq(dmairq, camelot_txdma, cam); in camelot_pcm_open()
142 if (unlikely(ret)) { in camelot_pcm_open()
144 snd_soc_rtd_to_cpu(rtd, 0)->id); in camelot_pcm_open()
145 return -EBUSY; in camelot_pcm_open()
147 (void)dmabrg_request_irq(dmairq + 1, camelot_txdma, cam); in camelot_pcm_open()
156 struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id]; in camelot_pcm_close() local
157 int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; in camelot_pcm_close()
160 dmairq = (recv) ? cam->txid + 2 : cam->txid; in camelot_pcm_close()
162 if (recv) in camelot_pcm_close()
163 cam->rx_ss = NULL; in camelot_pcm_close()
165 cam->tx_ss = NULL; in camelot_pcm_close()
178 struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id]; in camelot_hw_params() local
179 int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; in camelot_hw_params()
181 if (recv) { in camelot_hw_params()
182 cam->rx_period_size = params_period_bytes(hw_params); in camelot_hw_params()
183 cam->rx_period = 0; in camelot_hw_params()
185 cam->tx_period_size = params_period_bytes(hw_params); in camelot_hw_params()
186 cam->tx_period = 0; in camelot_hw_params()
194 struct snd_pcm_runtime *runtime = substream->runtime; in camelot_prepare()
196 struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id]; in camelot_prepare() local
198 pr_debug("PCM data: addr %pad len %zu\n", &runtime->dma_addr, in camelot_prepare()
199 runtime->dma_bytes); in camelot_prepare()
201 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in camelot_prepare()
202 BRGREG(BRGATXSAR) = (unsigned long)runtime->dma_area; in camelot_prepare()
203 BRGREG(BRGATXTCR) = runtime->dma_bytes; in camelot_prepare()
205 BRGREG(BRGARXDAR) = (unsigned long)runtime->dma_area; in camelot_prepare()
206 BRGREG(BRGARXTCR) = runtime->dma_bytes; in camelot_prepare()
212 static inline void dmabrg_play_dma_start(struct camelot_pcm *cam) in dmabrg_play_dma_start() argument
215 /* start DMABRG engine: XFER start, auto-addr-reload */ in dmabrg_play_dma_start()
219 static inline void dmabrg_play_dma_stop(struct camelot_pcm *cam) in dmabrg_play_dma_stop() argument
226 static inline void dmabrg_rec_dma_start(struct camelot_pcm *cam) in dmabrg_rec_dma_start() argument
229 /* start DMABRG engine: recv start, auto-reload */ in dmabrg_rec_dma_start()
233 static inline void dmabrg_rec_dma_stop(struct camelot_pcm *cam) in dmabrg_rec_dma_stop() argument
244 struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id]; in camelot_trigger() local
245 int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; in camelot_trigger()
249 if (recv) in camelot_trigger()
250 dmabrg_rec_dma_start(cam); in camelot_trigger()
252 dmabrg_play_dma_start(cam); in camelot_trigger()
255 if (recv) in camelot_trigger()
256 dmabrg_rec_dma_stop(cam); in camelot_trigger()
258 dmabrg_play_dma_stop(cam); in camelot_trigger()
261 return -EINVAL; in camelot_trigger()
270 struct snd_pcm_runtime *runtime = substream->runtime; in camelot_pos()
272 struct camelot_pcm *cam = &cam_pcm_data[snd_soc_rtd_to_cpu(rtd, 0)->id]; in camelot_pos() local
273 int recv = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 0:1; in camelot_pos()
280 * fast-playback sound in my test application (ScummVM) in camelot_pos()
282 if (recv) in camelot_pos()
283 pos = cam->rx_period ? cam->rx_period_size : 0; in camelot_pos()
285 pos = cam->tx_period ? cam->tx_period_size : 0; in camelot_pos()
293 struct snd_pcm *pcm = rtd->pcm; in camelot_pcm_new()
296 * in MMAP mode (i.e. aplay -M) in camelot_pcm_new()
318 return devm_snd_soc_register_component(&pdev->dev, &sh7760_soc_component, in sh7760_soc_platform_probe()
324 .name = "sh7760-pcm-audio",