1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef CTATC_H
19#define CTATC_H
20
21#include <linux/types.h>
22#include <linux/mutex.h>
23#include <linux/pci.h>
24#include <linux/timer.h>
25#include <sound/core.h>
26
27#include "ctvmem.h"
28#include "cthardware.h"
29#include "ctresource.h"
30
31enum CTALSADEVS {
32 FRONT,
33 SURROUND,
34 CLFE,
35 SIDE,
36 IEC958,
37 MIXER,
38 NUM_CTALSADEVS
39};
40
41struct ct_atc_chip_sub_details {
42 u16 subsys;
43 const char *nm_model;
44};
45
46struct ct_atc_chip_details {
47 u16 vendor;
48 u16 device;
49 const struct ct_atc_chip_sub_details *sub_details;
50 const char *nm_card;
51};
52
53struct ct_atc;
54struct ct_timer;
55struct ct_timer_instance;
56
57
58struct ct_atc_pcm {
59 struct snd_pcm_substream *substream;
60 void (*interrupt)(struct ct_atc_pcm *apcm);
61 struct ct_timer_instance *timer;
62 unsigned int started:1;
63
64
65 struct ct_vm_block *vm_block;
66 void *src;
67 void **srccs;
68 void **srcimps;
69 void **amixers;
70 void *mono;
71 unsigned char n_srcc;
72 unsigned char n_srcimp;
73 unsigned char n_amixer;
74};
75
76
77struct ct_atc {
78 struct pci_dev *pci;
79 struct snd_card *card;
80 unsigned int rsr;
81 unsigned int msr;
82 unsigned int pll_rate;
83
84 int chip_type;
85 int model;
86 const char *chip_name;
87 const char *model_name;
88
89 struct ct_vm *vm;
90 int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
91 void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
92 unsigned long (*get_ptp_phys)(struct ct_atc *atc, int index);
93
94 struct mutex atc_mutex;
95
96 int (*pcm_playback_prepare)(struct ct_atc *atc,
97 struct ct_atc_pcm *apcm);
98 int (*pcm_playback_start)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
99 int (*pcm_playback_stop)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
100 int (*pcm_playback_position)(struct ct_atc *atc,
101 struct ct_atc_pcm *apcm);
102 int (*spdif_passthru_playback_prepare)(struct ct_atc *atc,
103 struct ct_atc_pcm *apcm);
104 int (*pcm_capture_prepare)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
105 int (*pcm_capture_start)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
106 int (*pcm_capture_stop)(struct ct_atc *atc, struct ct_atc_pcm *apcm);
107 int (*pcm_capture_position)(struct ct_atc *atc,
108 struct ct_atc_pcm *apcm);
109 int (*pcm_release_resources)(struct ct_atc *atc,
110 struct ct_atc_pcm *apcm);
111 int (*select_line_in)(struct ct_atc *atc);
112 int (*select_mic_in)(struct ct_atc *atc);
113 int (*select_digit_io)(struct ct_atc *atc);
114 int (*line_front_unmute)(struct ct_atc *atc, unsigned char state);
115 int (*line_surround_unmute)(struct ct_atc *atc, unsigned char state);
116 int (*line_clfe_unmute)(struct ct_atc *atc, unsigned char state);
117 int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state);
118 int (*line_in_unmute)(struct ct_atc *atc, unsigned char state);
119 int (*mic_unmute)(struct ct_atc *atc, unsigned char state);
120 int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state);
121 int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state);
122 int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status);
123 int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status);
124 int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state);
125 struct capabilities (*capabilities)(struct ct_atc *atc);
126 int (*output_switch_get)(struct ct_atc *atc);
127 int (*output_switch_put)(struct ct_atc *atc, int position);
128 int (*mic_source_switch_get)(struct ct_atc *atc);
129 int (*mic_source_switch_put)(struct ct_atc *atc, int position);
130
131
132 void *rsc_mgrs[NUM_RSCTYP];
133 void *mixer;
134 struct hw *hw;
135 void **daios;
136 void **pcm;
137 void **srcs;
138 void **srcimps;
139 unsigned char n_daio;
140 unsigned char n_src;
141 unsigned char n_srcimp;
142 unsigned char n_pcm;
143
144 struct ct_timer *timer;
145
146#ifdef CONFIG_PM_SLEEP
147 int (*suspend)(struct ct_atc *atc);
148 int (*resume)(struct ct_atc *atc);
149#define NUM_PCMS (NUM_CTALSADEVS - 1)
150 struct snd_pcm *pcms[NUM_PCMS];
151#endif
152};
153
154
155int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
156 unsigned int rsr, unsigned int msr, int chip_type,
157 unsigned int subsysid, struct ct_atc **ratc);
158int ct_atc_create_alsa_devs(struct ct_atc *atc);
159
160#endif
161