aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorJames Bottomley <jejb@sparkweed.localdomain>2006-09-23 22:03:52 -0400
committerJames Bottomley <jejb@sparkweed.localdomain>2006-09-23 22:03:52 -0400
commit1aedf2ccc60fade26c46fae12e28664d0da3f199 (patch)
treed91083e3079f1ddb942a382ac2b5a7525570ad59 /include/sound
parentdfdc58ba354adb80d67c99f7be84f95a8e02e466 (diff)
parent1ab9dd0902df4f4ff56fbf672220549090ab28ba (diff)
Merge mulgrave-w:git/linux-2.6
Conflicts: include/linux/blkdev.h Trivial merge to incorporate tag prototypes.
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/ac97_codec.h32
-rw-r--r--include/sound/ad1848.h22
-rw-r--r--include/sound/ak4xxx-adda.h37
-rw-r--r--include/sound/asound.h19
-rw-r--r--include/sound/control.h13
-rw-r--r--include/sound/core.h10
-rw-r--r--include/sound/emu10k1.h4
-rw-r--r--include/sound/info.h7
-rw-r--r--include/sound/pcm.h4
-rw-r--r--include/sound/timer.h1
-rw-r--r--include/sound/tlv.h60
-rw-r--r--include/sound/vx_core.h1
12 files changed, 179 insertions, 31 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 758f8bf133c7..4c43521cc493 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -27,6 +27,7 @@
27 27
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h>
30#include "pcm.h" 31#include "pcm.h"
31#include "control.h" 32#include "control.h"
32#include "info.h" 33#include "info.h"
@@ -140,6 +141,20 @@
140#define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */ 141#define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */
141#define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */ 142#define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */
142 143
144/* powerdown bits */
145#define AC97_PD_ADC_STATUS 0x0001 /* ADC status (RO) */
146#define AC97_PD_DAC_STATUS 0x0002 /* DAC status (RO) */
147#define AC97_PD_MIXER_STATUS 0x0004 /* Analog mixer status (RO) */
148#define AC97_PD_VREF_STATUS 0x0008 /* Vref status (RO) */
149#define AC97_PD_PR0 0x0100 /* Power down PCM ADCs and input MUX */
150#define AC97_PD_PR1 0x0200 /* Power down PCM front DAC */
151#define AC97_PD_PR2 0x0400 /* Power down Mixer (Vref still on) */
152#define AC97_PD_PR3 0x0800 /* Power down Mixer (Vref off) */
153#define AC97_PD_PR4 0x1000 /* Power down AC-Link */
154#define AC97_PD_PR5 0x2000 /* Disable internal clock usage */
155#define AC97_PD_PR6 0x4000 /* Headphone amplifier */
156#define AC97_PD_EAPD 0x8000 /* External Amplifer Power Down (EAPD) */
157
143/* extended audio ID bit defines */ 158/* extended audio ID bit defines */
144#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */ 159#define AC97_EI_VRA 0x0001 /* Variable bit rate supported */
145#define AC97_EI_DRA 0x0002 /* Double rate supported */ 160#define AC97_EI_DRA 0x0002 /* Double rate supported */
@@ -359,6 +374,7 @@
359#define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */ 374#define AC97_SCAP_INV_EAPD (1<<7) /* inverted EAPD */
360#define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */ 375#define AC97_SCAP_DETECT_BY_VENDOR (1<<8) /* use vendor registers for read tests */
361#define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ 376#define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */
377#define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */
362 378
363/* ac97->flags */ 379/* ac97->flags */
364#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ 380#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */
@@ -491,6 +507,12 @@ struct snd_ac97 {
491 /* jack-sharing info */ 507 /* jack-sharing info */
492 unsigned char indep_surround; 508 unsigned char indep_surround;
493 unsigned char channel_mode; 509 unsigned char channel_mode;
510
511#ifdef CONFIG_SND_AC97_POWER_SAVE
512 unsigned int power_up; /* power states */
513 struct workqueue_struct *power_workq;
514 struct work_struct power_work;
515#endif
494 struct device dev; 516 struct device dev;
495}; 517};
496 518
@@ -532,6 +554,15 @@ unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
532void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 554void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
533int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value); 555int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
534int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value); 556int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value);
557#ifdef CONFIG_SND_AC97_POWER_SAVE
558int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup);
559#else
560static inline int snd_ac97_update_power(struct snd_ac97 *ac97, int reg,
561 int powerup)
562{
563 return 0;
564}
565#endif
535#ifdef CONFIG_PM 566#ifdef CONFIG_PM
536void snd_ac97_suspend(struct snd_ac97 *ac97); 567void snd_ac97_suspend(struct snd_ac97 *ac97);
537void snd_ac97_resume(struct snd_ac97 *ac97); 568void snd_ac97_resume(struct snd_ac97 *ac97);
@@ -583,6 +614,7 @@ struct ac97_pcm {
583 copy_flag: 1, /* lowlevel driver must fill all entries */ 614 copy_flag: 1, /* lowlevel driver must fill all entries */
584 spdif: 1; /* spdif pcm */ 615 spdif: 1; /* spdif pcm */
585 unsigned short aslots; /* active slots */ 616 unsigned short aslots; /* active slots */
617 unsigned short cur_dbl; /* current double-rate state */
586 unsigned int rates; /* available rates */ 618 unsigned int rates; /* available rates */
587 struct { 619 struct {
588 unsigned short slots; /* driver input: requested AC97 slot numbers */ 620 unsigned short slots; /* driver input: requested AC97 slot numbers */
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 57af1fe7b309..c8de6f83338f 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -179,14 +179,13 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ 179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) 180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
181 181
182int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value);
183
184/* for ease of use */ 182/* for ease of use */
185struct ad1848_mix_elem { 183struct ad1848_mix_elem {
186 const char *name; 184 const char *name;
187 int index; 185 int index;
188 int type; 186 int type;
189 unsigned long private_value; 187 unsigned long private_value;
188 unsigned int *tlv;
190}; 189};
191 190
192#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \ 191#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \
@@ -195,15 +194,26 @@ struct ad1848_mix_elem {
195 .type = AD1848_MIX_SINGLE, \ 194 .type = AD1848_MIX_SINGLE, \
196 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) } 195 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) }
197 196
197#define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
198{ .name = xname, \
199 .index = xindex, \
200 .type = AD1848_MIX_SINGLE, \
201 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \
202 .tlv = xtlv }
203
198#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 204#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
199{ .name = xname, \ 205{ .name = xname, \
200 .index = xindex, \ 206 .index = xindex, \
201 .type = AD1848_MIX_DOUBLE, \ 207 .type = AD1848_MIX_DOUBLE, \
202 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } 208 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
203 209
204static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c) 210#define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
205{ 211{ .name = xname, \
206 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); 212 .index = xindex, \
207} 213 .type = AD1848_MIX_DOUBLE, \
214 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
215 .tlv = xtlv }
216
217int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c);
208 218
209#endif /* __SOUND_AD1848_H */ 219#endif /* __SOUND_AD1848_H */
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index 3d9888492026..d0deca669b92 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -39,26 +39,39 @@ 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 */
43struct snd_akm4xxx_dac_channel {
44 char *name; /* mixer volume name */
45 unsigned int num_channels;
46};
47
48/* ADC labels and channels */
49struct snd_akm4xxx_adc_channel {
50 char *name; /* capture gain volume label */
51 char *switch_name; /* capture switch */
52 unsigned int num_channels;
53};
54
42struct snd_akm4xxx { 55struct snd_akm4xxx {
43 struct snd_card *card; 56 struct snd_card *card;
44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ 57 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */
45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */ 58 unsigned int num_dacs; /* AK4524 or AK4528 DACs */
46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ 59 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
47 unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image 60 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 */ 61 unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */
51 void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */ 62 void *private_data[AK4XXX_MAX_CHIPS]; /* helper for driver */
52 /* template should fill the following fields */ 63 /* template should fill the following fields */
53 unsigned int idx_offset; /* control index offset */ 64 unsigned int idx_offset; /* control index offset */
54 enum { 65 enum {
55 SND_AK4524, SND_AK4528, SND_AK4529, 66 SND_AK4524, SND_AK4528, SND_AK4529,
56 SND_AK4355, SND_AK4358, SND_AK4381 67 SND_AK4355, SND_AK4358, SND_AK4381,
68 SND_AK5365
57 } type; 69 } type;
58 unsigned int *num_stereo; /* array of combined counts 70
59 * for the mixer 71 /* (array) information of combined codecs */
60 */ 72 struct snd_akm4xxx_dac_channel *dac_info;
61 char **channel_names; /* array of mixer channel names */ 73 struct snd_akm4xxx_adc_channel *adc_info;
74
62 struct snd_ak4xxx_ops ops; 75 struct snd_ak4xxx_ops ops;
63}; 76};
64 77
@@ -72,9 +85,9 @@ int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
72 (ak)->images[(chip) * 16 + (reg)] 85 (ak)->images[(chip) * 16 + (reg)]
73#define snd_akm4xxx_set(ak,chip,reg,val) \ 86#define snd_akm4xxx_set(ak,chip,reg,val) \
74 ((ak)->images[(chip) * 16 + (reg)] = (val)) 87 ((ak)->images[(chip) * 16 + (reg)] = (val))
75#define snd_akm4xxx_get_ipga(ak,chip,reg) \ 88#define snd_akm4xxx_get_vol(ak,chip,reg) \
76 (ak)->ipga_gain[chip][(reg)-4] 89 (ak)->volumes[(chip) * 16 + (reg)]
77#define snd_akm4xxx_set_ipga(ak,chip,reg,val) \ 90#define snd_akm4xxx_set_vol(ak,chip,reg,val) \
78 ((ak)->ipga_gain[chip][(reg)-4] = (val)) 91 ((ak)->volumes[(chip) * 16 + (reg)] = (val))
79 92
80#endif /* __SOUND_AK4XXX_ADDA_H */ 93#endif /* __SOUND_AK4XXX_ADDA_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 41885f48ad91..c1621c650a9a 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -688,7 +688,7 @@ struct snd_timer_tread {
688 * * 688 * *
689 ****************************************************************************/ 689 ****************************************************************************/
690 690
691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
692 692
693struct snd_ctl_card_info { 693struct snd_ctl_card_info {
694 int card; /* card number */ 694 int card; /* card number */
@@ -727,10 +727,15 @@ typedef int __bitwise snd_ctl_elem_iface_t;
727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
728#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) 728#define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE)
729#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ 729#define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */
730#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<2) /* when was control changed */ 730#define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */
731#define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */
732#define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */
733#define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
734#define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */
731#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ 735#define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */
732#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ 736#define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */
733#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ 737#define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */
738#define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */
734#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ 739#define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */
735#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ 740#define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */
736#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ 741#define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */
@@ -818,6 +823,12 @@ struct snd_ctl_elem_value {
818 unsigned char reserved[128-sizeof(struct timespec)]; 823 unsigned char reserved[128-sizeof(struct timespec)];
819}; 824};
820 825
826struct snd_ctl_tlv {
827 unsigned int numid; /* control element numeric identification */
828 unsigned int length; /* in bytes aligned to 4 */
829 unsigned int tlv[0]; /* first TLV */
830};
831
821enum { 832enum {
822 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 833 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
823 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), 834 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
@@ -831,6 +842,9 @@ enum {
831 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), 842 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
832 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), 843 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
833 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), 844 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
845 SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv),
846 SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv),
847 SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv),
834 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 848 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
835 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), 849 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
836 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 850 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
@@ -855,6 +869,7 @@ enum sndrv_ctl_event_type {
855#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ 869#define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */
856#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ 870#define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */
857#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 871#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
872#define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */
858#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 873#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
859 874
860struct snd_ctl_event { 875struct snd_ctl_event {
diff --git a/include/sound/control.h b/include/sound/control.h
index 2489b1eb0110..1de148b0fd94 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -30,6 +30,11 @@ struct snd_kcontrol;
30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); 30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
33typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol,
34 int op_flag, /* 0=read,1=write,-1=command */
35 unsigned int size,
36 unsigned int __user *tlv);
37
33 38
34struct snd_kcontrol_new { 39struct snd_kcontrol_new {
35 snd_ctl_elem_iface_t iface; /* interface identifier */ 40 snd_ctl_elem_iface_t iface; /* interface identifier */
@@ -42,6 +47,10 @@ struct snd_kcontrol_new {
42 snd_kcontrol_info_t *info; 47 snd_kcontrol_info_t *info;
43 snd_kcontrol_get_t *get; 48 snd_kcontrol_get_t *get;
44 snd_kcontrol_put_t *put; 49 snd_kcontrol_put_t *put;
50 union {
51 snd_kcontrol_tlv_rw_t *c;
52 unsigned int *p;
53 } tlv;
45 unsigned long private_value; 54 unsigned long private_value;
46}; 55};
47 56
@@ -58,6 +67,10 @@ struct snd_kcontrol {
58 snd_kcontrol_info_t *info; 67 snd_kcontrol_info_t *info;
59 snd_kcontrol_get_t *get; 68 snd_kcontrol_get_t *get;
60 snd_kcontrol_put_t *put; 69 snd_kcontrol_put_t *put;
70 union {
71 snd_kcontrol_tlv_rw_t *c;
72 unsigned int *p;
73 } tlv;
61 unsigned long private_value; 74 unsigned long private_value;
62 void *private_data; 75 void *private_data;
63 void (*private_free)(struct snd_kcontrol *kcontrol); 76 void (*private_free)(struct snd_kcontrol *kcontrol);
diff --git a/include/sound/core.h b/include/sound/core.h
index bab3ff457e40..b056ea925ecf 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -25,8 +25,8 @@
25#include <linux/sched.h> /* wake_up() */ 25#include <linux/sched.h> /* wake_up() */
26#include <linux/mutex.h> /* struct mutex */ 26#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/workqueue.h> /* struct workqueue_struct */
29#include <linux/pm.h> /* pm_message_t */ 28#include <linux/pm.h> /* pm_message_t */
29#include <linux/device.h>
30 30
31/* forward declarations */ 31/* forward declarations */
32#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
@@ -71,7 +71,6 @@ struct snd_device_ops {
71 int (*dev_free)(struct snd_device *dev); 71 int (*dev_free)(struct snd_device *dev);
72 int (*dev_register)(struct snd_device *dev); 72 int (*dev_register)(struct snd_device *dev);
73 int (*dev_disconnect)(struct snd_device *dev); 73 int (*dev_disconnect)(struct snd_device *dev);
74 int (*dev_unregister)(struct snd_device *dev);
75}; 74};
76 75
77struct snd_device { 76struct snd_device {
@@ -131,8 +130,8 @@ struct snd_card {
131 state */ 130 state */
132 spinlock_t files_lock; /* lock the files for this card */ 131 spinlock_t files_lock; /* lock the files for this card */
133 int shutdown; /* this card is going down */ 132 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct work_struct free_workq; /* for free in workqueue */
136 struct device *dev; 135 struct device *dev;
137 136
138#ifdef CONFIG_PM 137#ifdef CONFIG_PM
@@ -188,6 +187,7 @@ struct snd_minor {
188 int device; /* device number */ 187 int device; /* device number */
189 const struct file_operations *f_ops; /* file operations */ 188 const struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */ 189 void *private_data; /* private data for f_ops->open */
190 struct class_device *class_dev; /* class device for sysfs */
191}; 191};
192 192
193/* sound.c */ 193/* sound.c */
@@ -202,6 +202,8 @@ int snd_register_device(int type, struct snd_card *card, int dev,
202 const char *name); 202 const char *name);
203int snd_unregister_device(int type, struct snd_card *card, int dev); 203int snd_unregister_device(int type, struct snd_card *card, int dev);
204void *snd_lookup_minor_data(unsigned int minor, int type); 204void *snd_lookup_minor_data(unsigned int minor, int type);
205int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
206 const struct class_device_attribute *attr);
205 207
206#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
207int snd_register_oss_device(int type, struct snd_card *card, int dev, 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
@@ -244,7 +246,7 @@ struct snd_card *snd_card_new(int idx, const char *id,
244 struct module *module, int extra_size); 246 struct module *module, int extra_size);
245int snd_card_disconnect(struct snd_card *card); 247int snd_card_disconnect(struct snd_card *card);
246int snd_card_free(struct snd_card *card); 248int snd_card_free(struct snd_card *card);
247int snd_card_free_in_thread(struct snd_card *card); 249int snd_card_free_when_closed(struct snd_card *card);
248int snd_card_register(struct snd_card *card); 250int snd_card_register(struct snd_card *card);
249int snd_card_info_init(void); 251int snd_card_info_init(void);
250int snd_card_info_done(void); 252int snd_card_info_done(void);
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 884bbf54cd36..892e310c504d 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1524,6 +1524,10 @@ struct snd_emu10k1_fx8010_control_gpr {
1524 unsigned int value[32]; /* initial values */ 1524 unsigned int value[32]; /* initial values */
1525 unsigned int min; /* minimum range */ 1525 unsigned int min; /* minimum range */
1526 unsigned int max; /* maximum range */ 1526 unsigned int max; /* maximum range */
1527 union {
1528 snd_kcontrol_tlv_rw_t *c;
1529 unsigned int *p;
1530 } tlv;
1527 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1531 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1528}; 1532};
1529 1533
diff --git a/include/sound/info.h b/include/sound/info.h
index 74f6996769c7..97ffc4fb9969 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -71,7 +71,6 @@ struct snd_info_entry {
71 mode_t mode; 71 mode_t mode;
72 long size; 72 long size;
73 unsigned short content; 73 unsigned short content;
74 unsigned short disconnected: 1;
75 union { 74 union {
76 struct snd_info_entry_text text; 75 struct snd_info_entry_text text;
77 struct snd_info_entry_ops *ops; 76 struct snd_info_entry_ops *ops;
@@ -83,6 +82,8 @@ struct snd_info_entry {
83 void (*private_free)(struct snd_info_entry *entry); 82 void (*private_free)(struct snd_info_entry *entry);
84 struct proc_dir_entry *p; 83 struct proc_dir_entry *p;
85 struct mutex access; 84 struct mutex access;
85 struct list_head children;
86 struct list_head list;
86}; 87};
87 88
88#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 89#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
@@ -122,8 +123,8 @@ int snd_info_restore_text(struct snd_info_entry * entry);
122int snd_info_card_create(struct snd_card * card); 123int snd_info_card_create(struct snd_card * card);
123int snd_info_card_register(struct snd_card * card); 124int snd_info_card_register(struct snd_card * card);
124int snd_info_card_free(struct snd_card * card); 125int snd_info_card_free(struct snd_card * card);
126void snd_info_card_disconnect(struct snd_card * card);
125int snd_info_register(struct snd_info_entry * entry); 127int snd_info_register(struct snd_info_entry * entry);
126int snd_info_unregister(struct snd_info_entry * entry);
127 128
128/* for card drivers */ 129/* for card drivers */
129int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp); 130int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
@@ -156,8 +157,8 @@ static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
156static inline int snd_info_card_create(struct snd_card * card) { return 0; } 157static inline int snd_info_card_create(struct snd_card * card) { return 0; }
157static inline int snd_info_card_register(struct snd_card * card) { return 0; } 158static inline int snd_info_card_register(struct snd_card * card) { return 0; }
158static inline int snd_info_card_free(struct snd_card * card) { return 0; } 159static inline int snd_info_card_free(struct snd_card * card) { return 0; }
160static inline void snd_info_card_disconnect(struct snd_card * card) { }
159static inline int snd_info_register(struct snd_info_entry * entry) { return 0; } 161static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
160static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
161 162
162static inline int snd_card_proc_new(struct snd_card *card, const char *name, 163static inline int snd_card_proc_new(struct snd_card *card, const char *name,
163 struct snd_info_entry **entryp) { return -EINVAL; } 164 struct snd_info_entry **entryp) { return -EINVAL; }
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index f84d84993a31..60d40b34efc0 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -190,7 +190,7 @@ struct snd_pcm_ops {
190 190
191struct snd_pcm_file { 191struct snd_pcm_file {
192 struct snd_pcm_substream *substream; 192 struct snd_pcm_substream *substream;
193 struct snd_pcm_file *next; 193 int no_compat_mmap;
194}; 194};
195 195
196struct snd_pcm_hw_rule; 196struct snd_pcm_hw_rule;
@@ -384,7 +384,6 @@ struct snd_pcm_substream {
384 struct snd_info_entry *proc_prealloc_entry; 384 struct snd_info_entry *proc_prealloc_entry;
385#endif 385#endif
386 /* misc flags */ 386 /* misc flags */
387 unsigned int no_mmap_ctrl: 1;
388 unsigned int hw_opened: 1; 387 unsigned int hw_opened: 1;
389}; 388};
390 389
@@ -402,7 +401,6 @@ struct snd_pcm_str {
402 /* -- OSS things -- */ 401 /* -- OSS things -- */
403 struct snd_pcm_oss_stream oss; 402 struct snd_pcm_oss_stream oss;
404#endif 403#endif
405 struct snd_pcm_file *files;
406#ifdef CONFIG_SND_VERBOSE_PROCFS 404#ifdef CONFIG_SND_VERBOSE_PROCFS
407 struct snd_info_entry *proc_root; 405 struct snd_info_entry *proc_root;
408 struct snd_info_entry *proc_info_entry; 406 struct snd_info_entry *proc_info_entry;
diff --git a/include/sound/timer.h b/include/sound/timer.h
index 5ece2bf541dc..d42c083db1da 100644
--- a/include/sound/timer.h
+++ b/include/sound/timer.h
@@ -129,7 +129,6 @@ void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstam
129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); 129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer);
130int snd_timer_global_free(struct snd_timer *timer); 130int snd_timer_global_free(struct snd_timer *timer);
131int snd_timer_global_register(struct snd_timer *timer); 131int snd_timer_global_register(struct snd_timer *timer);
132int snd_timer_global_unregister(struct snd_timer *timer);
133 132
134int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); 133int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id);
135int snd_timer_close(struct snd_timer_instance *timeri); 134int snd_timer_close(struct snd_timer_instance *timeri);
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
new file mode 100644
index 000000000000..d93a96b91875
--- /dev/null
+++ b/include/sound/tlv.h
@@ -0,0 +1,60 @@
1#ifndef __SOUND_TLV_H
2#define __SOUND_TLV_H
3
4/*
5 * Advanced Linux Sound Architecture - ALSA - Driver
6 * Copyright (c) 2006 by Jaroslav Kysela <perex@suse.cz>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25/*
26 * TLV structure is right behind the struct snd_ctl_tlv:
27 * unsigned int type - see SNDRV_CTL_TLVT_*
28 * unsigned int length
29 * .... data aligned to sizeof(unsigned int), use
30 * block_length = (length + (sizeof(unsigned int) - 1)) &
31 * ~(sizeof(unsigned int) - 1)) ....
32 */
33
34#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
36#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
37#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
38
39#define TLV_DB_SCALE_ITEM(min, step, mute) \
40 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
41 (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0)
42#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
43 unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) }
44
45/* linear volume between min_dB and max_dB (.01dB unit) */
46#define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \
47 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \
48 (min_dB), (max_dB)
49#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \
50 unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) }
51
52/* dB range container */
53/* Each item is: <min> <max> <TLV> */
54/* The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR */
55#define TLV_DB_RANGE_HEAD(num) \
56 SNDRV_CTL_TLVT_DB_RANGE, 6 * (num) * sizeof(unsigned int)
57
58#define TLV_DB_GAIN_MUTE -9999999
59
60#endif /* __SOUND_TLV_H */
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 9821a6194caa..dbca14170615 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -128,6 +128,7 @@ struct snd_vx_hardware {
128 unsigned int num_ins; 128 unsigned int num_ins;
129 unsigned int num_outs; 129 unsigned int num_outs;
130 unsigned int output_level_max; 130 unsigned int output_level_max;
131 unsigned int *output_level_db_scale;
131}; 132};
132 133
133/* hwdep id string */ 134/* hwdep id string */