| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * | 
|  | 8 | *	Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> | 
|  | 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 |  | 
| Takashi Iwai | dc4cafb | 2005-11-17 14:19:28 +0100 | [diff] [blame] | 30 | struct snd_akm4xxx; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 |  | 
|  | 32 | struct snd_ak4xxx_ops { | 
| Takashi Iwai | dc4cafb | 2005-11-17 14:19:28 +0100 | [diff] [blame] | 33 | void (*lock)(struct snd_akm4xxx *ak, int chip); | 
|  | 34 | void (*unlock)(struct snd_akm4xxx *ak, int chip); | 
| Takashi Iwai | cb9d24e | 2006-06-27 17:49:12 +0200 | [diff] [blame] | 35 | void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, | 
|  | 36 | unsigned char val); | 
| Takashi Iwai | dc4cafb | 2005-11-17 14:19:28 +0100 | [diff] [blame] | 37 | void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | }; | 
|  | 39 |  | 
|  | 40 | #define AK4XXX_IMAGE_SIZE	(AK4XXX_MAX_CHIPS * 16)	/* 64 bytes */ | 
|  | 41 |  | 
| Takashi Iwai | 723b2b0 | 2006-08-30 16:49:54 +0200 | [diff] [blame] | 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 */ | 
| Takashi Iwai | 723b2b0 | 2006-08-30 16:49:54 +0200 | [diff] [blame] | 51 | char *switch_name;	/* capture switch */ | 
|  | 52 | unsigned int num_channels; | 
|  | 53 | }; | 
|  | 54 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | struct snd_akm4xxx { | 
| Takashi Iwai | dc4cafb | 2005-11-17 14:19:28 +0100 | [diff] [blame] | 56 | struct snd_card *card; | 
| Takashi Iwai | cb9d24e | 2006-06-27 17:49:12 +0200 | [diff] [blame] | 57 | unsigned int num_adcs;			/* AK4524 or AK4528 ADCs */ | 
|  | 58 | unsigned int num_dacs;			/* AK4524 or AK4528 DACs */ | 
|  | 59 | unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ | 
| Takashi Iwai | 723b2b0 | 2006-08-30 16:49:54 +0200 | [diff] [blame] | 60 | unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | unsigned long private_value[AK4XXX_MAX_CHIPS];	/* helper for driver */ | 
|  | 62 | void *private_data[AK4XXX_MAX_CHIPS];		/* helper for driver */ | 
|  | 63 | /* template should fill the following fields */ | 
| Takashi Iwai | cb9d24e | 2006-06-27 17:49:12 +0200 | [diff] [blame] | 64 | unsigned int idx_offset;		/* control index offset */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | enum { | 
|  | 66 | SND_AK4524, SND_AK4528, SND_AK4529, | 
| Jochen Voss | 683fe15 | 2006-08-08 21:12:44 +0200 | [diff] [blame] | 67 | SND_AK4355, SND_AK4358, SND_AK4381, | 
|  | 68 | SND_AK5365 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } type; | 
| Takashi Iwai | 723b2b0 | 2006-08-30 16:49:54 +0200 | [diff] [blame] | 70 |  | 
|  | 71 | /* (array) information of combined codecs */ | 
|  | 72 | struct snd_akm4xxx_dac_channel *dac_info; | 
|  | 73 | struct snd_akm4xxx_adc_channel *adc_info; | 
|  | 74 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | struct snd_ak4xxx_ops ops; | 
|  | 76 | }; | 
|  | 77 |  | 
| Takashi Iwai | cb9d24e | 2006-06-27 17:49:12 +0200 | [diff] [blame] | 78 | void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, | 
|  | 79 | unsigned char val); | 
| Takashi Iwai | dc4cafb | 2005-11-17 14:19:28 +0100 | [diff] [blame] | 80 | void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state); | 
|  | 81 | void snd_akm4xxx_init(struct snd_akm4xxx *ak); | 
|  | 82 | int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 |  | 
| Takashi Iwai | cb9d24e | 2006-06-27 17:49:12 +0200 | [diff] [blame] | 84 | #define snd_akm4xxx_get(ak,chip,reg) \ | 
|  | 85 | (ak)->images[(chip) * 16 + (reg)] | 
|  | 86 | #define snd_akm4xxx_set(ak,chip,reg,val) \ | 
|  | 87 | ((ak)->images[(chip) * 16 + (reg)] = (val)) | 
| Takashi Iwai | 723b2b0 | 2006-08-30 16:49:54 +0200 | [diff] [blame] | 88 | #define snd_akm4xxx_get_vol(ak,chip,reg) \ | 
|  | 89 | (ak)->volumes[(chip) * 16 + (reg)] | 
|  | 90 | #define snd_akm4xxx_set_vol(ak,chip,reg,val) \ | 
|  | 91 | ((ak)->volumes[(chip) * 16 + (reg)] = (val)) | 
|  | 92 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | #endif /* __SOUND_AK4XXX_ADDA_H */ |