2019-05-27 06:55:05 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-16 22:20:36 +00:00
|
|
|
#ifndef __SOUND_AK4XXX_ADDA_H
|
|
|
|
#define __SOUND_AK4XXX_ADDA_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ALSA driver for AK4524 / AK4528 / AK4529 / AK4355 / AK4381
|
|
|
|
* AD and DA converters
|
|
|
|
*
|
2007-10-15 07:50:19 +00:00
|
|
|
* Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AK4XXX_MAX_CHIPS
|
|
|
|
#define AK4XXX_MAX_CHIPS 4
|
|
|
|
#endif
|
|
|
|
|
2005-11-17 13:19:28 +00:00
|
|
|
struct snd_akm4xxx;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
struct snd_ak4xxx_ops {
|
2005-11-17 13:19:28 +00:00
|
|
|
void (*lock)(struct snd_akm4xxx *ak, int chip);
|
|
|
|
void (*unlock)(struct snd_akm4xxx *ak, int chip);
|
2006-06-27 15:49:12 +00:00
|
|
|
void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg,
|
|
|
|
unsigned char val);
|
2005-11-17 13:19:28 +00:00
|
|
|
void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
|
|
|
|
|
2006-08-30 14:49:54 +00:00
|
|
|
/* DAC label and channels */
|
|
|
|
struct snd_akm4xxx_dac_channel {
|
|
|
|
char *name; /* mixer volume name */
|
|
|
|
unsigned int num_channels;
|
2007-05-19 15:21:04 +00:00
|
|
|
char *switch_name; /* mixer switch*/
|
2006-08-30 14:49:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ADC labels and channels */
|
|
|
|
struct snd_akm4xxx_adc_channel {
|
|
|
|
char *name; /* capture gain volume label */
|
|
|
|
char *switch_name; /* capture switch */
|
|
|
|
unsigned int num_channels;
|
2006-10-04 16:04:10 +00:00
|
|
|
char *selector_name; /* capture source select label */
|
|
|
|
const char **input_names; /* capture source names (NULL terminated) */
|
2006-08-30 14:49:54 +00:00
|
|
|
};
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct snd_akm4xxx {
|
2005-11-17 13:19:28 +00:00
|
|
|
struct snd_card *card;
|
2006-06-27 15:49:12 +00:00
|
|
|
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 */
|
2006-08-30 14:49:54 +00:00
|
|
|
unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */
|
2005-04-16 22:20:36 +00:00
|
|
|
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 */
|
2006-06-27 15:49:12 +00:00
|
|
|
unsigned int idx_offset; /* control index offset */
|
2005-04-16 22:20:36 +00:00
|
|
|
enum {
|
|
|
|
SND_AK4524, SND_AK4528, SND_AK4529,
|
2006-08-08 19:12:44 +00:00
|
|
|
SND_AK4355, SND_AK4358, SND_AK4381,
|
2009-09-16 20:25:36 +00:00
|
|
|
SND_AK5365, SND_AK4620,
|
2005-04-16 22:20:36 +00:00
|
|
|
} type;
|
2006-08-30 14:49:54 +00:00
|
|
|
|
|
|
|
/* (array) information of combined codecs */
|
2007-01-29 14:27:56 +00:00
|
|
|
const struct snd_akm4xxx_dac_channel *dac_info;
|
|
|
|
const struct snd_akm4xxx_adc_channel *adc_info;
|
2006-08-30 14:49:54 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct snd_ak4xxx_ops ops;
|
2009-09-16 20:25:36 +00:00
|
|
|
unsigned int num_chips;
|
|
|
|
unsigned int total_regs;
|
|
|
|
const char *name;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2006-06-27 15:49:12 +00:00
|
|
|
void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg,
|
|
|
|
unsigned char val);
|
2005-11-17 13:19:28 +00:00
|
|
|
void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
|
|
|
|
void snd_akm4xxx_init(struct snd_akm4xxx *ak);
|
|
|
|
int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-06-27 15:49:12 +00:00
|
|
|
#define snd_akm4xxx_get(ak,chip,reg) \
|
|
|
|
(ak)->images[(chip) * 16 + (reg)]
|
|
|
|
#define snd_akm4xxx_set(ak,chip,reg,val) \
|
|
|
|
((ak)->images[(chip) * 16 + (reg)] = (val))
|
2006-08-30 14:49:54 +00:00
|
|
|
#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))
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* __SOUND_AK4XXX_ADDA_H */
|