1#ifndef __SOUND_AK4XXX_ADDA_H
2#define __SOUND_AK4XXX_ADDA_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef AK4XXX_MAX_CHIPS
27#define AK4XXX_MAX_CHIPS 4
28#endif
29
30struct snd_akm4xxx;
31
32struct snd_ak4xxx_ops {
33 void (*lock)(struct snd_akm4xxx *ak, int chip);
34 void (*unlock)(struct snd_akm4xxx *ak, int chip);
35 void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg,
36 unsigned char val);
37 void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
38};
39
40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16)
41
42
43struct snd_akm4xxx_dac_channel {
44 char *name;
45 unsigned int num_channels;
46 char *switch_name;
47};
48
49
50struct snd_akm4xxx_adc_channel {
51 char *name;
52 char *switch_name;
53 unsigned int num_channels;
54 char *selector_name;
55 const char **input_names;
56};
57
58struct snd_akm4xxx {
59 struct snd_card *card;
60 unsigned int num_adcs;
61 unsigned int num_dacs;
62 unsigned char images[AK4XXX_IMAGE_SIZE];
63 unsigned char volumes[AK4XXX_IMAGE_SIZE];
64 unsigned long private_value[AK4XXX_MAX_CHIPS];
65 void *private_data[AK4XXX_MAX_CHIPS];
66
67 unsigned int idx_offset;
68 enum {
69 SND_AK4524, SND_AK4528, SND_AK4529,
70 SND_AK4355, SND_AK4358, SND_AK4381,
71 SND_AK5365, SND_AK4620,
72 } type;
73
74
75 const struct snd_akm4xxx_dac_channel *dac_info;
76 const struct snd_akm4xxx_adc_channel *adc_info;
77
78 struct snd_ak4xxx_ops ops;
79 unsigned int num_chips;
80 unsigned int total_regs;
81 const char *name;
82};
83
84void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg,
85 unsigned char val);
86void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
87void snd_akm4xxx_init(struct snd_akm4xxx *ak);
88int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
89
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))
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
99#endif
100