xref: /openbmc/linux/include/sound/pxa2xx-lib.h (revision b8bb76713ec50df2f11efee386e16f93d51e1076)
1 #ifndef PXA2XX_LIB_H
2 #define PXA2XX_LIB_H
3 
4 #include <linux/platform_device.h>
5 #include <sound/ac97_codec.h>
6 
7 /* PCM */
8 
9 struct pxa2xx_pcm_dma_params {
10 	char *name;			/* stream identifier */
11 	u32 dcmd;			/* DMA descriptor dcmd field */
12 	volatile u32 *drcmr;		/* the DMA request channel to use */
13 	u32 dev_addr;			/* device physical address for DMA */
14 };
15 
16 extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
17 				struct snd_pcm_hw_params *params);
18 extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
19 extern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
20 extern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream);
21 extern int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream);
22 extern void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id);
23 extern int __pxa2xx_pcm_open(struct snd_pcm_substream *substream);
24 extern int __pxa2xx_pcm_close(struct snd_pcm_substream *substream);
25 extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream,
26 	struct vm_area_struct *vma);
27 extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream);
28 extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm);
29 
30 /* AC97 */
31 
32 extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
33 extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
34 
35 extern bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97);
36 extern bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97);
37 extern void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97);
38 
39 extern int pxa2xx_ac97_hw_suspend(void);
40 extern int pxa2xx_ac97_hw_resume(void);
41 
42 extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
43 extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
44 
45 /* AC97 platform_data */
46 /**
47  * struct pxa2xx_ac97_platform_data - pxa ac97 platform data
48  * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95)
49  *              a -1 value means no gpio will be used for reset
50  *
51  * Platform data should only be specified for pxa27x CPUs where a silicon bug
52  * prevents correct operation of the reset line. If not specified, the default
53  * behaviour is to consider gpio 113 as the AC97 reset line, which is the
54  * default on most boards.
55  */
56 struct pxa2xx_ac97_platform_data {
57 	int reset_gpio;
58 };
59 
60 #endif
61