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