LaCie Firewire Speakers/Griffin FireWave support
A message that is not in the archive (sent off-list or not yet received): [email protected]
Clemens Ladisch
maintainercover LaCie Firewire Speakers/Griffin FireWave support
This driver version is, I hope, finished enough so that I can commit it soon.
The FireWave's low-frequency processing makes me believe that this device is prepared to accept two- and four-channel data, so I've enabled this in the driver; but I'd still like to actually know if it works. (If it does, adding support for the AC-3 decoding will be possible too.)
I haven't yet looked into volume controls.
Jay, are you OK with "Tested-by: Jay Fenlason <[email protected]>"?
Stefan, if those firewire core bits are worth your notice :) , please give an Acked-by for them.
Regards,
Clemens
Clemens Ladisch
maintainerPATCH 1/2 ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
Add a driver for two playback-only FireWire devices based on the OXFW970 chip.
v2: Better AMDTP API abstraction; fix fw_unit leak; small fixes.
Two- and four-channel output on the FireWave is experimental.
--- drivers/firewire/core-iso.c | 1 drivers/firewire/core.h | 3 include/linux/firewire.h | 7 sound/Kconfig | 2 sound/Makefile | 2 sound/firewire/Kconfig | 25 + sound/firewire/Makefile | 6 sound/firewire/amdtp.c | 511 ++++++++++++++++++++++++++++++++ sound/firewire/amdtp.h | 151 +++++++++ sound/firewire/cmp.c | 316 +++++++++++++++++++ sound/firewire/cmp.h | 40 ++ sound/firewire/fcp.c | 223 +++++++++++++ sound/firewire/fcp.h | 12 sound/firewire/iso-resources.c | 224 ++++++++++++++ sound/firewire/iso-resources.h | 39 ++ sound/firewire/lib.c | 68 ++++ sound/firewire/lib.h | 19 + sound/firewire/packets-buffer.c | 74 ++++ sound/firewire/packets-buffer.h | 26 + sound/firewire/speakers.c | 484 ++++++++++++++++++++++++++++++ 20 files changed, 2229 insertions(+), 4 deletions(-)
sound/Kconfig +2 -0
@@ -97,6 +97,8 @@ source "sound/sh/Kconfig" # here assuming USB is defined before ALSA source "sound/usb/Kconfig" +source "sound/firewire/Kconfig" + # the following will depend on the order of config. # here assuming PCMCIA is defined before ALSA source "sound/pcmcia/Kconfig"
sound/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-$(CONFIG_SOUND_PRIME) += sound_firmw obj-$(CONFIG_SOUND_PRIME) += oss/ obj-$(CONFIG_DMASOUND) += oss/ obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \ - sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ + firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ obj-$(CONFIG_SND_AOA) += aoa/ # This one must be compilable even if sound is configured out
sound/firewire/Kconfig new file +25 -0
@@ -0,0 +1,25 @@ +menuconfig SND_FIREWIRE + bool "FireWire sound devices" + depends on FIREWIRE + default y + help + Support for IEEE-1394/FireWire/iLink sound devices. + +if SND_FIREWIRE && FIREWIRE + +config SND_FIREWIRE_LIB + tristate + depends on SND_PCM + +config SND_FIREWIRE_SPEAKERS + tristate "FireWire speakers" + select SND_PCM + select SND_FIREWIRE_LIB + help + Say Y here to include support for the LaCie Firewire Speakers + and the Griffin FireWave Surround. + + To compile this driver as a module, choose M here: the module + will be called snd-firewire-speakers. + +endif # SND_FIREWIRE
sound/firewire/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +snd-firewire-lib-objs := lib.o iso-resources.o packets-buffer.o \ + fcp.o cmp.o amdtp.o +snd-firewire-speakers-objs := speakers.o + +obj-$(CONFIG_SND_FIREWIRE_LIB) += snd-firewire-lib.o +obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o
drivers/firewire/core-iso.c +1 -0
@@ -369,3 +369,4 @@ void fw_iso_resource_manage(struct fw_ca *channel = ret; } } +EXPORT_SYMBOL (fw_iso_resource_manage);
drivers/firewire/core.h +0 -3
@@ -147,9 +147,6 @@ void fw_node_event(struct fw_card *card,/* -iso */ int fw_iso_buffer_map (struct fw_iso_buffer *buffer,struct vm_area_struct *vma); -void fw_iso_resource_manage (struct fw_card *card,int generation, -u64 channels_mask,int *channel,int *bandwidth, -bool allocate,__be32 buffer[2 ]);/* -topology */
include/linux/firewire.h +7 -0
@@ -42,6 +42,10 @@#define CSR_BROADCAST_CHANNEL 0x234#define CSR_CONFIG_ROM 0x400#define CSR_CONFIG_ROM_END 0x800 +#define CSR_OMPR 0x900 +#define CSR_OPCR (i) (0x904 + (i) * 4) +#define CSR_IMPR 0x980 +#define CSR_IPCR (i) (0x984 + (i) * 4)#define CSR_FCP_COMMAND 0xB00#define CSR_FCP_RESPONSE 0xD00#define CSR_FCP_END 0xF00
@@ -441,5 +445,8 @@ int fw_iso_context_start(struct fw_iso_c int cycle, int sync, int tags);int fw_iso_context_stop (struct fw_iso_context *ctx);void fw_iso_context_destroy (struct fw_iso_context *ctx); +void fw_iso_resource_manage (struct fw_card *card,int generation, +u64 channels_mask,int *channel,int *bandwidth, +bool allocate,__be32 buffer[2 ]);#endif /* _LINUX_FIREWIRE_H */
sound/firewire/cmp.c new file +316 -0
316 lines not on this page · raw message
sound/firewire/cmp.h new file +40 -0
@@ -0,0 +1,40 @@ +#ifndef SOUND_FIREWIRE_CMP_H_INCLUDED +#define SOUND_FIREWIRE_CMP_H_INCLUDED + +#include <linux/mutex.h> +#include <linux/types.h> +#include "iso-resources.h" + +struct fw_unit ; + +/** +* struct cmp_connection - manages an isochronous connection to a device +* @speed: the connection's actual speed +* +* This structure manages (using CMP) an isochronous stream from the local +* computer to a device's input plug (iPCR). +* +* There is no corresponding oPCR created on the local computer, so it is not +* possible to overlay connections on top of this one. +*/ +struct cmp_connection { +int speed; +/* private: */ +bool connected; +struct mutex mutex; +struct fw_iso_resources resources; +unsigned int pcr_index; +unsigned int max_speed; +}; + +int cmp_connection_init (struct cmp_connection * connection, +struct fw_unit *unit, +unsigned int ipcr_index); +void cmp_connection_destroy (struct cmp_connection *connection); + +int cmp_connection_establish (struct cmp_connection *connection, +unsigned int max_payload); +int cmp_connection_update (struct cmp_connection *connection); +void cmp_connection_break (struct cmp_connection *connection); + +#endif
sound/firewire/fcp.c new file +223 -0
223 lines not on this page · raw message
sound/firewire/fcp.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef SOUND_FIREWIRE_FCP_H_INCLUDED +#define SOUND_FIREWIRE_FCP_H_INCLUDED + +struct fw_unit ; + +int fcp_avc_transaction (struct fw_unit *unit, +const void *command,unsigned int command_size, +void *response,unsigned int response_size, +unsigned int response_match_bytes); +void fcp_bus_reset (struct fw_unit *unit); + +#endif
sound/firewire/speakers.c new file +484 -0
484 lines not on this page · raw message
sound/firewire/lib.c new file +68 -0
68 lines not on this page · raw message
sound/firewire/lib.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef SOUND_FIREWIRE_LIB_H_INCLUDED +#define SOUND_FIREWIRE_LIB_H_INCLUDED + +#include <linux/firewire-constants.h> +#include <linux/types.h> + +struct fw_unit ; + +int snd_fw_transaction (struct fw_unit *unit,int tcode, +u64 offset,void *buffer,size_t length); +const char *rcode_string (unsigned int rcode); + +/* returns true if retrying the transaction would not make sense */ +static inline bool rcode_is_permanent_error (int rcode) +{ +return rcode ==RCODE_TYPE_ERROR || rcode ==RCODE_ADDRESS_ERROR ; +} + +#endif
sound/firewire/iso-resources.c new file +224 -0
224 lines not on this page · raw message
sound/firewire/iso-resources.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED +#define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED + +#include <linux/mutex.h> +#include <linux/types.h> + +struct fw_unit ; + +/** +* struct fw_iso_resources - manages channel/bandwidth allocation +* @channels_mask: if the device does not support all channel numbers, set this +* bit mask to something else than the default (all ones) +* +* This structure manages (de)allocation of isochronous resources (channel and +* bandwidth) for one isochronous stream. +*/ +struct fw_iso_resources { +u64 channels_mask; +/* private: */ +struct fw_unit *unit; +struct mutex mutex; +unsigned int channel; +unsigned int bandwidth;/* in bandwidth units, without overhead */ +unsigned int bandwidth_overhead; +int generation;/* in which allocation is valid */ +bool allocated; +__be32 buffer[2 ]; +}; + +void fw_iso_resources_init (struct fw_iso_resources *r, +struct fw_unit *unit); +void fw_iso_resources_destroy (struct fw_iso_resources *r); + +int fw_iso_resources_allocate (struct fw_iso_resources *r, +unsigned int max_payload_bytes,int speed); +int fw_iso_resources_update (struct fw_iso_resources *r); +void fw_iso_resources_free (struct fw_iso_resources *r); + +#endif
sound/firewire/packets-buffer.c new file +74 -0
74 lines not on this page · raw message
sound/firewire/packets-buffer.h new file +26 -0
@@ -0,0 +1,26 @@ +#ifndef SOUND_FIREWIRE_PACKETS_BUFFER_H_INCLUDED +#define SOUND_FIREWIRE_PACKETS_BUFFER_H_INCLUDED + +#include <linux/dma-mapping.h> +#include <linux/firewire.h> + +/** +* struct iso_packets_buffer - manages a buffer for many packets +* @iso_buffer: the memory containing the packets +* @packets: an array, with each element pointing to one packet +*/ +struct iso_packets_buffer { +struct fw_iso_buffer iso_buffer; +struct { +void *buffer; +unsigned int offset; + } *packets; +}; + +int iso_packets_buffer_init (struct iso_packets_buffer *b,struct fw_unit *unit, +unsigned int count,unsigned int packet_size, +enum dma_data_direction direction); +void iso_packets_buffer_destroy (struct iso_packets_buffer *b, +struct fw_unit *unit); + +#endif
sound/firewire/amdtp.c new file +511 -0
511 lines not on this page · raw message
sound/firewire/amdtp.h new file +151 -0
151 lines not on this page · raw message
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
Re: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
Quoted 29 lines · On Feb 07 Clemens Ladisch wrote:
Add a driver for two playback-only FireWire devices based on the OXFW970 chip.
v2: Better AMDTP API abstraction; fix
fw_unitleak; small fixes.
Two- and four-channel output on the FireWave is experimental.Signed-off-by Clemens Ladisch <[email protected]>--- drivers/firewire/core-iso.c | 1 drivers/firewire/core.h | 3 include/linux/firewire.h | 7 sound/Kconfig | 2 sound/Makefile | 2 sound/firewire/Kconfig | 25 + sound/firewire/Makefile | 6 sound/firewire/amdtp.c | 511 ++++++++++++++++++++++++++++++++ sound/firewire/amdtp.h | 151 +++++++++ sound/firewire/cmp.c | 316 +++++++++++++++++++ sound/firewire/cmp.h | 40 ++ sound/firewire/fcp.c | 223 +++++++++++++ sound/firewire/fcp.h | 12 sound/firewire/iso-resources.c | 224 ++++++++++++++ sound/firewire/iso-resources.h | 39 ++ sound/firewire/lib.c | 68 ++++ sound/firewire/lib.h | 19 + sound/firewire/packets-buffer.c | 74 ++++ sound/firewire/packets-buffer.h | 26 + sound/firewire/speakers.c | 484 ++++++++++++++++++++++++++++++ 20 files changed, 2229 insertions(+), 4 deletions(-)
[...]
Quoted 33 lines
drivers/firewire/core-iso.c +1
-0@@ -369,3 +369,4 @@ void fw_iso_resource_manage(struct fw_ca *channel = ret; } } +EXPORT_SYMBOL (fw_iso_resource_manage);drivers/firewire/core.h +0
-3@@ -147,9 +147,6 @@ void fw_node_event(struct fw_card *card,/* -iso */ int fw_iso_buffer_map (struct fw_iso_buffer *buffer,struct vm_area_struct *vma); -void fw_iso_resource_manage (struct fw_card *card,int generation, -u64 channels_mask,int *channel,int *bandwidth, -bool allocate,__be32 buffer[2 ]);/* -topology */ include/linux/firewire.h +4
-0@@ -42,6 +42,10 @@#define CSR_BROADCAST_CHANNEL 0x234#define CSR_CONFIG_ROM 0x400#define CSR_CONFIG_ROM_END 0x800 +#define CSR_OMPR 0x900 +#define CSR_OPCR (i) (0x904 + (i) * 4) +#define CSR_IMPR 0x980 +#define CSR_IPCR (i) (0x984 + (i) * 4)#define CSR_FCP_COMMAND 0xB00#define CSR_FCP_RESPONSE 0xD00#define CSR_FCP_END 0xF00
include/linux/firewire.h int fw_iso_context_start(struct fw_iso_c · line 452
Quoted 8 lines
include/linux/firewire.h +3
-0@@ -441,5 +445,8 @@ int fw_iso_context_start(struct fw_iso_c int cycle, int sync, int tags);int fw_iso_context_stop (struct fw_iso_context *ctx);void fw_iso_context_destroy (struct fw_iso_context *ctx); +void fw_iso_resource_manage (struct fw_card *card,int generation, +u64 channels_mask,int *channel,int *bandwidth, +bool allocate,__be32 buffer[2 ]);#endif /* _LINUX_FIREWIRE_H */
[...]
The firewire subsystem parts of this patch and their being routed through the ALSA development repository are fine with me. The export of fw_iso_resource_manage is also going to be needed by drivers/media/dvb/firewire/firedtv* eventually (maintained through the v4l-dvb tree), but I suppose my lack of development speed with firedtv will prevent any conflicts (which would be trivial to resolve in git anyway). Hence,
I am going to test this driver with LaCie FireWire Speakers and Griffin FireWave RSN. BTW, FireWave is a 6-channel-out device which is targeted to be used on OS X as either a stereo or a 5.1-Dolby-surround output. I heard that the 5.1 mode is configured by a vendor-specific AV/C command. (The FireWave was sold with an OS X driver; without this vendor driver it just works as a stereo-out soundcard with OS X' stock driver.)
Signature · 10 lines
Stefan Richter -=====-==-== --=- --=== http://arcgraph.de/sr/ ------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb
Clemens Ladisch
maintainerRe: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
Quoted 6 lines · Stefan Richter
I am going to test this driver with LaCie FireWire Speakers and Griffin FireWave RSN. BTW, FireWave is a 6-channel-out device which is targeted to be used on OS X as either a stereo or a 5.1-Dolby-surround output. I heard that the 5.1 mode is configured by a vendor-specific AV/C command. (The FireWave was sold with an OS X driver; without this vendor driver it just works as a stereo-out soundcard with OS X' stock driver.)
Jay has already tested the FireWave in 6-channel mode; in fact, this was the only format that the previous patch supported for the FireWave.
If OS X works with two channels without knowing that the device expects six, this implies that the device automatically detects the format of the incoming stream, and that sending Dolby data (which would just be two-channel data labeled as "SPDIF") should work too.
Regards,
Clemens
Re: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
In reply to Stefan RichterHere are the results of a few quick smoke tests.
First I attached FireWave and Speakers to my Mac mini and booted into OS X to make sure that this hardware still works. Both do. I don't have Griffin's driver installed. The FireWave puts out proper stereo sound on the L/R port, some muffled sound and pops on the C/S port, and nothing on the LS/RS port. The Speakers put out a loud tinny sound as expected from them.
Rebooted into Linux (2.6.38-rc3). snd_firewire_speakers gets loaded right after I modprobed firewire-ohci, yet somehow no devices are bound to it. (I guess I will add some printks here to look closer onto the device probe under various circumstances.) Removed the speakers, and perhaps replugged the FireWave. They get bound, programs show them as sound card. Unloaded the snd_hda_intel driver to make testing easier.
Xine, although configured to the alsa backend, somehow refuses to use the alsa backend and falls through to jack which doesn't have any devices present at the moment. Kaffeine which uses xine as backend pops up a window that it can't open the sound device. Audacious complains about missing mixer and can't use this sound card.
KDE4's hardware control, sound pane, shows the card and lets me play the test sound on it. First few seconds are choppy. Shortly after the test sound faded I press teh test button again and get a kernel panic:
BUG: unable to handle kernel paging request at [...] IP: [...] iso_packets_buffer_destroy+0x8/0x1d [snd_firewire_lib] [...] Call Trace: [...] amdtp_out_stream_stop+0x3b/0x46 [snd_firewire_lib] [...]
I will send you a screenshot off list.
Next test: Plugged the Speakers in, unloaded snd_hda_intel, loaded firewire-ohci, snd_firewire_speakers now gets bound to devie right away. Started xine and played a file. No complaint. (Hmm, I wonder whether I had an operator error in my earlier session with FireWave.) There is the same problem as in the first KDE4 control panel test: Playback starts with an Autechre remix during the first few seconds. ;-)
Subsequent pause/resume or program exit/ program restart of xine do not feature the choppy lead in anymore.
Audacious again pops up a window titled "ALSA error", saying "No suitable mixer element found." But it actually plays back now.
Alas the missing mixer makes the whole affair not quite usable yet: The LaCie FireWire Speakers are very loud; too loud for the desk or living room. On OS X, I had their volume pulled down to the lowest mark.
No kernel panic yet.
Plugged Speakers out and FireWave in. Gets bound. Xine plays back, as does Audacious (which again first the missing mixer nag window). Alas there is choppy noise during the whole playback, with different audio sources.
Reboot with FireWave plugged in. Same results as in the session before. The choppy noise apparently starts as soon as there was a louder part in the audio stream. This noise changes is pitch all the time along with the music. The Speakers don't seem to have that noise, but I can't really be sure because the building where I live in is not suitable to test them longer at full volume, at least not at this time of day.
Still haven't reproduced the aforementioned kernel panic.
-----
By the way, the ALSA subsystem is not sparse-clean if CF="-D__CHECK_ENDIAN__" is specified in the make command line. Sparse gets nervous about __bitwise types being used as integers.
Signature · 10 lines
Stefan Richter -=====-==-== --=- --=== http://arcgraph.de/sr/ ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb
Clemens Ladisch
maintainerRe: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
Quoted 6 lines · Stefan Richter
BUG: unable to handle kernel paging request at [...] IP: [...] iso_packets_buffer_destroy+0x8/0x1d [snd_firewire_lib] [...] Call Trace: [...] amdtp_out_stream_stop+0x3b/0x46 [snd_firewire_lib] [...]
f8cc3400: 55 push %ebp f8cc3401: 89 e5 mov %esp,%ebp f8cc3403: 53 push %ebx f8cc3404: 89 c3 mov %eax,%ebx f8cc3406: 8b 02 mov (%edx),%eax f8cc3408: <8b>50 fc mov -0x4(%eax),%edx f8cc340b: 89 d8 mov %ebx,%eax f8cc340d: e8 9a fe 02 00 call 0xf8cf32ac f8cc3412: 8b 43 0c mov 0xc(%ebx),%eax f8cc3415: e8 1f 62 3c c8 call 0xc1089639 f8cc341a: 5b pop %ebx f8cc341b: c9 leave f8cc341c: c3 ret
The crash happens when iso_packets_buffer_destroy() tries to read fw_parent_device(unit)->card.
b points to address 0xf3120c58, unit to 0xf1164df0. fw_parent_device(unit) results in 0xf12e8bf4, which looks more or less like a kmalloc()ed pointer, but is not correctly aligned if the standard buddy allocator is used, and turns out not to be in a valid address range.
There must be a wrong pointer somewhere in this chain, but I have no clue where.
Regards,
Clemens
Clemens Ladisch
maintainerRe: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
In reply to Stefan RichterQuoted 4 lines · Stefan Richter
Xine, although configured to the alsa backend, somehow refuses to use the alsa backend and falls through to jack which doesn't have any devices present at the moment. Kaffeine which uses xine as backend pops up a window that it can't open the sound device.
Unfortunately, xine doesn't have useful error messages ...
Try "aplay -D plughw:FireWave something.wav" (or -D plughw:Speakers).
Quoted 9 lines
KDE4's hardware control, sound pane, shows the card and lets me play the test sound on it. First few seconds are choppy. [...]
Next test: Plugged the Speakers in, unloaded
snd_hda_intel, loaded firewire-ohci,snd_firewire_speakersnow gets bound to devie right away. Started xine and played a file. No complaint. (Hmm, I wonder whether I had an operator error in my earlier session with FireWave.) There is the same problem as in the first KDE4 control panel test: Playback starts with an Autechre remix during the first few seconds. ;-)
If it is the same with both devices, the problem is probably not a wrong number of channels.
Choppy sound could indicate a wrong sample rate. Jay used speaker-test, which uses 48 kHz by default, but most music files are 44.1 kHz, so it looks as if switching the sample rate does not work correctly.
Quoted 3 lines
Alas the missing mixer makes the whole affair not quite usable yet: The LaCie FireWire Speakers are very loud; too loud for the desk or living room. On OS X, I had their volume pulled down to the lowest mark.
Attached are .conf files that enable software volume emulation for devices "default", "front", "surround40", and "surround51", but not "hw". Put them into /usr/share/alsa/cards/ (or wherever your distribution puts them).
Regards,
Clemens
#
# Configuration for the LaCie Firewire speakers
#
FWSpeakers.pcm.default {
@args [ CARD ]
@args.CARD {
type string
}
type plug
slave.pcm {
type softvol
slave.pcm {
@func concat
strings [ "dmix:" $CARD ",FORMAT=S32" ]
}
control {
name "PCM Playback Volume"
card $CARD
}
}
}<confdir:pcm/front.conf>
FWSpeakers.pcm.front.0 {
@args [ CARD ]
@args.CARD {
type string
}
type softvol
slave.pcm {
type hw
card $CARD
}
control {
name "PCM Playback Volume"
card $CARD
}
}#
# Configuration for the Griffin FireWave Surround
#
FireWave.pcm.default {
@args [ CARD ]
@args.CARD {
type string
}
type plug
slave.pcm {
type softvol
slave.pcm {
@func concat
strings [ "dmix:" $CARD ",FORMAT=S32" ]
}
control {
name "PCM Playback Volume"
card $CARD
}
}
}<confdir:pcm/front.conf>
FireWave.pcm.front.0 {
@args [ CARD ]
@args.CARD {
type string
}
type softvol
slave.pcm {
type hw
card $CARD
}
control {
name "PCM Playback Volume"
card $CARD
}
}<confdir:pcm/surround40.conf>
FireWave.pcm.surround40.0 {
@args [ CARD ]
@args.CARD {
type string
}
type softvol
slave.pcm {
type hw
card $CARD
}
control {
name "PCM Playback Volume"
card $CARD
}
}<confdir:pcm/surround41.conf>
<confdir:pcm/surround50.conf>
<confdir:pcm/surround51.conf>
FireWave.pcm.surround51.0 {
@args [ CARD ]
@args.CARD {
type string
}
type route
ttable [
[ 1 0 0 0 0 0 ]
[ 0 1 0 0 0 0 ]
[ 0 0 0 0 1 0 ]
[ 0 0 0 0 0 1 ]
[ 0 0 1 0 0 0 ]
[ 0 0 0 1 0 0 ]
]
slave.pcm {
type softvol
slave.pcm {
type hw
card $CARD
}
control {
name "PCM Playback Volume"
card $CARD
}
}
}_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
Quoted 7 lines · On Feb 08 Clemens Ladisch wrote:
Quoted 6 lines · Stefan Richter
Next test: Plugged the Speakers in, unloaded
snd_hda_intel, loaded firewire-ohci,snd_firewire_speakersnow gets bound to devie right away. Started xine and played a file. No complaint. (Hmm, I wonder whether I had an operator error in my earlier session with FireWave.) There is the same problem as in the first KDE4 control panel test: Playback starts with an Autechre remix during the first few seconds. ;-)
I cannot reproduce the noise (clicks) at the start. But clicks or pops during playback are fully reproducible with the FireWave. I am not 100% sure but I think the Speakers are not affected.
These clicks or pops occur at a fast rate whenever there is a louder passage in the sound stream. The pitch and rate of clicks or pops apparently depends on the spectrum of of the sound stream. They happen alongside the normal expected sound.
Quoted 7 lines
If it is the same with both devices, the problem is probably not a wrong number of channels.
Choppy sound could indicate a wrong sample rate. Jay used speaker-test, which uses 48 kHz by default, but most music files are 44.1 kHz, so it looks as if switching the sample rate does not work correctly.
Quoted 8 lines
Quoted 3 lines
Alas the missing mixer makes the whole affair not quite usable yet: The LaCie FireWire Speakers are very loud; too loud for the desk or living room. On OS X, I had their volume pulled down to the lowest mark.
Attached are .conf files that enable software volume emulation for devices "default", "front", "surround40", and "surround51", but not "hw". Put them into
/usr/share/alsa/cards/(or wherever your distribution puts them).
This works indeed... most of the time. Eventually (after device replugs or driver reloading), somehow this software mixer/ volume control was not found anymore. It was back again in a later session.
But I learned that Audacious has an option to add such a software mixer/ volume control itself.
The effect of either way of volume control on the Speakers is that they become usable (as far as desktop speakers can be considered usable).
The effect on the FireWave is that above mentioned clicks or pops are avoided if the volume is turned down far enough. However, at this state the right channel puts out a high-frequency tone, close to what I suspect is the upper frequency of the hearing capability of a well-maintained ear. The left channel doesn't do that.
Furthermore, the muffled sound that the C/S port (the S channel) puts out under OS X by Apple's stock driver¹ does not occur under Linux.
¹) as if it was driven as a 2.1 system, but it is probably just accidental because it is too quiet and there are occasional pops on this channel
Signature · 13 lines
Stefan Richter -=====-==-== --=- -=--- http://arcgraph.de/sr/ ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux1394-devel
Re: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
In reply to Clemens Ladischsound/firewire/speakers.c line 319
Quoted 4 lines · On Feb 07 Clemens Ladisch wrote:
sound/firewire/speakers.c new file +4
-0+static const struct device_info lacie_speakers = { + .driver_name ="FWSpeakers" , + .short_name ="Firewire Speakers" , + .long_name ="LaCie Firewire Speakers" ,
FWIW, it is spelled "LaCie FireWire Speakers" in LaCie's printed material and on their web site, whereas their firmware programmers put "LaCie Firewire speakers" as model descriptor leaf into the Configuration ROM. Does the precise case of device_info strings matter to userspace?
Signature · 10 lines
Stefan Richter -=====-==-== --=- --=== http://arcgraph.de/sr/ ------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb
Clemens Ladisch
maintainerRe: [PATCH 1/2] ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
Quoted 9 lines · Stefan Richter
sound/firewire/speakers.c line 319
Quoted 4 lines · On Feb 07 Clemens Ladisch wrote:
sound/firewire/speakers.c new file +4
-0+static const struct device_info lacie_speakers = { + .driver_name ="FWSpeakers" , + .short_name ="Firewire Speakers" , + .long_name ="LaCie Firewire Speakers" ,FWIW, it is spelled "LaCie FireWire Speakers" in LaCie's printed material and on their web site, whereas their firmware programmers put "LaCie Firewire speakers" as model descriptor leaf into the Configuration ROM.
I took the latter as model, but capitalized "Speakers" because it's a proper noun. I'll change it to "W".
Quoted 1 line
Does the precise case of
device_infostrings matter to userspace?
Only for the driver name. If I had used a common driver name for both, the .conf file would have to use the short name to differentiate them. The long name contains random junk (as far as everybody except PulseAudio is concerned).
Regards,
Clemens
Clemens Ladisch
maintainerPATCH 1/1 ALSA: add LaCie Firewire Speakers/Griffin FireWave surround driver
In reply to Clemens LadischAdd a driver for two playback-only FireWire devices based on the OXFW970 chip.
v2: Better AMDTP API abstraction; fix fw_unit leak; small fixes.
Two- and four-channel output on the FireWave is experimental.
v3: cache the iPCR value to (hopefully) prevent FireWave hangs
--- drivers/firewire/core-iso.c | 1 drivers/firewire/core.h | 3 include/linux/firewire.h | 7 sound/Kconfig | 2 sound/Makefile | 2 sound/firewire/Kconfig | 25 + sound/firewire/Makefile | 6 sound/firewire/amdtp.c | 511 ++++++++++++++++++++++++++++++++ sound/firewire/amdtp.h | 151 +++++++++ sound/firewire/cmp.c | 298 ++++++++++++++++++ sound/firewire/cmp.h | 41 ++ sound/firewire/fcp.c | 223 +++++++++++++ sound/firewire/fcp.h | 12 sound/firewire/iso-resources.c | 224 ++++++++++++++ sound/firewire/iso-resources.h | 39 ++ sound/firewire/lib.c | 68 ++++ sound/firewire/lib.h | 19 + sound/firewire/packets-buffer.c | 74 ++++ sound/firewire/packets-buffer.h | 26 + sound/firewire/speakers.c | 484 ++++++++++++++++++++++++++++++ 20 files changed, 2212 insertions(+), 4 deletions(-)
sound/Kconfig +2 -0
@@ -97,6 +97,8 @@ source "sound/sh/Kconfig" # here assuming USB is defined before ALSA source "sound/usb/Kconfig" +source "sound/firewire/Kconfig" + # the following will depend on the order of config. # here assuming PCMCIA is defined before ALSA source "sound/pcmcia/Kconfig"
sound/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-$(CONFIG_SOUND_PRIME) += sound_firmw obj-$(CONFIG_SOUND_PRIME) += oss/ obj-$(CONFIG_DMASOUND) += oss/ obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \ - sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ + firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ obj-$(CONFIG_SND_AOA) += aoa/ # This one must be compilable even if sound is configured out
sound/firewire/Kconfig new file +25 -0
@@ -0,0 +1,25 @@ +menuconfig SND_FIREWIRE + bool "FireWire sound devices" + depends on FIREWIRE + default y + help + Support for IEEE-1394/FireWire/iLink sound devices. + +if SND_FIREWIRE && FIREWIRE + +config SND_FIREWIRE_LIB + tristate + depends on SND_PCM + +config SND_FIREWIRE_SPEAKERS + tristate "FireWire speakers" + select SND_PCM + select SND_FIREWIRE_LIB + help + Say Y here to include support for the LaCie Firewire Speakers + and the Griffin FireWave Surround. + + To compile this driver as a module, choose M here: the module + will be called snd-firewire-speakers. + +endif # SND_FIREWIRE
sound/firewire/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +snd-firewire-lib-objs := lib.o iso-resources.o packets-buffer.o \ + fcp.o cmp.o amdtp.o +snd-firewire-speakers-objs := speakers.o + +obj-$(CONFIG_SND_FIREWIRE_LIB) += snd-firewire-lib.o +obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o
drivers/firewire/core-iso.c +1 -0
@@ -369,3 +369,4 @@ void fw_iso_resource_manage(struct fw_ca *channel = ret; } } +EXPORT_SYMBOL (fw_iso_resource_manage);
drivers/firewire/core.h +0 -3
@@ -147,9 +147,6 @@ void fw_node_event(struct fw_card *card,/* -iso */ int fw_iso_buffer_map (struct fw_iso_buffer *buffer,struct vm_area_struct *vma); -void fw_iso_resource_manage (struct fw_card *card,int generation, -u64 channels_mask,int *channel,int *bandwidth, -bool allocate,__be32 buffer[2 ]);/* -topology */
include/linux/firewire.h +7 -0
@@ -42,6 +42,10 @@#define CSR_BROADCAST_CHANNEL 0x234#define CSR_CONFIG_ROM 0x400#define CSR_CONFIG_ROM_END 0x800 +#define CSR_OMPR 0x900 +#define CSR_OPCR (i) (0x904 + (i) * 4) +#define CSR_IMPR 0x980 +#define CSR_IPCR (i) (0x984 + (i) * 4)#define CSR_FCP_COMMAND 0xB00#define CSR_FCP_RESPONSE 0xD00#define CSR_FCP_END 0xF00
@@ -441,5 +445,8 @@ int fw_iso_context_start(struct fw_iso_c int cycle, int sync, int tags);int fw_iso_context_stop (struct fw_iso_context *ctx);void fw_iso_context_destroy (struct fw_iso_context *ctx); +void fw_iso_resource_manage (struct fw_card *card,int generation, +u64 channels_mask,int *channel,int *bandwidth, +bool allocate,__be32 buffer[2 ]);#endif /* _LINUX_FIREWIRE_H */
sound/firewire/cmp.c new file +298 -0
298 lines not on this page · raw message
sound/firewire/cmp.h new file +41 -0
41 lines not on this page · raw message
sound/firewire/fcp.c new file +223 -0
223 lines not on this page · raw message
sound/firewire/fcp.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef SOUND_FIREWIRE_FCP_H_INCLUDED +#define SOUND_FIREWIRE_FCP_H_INCLUDED + +struct fw_unit ; + +int fcp_avc_transaction (struct fw_unit *unit, +const void *command,unsigned int command_size, +void *response,unsigned int response_size, +unsigned int response_match_bytes); +void fcp_bus_reset (struct fw_unit *unit); + +#endif
sound/firewire/speakers.c new file +484 -0
484 lines not on this page · raw message
sound/firewire/lib.c new file +68 -0
68 lines not on this page · raw message
sound/firewire/lib.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef SOUND_FIREWIRE_LIB_H_INCLUDED +#define SOUND_FIREWIRE_LIB_H_INCLUDED + +#include <linux/firewire-constants.h> +#include <linux/types.h> + +struct fw_unit ; + +int snd_fw_transaction (struct fw_unit *unit,int tcode, +u64 offset,void *buffer,size_t length); +const char *rcode_string (unsigned int rcode); + +/* returns true if retrying the transaction would not make sense */ +static inline bool rcode_is_permanent_error (int rcode) +{ +return rcode ==RCODE_TYPE_ERROR || rcode ==RCODE_ADDRESS_ERROR ; +} + +#endif
sound/firewire/iso-resources.c new file +224 -0
224 lines not on this page · raw message
sound/firewire/iso-resources.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED +#define SOUND_FIREWIRE_ISO_RESOURCES_H_INCLUDED + +#include <linux/mutex.h> +#include <linux/types.h> + +struct fw_unit ; + +/** +* struct fw_iso_resources - manages channel/bandwidth allocation +* @channels_mask: if the device does not support all channel numbers, set this +* bit mask to something else than the default (all ones) +* +* This structure manages (de)allocation of isochronous resources (channel and +* bandwidth) for one isochronous stream. +*/ +struct fw_iso_resources { +u64 channels_mask; +/* private: */ +struct fw_unit *unit; +struct mutex mutex; +unsigned int channel; +unsigned int bandwidth;/* in bandwidth units, without overhead */ +unsigned int bandwidth_overhead; +int generation;/* in which allocation is valid */ +bool allocated; +__be32 buffer[2 ]; +}; + +void fw_iso_resources_init (struct fw_iso_resources *r, +struct fw_unit *unit); +void fw_iso_resources_destroy (struct fw_iso_resources *r); + +int fw_iso_resources_allocate (struct fw_iso_resources *r, +unsigned int max_payload_bytes,int speed); +int fw_iso_resources_update (struct fw_iso_resources *r); +void fw_iso_resources_free (struct fw_iso_resources *r); + +#endif
sound/firewire/packets-buffer.c new file +74 -0
74 lines not on this page · raw message
sound/firewire/packets-buffer.h new file +26 -0
@@ -0,0 +1,26 @@ +#ifndef SOUND_FIREWIRE_PACKETS_BUFFER_H_INCLUDED +#define SOUND_FIREWIRE_PACKETS_BUFFER_H_INCLUDED + +#include <linux/dma-mapping.h> +#include <linux/firewire.h> + +/** +* struct iso_packets_buffer - manages a buffer for many packets +* @iso_buffer: the memory containing the packets +* @packets: an array, with each element pointing to one packet +*/ +struct iso_packets_buffer { +struct fw_iso_buffer iso_buffer; +struct { +void *buffer; +unsigned int offset; + } *packets; +}; + +int iso_packets_buffer_init (struct iso_packets_buffer *b,struct fw_unit *unit, +unsigned int count,unsigned int packet_size, +enum dma_data_direction direction); +void iso_packets_buffer_destroy (struct iso_packets_buffer *b, +struct fw_unit *unit); + +#endif
sound/firewire/amdtp.c new file +511 -0
511 lines not on this page · raw message
sound/firewire/amdtp.h new file +151 -0
151 lines not on this page · raw message
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
Clemens Ladisch
maintainerPATCH 2/2 alsa-lib: add LaCie Firewire Speakers/Griffin FireWave Surround driver
In reply to Clemens LadischAdd configuration files for the "default"/"front"/"surround40"/ "surround51" devices for the snd-firewire-speakers driver.
--- src/conf/cards/Makefile.am | 2 + src/conf/cards/FWSpeakers.conf | 26 ++++++++++++++ src/conf/cards/FireWave.conf | 61 +++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+)
src/conf/cards/Makefile.am +2 -0
@@ -25,6 +25,8 @@ cfg_files = aliases.conf \ ENS1371.conf \ ES1968.conf \ FM801.conf \ + FWSpeakers.conf \ + FireWave.conf \ GUS.conf \ HDA-Intel.conf \ ICE1712.conf \
src/conf/cards/FWSpeakers.conf new file +26 -0
@@ -0,0 +1,26 @@ +# +# Configuration for the LaCie Firewire speakers +# + +FWSpeakers.pcm.default { + @args [ CARD ] + @args.CARD { + type string + } + type plug + slave.pcm { + @func concat + strings [ "dmix:" $CARD ",FORMAT=S32" ] + } +} + +<confdir:pcm/front.conf> + +FWSpeakers.pcm.front.0 { + @args [ CARD ] + @args.CARD { + type string + } + type hw + card $CARD +}
src/conf/cards/FireWave.conf new file +61 -0
61 lines not on this page · raw message