xref: /openbmc/linux/sound/pci/aw2/aw2-saa7146.h (revision 275876e2)
1 /*****************************************************************************
2  *
3  * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and
4  * Jean-Christian Hassler <jhassler@free.fr>
5  *
6  * This file is part of the Audiowerk2 ALSA driver
7  *
8  * The Audiowerk2 ALSA driver is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2.
11  *
12  * The Audiowerk2 ALSA driver is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with the Audiowerk2 ALSA driver; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
20  * USA.
21  *
22  *****************************************************************************/
23 
24 #ifndef AW2_SAA7146_H
25 #define AW2_SAA7146_H
26 
27 #define NB_STREAM_PLAYBACK 2
28 #define NB_STREAM_CAPTURE 1
29 
30 #define NUM_STREAM_PLAYBACK_ANA 0
31 #define NUM_STREAM_PLAYBACK_DIG 1
32 
33 #define NUM_STREAM_CAPTURE_ANA 0
34 
35 typedef void (*snd_aw2_saa7146_it_cb) (void *);
36 
37 struct snd_aw2_saa7146_cb_param {
38 	snd_aw2_saa7146_it_cb p_it_callback;
39 	void *p_callback_param;
40 };
41 
42 /* definition of the chip-specific record */
43 
44 struct snd_aw2_saa7146 {
45 	void __iomem *base_addr;
46 };
47 
48 extern void snd_aw2_saa7146_setup(struct snd_aw2_saa7146 *chip,
49 				  void __iomem *pci_base_addr);
50 extern int snd_aw2_saa7146_free(struct snd_aw2_saa7146 *chip);
51 
52 extern void snd_aw2_saa7146_pcm_init_playback(struct snd_aw2_saa7146 *chip,
53 					      int stream_number,
54 					      unsigned long dma_addr,
55 					      unsigned long period_size,
56 					      unsigned long buffer_size);
57 extern void snd_aw2_saa7146_pcm_init_capture(struct snd_aw2_saa7146 *chip,
58 					     int stream_number,
59 					     unsigned long dma_addr,
60 					     unsigned long period_size,
61 					     unsigned long buffer_size);
62 extern void snd_aw2_saa7146_define_it_playback_callback(unsigned int
63 							stream_number,
64 							snd_aw2_saa7146_it_cb
65 							p_it_callback,
66 							void *p_callback_param);
67 extern void snd_aw2_saa7146_define_it_capture_callback(unsigned int
68 						       stream_number,
69 						       snd_aw2_saa7146_it_cb
70 						       p_it_callback,
71 						       void *p_callback_param);
72 extern void snd_aw2_saa7146_pcm_trigger_start_capture(struct snd_aw2_saa7146
73 						      *chip, int stream_number);
74 extern void snd_aw2_saa7146_pcm_trigger_stop_capture(struct snd_aw2_saa7146
75 						     *chip, int stream_number);
76 
77 extern void snd_aw2_saa7146_pcm_trigger_start_playback(struct snd_aw2_saa7146
78 						       *chip,
79 						       int stream_number);
80 extern void snd_aw2_saa7146_pcm_trigger_stop_playback(struct snd_aw2_saa7146
81 						      *chip, int stream_number);
82 
83 extern irqreturn_t snd_aw2_saa7146_interrupt(int irq, void *dev_id);
84 extern unsigned int snd_aw2_saa7146_get_hw_ptr_playback(struct snd_aw2_saa7146
85 							*chip,
86 							int stream_number,
87 							unsigned char
88 							*start_addr,
89 							unsigned int
90 							buffer_size);
91 extern unsigned int snd_aw2_saa7146_get_hw_ptr_capture(struct snd_aw2_saa7146
92 						       *chip,
93 						       int stream_number,
94 						       unsigned char
95 						       *start_addr,
96 						       unsigned int
97 						       buffer_size);
98 
99 extern void snd_aw2_saa7146_use_digital_input(struct snd_aw2_saa7146 *chip,
100 					      int use_digital);
101 
102 extern int snd_aw2_saa7146_is_using_digital_input(struct snd_aw2_saa7146
103 						  *chip);
104 
105 #endif
106