summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-08-30 16:49:54 +0200
committerJaroslav Kysela <perex@suse.cz>2006-09-23 10:45:08 +0200
commit723b2b0d36fa7cea81a962af2d40d88520d5a5f1 (patch)
tree0020b109e0792aba552c99cff7b6576b81a5c2b6 /include
parentd0ae48471570c680333cbe28c143bbab887a4ec2 (diff)
downloadlinux-next-723b2b0d36fa7cea81a962af2d40d88520d5a5f1.tar.gz
[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')
-rw-r--r--include/sound/ak4xxx-adda.h40
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 {
#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
+/* DAC label and channels */
+struct snd_akm4xxx_dac_channel {
+ char *name; /* mixer volume name */
+ unsigned int num_channels;
+};
+
+/* ADC labels and channels */
+struct snd_akm4xxx_adc_channel {
+ char *name; /* capture gain volume label */
+ char *gain_name; /* IPGA */
+ char *switch_name; /* capture switch */
+ unsigned int num_channels;
+};
+
struct snd_akm4xxx {
struct snd_card *card;
unsigned int num_adcs; /* AK4524 or AK4528 ADCs */
unsigned int num_dacs; /* AK4524 or AK4528 DACs */
unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
- unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image
- * for IPGA (AK4528)
- */
+ unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */
unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */
void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */
/* template should fill the following fields */
@@ -56,10 +68,11 @@ struct snd_akm4xxx {
SND_AK4355, SND_AK4358, SND_AK4381,
SND_AK5365
} type;
- unsigned int *num_stereo; /* array of combined counts
- * for the mixer
- */
- char **channel_names; /* array of mixer channel names */
+
+ /* (array) information of combined codecs */
+ struct snd_akm4xxx_dac_channel *dac_info;
+ struct snd_akm4xxx_adc_channel *adc_info;
+
struct snd_ak4xxx_ops ops;
};
@@ -73,9 +86,18 @@ int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
(ak)->images[(chip) * 16 + (reg)]
#define snd_akm4xxx_set(ak,chip,reg,val) \
((ak)->images[(chip) * 16 + (reg)] = (val))
+#define snd_akm4xxx_get_vol(ak,chip,reg) \
+ (ak)->volumes[(chip) * 16 + (reg)]
+#define snd_akm4xxx_set_vol(ak,chip,reg,val) \
+ ((ak)->volumes[(chip) * 16 + (reg)] = (val))
+
+/* Warning: IPGA is tricky - we assume the addr + 4 is unused
+ * so far, it's OK for all AK codecs with IPGA:
+ * AK4524, AK4528 and EK5365
+ */
#define snd_akm4xxx_get_ipga(ak,chip,reg) \
- (ak)->ipga_gain[chip][(reg)-4]
+ snd_akm4xxx_get_vol(ak, chip, (reg) + 4)
#define snd_akm4xxx_set_ipga(ak,chip,reg,val) \
- ((ak)->ipga_gain[chip][(reg)-4] = (val))
+ snd_akm4xxx_set_vol(ak, chip, (reg) + 4, val)
#endif /* __SOUND_AK4XXX_ADDA_H */