15 #include <linux/module.h>
28 #define BRGATXSAR 0x00
29 #define BRGARXDAR 0x04
30 #define BRGATXTCR 0x08
31 #define BRGARXTCR 0x0C
33 #define BRGATXTCNT 0x14
34 #define BRGARXTCNT 0x18
36 #define ACR_RAR (1 << 18)
37 #define ACR_RDS (1 << 17)
38 #define ACR_RDE (1 << 16)
39 #define ACR_TAR (1 << 2)
40 #define ACR_TDS (1 << 1)
41 #define ACR_TDE (1 << 0)
44 #define ACR_RAM_NONE (0 << 24)
45 #define ACR_RAM_4BYTE (1 << 24)
46 #define ACR_RAM_2WORD (2 << 24)
47 #define ACR_TAM_NONE (0 << 8)
48 #define ACR_TAM_4BYTE (1 << 8)
49 #define ACR_TAM_2WORD (2 << 8)
75 #define BRGREG(x) (*(unsigned long *)(cam->mmio + (x)))
87 #define DMABRG_PERIOD_MIN 16 * 1024
88 #define DMABRG_PERIOD_MAX 0x03fffffc
89 #define DMABRG_PREALLOC_BUFFER 32 * 1024
90 #define DMABRG_PREALLOC_BUFFER_MAX 32 * 1024
93 #define DMABRG_RATES \
94 SNDRV_PCM_RATE_8000_192000
97 (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | \
98 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE | \
99 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_U20_3LE | \
100 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3LE | \
101 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_U32_LE)
123 static void camelot_txdma(
void *
data)
130 static void camelot_rxdma(
void *data)
147 dmairq = (recv) ? cam->
txid + 2 : cam->
txid;
149 cam->
rx_ss = substream;
152 pr_debug(
"audio unit %d irqs already taken!\n",
158 cam->
tx_ss = substream;
161 pr_debug(
"audio unit %d irqs already taken!\n",
177 dmairq = (recv) ? cam->
txid + 2 : cam->
txid;
224 pr_debug(
"PCM data: addr 0x%08ulx len %d\n",
245 static inline void dmabrg_play_dma_stop(
struct camelot_pcm *cam)
252 static inline void dmabrg_rec_dma_start(
struct camelot_pcm *cam)
259 static inline void dmabrg_rec_dma_stop(
struct camelot_pcm *cam)
275 dmabrg_rec_dma_start(cam);
277 dmabrg_play_dma_start(cam);
281 dmabrg_rec_dma_stop(cam);
283 dmabrg_play_dma_stop(cam);
311 return bytes_to_frames(runtime, pos);
315 .
open = camelot_pcm_open,
316 .close = camelot_pcm_close,
318 .hw_params = camelot_hw_params,
319 .hw_free = camelot_hw_free,
320 .prepare = camelot_prepare,
321 .trigger = camelot_trigger,
322 .pointer = camelot_pos,
325 static void camelot_pcm_free(
struct snd_pcm *
pcm)
346 .pcm_ops = &camelot_pcm_ops,
347 .pcm_new = camelot_pcm_new,
348 .pcm_free = camelot_pcm_free,
364 .name =
"sh7760-pcm-audio",
368 .probe = sh7760_soc_platform_probe,