xref: /linux/sound/pci/aw2/aw2-saa7146.h (revision 37744feebc086908fd89760650f458ab19071750)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*****************************************************************************
3  *
4  * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and
5  * Jean-Christian Hassler <jhassler@free.fr>
6  *
7  * This file is part of the Audiowerk2 ALSA driver
8  *
9  *****************************************************************************/
10 
11 #ifndef AW2_SAA7146_H
12 #define AW2_SAA7146_H
13 
14 #define NB_STREAM_PLAYBACK 2
15 #define NB_STREAM_CAPTURE 1
16 
17 #define NUM_STREAM_PLAYBACK_ANA 0
18 #define NUM_STREAM_PLAYBACK_DIG 1
19 
20 #define NUM_STREAM_CAPTURE_ANA 0
21 
22 typedef void (*snd_aw2_saa7146_it_cb) (void *);
23 
24 struct snd_aw2_saa7146_cb_param {
25 	snd_aw2_saa7146_it_cb p_it_callback;
26 	void *p_callback_param;
27 };
28 
29 /* definition of the chip-specific record */
30 
31 struct snd_aw2_saa7146 {
32 	void __iomem *base_addr;
33 };
34 
35 extern void snd_aw2_saa7146_setup(struct snd_aw2_saa7146 *chip,
36 				  void __iomem *pci_base_addr);
37 extern int snd_aw2_saa7146_free(struct snd_aw2_saa7146 *chip);
38 
39 extern void snd_aw2_saa7146_pcm_init_playback(struct snd_aw2_saa7146 *chip,
40 					      int stream_number,
41 					      unsigned long dma_addr,
42 					      unsigned long period_size,
43 					      unsigned long buffer_size);
44 extern void snd_aw2_saa7146_pcm_init_capture(struct snd_aw2_saa7146 *chip,
45 					     int stream_number,
46 					     unsigned long dma_addr,
47 					     unsigned long period_size,
48 					     unsigned long buffer_size);
49 extern void snd_aw2_saa7146_define_it_playback_callback(unsigned int
50 							stream_number,
51 							snd_aw2_saa7146_it_cb
52 							p_it_callback,
53 							void *p_callback_param);
54 extern void snd_aw2_saa7146_define_it_capture_callback(unsigned int
55 						       stream_number,
56 						       snd_aw2_saa7146_it_cb
57 						       p_it_callback,
58 						       void *p_callback_param);
59 extern void snd_aw2_saa7146_pcm_trigger_start_capture(struct snd_aw2_saa7146
60 						      *chip, int stream_number);
61 extern void snd_aw2_saa7146_pcm_trigger_stop_capture(struct snd_aw2_saa7146
62 						     *chip, int stream_number);
63 
64 extern void snd_aw2_saa7146_pcm_trigger_start_playback(struct snd_aw2_saa7146
65 						       *chip,
66 						       int stream_number);
67 extern void snd_aw2_saa7146_pcm_trigger_stop_playback(struct snd_aw2_saa7146
68 						      *chip, int stream_number);
69 
70 extern irqreturn_t snd_aw2_saa7146_interrupt(int irq, void *dev_id);
71 extern unsigned int snd_aw2_saa7146_get_hw_ptr_playback(struct snd_aw2_saa7146
72 							*chip,
73 							int stream_number,
74 							unsigned char
75 							*start_addr,
76 							unsigned int
77 							buffer_size);
78 extern unsigned int snd_aw2_saa7146_get_hw_ptr_capture(struct snd_aw2_saa7146
79 						       *chip,
80 						       int stream_number,
81 						       unsigned char
82 						       *start_addr,
83 						       unsigned int
84 						       buffer_size);
85 
86 extern void snd_aw2_saa7146_use_digital_input(struct snd_aw2_saa7146 *chip,
87 					      int use_digital);
88 
89 extern int snd_aw2_saa7146_is_using_digital_input(struct snd_aw2_saa7146
90 						  *chip);
91 
92 #endif
93