Blame view

include/sound/ak4xxx-adda.h 3.34 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
  #ifndef __SOUND_AK4XXX_ADDA_H
  #define __SOUND_AK4XXX_ADDA_H
  
  /*
   *   ALSA driver for AK4524 / AK4528 / AK4529 / AK4355 / AK4381
   *   AD and DA converters
   *
c1017a4cd   Jaroslav Kysela   [ALSA] Changed Ja...
8
   *	Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
   *
   *   This program is free software; you can redistribute it and/or modify
   *   it under the terms of the GNU General Public License as published by
   *   the Free Software Foundation; either version 2 of the License, or
   *   (at your option) any later version.
   *
   *   This program is distributed in the hope that it will be useful,
   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *   GNU General Public License for more details.
   *
   *   You should have received a copy of the GNU General Public License
   *   along with this program; if not, write to the Free Software
   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
   *
   */      
  
  #ifndef AK4XXX_MAX_CHIPS
  #define AK4XXX_MAX_CHIPS	4
  #endif
dc4cafbad   Takashi Iwai   [ALSA] Remove xxx...
29
  struct snd_akm4xxx;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
  
  struct snd_ak4xxx_ops {
dc4cafbad   Takashi Iwai   [ALSA] Remove xxx...
32
33
  	void (*lock)(struct snd_akm4xxx *ak, int chip);
  	void (*unlock)(struct snd_akm4xxx *ak, int chip);
cb9d24e43   Takashi Iwai   [ALSA] ak4xxx-add...
34
35
  	void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg,
  		      unsigned char val);
dc4cafbad   Takashi Iwai   [ALSA] Remove xxx...
36
  	void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
  };
  
  #define AK4XXX_IMAGE_SIZE	(AK4XXX_MAX_CHIPS * 16)	/* 64 bytes */
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
40
41
42
43
  /* DAC label and channels */
  struct snd_akm4xxx_dac_channel {
  	char *name;		/* mixer volume name */
  	unsigned int num_channels;
ea7cfcdfe   Pavel Hofman   [ALSA] ice1724 - ...
44
  	char *switch_name;		/* mixer switch*/
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
45
46
47
48
49
  };
  
  /* ADC labels and channels */
  struct snd_akm4xxx_adc_channel {
  	char *name;		/* capture gain volume label */
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
50
51
  	char *switch_name;	/* capture switch */
  	unsigned int num_channels;
a58e7cb16   Jochen Voss   [ALSA] Enable cap...
52
53
  	char *selector_name;	/* capture source select label */
  	const char **input_names; /* capture source names (NULL terminated) */
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
54
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
  struct snd_akm4xxx {
dc4cafbad   Takashi Iwai   [ALSA] Remove xxx...
56
  	struct snd_card *card;
cb9d24e43   Takashi Iwai   [ALSA] ak4xxx-add...
57
58
59
  	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 */
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
60
  	unsigned char volumes[AK4XXX_IMAGE_SIZE]; /* saved volume values */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
63
  	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 */
cb9d24e43   Takashi Iwai   [ALSA] ak4xxx-add...
64
  	unsigned int idx_offset;		/* control index offset */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
65
66
  	enum {
  		SND_AK4524, SND_AK4528, SND_AK4529,
683fe1537   Jochen Voss   [ALSA] Revolution...
67
  		SND_AK4355, SND_AK4358, SND_AK4381,
8f34692f6   Pavel Hofman   ALSA: ak4620 supp...
68
  		SND_AK5365, SND_AK4620,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
69
  	} type;
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
70
71
  
  	/* (array) information of combined codecs */
517400cbc   Takashi Iwai   [ALSA] Add some m...
72
73
  	const struct snd_akm4xxx_dac_channel *dac_info;
  	const struct snd_akm4xxx_adc_channel *adc_info;
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
74

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  	struct snd_ak4xxx_ops ops;
8f34692f6   Pavel Hofman   ALSA: ak4620 supp...
76
77
78
  	unsigned int num_chips;
  	unsigned int total_regs;
  	const char *name;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
79
  };
cb9d24e43   Takashi Iwai   [ALSA] ak4xxx-add...
80
81
  void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg,
  		       unsigned char val);
dc4cafbad   Takashi Iwai   [ALSA] Remove xxx...
82
83
84
  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);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
85

cb9d24e43   Takashi Iwai   [ALSA] ak4xxx-add...
86
87
88
89
  #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))
723b2b0d3   Takashi Iwai   [ALSA] Clean up a...
90
91
92
93
  #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))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
  #endif /* __SOUND_AK4XXX_ADDA_H */