diff options
author | Sedji Gaouaou <sedji.gaouaou@atmel.com> | 2008-10-03 10:57:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-10-31 09:12:26 -0400 |
commit | 6c7425095c9ee23d080dba3e27217a254cce4562 (patch) | |
tree | c6c27e1c986b2adeda4adbdcad934b816d654b75 /sound/soc/atmel/atmel-pcm.h | |
parent | dc06102a0c8b5aa0dd7f9a40ce241e793c252a87 (diff) |
ASoC: Merge AT91 and AVR32 support into a single atmel architecture
The Ateml AT91 and AVR32 SoC share common IP for audio and can share the
same driver code using the atmel-ssc API provided for both architectures.
Do this, creating a new unified atmel ASoC architecture to replace the
previous at32 and at91 ones.
[This was contributed as a patch series for reviewability but has been
squashed down to a single commit to help preserve both the history and
bisectability. A small bugfix from Jukka is included.]
Tested-by: Jukka Hynninen <ext-jukka.hynninen@vaisala.com>
Signed-off-by: Sedji Gaouaou <sedji.gaouaou@atmel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/atmel/atmel-pcm.h')
-rw-r--r-- | sound/soc/atmel/atmel-pcm.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/sound/soc/atmel/atmel-pcm.h b/sound/soc/atmel/atmel-pcm.h new file mode 100644 index 000000000000..ec9b2824b663 --- /dev/null +++ b/sound/soc/atmel/atmel-pcm.h | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * at91-pcm.h - ALSA PCM interface for the Atmel AT91 SoC. | ||
3 | * | ||
4 | * Copyright (C) 2005 SAN People | ||
5 | * Copyright (C) 2008 Atmel | ||
6 | * | ||
7 | * Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com> | ||
8 | * | ||
9 | * Based on at91-pcm. by: | ||
10 | * Frank Mandarino <fmandarino@endrelia.com> | ||
11 | * Copyright 2006 Endrelia Technologies Inc. | ||
12 | * | ||
13 | * Based on pxa2xx-pcm.c by: | ||
14 | * | ||
15 | * Author: Nicolas Pitre | ||
16 | * Created: Nov 30, 2004 | ||
17 | * Copyright: (C) 2004 MontaVista Software, Inc. | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify | ||
20 | * it under the terms of the GNU General Public License as published by | ||
21 | * the Free Software Foundation; either version 2 of the License, or | ||
22 | * (at your option) any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, | ||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | * GNU General Public License for more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License | ||
30 | * along with this program; if not, write to the Free Software | ||
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
32 | */ | ||
33 | |||
34 | #ifndef _ATMEL_PCM_H | ||
35 | #define _ATMEL_PCM_H | ||
36 | |||
37 | #include <linux/atmel-ssc.h> | ||
38 | |||
39 | /* | ||
40 | * Registers and status bits that are required by the PCM driver. | ||
41 | */ | ||
42 | struct atmel_pdc_regs { | ||
43 | unsigned int xpr; /* PDC recv/trans pointer */ | ||
44 | unsigned int xcr; /* PDC recv/trans counter */ | ||
45 | unsigned int xnpr; /* PDC next recv/trans pointer */ | ||
46 | unsigned int xncr; /* PDC next recv/trans counter */ | ||
47 | unsigned int ptcr; /* PDC transfer control */ | ||
48 | }; | ||
49 | |||
50 | struct atmel_ssc_mask { | ||
51 | u32 ssc_enable; /* SSC recv/trans enable */ | ||
52 | u32 ssc_disable; /* SSC recv/trans disable */ | ||
53 | u32 ssc_endx; /* SSC ENDTX or ENDRX */ | ||
54 | u32 ssc_endbuf; /* SSC TXBUFE or RXBUFF */ | ||
55 | u32 pdc_enable; /* PDC recv/trans enable */ | ||
56 | u32 pdc_disable; /* PDC recv/trans disable */ | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * This structure, shared between the PCM driver and the interface, | ||
61 | * contains all information required by the PCM driver to perform the | ||
62 | * PDC DMA operation. All fields except dma_intr_handler() are initialized | ||
63 | * by the interface. The dms_intr_handler() pointer is set by the PCM | ||
64 | * driver and called by the interface SSC interrupt handler if it is | ||
65 | * non-NULL. | ||
66 | */ | ||
67 | struct atmel_pcm_dma_params { | ||
68 | char *name; /* stream identifier */ | ||
69 | int pdc_xfer_size; /* PDC counter increment in bytes */ | ||
70 | struct ssc_device *ssc; /* SSC device for stream */ | ||
71 | struct atmel_pdc_regs *pdc; /* PDC receive or transmit registers */ | ||
72 | struct atmel_ssc_mask *mask; /* SSC & PDC status bits */ | ||
73 | struct snd_pcm_substream *substream; | ||
74 | void (*dma_intr_handler)(u32, struct snd_pcm_substream *); | ||
75 | }; | ||
76 | |||
77 | extern struct snd_soc_platform atmel_soc_platform; | ||
78 | |||
79 | |||
80 | /* | ||
81 | * SSC register access (since ssc_writel() / ssc_readl() require literal name) | ||
82 | */ | ||
83 | #define ssc_readx(base, reg) (__raw_readl((base) + (reg))) | ||
84 | #define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg)) | ||
85 | |||
86 | #endif /* _ATMEL_PCM_H */ | ||