diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-08-30 10:49:54 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-09-23 04:45:08 -0400 |
commit | 723b2b0d36fa7cea81a962af2d40d88520d5a5f1 (patch) | |
tree | 0020b109e0792aba552c99cff7b6576b81a5c2b6 /include/sound | |
parent | d0ae48471570c680333cbe28c143bbab887a4ec2 (diff) |
[ALSA] Clean up and add TLV support to AK4xxx i2c driver
- Clean up the code in AK4xxx-ADDA i2c code.
- Fix capture gain controls for AK5365
- Changed the static table for DAC/ADC mixer labels to use
structs
- Implemented TLV entries for each AK codec
The volumes in AK4524, AK4528 and AK5365 are corrected with
a table to be suitable for dB conversion.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/ak4xxx-adda.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h index 65ddfa3cac1f..026e4072a9a1 100644 --- a/include/sound/ak4xxx-adda.h +++ b/include/sound/ak4xxx-adda.h | |||
@@ -39,14 +39,26 @@ struct snd_ak4xxx_ops { | |||
39 | 39 | ||
40 | #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ | 40 | #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ |
41 | 41 | ||
42 | /* DAC label and channels */ | ||
43 | struct snd_akm4xxx_dac_channel { | ||
44 | char *name; /* mixer volume name */ | ||
45 | unsigned int num_channels; | ||
46 | }; | ||
47 | |||
48 | /* ADC labels and channels */ | ||
49 | struct snd_akm4xxx_adc_channel { | ||
50 | char *name; /* capture gain volume label */ | ||
51 | char *gain_name; /* IPGA */ | ||
52 | char *switch_name; /* capture switch */ | ||
53 | unsigned int num_channels; | ||
54 | }; | ||
55 | |||
42 | struct snd_akm4xxx { | 56 | struct snd_akm4xxx { |
43 | struct snd_card *card; | 57 | struct snd_card *card; |
44 | unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ | 58 | unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ |
45 | unsigned int num_dacs; /* AK4524 or AK4528 DACs */ | 59 | unsigned int num_dacs; /* AK4524 or AK4528 DACs */ |
46 | unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ | 60 | unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ |
47 | unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image | 61 | unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */ |
48 | * for IPGA (AK4528) | ||
49 | */ | ||
50 | unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ | 62 | unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ |
51 | void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ | 63 | void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ |
52 | /* template should fill the following fields */ | 64 | /* template should fill the following fields */ |
@@ -56,10 +68,11 @@ struct snd_akm4xxx { | |||
56 | SND_AK4355, SND_AK4358, SND_AK4381, | 68 | SND_AK4355, SND_AK4358, SND_AK4381, |
57 | SND_AK5365 | 69 | SND_AK5365 |
58 | } type; | 70 | } type; |
59 | unsigned int *num_stereo; /* array of combined counts | 71 | |
60 | * for the mixer | 72 | /* (array) information of combined codecs */ |
61 | */ | 73 | struct snd_akm4xxx_dac_channel *dac_info; |
62 | char **channel_names; /* array of mixer channel names */ | 74 | struct snd_akm4xxx_adc_channel *adc_info; |
75 | |||
63 | struct snd_ak4xxx_ops ops; | 76 | struct snd_ak4xxx_ops ops; |
64 | }; | 77 | }; |
65 | 78 | ||
@@ -73,9 +86,18 @@ int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak); | |||
73 | (ak)->images[(chip) * 16 + (reg)] | 86 | (ak)->images[(chip) * 16 + (reg)] |
74 | #define snd_akm4xxx_set(ak,chip,reg,val) \ | 87 | #define snd_akm4xxx_set(ak,chip,reg,val) \ |
75 | ((ak)->images[(chip) * 16 + (reg)] = (val)) | 88 | ((ak)->images[(chip) * 16 + (reg)] = (val)) |
89 | #define snd_akm4xxx_get_vol(ak,chip,reg) \ | ||
90 | (ak)->volumes[(chip) * 16 + (reg)] | ||
91 | #define snd_akm4xxx_set_vol(ak,chip,reg,val) \ | ||
92 | ((ak)->volumes[(chip) * 16 + (reg)] = (val)) | ||
93 | |||
94 | /* Warning: IPGA is tricky - we assume the addr + 4 is unused | ||
95 | * so far, it's OK for all AK codecs with IPGA: | ||
96 | * AK4524, AK4528 and EK5365 | ||
97 | */ | ||
76 | #define snd_akm4xxx_get_ipga(ak,chip,reg) \ | 98 | #define snd_akm4xxx_get_ipga(ak,chip,reg) \ |
77 | (ak)->ipga_gain[chip][(reg)-4] | 99 | snd_akm4xxx_get_vol(ak, chip, (reg) + 4) |
78 | #define snd_akm4xxx_set_ipga(ak,chip,reg,val) \ | 100 | #define snd_akm4xxx_set_ipga(ak,chip,reg,val) \ |
79 | ((ak)->ipga_gain[chip][(reg)-4] = (val)) | 101 | snd_akm4xxx_set_vol(ak, chip, (reg) + 4, val) |
80 | 102 | ||
81 | #endif /* __SOUND_AK4XXX_ADDA_H */ | 103 | #endif /* __SOUND_AK4XXX_ADDA_H */ |