Loading include/sound/hdaudio_ext.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -88,6 +88,8 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream, struct snd_pcm_substream *substream, int type); int type); void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type); void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type); void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus, struct hdac_ext_stream *azx_dev, bool decouple); void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, struct hdac_ext_stream *azx_dev, bool decouple); struct hdac_ext_stream *azx_dev, bool decouple); void snd_hdac_ext_stop_streams(struct hdac_bus *bus); void snd_hdac_ext_stop_streams(struct hdac_bus *bus); Loading include/sound/memalloc.h +47 −11 Original line number Original line Diff line number Diff line Loading @@ -9,16 +9,20 @@ #ifndef __SOUND_MEMALLOC_H #ifndef __SOUND_MEMALLOC_H #define __SOUND_MEMALLOC_H #define __SOUND_MEMALLOC_H #include <linux/dma-direction.h> #include <asm/page.h> #include <asm/page.h> struct device; struct device; struct vm_area_struct; struct vm_area_struct; struct sg_table; /* /* * buffer device info * buffer device info */ */ struct snd_dma_device { struct snd_dma_device { int type; /* SNDRV_DMA_TYPE_XXX */ int type; /* SNDRV_DMA_TYPE_XXX */ enum dma_data_direction dir; /* DMA direction */ bool need_sync; /* explicit sync needed? */ struct device *dev; /* generic device */ struct device *dev; /* generic device */ }; }; Loading @@ -32,19 +36,21 @@ struct snd_dma_device { #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ #define SNDRV_DMA_TYPE_DEV_WC 5 /* continuous write-combined */ #define SNDRV_DMA_TYPE_DEV_WC 5 /* continuous write-combined */ #ifdef CONFIG_SND_DMA_SGBUF #define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ #define SNDRV_DMA_TYPE_DEV_WC_SG 6 /* SG write-combined */ #else #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ #define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC #endif #ifdef CONFIG_GENERIC_ALLOCATOR #ifdef CONFIG_GENERIC_ALLOCATOR #define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */ #define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */ #else #else #define SNDRV_DMA_TYPE_DEV_IRAM SNDRV_DMA_TYPE_DEV #define SNDRV_DMA_TYPE_DEV_IRAM SNDRV_DMA_TYPE_DEV #endif #endif #define SNDRV_DMA_TYPE_VMALLOC 7 /* vmalloc'ed buffer */ #define SNDRV_DMA_TYPE_VMALLOC 7 /* vmalloc'ed buffer */ #define SNDRV_DMA_TYPE_NONCONTIG 8 /* non-coherent SG buffer */ #define SNDRV_DMA_TYPE_NONCOHERENT 9 /* non-coherent buffer */ #ifdef CONFIG_SND_DMA_SGBUF #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_NONCONTIG #define SNDRV_DMA_TYPE_DEV_WC_SG 6 /* SG write-combined */ #else #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ #define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC #endif /* /* * info for buffer allocation * info for buffer allocation Loading @@ -66,22 +72,52 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size) } } /* allocate/release a buffer */ /* allocate/release a buffer */ int snd_dma_alloc_pages(int type, struct device *dev, size_t size, int snd_dma_alloc_dir_pages(int type, struct device *dev, enum dma_data_direction dir, size_t size, struct snd_dma_buffer *dmab); struct snd_dma_buffer *dmab); static inline int snd_dma_alloc_pages(int type, struct device *dev, size_t size, struct snd_dma_buffer *dmab) { return snd_dma_alloc_dir_pages(type, dev, DMA_BIDIRECTIONAL, size, dmab); } int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size, int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size, struct snd_dma_buffer *dmab); struct snd_dma_buffer *dmab); void snd_dma_free_pages(struct snd_dma_buffer *dmab); void snd_dma_free_pages(struct snd_dma_buffer *dmab); int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab, int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab, struct vm_area_struct *area); struct vm_area_struct *area); enum snd_dma_sync_mode { SNDRV_DMA_SYNC_CPU, SNDRV_DMA_SYNC_DEVICE }; #ifdef CONFIG_HAS_DMA void snd_dma_buffer_sync(struct snd_dma_buffer *dmab, enum snd_dma_sync_mode mode); #else static inline void snd_dma_buffer_sync(struct snd_dma_buffer *dmab, enum snd_dma_sync_mode mode) {} #endif dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset); dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset); struct page *snd_sgbuf_get_page(struct snd_dma_buffer *dmab, size_t offset); struct page *snd_sgbuf_get_page(struct snd_dma_buffer *dmab, size_t offset); unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, unsigned int ofs, unsigned int size); unsigned int ofs, unsigned int size); /* device-managed memory allocator */ /* device-managed memory allocator */ struct snd_dma_buffer *snd_devm_alloc_pages(struct device *dev, int type, struct snd_dma_buffer *snd_devm_alloc_dir_pages(struct device *dev, int type, enum dma_data_direction dir, size_t size); size_t size); static inline struct snd_dma_buffer * snd_devm_alloc_pages(struct device *dev, int type, size_t size) { return snd_devm_alloc_dir_pages(dev, type, DMA_BIDIRECTIONAL, size); } static inline struct sg_table * snd_dma_noncontig_sg_table(struct snd_dma_buffer *dmab) { return dmab->private_data; } #endif /* __SOUND_MEMALLOC_H */ #endif /* __SOUND_MEMALLOC_H */ include/uapi/sound/asound.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1002,7 +1002,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ // (1 << 3) is unused. /* (1 << 3) is unused. */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) Loading include/uapi/sound/firewire.h +150 −0 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479 #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479 #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d #define SNDRV_FIREWIRE_EVENT_MOTU_REGISTER_DSP_CHANGE 0x4d545244 struct snd_firewire_event_common { struct snd_firewire_event_common { unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ Loading Loading @@ -65,6 +66,12 @@ struct snd_firewire_event_tascam_control { struct snd_firewire_tascam_change changes[0]; struct snd_firewire_tascam_change changes[0]; }; }; struct snd_firewire_event_motu_register_dsp_change { unsigned int type; __u32 count; /* The number of changes. */ __u32 changes[]; /* Encoded event for change of register DSP. */ }; union snd_firewire_event { union snd_firewire_event { struct snd_firewire_event_common common; struct snd_firewire_event_common common; struct snd_firewire_event_lock_status lock_status; struct snd_firewire_event_lock_status lock_status; Loading @@ -73,6 +80,7 @@ union snd_firewire_event { struct snd_firewire_event_digi00x_message digi00x_message; struct snd_firewire_event_digi00x_message digi00x_message; struct snd_firewire_event_tascam_control tascam_control; struct snd_firewire_event_tascam_control tascam_control; struct snd_firewire_event_motu_notification motu_notification; struct snd_firewire_event_motu_notification motu_notification; struct snd_firewire_event_motu_register_dsp_change motu_register_dsp_change; }; }; Loading @@ -80,6 +88,9 @@ union snd_firewire_event { #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state) #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state) #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_METER _IOR('H', 0xfc, struct snd_firewire_motu_register_dsp_meter) #define SNDRV_FIREWIRE_IOCTL_MOTU_COMMAND_DSP_METER _IOR('H', 0xfd, struct snd_firewire_motu_command_dsp_meter) #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_PARAMETER _IOR('H', 0xfe, struct snd_firewire_motu_register_dsp_parameter) #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 Loading Loading @@ -108,4 +119,143 @@ struct snd_firewire_tascam_state { __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; }; }; /* * In below MOTU models, software is allowed to control their DSP by accessing to registers. * - 828mk2 * - 896hd * - Traveler * - 8 pre * - Ultralite * - 4 pre * - Audio Express * * On the other hand, the status of DSP is split into specific messages included in the sequence of * isochronous packet. ALSA firewire-motu driver gathers the messages and allow userspace applications * to read it via ioctl. In 828mk2, 896hd, and Traveler, hardware meter for all of physical inputs * are put into the message, while one pair of physical outputs is selected. The selection is done by * LSB one byte in asynchronous write quadlet transaction to 0x'ffff'f000'0b2c. * * I note that V3HD/V4HD uses asynchronous transaction for the purpose. The destination address is * registered to 0x'ffff'f000'0b38 and '0b3c by asynchronous write quadlet request. The size of * message differs between 23 and 51 quadlets. For the case, the number of mixer bus can be extended * up to 12. */ #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT 24 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT 24 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT \ (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT + SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT) /** * struct snd_firewire_motu_register_dsp_meter - the container for meter information in DSP * controlled by register access * @data: Signal level meters. The mapping between position and input/output channel is * model-dependent. * * The structure expresses the part of DSP status for hardware meter. The u8 storage includes linear * value for audio signal level between 0x00 and 0x7f. */ struct snd_firewire_motu_register_dsp_meter { __u8 data[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT]; }; #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT 4 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT 20 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT 10 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT + 2) /** * snd_firewire_motu_register_dsp_parameter - the container for parameters of DSP controlled * by register access. * @mixer.source.gain: The gain of source to mixer. * @mixer.source.pan: The L/R balance of source to mixer. * @mixer.source.flag: The flag of source to mixer, including mute, solo. * @mixer.source.paired_balance: The L/R balance of paired source to mixer, only for 4 pre and * Audio Express. * @mixer.source.paired_width: The width of paired source to mixer, only for 4 pre and * Audio Express. * @mixer.output.paired_volume: The volume of paired output from mixer. * @mixer.output.paired_flag: The flag of paired output from mixer. * @output.main_paired_volume: The volume of paired main output. * @output.hp_paired_volume: The volume of paired hp output. * @output.hp_paired_assignment: The source assigned to paired hp output. * @output.reserved: Padding for 32 bit alignment for future extension. * @line_input.boost_flag: The flags of boost for line inputs, only for 828mk2 and Traveler. * @line_input.nominal_level_flag: The flags of nominal level for line inputs, only for 828mk2 and * Traveler. * @line_input.reserved: Padding for 32 bit alignment for future extension. * @input.gain_and_invert: The value including gain and invert for input, only for Ultralite, 4 pre * and Audio Express. * @input.flag: The flag of input; e.g. jack detection, phantom power, and pad, only for Ultralite, * 4 pre and Audio express. * @reserved: Padding so that the size of structure is kept to 512 byte, but for future extension. * * The structure expresses the set of parameters for DSP controlled by register access. */ struct snd_firewire_motu_register_dsp_parameter { struct { struct { __u8 gain[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 pan[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 paired_balance[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 paired_width[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; } source[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; struct { __u8 paired_volume[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; __u8 paired_flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; } output; } mixer; struct { __u8 main_paired_volume; __u8 hp_paired_volume; __u8 hp_paired_assignment; __u8 reserved[5]; } output; struct { __u8 boost_flag; __u8 nominal_level_flag; __u8 reserved[6]; } line_input; struct { __u8 gain_and_invert[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT]; __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT]; } input; __u8 reserved[64]; }; /* * In below MOTU models, software is allowed to control their DSP by command in frame of * asynchronous transaction to 0x'ffff'0001'0000: * * - 828 mk3 (FireWire only and Hybrid) * - 896 mk3 (FireWire only and Hybrid) * - Ultralite mk3 (FireWire only and Hybrid) * - Traveler mk3 * - Track 16 * * On the other hand, the states of hardware meter is split into specific messages included in the * sequence of isochronous packet. ALSA firewire-motu driver gathers the message and allow userspace * application to read it via ioctl. */ #define SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT 400 /** * struct snd_firewire_motu_command_dsp_meter - the container for meter information in DSP * controlled by command * @data: Signal level meters. The mapping between position and signal channel is model-dependent. * * The structure expresses the part of DSP status for hardware meter. The 32 bit storage is * estimated to include IEEE 764 32 bit single precision floating point (binary32) value. It is * expected to be linear value (not logarithm) for audio signal level between 0.0 and +1.0. */ struct snd_firewire_motu_command_dsp_meter { #ifdef __KERNEL__ __u32 data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; #else float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; #endif }; #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */ #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */ sound/core/Makefile +2 −1 Original line number Original line Diff line number Diff line Loading @@ -9,7 +9,9 @@ ifneq ($(CONFIG_SND_PROC_FS),) snd-y += info.o snd-y += info.o snd-$(CONFIG_SND_OSSEMUL) += info_oss.o snd-$(CONFIG_SND_OSSEMUL) += info_oss.o endif endif ifneq ($(CONFIG_M68K),y) snd-$(CONFIG_ISA_DMA_API) += isadma.o snd-$(CONFIG_ISA_DMA_API) += isadma.o endif snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o snd-$(CONFIG_SND_VMASTER) += vmaster.o snd-$(CONFIG_SND_VMASTER) += vmaster.o snd-$(CONFIG_SND_JACK) += ctljack.o jack.o snd-$(CONFIG_SND_JACK) += ctljack.o jack.o Loading @@ -17,7 +19,6 @@ snd-$(CONFIG_SND_JACK) += ctljack.o jack.o snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_misc.o \ snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_misc.o \ pcm_memory.o memalloc.o pcm_memory.o memalloc.o snd-pcm-$(CONFIG_SND_PCM_TIMER) += pcm_timer.o snd-pcm-$(CONFIG_SND_PCM_TIMER) += pcm_timer.o snd-pcm-$(CONFIG_SND_DMA_SGBUF) += sgbuf.o snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o Loading Loading
include/sound/hdaudio_ext.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -88,6 +88,8 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, struct snd_pcm_substream *substream, struct snd_pcm_substream *substream, int type); int type); void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type); void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type); void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus, struct hdac_ext_stream *azx_dev, bool decouple); void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, struct hdac_ext_stream *azx_dev, bool decouple); struct hdac_ext_stream *azx_dev, bool decouple); void snd_hdac_ext_stop_streams(struct hdac_bus *bus); void snd_hdac_ext_stop_streams(struct hdac_bus *bus); Loading
include/sound/memalloc.h +47 −11 Original line number Original line Diff line number Diff line Loading @@ -9,16 +9,20 @@ #ifndef __SOUND_MEMALLOC_H #ifndef __SOUND_MEMALLOC_H #define __SOUND_MEMALLOC_H #define __SOUND_MEMALLOC_H #include <linux/dma-direction.h> #include <asm/page.h> #include <asm/page.h> struct device; struct device; struct vm_area_struct; struct vm_area_struct; struct sg_table; /* /* * buffer device info * buffer device info */ */ struct snd_dma_device { struct snd_dma_device { int type; /* SNDRV_DMA_TYPE_XXX */ int type; /* SNDRV_DMA_TYPE_XXX */ enum dma_data_direction dir; /* DMA direction */ bool need_sync; /* explicit sync needed? */ struct device *dev; /* generic device */ struct device *dev; /* generic device */ }; }; Loading @@ -32,19 +36,21 @@ struct snd_dma_device { #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ #define SNDRV_DMA_TYPE_DEV_WC 5 /* continuous write-combined */ #define SNDRV_DMA_TYPE_DEV_WC 5 /* continuous write-combined */ #ifdef CONFIG_SND_DMA_SGBUF #define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ #define SNDRV_DMA_TYPE_DEV_WC_SG 6 /* SG write-combined */ #else #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ #define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC #endif #ifdef CONFIG_GENERIC_ALLOCATOR #ifdef CONFIG_GENERIC_ALLOCATOR #define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */ #define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */ #else #else #define SNDRV_DMA_TYPE_DEV_IRAM SNDRV_DMA_TYPE_DEV #define SNDRV_DMA_TYPE_DEV_IRAM SNDRV_DMA_TYPE_DEV #endif #endif #define SNDRV_DMA_TYPE_VMALLOC 7 /* vmalloc'ed buffer */ #define SNDRV_DMA_TYPE_VMALLOC 7 /* vmalloc'ed buffer */ #define SNDRV_DMA_TYPE_NONCONTIG 8 /* non-coherent SG buffer */ #define SNDRV_DMA_TYPE_NONCOHERENT 9 /* non-coherent buffer */ #ifdef CONFIG_SND_DMA_SGBUF #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_NONCONTIG #define SNDRV_DMA_TYPE_DEV_WC_SG 6 /* SG write-combined */ #else #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ #define SNDRV_DMA_TYPE_DEV_WC_SG SNDRV_DMA_TYPE_DEV_WC #endif /* /* * info for buffer allocation * info for buffer allocation Loading @@ -66,22 +72,52 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size) } } /* allocate/release a buffer */ /* allocate/release a buffer */ int snd_dma_alloc_pages(int type, struct device *dev, size_t size, int snd_dma_alloc_dir_pages(int type, struct device *dev, enum dma_data_direction dir, size_t size, struct snd_dma_buffer *dmab); struct snd_dma_buffer *dmab); static inline int snd_dma_alloc_pages(int type, struct device *dev, size_t size, struct snd_dma_buffer *dmab) { return snd_dma_alloc_dir_pages(type, dev, DMA_BIDIRECTIONAL, size, dmab); } int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size, int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size, struct snd_dma_buffer *dmab); struct snd_dma_buffer *dmab); void snd_dma_free_pages(struct snd_dma_buffer *dmab); void snd_dma_free_pages(struct snd_dma_buffer *dmab); int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab, int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab, struct vm_area_struct *area); struct vm_area_struct *area); enum snd_dma_sync_mode { SNDRV_DMA_SYNC_CPU, SNDRV_DMA_SYNC_DEVICE }; #ifdef CONFIG_HAS_DMA void snd_dma_buffer_sync(struct snd_dma_buffer *dmab, enum snd_dma_sync_mode mode); #else static inline void snd_dma_buffer_sync(struct snd_dma_buffer *dmab, enum snd_dma_sync_mode mode) {} #endif dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset); dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset); struct page *snd_sgbuf_get_page(struct snd_dma_buffer *dmab, size_t offset); struct page *snd_sgbuf_get_page(struct snd_dma_buffer *dmab, size_t offset); unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, unsigned int ofs, unsigned int size); unsigned int ofs, unsigned int size); /* device-managed memory allocator */ /* device-managed memory allocator */ struct snd_dma_buffer *snd_devm_alloc_pages(struct device *dev, int type, struct snd_dma_buffer *snd_devm_alloc_dir_pages(struct device *dev, int type, enum dma_data_direction dir, size_t size); size_t size); static inline struct snd_dma_buffer * snd_devm_alloc_pages(struct device *dev, int type, size_t size) { return snd_devm_alloc_dir_pages(dev, type, DMA_BIDIRECTIONAL, size); } static inline struct sg_table * snd_dma_noncontig_sg_table(struct snd_dma_buffer *dmab) { return dmab->private_data; } #endif /* __SOUND_MEMALLOC_H */ #endif /* __SOUND_MEMALLOC_H */
include/uapi/sound/asound.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1002,7 +1002,7 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ // (1 << 3) is unused. /* (1 << 3) is unused. */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) Loading
include/uapi/sound/firewire.h +150 −0 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479 #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479 #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d #define SNDRV_FIREWIRE_EVENT_MOTU_REGISTER_DSP_CHANGE 0x4d545244 struct snd_firewire_event_common { struct snd_firewire_event_common { unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ Loading Loading @@ -65,6 +66,12 @@ struct snd_firewire_event_tascam_control { struct snd_firewire_tascam_change changes[0]; struct snd_firewire_tascam_change changes[0]; }; }; struct snd_firewire_event_motu_register_dsp_change { unsigned int type; __u32 count; /* The number of changes. */ __u32 changes[]; /* Encoded event for change of register DSP. */ }; union snd_firewire_event { union snd_firewire_event { struct snd_firewire_event_common common; struct snd_firewire_event_common common; struct snd_firewire_event_lock_status lock_status; struct snd_firewire_event_lock_status lock_status; Loading @@ -73,6 +80,7 @@ union snd_firewire_event { struct snd_firewire_event_digi00x_message digi00x_message; struct snd_firewire_event_digi00x_message digi00x_message; struct snd_firewire_event_tascam_control tascam_control; struct snd_firewire_event_tascam_control tascam_control; struct snd_firewire_event_motu_notification motu_notification; struct snd_firewire_event_motu_notification motu_notification; struct snd_firewire_event_motu_register_dsp_change motu_register_dsp_change; }; }; Loading @@ -80,6 +88,9 @@ union snd_firewire_event { #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state) #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state) #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_METER _IOR('H', 0xfc, struct snd_firewire_motu_register_dsp_meter) #define SNDRV_FIREWIRE_IOCTL_MOTU_COMMAND_DSP_METER _IOR('H', 0xfd, struct snd_firewire_motu_command_dsp_meter) #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_PARAMETER _IOR('H', 0xfe, struct snd_firewire_motu_register_dsp_parameter) #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 Loading Loading @@ -108,4 +119,143 @@ struct snd_firewire_tascam_state { __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; }; }; /* * In below MOTU models, software is allowed to control their DSP by accessing to registers. * - 828mk2 * - 896hd * - Traveler * - 8 pre * - Ultralite * - 4 pre * - Audio Express * * On the other hand, the status of DSP is split into specific messages included in the sequence of * isochronous packet. ALSA firewire-motu driver gathers the messages and allow userspace applications * to read it via ioctl. In 828mk2, 896hd, and Traveler, hardware meter for all of physical inputs * are put into the message, while one pair of physical outputs is selected. The selection is done by * LSB one byte in asynchronous write quadlet transaction to 0x'ffff'f000'0b2c. * * I note that V3HD/V4HD uses asynchronous transaction for the purpose. The destination address is * registered to 0x'ffff'f000'0b38 and '0b3c by asynchronous write quadlet request. The size of * message differs between 23 and 51 quadlets. For the case, the number of mixer bus can be extended * up to 12. */ #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT 24 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT 24 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT \ (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT + SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT) /** * struct snd_firewire_motu_register_dsp_meter - the container for meter information in DSP * controlled by register access * @data: Signal level meters. The mapping between position and input/output channel is * model-dependent. * * The structure expresses the part of DSP status for hardware meter. The u8 storage includes linear * value for audio signal level between 0x00 and 0x7f. */ struct snd_firewire_motu_register_dsp_meter { __u8 data[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT]; }; #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT 4 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT 20 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT 10 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT + 2) /** * snd_firewire_motu_register_dsp_parameter - the container for parameters of DSP controlled * by register access. * @mixer.source.gain: The gain of source to mixer. * @mixer.source.pan: The L/R balance of source to mixer. * @mixer.source.flag: The flag of source to mixer, including mute, solo. * @mixer.source.paired_balance: The L/R balance of paired source to mixer, only for 4 pre and * Audio Express. * @mixer.source.paired_width: The width of paired source to mixer, only for 4 pre and * Audio Express. * @mixer.output.paired_volume: The volume of paired output from mixer. * @mixer.output.paired_flag: The flag of paired output from mixer. * @output.main_paired_volume: The volume of paired main output. * @output.hp_paired_volume: The volume of paired hp output. * @output.hp_paired_assignment: The source assigned to paired hp output. * @output.reserved: Padding for 32 bit alignment for future extension. * @line_input.boost_flag: The flags of boost for line inputs, only for 828mk2 and Traveler. * @line_input.nominal_level_flag: The flags of nominal level for line inputs, only for 828mk2 and * Traveler. * @line_input.reserved: Padding for 32 bit alignment for future extension. * @input.gain_and_invert: The value including gain and invert for input, only for Ultralite, 4 pre * and Audio Express. * @input.flag: The flag of input; e.g. jack detection, phantom power, and pad, only for Ultralite, * 4 pre and Audio express. * @reserved: Padding so that the size of structure is kept to 512 byte, but for future extension. * * The structure expresses the set of parameters for DSP controlled by register access. */ struct snd_firewire_motu_register_dsp_parameter { struct { struct { __u8 gain[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 pan[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 paired_balance[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; __u8 paired_width[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT]; } source[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; struct { __u8 paired_volume[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; __u8 paired_flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT]; } output; } mixer; struct { __u8 main_paired_volume; __u8 hp_paired_volume; __u8 hp_paired_assignment; __u8 reserved[5]; } output; struct { __u8 boost_flag; __u8 nominal_level_flag; __u8 reserved[6]; } line_input; struct { __u8 gain_and_invert[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT]; __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT]; } input; __u8 reserved[64]; }; /* * In below MOTU models, software is allowed to control their DSP by command in frame of * asynchronous transaction to 0x'ffff'0001'0000: * * - 828 mk3 (FireWire only and Hybrid) * - 896 mk3 (FireWire only and Hybrid) * - Ultralite mk3 (FireWire only and Hybrid) * - Traveler mk3 * - Track 16 * * On the other hand, the states of hardware meter is split into specific messages included in the * sequence of isochronous packet. ALSA firewire-motu driver gathers the message and allow userspace * application to read it via ioctl. */ #define SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT 400 /** * struct snd_firewire_motu_command_dsp_meter - the container for meter information in DSP * controlled by command * @data: Signal level meters. The mapping between position and signal channel is model-dependent. * * The structure expresses the part of DSP status for hardware meter. The 32 bit storage is * estimated to include IEEE 764 32 bit single precision floating point (binary32) value. It is * expected to be linear value (not logarithm) for audio signal level between 0.0 and +1.0. */ struct snd_firewire_motu_command_dsp_meter { #ifdef __KERNEL__ __u32 data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; #else float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT]; #endif }; #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */ #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */
sound/core/Makefile +2 −1 Original line number Original line Diff line number Diff line Loading @@ -9,7 +9,9 @@ ifneq ($(CONFIG_SND_PROC_FS),) snd-y += info.o snd-y += info.o snd-$(CONFIG_SND_OSSEMUL) += info_oss.o snd-$(CONFIG_SND_OSSEMUL) += info_oss.o endif endif ifneq ($(CONFIG_M68K),y) snd-$(CONFIG_ISA_DMA_API) += isadma.o snd-$(CONFIG_ISA_DMA_API) += isadma.o endif snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o snd-$(CONFIG_SND_VMASTER) += vmaster.o snd-$(CONFIG_SND_VMASTER) += vmaster.o snd-$(CONFIG_SND_JACK) += ctljack.o jack.o snd-$(CONFIG_SND_JACK) += ctljack.o jack.o Loading @@ -17,7 +19,6 @@ snd-$(CONFIG_SND_JACK) += ctljack.o jack.o snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_misc.o \ snd-pcm-y := pcm.o pcm_native.o pcm_lib.o pcm_misc.o \ pcm_memory.o memalloc.o pcm_memory.o memalloc.o snd-pcm-$(CONFIG_SND_PCM_TIMER) += pcm_timer.o snd-pcm-$(CONFIG_SND_PCM_TIMER) += pcm_timer.o snd-pcm-$(CONFIG_SND_DMA_SGBUF) += sgbuf.o snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o snd-pcm-$(CONFIG_SND_PCM_ELD) += pcm_drm_eld.o snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o snd-pcm-$(CONFIG_SND_PCM_IEC958) += pcm_iec958.o Loading