~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to kernel/drv/oss_envy24ht/envy24ht.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Purpose: Common definitions for envy24ht driver files
 
3
 */
 
4
/*
 
5
 *
 
6
 * This file is part of Open Sound System.
 
7
 *
 
8
 * Copyright (C) 4Front Technologies 1996-2008.
 
9
 *
 
10
 * This this source file is released under GPL v2 license (no other versions).
 
11
 * See the COPYING file included in the main directory of this source
 
12
 * distribution for the license terms and conditions.
 
13
 *
 
14
 */
 
15
#include "ac97.h"
 
16
#include "midi_core.h"
 
17
 
 
18
/* 
 
19
 * Various subvendor device ID's
 
20
 */
 
21
#define SSID_AUREON_SPACE    0x1145153b
 
22
#define SSID_AUREON_SKY      0x1147153b
 
23
#define SSID_AUREON_UNIVERSE 0x1153153b
 
24
#define SSID_PHASE28         0x1149153b
 
25
#define SSID_PRODIGY71       0x45534933
 
26
#define SSID_PRODIGYHD2      0x41543137
 
27
#define SSID_PRODIGYHD2_ADE  0x24011412
 
28
#define SSID_JULIA           0x45533031
 
29
#define SSID_AP192           0x36321412
 
30
 
 
31
typedef struct
 
32
{
 
33
  unsigned int dwSubVendorID;   /* PCI[2C-2F], in BIG ENDIAN format */
 
34
  unsigned char bSize;          /* size of EEPROM image in bytes */
 
35
  unsigned char bVersion;       /* version equal 1 for this structure. */
 
36
  unsigned char bCodecConfig;   /* PCI[60] */
 
37
  unsigned char bACLinkConfig;  /* PCI[61] */
 
38
  unsigned char bI2SID;         /* PCI[62] */
 
39
  unsigned char bSpdifConfig;   /* PCI[63] */
 
40
  unsigned char bGPIOInitMask0; /* Corresponding bits need to be inited */
 
41
  /* 0 means write bit and 1 means cannot write */
 
42
  unsigned char bGPIOInitState0;        /* Initial state of GPIO pins */
 
43
  unsigned char bGPIODirection0;        /* GPIO Direction State */
 
44
  unsigned char bGPIOInitMask1;
 
45
  unsigned char bGPIOInitState1;
 
46
  unsigned char bGPIODirection1;
 
47
  unsigned char bGPIOInitMask2;
 
48
  unsigned char bGPIOInitState2;
 
49
  unsigned char bGPIODirection2;
 
50
  unsigned char bAC97RecSrc;
 
51
  unsigned char bDACID[4];      /* I2S IDs for DACs [0 ~ 3] */
 
52
  unsigned char bADCID[4];      /* I2S IDs for ADCs [0 ~ 3] */
 
53
  unsigned char bDACID4;        /* I2S ID  for DAC#4 */
 
54
  unsigned char Reserved[32];
 
55
} eeprom_data_t;
 
56
 
 
57
typedef struct envy24ht_auxdrv envy24ht_auxdrv_t;
 
58
 
 
59
typedef struct
 
60
{
 
61
  unsigned int svid;
 
62
  char *product;
 
63
  int nr_outs, nr_ins;          /* # of analog channels */
 
64
  int flags;
 
65
#define MF_MIDI                 0x00000001      /* Has MIDI port */
 
66
#define MF_192K                 0x00000002      /* Supports 192kHz */
 
67
#define MF_SPDIFIN              0x00000004      /* Has S/PDIF input */
 
68
#define MF_SPDIFOUT             0x00000008      /* Has S/PDIF output */
 
69
#define MF_ENVY24PT             0x00000010      /* Envy24PT chip (no EEPROM) */
 
70
#define MF_NOAC97               0x00000020      /* Ignore AC97 codec */
 
71
  const envy24ht_auxdrv_t *auxdrv;
 
72
  unsigned char *eeprom_data;
 
73
}
 
74
card_spec;
 
75
 
 
76
#define ICENSEMBLE_VENDOR_ID    0x1412
 
77
#define ICENSEMBLE_ENVY24HT_ID  0x1724
 
78
#define MAX_ENVY24HT_CARD 8
 
79
 
 
80
#ifdef USE_LICENSING
 
81
extern int options_data;
 
82
#endif
 
83
 
 
84
#define MAX_ODEV 5
 
85
#define MAX_IDEV 2
 
86
 
 
87
typedef struct
 
88
{
 
89
  int dev;
 
90
  int open_mode;
 
91
  int direction;
 
92
  int fmt;
 
93
  char *name;
 
94
 
 
95
  int channels;
 
96
  volatile int is_active;
 
97
  volatile int trigger_bits;
 
98
  oss_native_word base;
 
99
  unsigned char mask;
 
100
  int dev_flags;
 
101
#define DF_MULTICH              0x00000001
 
102
#define DF_SPDIF                0x00000002
 
103
#define DF_AC3                  0x00000004
 
104
#define DF_DUPLEX               0x00000008
 
105
  int chmask;
 
106
  int used_chmask;
 
107
 
 
108
  int state_bits;
 
109
}
 
110
envy24ht_portc;
 
111
 
 
112
typedef struct
 
113
{
 
114
  int dta, clk;
 
115
} oss_i2c_t;
 
116
 
 
117
/*****************/
 
118
 
 
119
typedef struct
 
120
{
 
121
  oss_device_t *osdev;
 
122
  oss_mutex_t mutex;
 
123
  oss_mutex_t low_mutex;
 
124
  const envy24ht_auxdrv_t *auxdrv;
 
125
  int codec_type;
 
126
#define CODEC_I2S       0
 
127
#define CODEC_AC97      1
 
128
  int mpu1_attached, mpu2_attached;
 
129
  oss_native_word ccs_base, mt_base;
 
130
  int irq;
 
131
  card_spec *model_data;
 
132
  unsigned int subvendor;
 
133
  eeprom_data_t eeprom;
 
134
  char channel_names[4][10];
 
135
  unsigned short gpio_shadow_L;
 
136
  unsigned char gpio_shadow_H;
 
137
 
 
138
  oss_i2c_t i2c;
 
139
/*
 
140
 * MT mixer
 
141
 */
 
142
 
 
143
  int mixer_dev;
 
144
  ac97_devc ac97devc;
 
145
 
 
146
  int nr_outdevs, nr_indevs;
 
147
  envy24ht_portc play_portc[MAX_ODEV];
 
148
  envy24ht_portc rec_portc[MAX_IDEV];
 
149
 
 
150
  int outportmask, inportmask;
 
151
  int nr_play_channels, nr_rec_channels;
 
152
  int first_dev;
 
153
 
 
154
  int open_count;
 
155
  int speed, pending_speed, pending_speed_sel, speedbits, configured_rate_sel;
 
156
  int prev_speed;               /* Strictly for use by low level modules */
 
157
  int max_ratesel;
 
158
  int syncsource;
 
159
 
 
160
  int use_src;
 
161
  int ratelock;
 
162
  int external_sync;
 
163
  int busy_play_channels;
 
164
  int busy_rec_channels;
 
165
 
 
166
  spdif_devc spdc;
 
167
  int gains[6];
 
168
  int monitor[5];
 
169
  int recsrc;
 
170
 
 
171
/*
 
172
 * MIDI
 
173
 */
 
174
  int midi_opened;
 
175
  int midi_attached;
 
176
  oss_midi_inputbyte_t midi_input_intr;
 
177
  oss_midi_outputintr_t midi_output_intr;
 
178
  volatile unsigned char input_byte;
 
179
  int midi_dev;
 
180
 
 
181
/*
 
182
 * Low level stuff
 
183
 */
 
184
  unsigned char dac1val[5], dac2val[11];        /* M Audio Revo 7.1 */
 
185
  unsigned short m_AC97Volume[6];       /* Terratec Aureon */
 
186
  unsigned char m_fAC97Mute[6]; /* Terratec Aureon */
 
187
  int m_DigInSource;            /* Aureon */
 
188
  int m_LineInSource;           /* Aureon */
 
189
  int m_SPDIFSource;            /* Aureon */
 
190
  int m_ADCIndex;               /* Aureon */
 
191
  int m_f1724SPDIF;             /* Aureon */
 
192
  int m_SPDIFConfig;            /* Aureon */
 
193
  int m_Frontjack;              /* Aureon */
 
194
  unsigned char m_fDACMute[12]; /* Aureon */
 
195
  unsigned char m_DACVolume[13];        /* Aureon & Juli@ */
 
196
  unsigned short m_ADCVolume[8];        /* Aureon */
 
197
  unsigned char m_ADCMux;       /* Aureon */
 
198
  unsigned char m_fSPDIFRecord; /* Aureon */
 
199
  unsigned char m_AuxMux;       /* Aureon */
 
200
  unsigned int m_ClockSource;   /* Aureon */
 
201
  unsigned int m_Out0Source;    /* Aureon */
 
202
 
 
203
  int mute;
 
204
  int reclevel;
 
205
  timeout_id_t timeout_id;      /* Juli@ */
 
206
 
 
207
  unsigned char syncstart_mask;
 
208
}
 
209
envy24ht_devc;
 
210
 
 
211
struct envy24ht_auxdrv
 
212
{
 
213
  void (*card_init) (envy24ht_devc * devc);
 
214
  int (*mixer_init) (envy24ht_devc * devc, int dev, int group);
 
215
  void (*set_rate) (envy24ht_devc * devc);
 
216
  int (*get_locked_status) (envy24ht_devc * devc);
 
217
  int (*spdif_mixer_init) (envy24ht_devc * devc, int dev, int group);
 
218
  int (*private1) (envy24ht_devc * devc, int value);
 
219
  int (*audio_ioctl) (envy24ht_devc * devc, envy24ht_portc * portc, unsigned int cmd,
 
220
                      ioctl_arg arg);
 
221
  void (*card_uninit) (envy24ht_devc * devc);
 
222
};
 
223
 
 
224
struct speed_sel
 
225
{
 
226
  int speed, speedbits;
 
227
};
 
228
 
 
229
void envy24ht_write_cci (envy24ht_devc * devc, int pos, int data);
 
230
int envy24ht_read_cci (envy24ht_devc * devc, int pos);