[ALSA] Revised AT32 ASoC Patch
[linux-2.6/linux-loongson.git] / sound / soc / at32 / at32-pcm.h
blob2a52430417da82dd9c3a5abd092caa754ba2d71e
1 /* sound/soc/at32/at32-pcm.h
2 * ASoC PCM interface for Atmel AT32 SoC
4 * Copyright (C) 2008 Long Range Systems
5 * Geoffrey Wossum <gwossum@acm.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #ifndef __SOUND_SOC_AT32_AT32_PCM_H
13 #define __SOUND_SOC_AT32_AT32_PCM_H __FILE__
15 #include <linux/atmel-ssc.h>
19 * Registers and status bits that are required by the PCM driver
20 * TODO: Is ptcr really used?
22 struct at32_pdc_regs {
23 u32 xpr; /* PDC RX/TX pointer */
24 u32 xcr; /* PDC RX/TX counter */
25 u32 xnpr; /* PDC next RX/TX pointer */
26 u32 xncr; /* PDC next RX/TX counter */
27 u32 ptcr; /* PDC transfer control */
33 * SSC mask info
35 struct at32_ssc_mask {
36 u32 ssc_enable; /* SSC RX/TX enable */
37 u32 ssc_disable; /* SSC RX/TX disable */
38 u32 ssc_endx; /* SSC ENDTX or ENDRX */
39 u32 ssc_endbuf; /* SSC TXBUFF or RXBUFF */
40 u32 pdc_enable; /* PDC RX/TX enable */
41 u32 pdc_disable; /* PDC RX/TX disable */
47 * This structure, shared between the PCM driver and the interface,
48 * contains all information required by the PCM driver to perform the
49 * PDC DMA operation. All fields except dma_intr_handler() are initialized
50 * by the interface. The dms_intr_handler() pointer is set by the PCM
51 * driver and called by the interface SSC interrupt handler if it is
52 * non-NULL.
54 struct at32_pcm_dma_params {
55 char *name; /* stream identifier */
56 int pdc_xfer_size; /* PDC counter increment in bytes */
57 struct ssc_device *ssc; /* SSC device for stream */
58 struct at32_pdc_regs *pdc; /* PDC register info */
59 struct at32_ssc_mask *mask; /* SSC mask info */
60 struct snd_pcm_substream *substream;
61 void (*dma_intr_handler) (u32, struct snd_pcm_substream *);
67 * The AT32 ASoC platform driver
69 extern struct snd_soc_platform at32_soc_platform;
74 * SSC register access (since ssc_writel() / ssc_readl() require literal name)
76 #define ssc_readx(base, reg) (__raw_readl((base) + (reg)))
77 #define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))
79 #endif /* __SOUND_SOC_AT32_AT32_PCM_H */