]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __SOUND_AK4XXX_ADDA_H |
2 | #define __SOUND_AK4XXX_ADDA_H | |
3 | ||
4 | /* | |
5 | * ALSA driver for AK4524 / AK4528 / AK4529 / AK4355 / AK4381 | |
6 | * AD and DA converters | |
7 | * | |
c1017a4c | 8 | * Copyright (c) 2000 Jaroslav Kysela <[email protected]> |
1da177e4 LT |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 | * | |
24 | */ | |
25 | ||
26 | #ifndef AK4XXX_MAX_CHIPS | |
27 | #define AK4XXX_MAX_CHIPS 4 | |
28 | #endif | |
29 | ||
dc4cafba | 30 | struct snd_akm4xxx; |
1da177e4 LT |
31 | |
32 | struct snd_ak4xxx_ops { | |
dc4cafba TI |
33 | void (*lock)(struct snd_akm4xxx *ak, int chip); |
34 | void (*unlock)(struct snd_akm4xxx *ak, int chip); | |
cb9d24e4 TI |
35 | void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, |
36 | unsigned char val); | |
dc4cafba | 37 | void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate); |
1da177e4 LT |
38 | }; |
39 | ||
40 | #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ | |
41 | ||
723b2b0d TI |
42 | /* DAC label and channels */ |
43 | struct snd_akm4xxx_dac_channel { | |
44 | char *name; /* mixer volume name */ | |
45 | unsigned int num_channels; | |
ea7cfcdf | 46 | char *switch_name; /* mixer switch*/ |
723b2b0d TI |
47 | }; |
48 | ||
49 | /* ADC labels and channels */ | |
50 | struct snd_akm4xxx_adc_channel { | |
51 | char *name; /* capture gain volume label */ | |
723b2b0d TI |
52 | char *switch_name; /* capture switch */ |
53 | unsigned int num_channels; | |
a58e7cb1 JV |
54 | char *selector_name; /* capture source select label */ |
55 | const char **input_names; /* capture source names (NULL terminated) */ | |
723b2b0d TI |
56 | }; |
57 | ||
1da177e4 | 58 | struct snd_akm4xxx { |
dc4cafba | 59 | struct snd_card *card; |
cb9d24e4 TI |
60 | unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ |
61 | unsigned int num_dacs; /* AK4524 or AK4528 DACs */ | |
62 | unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ | |
723b2b0d | 63 | unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */ |
1da177e4 LT |
64 | unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ |
65 | void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ | |
66 | /* template should fill the following fields */ | |
cb9d24e4 | 67 | unsigned int idx_offset; /* control index offset */ |
1da177e4 LT |
68 | enum { |
69 | SND_AK4524, SND_AK4528, SND_AK4529, | |
683fe153 | 70 | SND_AK4355, SND_AK4358, SND_AK4381, |
8f34692f | 71 | SND_AK5365, SND_AK4620, |
1da177e4 | 72 | } type; |
723b2b0d TI |
73 | |
74 | /* (array) information of combined codecs */ | |
517400cb TI |
75 | const struct snd_akm4xxx_dac_channel *dac_info; |
76 | const struct snd_akm4xxx_adc_channel *adc_info; | |
723b2b0d | 77 | |
1da177e4 | 78 | struct snd_ak4xxx_ops ops; |
8f34692f PH |
79 | unsigned int num_chips; |
80 | unsigned int total_regs; | |
81 | const char *name; | |
1da177e4 LT |
82 | }; |
83 | ||
cb9d24e4 TI |
84 | void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, |
85 | unsigned char val); | |
dc4cafba TI |
86 | void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state); |
87 | void snd_akm4xxx_init(struct snd_akm4xxx *ak); | |
88 | int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak); | |
1da177e4 | 89 | |
cb9d24e4 TI |
90 | #define snd_akm4xxx_get(ak,chip,reg) \ |
91 | (ak)->images[(chip) * 16 + (reg)] | |
92 | #define snd_akm4xxx_set(ak,chip,reg,val) \ | |
93 | ((ak)->images[(chip) * 16 + (reg)] = (val)) | |
723b2b0d TI |
94 | #define snd_akm4xxx_get_vol(ak,chip,reg) \ |
95 | (ak)->volumes[(chip) * 16 + (reg)] | |
96 | #define snd_akm4xxx_set_vol(ak,chip,reg,val) \ | |
97 | ((ak)->volumes[(chip) * 16 + (reg)] = (val)) | |
98 | ||
1da177e4 | 99 | #endif /* __SOUND_AK4XXX_ADDA_H */ |