IEEE 1394 updates for Linux 2.6.36.y (v1423 2012-12-02) Documentation/ABI/stable/firewire-cdev | 103 Documentation/ABI/stable/sysfs-bus-firewire | 133 Documentation/ioctl/ioctl-number.txt | 1 Documentation/sound/alsa/ALSA-Configuration.txt | 7 drivers/firewire/Kconfig | 16 drivers/firewire/Makefile | 1 drivers/firewire/core-card.c | 85 drivers/firewire/core-cdev.c | 187 - drivers/firewire/core-device.c | 241 - drivers/firewire/core-iso.c | 138 drivers/firewire/core-topology.c | 19 drivers/firewire/core-transaction.c | 200 - drivers/firewire/core.h | 52 drivers/firewire/init_ohci1394_dma.c | 309 ++ drivers/firewire/net.c | 282 + drivers/firewire/nosy.c | 7 drivers/firewire/ohci.c | 1554 +++++++--- drivers/firewire/sbp2.c | 424 +- drivers/ieee1394/Makefile | 2 drivers/ieee1394/init_ohci1394_dma.c | 285 - drivers/media/dvb/Kconfig | 2 drivers/media/dvb/firewire/Kconfig | 8 drivers/media/dvb/firewire/Makefile | 5 drivers/media/dvb/firewire/firedtv-1394.c | 300 -- drivers/media/dvb/firewire/firedtv-avc.c | 91 drivers/media/dvb/firewire/firedtv-ci.c | 34 drivers/media/dvb/firewire/firedtv-dvb.c | 135 drivers/media/dvb/firewire/firedtv-fe.c | 44 drivers/media/dvb/firewire/firedtv-fw.c | 147 - drivers/media/dvb/firewire/firedtv-rc.c | 9 drivers/media/dvb/firewire/firedtv.h | 45 include/asm-generic/dma-mapping-common.h | 14 include/linux/firewire-cdev.h | 117 include/linux/firewire.h | 64 include/sound/Kbuild | 1 include/sound/asound.h | 3 include/sound/firewire.h | 51 sound/Kconfig | 2 sound/Makefile | 2 sound/firewire/Kconfig | 78 sound/firewire/Makefile | 14 sound/firewire/amdtp.c | 544 +++ sound/firewire/amdtp.h | 164 + sound/firewire/cmp.c | 299 ++ sound/firewire/cmp.h | 41 sound/firewire/dice-interface.h | 371 ++ sound/firewire/dice.c | 1615 +++++++++++ sound/firewire/fcp.c | 224 + sound/firewire/fcp.h | 12 sound/firewire/fireworks.c | 2283 ++++++++++++++++ sound/firewire/fireworks.h | 201 + sound/firewire/isight.c | 750 +++++ sound/firewire/iso-resources.c | 231 + sound/firewire/iso-resources.h | 38 sound/firewire/lib.c | 71 sound/firewire/lib.h | 23 sound/firewire/packets-buffer.c | 76 sound/firewire/packets-buffer.h | 26 sound/firewire/scs1x.c | 527 +++ sound/firewire/speakers.c | 848 +++++ tools/firewire/nosy-dump.c | 4 61 files changed, 11526 insertions(+), 2034 deletions(-) Date: Wed, 28 Nov 2012 20:04:32 +0100 From: Stephan Gatzka firewire: net: Fix handling of fragmented multicast/broadcast packets. This patch fixes both the transmit and receive portion of sending fragmented mutlicast and broadcast packets. The transmit section was broken because the offset for INTFRAG and LASTFRAG packets were just miscalculated by IEEE1394_GASP_HDR_SIZE (which was reserved with skb_push() in fwnet_send_packet). The receive section was broken because in fwnet_incoming_packet is a call to fwnet_peer_find_by_node_id(). Called with generation == -1 it will not find a peer and the partial datagrams are associated to a peer. [Stefan R: The fix to use context->card->generation is not perfect. It relies on the IR tasklet which processes packets from the prior bus generation to run before the self-ID-complete worklet which sets the current card generation. Alas, there is no simple way of a race-free implementation. Let's do it this way for now.] Signed-off-by: Stephan Gatzka Cc: stable Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) Date: Mon, 22 Oct 2012 15:17:17 +0200 From: Stefan Richter tools/firewire: nosy-dump: check for allocation failure Behavior of null pointer dereference is undefined in the C language. Portably implement the desired behavior. Reported-by: Yang Yeping Signed-off-by: Stefan Richter --- tools/firewire/nosy-dump.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Sat, 26 May 2012 11:43:19 +0200 From: Clemens Ladisch ALSA: firewire: add Stanton SCS.1d/1m driver Add a MIDI driver for the Stanton FireWire DJ controllers. Tested-by: Sean M. Pappalardo - D.J. Pegasus Signed-off-by: Clemens Ladisch [[ Stefan R: rebased onto alsa-firewire-extend-snd_fw_transaction.patch ]] --- sound/firewire/Kconfig | 13 + sound/firewire/Makefile | 2 + sound/firewire/scs1x.c | 527 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 542 insertions(+) create mode 100644 sound/firewire/scs1x.c Date: Thu, 27 Sep 2012 21:46:09 +0200 From: Stefan Richter firewire: addendum to address handler RCU conversion Follow up on commit c285f6ff6787 "firewire: remove global lock around address handlers, convert to RCU": - address_handler_lock no longer serializes the address handler, only its function to serialize updates to the list of handlers remains. Rename the lock to address_handler_list_lock. - Callers of fw_core_remove_address_handler() must be able to sleep. Comment on this in the API documentation. - The counterpart fw_core_add_address_handler() is by nature something which is used in process context. Replace spin_lock_bh() by spin_lock() in fw_core_add_address_handler() and in fw_core_remove_address_handler(), and document that process context is now required for fw_core_add_address_handler(). - Extend the documentation of fw_address_callback_t. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 13 ++++++++----- include/linux/firewire.h | 12 ++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) Date: Sun, 19 Aug 2012 02:50:02 -0400 From: Peter Hurley firewire: remove global lock around address handlers, convert to RCU Upper-layer handlers for inbound requests were called with a spinlock held by firewire-core. Calling into upper layers with a lower layer lock held is generally a bad idea. What's more, since commit ea102d0ec475 "firewire: core: convert AR-req handler lock from _irqsave to _bh", a caller of fw_send_request() i.e. initiator of outbound request could no longer do that while having interrupts disabled, if the local node was addressed by that request. In order to make all this more flexible, convert the management of address ranges and handlers from a global lock around readers and writers to RCU (and a remaining global lock for writers). As a minor side effect, handling of inbound requests at different cards and of local requests is now no longer serialized. (There is still per-card serialization of remote requests since firewire-ohci uses a single DMA tasklet for inbound request events.) In other words, address handlers are now called in an RCU read-side critical section instead of from within a spin_lock_bh serialized section. (Changelog rewritten by Stefan R.) Signed-off-by: Peter Hurley Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) Date: Mon, 3 Sep 2012 21:17:50 +0200 From: Stephan Gatzka firewire: ohci: get IR bit from TSB41BA3D phy In case of a self constructed selfID packet this patch correctly determines the information if the TSB41BA3D phy initiated a bus reset. Signed-off-by: Stephan Gatzka Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) Date: Sun, 17 Jun 2012 19:57:23 +0200 From: Stefan Richter firewire: core: document is_local sysfs attribute Signed-off-by: Stefan Richter --- Documentation/ABI/stable/sysfs-bus-firewire | 11 +++++++++++ 1 file changed, 11 insertions(+) Date: Sun, 17 Jun 2012 16:40:36 +0200 From: Clemens Ladisch firewire: core: add is_local sysfs device attribute Making this information available in sysfs allows to differentiate between controllers in the local and remote Linux PCs, and thus is useful for servers that are started with udev rules. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 9 +++++++++ include/linux/firewire.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) Date: Wed, 13 Jun 2012 22:29:20 +0200 From: Clemens Ladisch firewire: ohci: initialize multiChanMode bits after reset OHCI 1.1 says: | Since the value of this bit is undefined after reset in all IR | contexts, software shall initialize this bit to zero in all contexts | whether or not active to maintain the exclusive nature of this bit. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 5 +++++ 1 file changed, 5 insertions(+) Date: Wed, 13 Jun 2012 22:28:24 +0200 From: Clemens Ladisch firewire: core: fix multichannel IR with buffers larger than 2 GB With a 32-bit i, computing i< Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Mon, 04 Jun 2012 21:28:07 +0200 From: Clemens Ladisch firewire: ohci: sanity-check MMIO resource pci_request_region() does not fail on resources that have not been allocated by the BIOS or by the kernel, so to avoid accessing registers that are not there, we have to check for this explicitly. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++++++ 1 file changed, 7 insertions(+) Date: Thu, 24 May 2012 19:29:19 +0200 From: Clemens Ladisch firewire: ohci: lazy bus time initialization The Bus_Time CSR is virtually never used, so we can avoid burning CPU in interrupt context for 1 or 3 IsochronousCycleTimer accesses every minute by not tracking the bus time until the CSR is actually accessed for the first time. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) Date: Thu, 24 May 2012 19:28:58 +0200 From: Clemens Ladisch firewire: core: allocate the low memory region Prevent userspace applications from allocating low memory address ranges. Otherwise, if some application happens to allocate such a range and intends for a remote node to access it, and if that node also implements SBP-2 (which will become more likely with the upcoming SBP-2 target support), these accesses would be routed by the physical DMA unit to some wrong memory address. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) Date: Thu, 24 May 2012 19:28:17 +0200 From: Clemens Ladisch firewire: core: make address handler length 64 bits The type of the length field of the fw_address_handler structure was size_t, which restricted it to 32 bits on 32-bit architectures. While making it u32 would match the userspace API, all calculations on this field use 64 bits anyway, and the ability to use 4 GB or larger address ranges is useful in the kernel. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- include/linux/firewire.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From fc5f80b152896c1ffded2a91d11dcb08ffcffebb Mon Sep 17 00:00:00 2001 From: Chris Boot Date: Wed, 1 Feb 2012 22:36:02 +0000 firewire: Move fw_card kref functions into linux/firewire.h When writing a firewire driver that doesn't deal with struct fw_device objects (e.g. it only publishes FireWire units and doesn't subscribe to them), you likely need to keep referenced to struct fw_card objects so that you can send messages to other nodes. This patch moves fw_card_put(), fw_card_get() and fw_card_release() into the public include/linux/firewire.h header instead of drivers/firewire/core.h, and adds EXPORT_SYMBOL_GPL(fw_card_release). The firewire-sbp-target module requires these so it can keep a reference to the fw_card object in order that it can fetch ORBs to execute and read/write related data and status information. Signed-off-by: Chris Boot Acked-by: Stefan Richter Cc: Clemens Ladisch Signed-off-by: Nicholas Bellinger --- drivers/firewire/core-card.c | 1 + drivers/firewire/core.h | 15 --------------- include/linux/firewire.h | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 15 deletions(-) From 253d92371ca29a470b2bbf91fb9824a9fef05657 Mon Sep 17 00:00:00 2001 From: Chris Boot Date: Thu, 16 Feb 2012 09:16:35 +0000 firewire: Add function to get speed from opaque struct fw_request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes it's useful to know the FireWire speed of the request that has just come in to a fw_address_handler callback. As struct fw_request is opaque we can't peek inside to get the speed out of the struct fw_packet that's just inside. For example, the SBP-2 spec says: "The speed at which the block write request to the MANAGEMENT_AGENT register is received shall determine the speed used by the target for all subsequent requests to read the initiator’s configuration ROM, fetch ORB’s from initiator memory or store status at the initiator’s status_FIFO. Command block ORB’s separately specify the speed for requests addressed to the data buffer or page table." [ ANSI T10/1155D Revision 4 page 53/54 ] Signed-off-by: Chris Boot Acked-by: Stefan Richter Cc: Clemens Ladisch Signed-off-by: Nicholas Bellinger --- drivers/firewire/core-transaction.c | 9 +++++++++ include/linux/firewire.h | 1 + 2 files changed, 10 insertions(+) Date: Fri, 18 May 2012 22:26:21 +0200 From: Clemens Ladisch firewire: sbp2: document the absence of alignment requirements The SBP-2/3 specifications do not require any alignment of data buffers; only their own data structures need to be quadlet-aligned [SR: or octlet-aligned]. Fix the comments to reflect this, but leave the actual alignment at 32 bits to avoid theoretical problems with target implementations that might handle this incorrectly. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) Date: Fri, 18 May 2012 18:40:19 +0200 From: Clemens Ladisch firewire: sbp2: use scsi_dma_(un)map Use the scsi_dma_map/scsi_dma_unmap helper to simplify the code a little. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) Date: Fri, 18 May 2012 18:39:39 +0200 From: Clemens Ladisch firewire: sbp2: give correct DMA device to scsi framework The sbp2 driver does DMA not on the unit but on the card device. The driver worked even with the wrong device because at the moment, it happens to reimplement the DMA functions of the SCSI framework. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) From 582610a1f45daeeceaa211a19d4e7a1a22cf7e90 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 15 Apr 2012 16:41:04 +0200 [PATCH 3/3] ALSA: dice: add support for M-Audio devices with many channels When using more than one receiver, i.e., more than 16 channels (8 at 192 kHz), the M-Audio firmware expects the data to arrive in one stream, but does not correctly reflect this in the DICE receiver description. Try to work around this by adjusting the description accordingly. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) From 48ea8420b80b35a15eeac4a6e3df6fdf256f8225 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 15 Apr 2012 16:36:52 +0200 [PATCH 2/3] ALSA: dice: add IDs to attach to M-Audio devices M-Audio devices do not use the DICE interface ID (probably because they do not fully conform to the DICE driver interface). Add the IDs so that the driver attaches anyway. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 6 ++++++ 1 file changed, 6 insertions(+) From 8b27ab78787261abe9b2ffa99e4980d16f849ab3 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 13 Apr 2012 23:25:35 +0200 [PATCH 1/3] ALSA: amdtp: rename amdtp_out_stream to amdtp_stream I originally planned to have separate output and input stream objects, but as Jay Fenlason's patch has shown, there is so much common code that it makes more sense to also have a common object for both directions. Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 106 +++++++++++++++++++------------------- sound/firewire/amdtp.h | 74 +++++++++++++------------- sound/firewire/dice.c | 44 ++++++++-------- sound/firewire/speakers.c | 44 ++++++++-------- 4 files changed, 134 insertions(+), 134 deletions(-) From 00990a1764475ca6bc432b06cefed9c21ed2f56c Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 12 Apr 2012 15:53:31 +0200 [PATCH 4/4] ALSA: dice: support multiple streams Allow playback on devices with more than one receiver. Due to the chip's ability to extract quadlets from anywhere in a packet, this does not require multiple isochronous streams. This is probably required to enable playback on devices with more than 16 channels (or 8 at 192 kHz). Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 276 +++++++++++++++++++++++++++++------------- 1 file changed, 192 insertions(+), 84 deletions(-) From 4e79022315b81e3987033c61e3949a35f01a6661 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 12 Apr 2012 11:33:22 +0200 [PATCH 3/4] ALSA: amdtp: allow custom quadlet ordering Instead of requiring that packets contain the samples of all PCM channels in order, introduce an indirection to allow custom orderings. This makes the special dual-wire copy function unnecessary, and prepares for the upcoming DICE multi-receiver support. Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 95 +++++++++++++++-------------------------- sound/firewire/amdtp.h | 12 +++-- sound/firewire/dice.c | 2 3 files changed, 42 insertions(+), 67 deletions(-) From fa478690ac74a0b48936f9d792142c3105195405 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 12 Apr 2012 11:44:19 +0200 [PATCH 2/4] ALSA: amdtp: remove S16 support Remove the code that converts AM824 samples to 16-bit samples. It's practically a duplicate of the 32-bit code, and just increases maintenance effort. Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 119 ++++---------------------------------- sound/firewire/amdtp.h | 5 +- sound/firewire/dice.c | 4 - sound/firewire/speakers.c | 5 +- 4 files changed, 16 insertions(+), 117 deletions(-) From e329fc72622387d9cffa6fbe37f07377873a73a1 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 10 Apr 2012 18:41:17 +0200 [PATCH 1/4] ALSA: dice: do not use dual-wire for M-Audio devices Adjust the driver to work correctly at 192 kHz with M-Audio devices, which have their firmware compiled without dual-wire mode. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) Date: Wed, 11 Apr 2012 17:39:59 +0200 From: Clemens Ladisch firewire: core: fw_device_refresh(): clean up error handling In fw_device_init() and fw_device_refresh(), if a call to read_cofig_rom() fails, the operation is retried a few times, with these retries being controlled by the MAX_RETRIES and RETRY_DELAY symbols. fw_device_refresh() also reads part of the config rom by calling reread_config_rom(). Any errors from this call resulted in retries with MAX_RETRIES/2 and RETRY_DELAY/2. There is no reason to require that a device that has initiated a bus reset must react faster to read requests than a device that has just been plugged in. Furthermore, if the config rom has changed, any errors from the following read_config_rom() call are then handled with the normal retry count and delay. Remove this inconsistency by always using the normal retry count and delay. (This also makes the two error handlers identical and allows merging them.) Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) Date: Wed, 11 Apr 2012 17:39:19 +0200 From: Clemens Ladisch firewire: core: log config rom reading errors If reading or refreshing a config rom fails, also log the actual error that caused it to fail. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 42 +++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 15 deletions(-) Date: Wed, 11 Apr 2012 17:38:47 +0200 From: Clemens Ladisch firewire: core: log error in case of failed bus manager lock If the lock access to the bus manager register fails, also log the actual error that caused it to fail. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Wed, 11 Apr 2012 17:38:10 +0200 From: Clemens Ladisch firewire: move rcode_string() to core There is nothing audio-specific about the rcode_string() helper, so move it from snd-firewire-lib into firewire-core to allow other code to use it. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 26 ++++++++++++++++++++++++++ include/linux/firewire.h | 1 + sound/firewire/lib.c | 28 +--------------------------- sound/firewire/lib.h | 1 - 4 files changed, 28 insertions(+), 28 deletions(-) Date: Wed, 11 Apr 2012 17:37:36 +0200 From: Clemens Ladisch firewire: core: improve reread_config_rom() interface The return value of reread_config_rom() was a mixture of two pieces of information: whether the function succeeded, and whether the config rom had changed. To clarify the semantics, and to allow returning the actual error code, split the second information into a new output parameter. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 40 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 21 deletions(-) Date: Wed, 11 Apr 2012 17:36:39 +0200 From: Clemens Ladisch firewire: core: wait for inaccessible devices after bus reset When reread_config_rom() encountered a config rom that was marked as not yet accessible, that device would be treated as "gone". This would mean that that device would effectively vanish until the next bus reset. The correct way to handle this situation is the same as in read_config_rom(), to treat this like other errors and to retry the read later, when the (possibly changed) config rom is available. The device is marked "gone" only if it continues to return zero values after these retries. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) Date: Mon, 9 Apr 2012 21:40:33 +0200 From: Stefan Richter firewire: ohci: omit spinlock IRQ flags where possible bus_reset_work() is only called from workqueue thread context. ohci_set_config_rom() and ohci_allocate_iso_context() perform GFP_KERNEL memory allocations, therefore they must be called with interrupts enabled. Hence these functions may disable and enable local IRQs without having to track IRQ state. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) Date: Mon, 9 Apr 2012 21:39:53 +0200 From: Stefan Richter firewire: ohci: correct signedness of a local variable bus_reset_work's reg is a bitfield. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Mon, 9 Apr 2012 20:51:18 +0200 From: Stefan Richter firewire: core: fix DMA mapping direction Seen with recent libdc1394: If a client mmap()s the buffer of an isochronous reception buffer with PROT_READ|PROT_WRITE instead of just PROT_READ, firewire-core sets the wrong DMA mapping direction during buffer initialization. The fix is to split fw_iso_buffer_init() into allocation and DMA mapping and to perform the latter after both buffer and DMA context were allocated. Buffer allocation and context allocation may happen in any order, but we need the context type (reception or transmission) in order to set the DMA direction of the buffer. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 51 ++++++++++++++++++---- drivers/firewire/core-iso.c | 80 +++++++++++++++++++++++------------ drivers/firewire/core.h | 7 +++ include/linux/firewire.h | 1 + 4 files changed, 100 insertions(+), 39 deletions(-) Date: Sun, 18 Mar 2012 19:06:39 +0100 From: Clemens Ladisch firewire: allow explicit flushing of iso packet completions Extend the kernel and userspace APIs to allow reporting all currently completed isochronous packets, even if the next interrupt packet has not yet been reached. This is required to determine the status of the packets at the end of a paused or stopped stream, and useful for more precise synchronization of audio streams. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 6 +++ drivers/firewire/core-cdev.c | 12 +++++ drivers/firewire/core-iso.c | 6 +++ drivers/firewire/core.h | 2 + drivers/firewire/ohci.c | 78 +++++++++++++++++++++++++++++++--- include/linux/firewire-cdev.h | 35 +++++++++++++-- include/linux/firewire.h | 1 + 7 files changed, 127 insertions(+), 13 deletions(-) Date: Sun, 18 Mar 2012 19:05:29 +0100 From: Clemens Ladisch firewire: prevent dropping of completed iso packet header data The buffer for the header data of completed iso packets has a fixed size, so it is possible to configure a stream with a big interval between interrupt packets or with big headers so that this buffer would overflow. Previously, ohci.c would drop any data that would not fit, but this could make unsuspecting applications believe that fewer than the actual number of packets have completed. Instead of dropping data, add calls to flush_iso_completion() so that there are as many events as needed to report all of the data. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/ohci.c | 18 +++++++++--------- include/linux/firewire-cdev.h | 9 +++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) Date: Sun, 18 Mar 2012 19:04:43 +0100 From: Clemens Ladisch firewire: ohci: factor out iso completion flushing code In preparation for the following patches that add more flushing, move the code for flushing accumulated header data into a common function. The timestamp of the last completed packed is passed through the context structure instead of a function parameter to allow accessing this value later outside of the handle_i?_packet functions. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) Date: Sun, 18 Mar 2012 19:04:05 +0100 From: Clemens Ladisch firewire: ohci: simplify iso header pointer arithmetic When storing the header data of completed iso packets, we effectively treat the buffers as arrays of quadlets. Actually declaring the pointers as u32* avoids repetitive pointer arithmetic, removes the unhelpfully named "i" variables, and thus makes the code clearer. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) Date: Sun, 18 Mar 2012 19:03:26 +0100 From: Clemens Ladisch firewire: ohci: optimize control bit checks Doing the endian conversion on the constant instead of the memory field allows the compiler to do the conversion at compile time. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Date: Sun, 18 Mar 2012 19:02:26 +0100 From: Clemens Ladisch firewire: ohci: remove unused excess_bytes field Commit 6498ba04aee6 (remove unused dualbuffer IR code) overlooked a field in struct iso_context. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 1 - 1 file changed, 1 deletion(-) Date: Sun, 18 Mar 2012 19:01:39 +0100 From: Clemens Ladisch firewire: ohci: copy_iso_headers(): make comment match the code The comment incorrectly talked about one little-endian quadlet, while there are actually two. Furthermore, the endianness of the remaining headers depends on whatever protocol is used, so don't mention them. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) Date: Mon, 12 Mar 2012 21:46:55 +0100 From: Clemens Ladisch firewire: cdev: fix IR multichannel event documentation State more precisely when fw_cdev_event_iso_interrupt_mc is sent. While the comment tried to reflect an amibuity in the OHCI specification, there is only one method that is useful in practice, and this also matches all the hardware implementations I've tested. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) Date: Mon, 12 Mar 2012 21:45:47 +0100 From: Clemens Ladisch firewire: ohci: fix too-early completion of IR multichannel buffers handle_ir_buffer_fill() assumed that a completed descriptor would be indicated by a non-zero transfer_status (as in most other descriptors). However, this field is written by the controller as soon as (the end of) the first packet has been written into the buffer. As a consequence, if we happen to run into such a descriptor when the interrupt handler is executed after such a packet has completed, the descriptor would be taken out of the list of active descriptors as soon as the buffer had been partially filled, so the event for the buffer being completely filled would never be sent. To fix this, handle descriptors only when they have been completely filled, i.e., when res_count == 0. (This also matches the condition that is reported by the controller with an interrupt.) Signed-off-by: Clemens Ladisch Cc: 2.6.36+ Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) Date: Sun, 4 Mar 2012 21:34:21 +0100 From: Stefan Richter firewire: ohci: move runtime debug facility out of #ifdef CONFIG_FIREWIRE_OHCI_DEBUG could have been exposed to kernel tweakers if CONFIG_EXPERT was set. But in hindsight, this stuff is far too useful to omit it. So get rid of two #else branches that are only going to bitrot otherwise. Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 5 ----- drivers/firewire/ohci.c | 20 +------------------- 2 files changed, 1 insertion(+), 24 deletions(-) Date: Sun, 4 Mar 2012 14:24:31 +0100 From: Stefan Richter firewire: tone down some diagnostic log messages The "skipped bus generations" message was added together with the respective fw_device retaining/ reviving code in order to see how it all works out. It did well, so don't spam the log anymore. The "register access failure" situation still needs an actual handler. But at this point it makes less sense to ask folks to send mails about it. We now have a pretty good picture of what controllers emit this and when: Texas Instruments PCIxx21 FireWire + CardBus + flash memory card controller: https://bugzilla.redhat.com/show_bug.cgi?id=608544 O2 Micro FireWire + flash memory card controller: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/801719 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/881688 http://marc.info/?l=linux1394-devel&m=132309283531423 http://marc.info/?l=linux1394-devel&m=132368567907469 http://marc.info/?l=linux1394-devel&m=132516165727468 http://marc.info/?l=linux1394-devel&m=133006486927699 Pinnacle Movieboard: commit 7f7e37115a8b6724f26d0637a04e1d35e3c59717 http://marc.info/?l=linux1394-devel&m=130714243325962 Signed-off-by: Stefan Richter --- drivers/firewire/core-topology.c | 1 - drivers/firewire/ohci.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) Date: Sun, 4 Mar 2012 14:23:00 +0100 From: Stefan Richter firewire: sbp2: replace a GFP_ATOMIC allocation sbp2_send_management_orb() is called by sbp2_login, sbp2_reconnect, and sbp2_remove, all which are able to sleep during memory allocations. Actually, sbp2_send_management_orb() itself is a sleeping function. Login and remove could allocate with GFP_KERNEL but reconnect needs GFP_NOIO to ensure progress in low memory situations. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From 5ddae8789f428b608e22788ea601aa8bfa204758 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 13 Feb 2012 21:55:13 +0100 ALSA: dice: fix detection of Weiss devices While most DICE devices keep TCAT's default category ID of 0x04, Weiss devices identify themselves with 0x00. Reported-by: Rolf Anderegg Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) From 9eb69c0d98d33e17caabb532d66730ec34df1afd Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 22 Jan 2012 16:46:23 +0100 ALSA: dice: dice_proc_read: remove wrong typecast Remove a wrong typecast that resulted from a copy-and-paste error. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Date: Wed, 15 Feb 2012 14:59:10 +0000 From: Chris Boot firewire: sbp2: Fix SCSI sense data mangling SCSI sense data in SBP-2/3 is carried in an unusual format that means we have to un-mangle it on our end before we pass it to the SCSI subsystem. Currently our un-mangling code doesn't quite follow the SBP-2 standard in that we always assume Current and never Deferred error types, we never set the VALID bit, and we mishandle the FILEMARK, EOM and ILI bits. This patch fixes the sense un-mangling to correctly handle those and follow the spec. Signed-off-by: Chris Boot Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) Date: Wed, 15 Feb 2012 14:59:09 +0000 From: Chris Boot firewire: sbp2: Ignore SBP-2 targets on the local node The firewire-sbp2 module tries to login to an SBP-2/3 target even when it is running on the local node, which fails because of the inability to fetch data from DMA mapped regions using firewire transactions on the local node. It also doesn't make much sense to have the initiator and target on the same node, so this patch prevents this behaviour. Signed-off-by: Chris Boot Signed-off-by: Stefan Richter (changed the comment) --- drivers/firewire/sbp2.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Wed, 15 Feb 2012 14:59:08 +0000 From: Chris Boot firewire: sbp2: Take into account Unit_Unique_ID If the target's unit directory contains a Unit_Unique_ID entry, we should use that as the target's GUID for identification purposes. The SBP-2 standards document says: "Although the node unique ID (EUI-64) present in the bus information block is sufficient to uniquely identify nodes attached to Serial Bus, it is insufficient to identify a target when a vendor implements a device with multiple Serial Bus node connections. In this case initiator software requires information by which a particular target may be uniquely identified, regardless of the Serial Bus access path used." [ IEEE T10 P1155D Revision 4, Section 7.6 (page 51) ] and [ IEEE T10 P1467D Revision 5, Section 7.9 (page 74) ] Signed-off-by: Chris Boot Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) Date: Tue, 21 Feb 2012 15:38:13 +0530 From: santosh nayak firewire: nosy: Use the macro DMA_BIT_MASK(). Use the macro DMA_BIT_MASK instead of the constant 0xffffffff Signed-off-by: Santosh Nayak Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sat, 18 Feb 2012 20:42:00 +0100 From: Stefan Richter firewire: core: convert AR-req handler lock from _irqsave to _bh fw_core_handle_request() is called by the low-level driver in tasklet context or process context, and fw_core_add/remove_address_handler() is called by mid- or high-level code in process context. So convert address_handler_lock accesses from those which disable local IRQs to ones which just disable local softIRQs. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) Date: Sat, 18 Feb 2012 19:54:45 +0100 From: Stefan Richter firewire: core: fix race at address_handler unregistration Fix the following unlikely but possible race: CPU 1 CPU 2 ------------------------------------------------------------------------ AR-request tasklet lookup handler unregister handler free handler->callback_data or handler call handler->callback The application which registered the handler has no way to stop nodes sending new requests to their address range, hence cannot prevent this race. Fix it simply by extending the address_handler_lock-protected region from only around the lookup to around both lookup and call. We only need to do so in the exclusive region handler; the FCP region handler already holds the lock around the handler->callback call. Alas this removes the current ability to execute the callback in parallel on different CPUs if it was called for different FireWire cards at the same time. (For a single card, the handler is already serialized.) If this loss of a rather obscure feature is not tolerable, a more complex fix would be required: Add a handler reference counter; wait in fw_core_remove_address_handler() for this conter to become zero. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Date: Sat, 18 Feb 2012 19:53:39 +0100 From: Stefan Richter firewire: core: remove obsolete comment Target-like applications or peer-to-peer-like applications require the global address handler registration which we have right now, or a per- card registration. And node lookup, while it would be nice to have, would be impossible in the brief time between self-ID-complete event and completion of firewire-core's topology scanning. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 8 -------- 1 file changed, 8 deletions(-) Date: Sat, 18 Feb 2012 22:03:14 +0100 From: Stefan Richter firewire: core: prefix log messages with card name Associate all log messages from firewire-core with the respective card because some people have more than one card. E.g. firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0 firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0 firewire_core: created device fw0: GUID 0814438400000389, S800 firewire_core: phy config: new root=ffc1, gap_count=5 firewire_core: created device fw1: GUID 0814438400000388, S800 firewire_core: created device fw2: GUID 0001d202e06800d1, S800 turns into firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0 firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0 firewire_core 0000:04:00.0: created device fw0: GUID 0814438400000389, S800 firewire_core 0000:04:00.0: phy config: new root=ffc1, gap_count=5 firewire_core 0000:05:00.0: created device fw1: GUID 0814438400000388, S800 firewire_core 0000:04:00.0: created device fw2: GUID 0001d202e06800d1, S800 This increases the module size slightly; to keep this in check, turn the former printk wrapper macros into functions. Their implementation is largely copied from driver core's dev_printk counterparts. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 28 ++++++++++--- drivers/firewire/core-cdev.c | 10 ++-- drivers/firewire/core-device.c | 60 +++++++++++++--------------- drivers/firewire/core-topology.c | 18 ++++---- drivers/firewire/core-transaction.c | 4 +- drivers/firewire/core.h | 6 +++ include/linux/firewire.h | 3 - 7 files changed, 72 insertions(+), 57 deletions(-) Date: Sun, 19 Feb 2012 12:48:36 +0100 From: Stefan Richter firewire: net: use dev_printk API Change the log line prefix from "firewire_net: " to "net firewire0: " etc. for the case that several RFC 2734 interfaces are being used in the same machine. Note, the netdev_printk API is not very useful to firewire-net. netdev_notice(net, "abc\n") would result in irritating messages like "firewire_ohci 0000:0a:00.0: firewire0: abc". Nor would a dev_printk on the fw_unit.device to which firewire-net is being bound be useful, because there are generally multiple ones of those per interface (from all RFC 2734 peers on the bus, the local node being only one of them). In the initialization message of each interface, log the PCI device name of the card which is parent of the netdevice instead of the GUID of the peer which was semi-randomly used to establish the netdevice. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) Date: Sat, 18 Feb 2012 22:01:54 +0100 From: Stefan Richter firewire: net: identify to driver core as "firewire_net", not "net" On second thought, there is little reason to have driver name differ from module name. Therefore, change /sys/bus/firewire/drivers/net /sys/bus/firewire/devices/fw0.0/driver -> [...]/net /sys/module/firewire_net/drivers/firewire:net to /sys/bus/firewire/drivers/firewire_net /sys/bus/firewire/devices/fw0.0/driver -> [...]/firewire_net /sys/module/firewire_net/drivers/firewire:firewire_net It is redundant but consistent with firewire-sbp2's recently changed driver name. I don't see this anywhere used, so it should not matter either way. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 18 Feb 2012 22:01:14 +0100 From: Stefan Richter firewire: sbp2: identify to driver core as "firewire_sbp2", not "sbp2" Commit eba9ebaaa26d "firewire: sbp2: use dev_printk API" changed messages from e.g. firewire_sbp2: fw3.0: logged in to LUN 0000 (0 retries) to sbp2 fw3.0: logged in to LUN 0000 (0 retries) because the driver calls itself as "sbp2" when registering with driver core and with SCSI core. This is of course confusing, so switch to the name "firewire_sbp2" for driver core in order to match what lsmod and /sys/module/ show. So we are back to firewire_sbp2 fw3.0: logged in to LUN 0000 (0 retries) in the kernel log. This also changes /sys/bus/firewire/drivers/sbp2 /sys/bus/firewire/devices/fw3.0/driver -> [...]/sbp2 /sys/module/firewire_sbp2/drivers/firewire:sbp2 to /sys/bus/firewire/drivers/firewire_sbp2 /sys/bus/firewire/devices/fw3.0/driver -> [...]/firewire_sbp2 /sys/module/firewire_sbp2/drivers/firewire:firewire_sbp2 but "cat /sys/class/scsi_host/host27/proc_name" stays "sbp2" just in case that proc_name is used by any userland. The transport detection in lsscsi is not affected. (Tested with lsscsi version 0.25.) Udev's /dev/disk/by-id and by-path symlinks are not affected either. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) Date: Sun, 29 Jan 2012 12:41:15 +0100 From: Stefan Richter firewire: ohci: disable MSI on Ricoh controllers The PCIe device FireWire (IEEE 1394) [0c00]: Ricoh Co Ltd FireWire Host Controller [1180:e832] (prog-if 10 [OHCI]) is unable to access attached FireWire devices when MSI is enabled but works if MSI is disabled. http://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg28251.html Hence add the "disable MSI" quirks flag for this device, or in fact for safety and simplicity for all current (R5U230, R5U231, R5U240) and future Ricoh PCIe 1394 controllers. Reported-by: Stefan Thomas Cc: 2.6.36+ Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Thu, 26 Jan 2012 22:05:58 +0100 From: Clemens Ladisch firewire: ohci: add reset packet quirk for SB Audigy The Audigy's SB1394 controller is actually from Texas Instruments and has the same bus reset packet generation bug, so it needs the same quirk entry. Signed-off-by: Clemens Ladisch Cc: 2.6.36+ Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 ++++ 1 file changed, 4 insertions(+) From 526795d69f5be6d058bdf89a65a303a1ee136aba Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 8 Jan 2012 22:18:00 +0100 [PATCH 9/9] ALSA: dice: document quadlet alignment Doing accesses without quadlet alignment is a bad idea because the firmware's byte-swapping would garble the data; clarify this in the documentation. Signed-off-by: Clemens Ladisch --- sound/firewire/dice-interface.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) From e27d3a9eb7b1faad9df75de68db9879ea54efd19 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 5 Jan 2012 22:36:08 +0100 [PATCH 8/9] ALSA: dice: add a proc file to show device information For easier debugging, add a proc file to show the device's capabilities and current status. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 246 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) From 1684cef612a7295667fcb8348257eaabb54cf29e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 5 Jan 2012 22:16:24 +0100 [PATCH 7/9] ALSA: dice: check clock change timeout Output a warning if the wait for the clock change notification times out. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) From 5e36fef41579d62c45111dd5bde2f9685b301b0e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 4 Dec 2011 22:07:01 +0100 [PATCH 5/9] ALSA: dice: dynamic sample rate selection Instead of relying of some control panel application to configure some fixed sample rate, allow applications to set it automatically. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 137 +++++++++++++++++++++++++++++++----------- 1 file changed, 102 insertions(+), 35 deletions(-) From 4eedb5b4f608f4a932a23967186aa87f8b41293a Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 4 Dec 2011 22:23:59 +0100 [PATCH 4/9] ALSA: dice: get rate-dependent parameters In preparation for sample rate selection support, read the stream parameters that might change when running at different sample rates. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 93 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 2 deletions(-) From ed30098478b23478e2bed0d4b8e526216edbdd67 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 5 Dec 2011 22:09:42 +0100 [PATCH 3/9] ALSA: dice: allow notifications during initialization Reorganize the initialization order so that the driver can receive notifications earlier. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) From 4cacc66e7690c21a837f52e868c76baa42f344b3 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 4 Dec 2011 21:47:00 +0100 [PATCH 2/9] ALSA: dice: get clock capabilities In preparation for sample rate selection support, ensure that the driver knows about the device's clock capabilities. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) From 018d4b379496d2530095993d696acb0c4191f323 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 16 Oct 2011 21:39:00 +0200 [PATCH 1/9] ALSA: dice: make amdtp_rates[] const Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 2 +- sound/firewire/amdtp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Date: Tue, 20 Dec 2011 21:34:12 +0100 From: Stefan Richter firewire: sbp2: use dev_printk API All messages are uniformly prefixed by driver name and device name now. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 93 ++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 42 deletions(-) Date: Tue, 20 Dec 2011 21:32:46 +0100 From: Stefan Richter firewire: ohci: use dev_printk API All messages are uniformly prefixed by driver name and device name now. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 185 +++++++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 79 deletions(-) From f29bf150b7ba0624142496c84bb48ddba561c0e2 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sat, 27 Aug 2011 20:05:15 +0200 ALSA: dice: fix locking Avoid a lock inversion between dice->mutex and pcm->open_mutex. Signed-off-by: Stefan Richter Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) From d79b51cb3e1ff55e0d7d87a0b57e54e16fcf29ab Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 11 Oct 2011 17:51:16 +0200 ALSA: dice: remove superfluous field The pcm field was not actually used. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) Date: Sat, 15 Oct 2011 23:12:23 +0200 From: Clemens Ladisch firewire: ohci: fix isochronous DMA synchronization Add the dma_sync_single_* calls necessary to ensure proper cache synchronization for isochronous data buffers on non-coherent architectures. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) Date: Sat, 15 Oct 2011 23:09:51 +0200 From: Clemens Ladisch dma-mapping: fix sync_single_range_* DMA debugging Commit 5fd75a7850b5 (dma-mapping: remove unnecessary sync_single_range_* in dma_map_ops) unified not only the dma_map_ops but also the corresponding debug_dma_sync_* calls. This led to spurious WARN()ings like the following because the DMA debug code was no longer able to detect the DMA buffer base address without the separate offset parameter: WARNING: at lib/dma-debug.c:911 check_sync+0xce/0x446() firewire_ohci 0000:04:00.0: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x00000000cedaa400] [size=1024 bytes] Call Trace: ... [] check_sync+0xce/0x446 [] debug_dma_sync_single_for_device+0x39/0x3b [] ohci_queue_iso+0x4f3/0x77d [firewire_ohci] ... To fix this, unshare the sync_single_* and sync_single_range_* implementations so that we are able to call the correct debug_dma_sync_* functions. Signed-off-by: Clemens Ladisch --- include/asm-generic/dma-mapping-common.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) Date: Sat, 15 Oct 2011 18:14:39 +0200 From: Clemens Ladisch firewire: ohci: work around selfID junk due to wrong gap count If a device's firmware initiates a bus reset by setting the IBR bit in PHY register 1 without resetting the gap count field to 63 (and without having sent a PHY configuration packet beforehand), the gap count of this node will remain at the old value after the bus reset and thus be inconsistent with the gap count on all other nodes. The bus manager is supposed to detect the inconsistent gap count values in the self ID packets and correct them by issuing another bus reset. However, if the buggy device happens to be the cycle master, and if it sends a cycle start packet immediately after the bus reset (which is likely after a long bus reset), then the time between the end of the selfID phase and the start of the cycle start packet will be based on the too-small gap count value, so this gap will be too short to be detected as a subaction gap by the other nodes. This means that the cycle start packet will be assumed to be self ID data, and will be stored after the actual self ID quadlets in the self ID buffer. This garbage in the self ID buffer made firewire-core ignore all of the self ID data, and thus prevented the Linux bus manager from correcting the problem. Furthermore, because the bus reset handling was aborted completely, asynchronous transfers would be no longer handled correctly, and fw_run_transaction() would hang until the next bus reset. To fix this, make the detection of inconsistent self IDs more discriminating: If the invalid data in the self ID buffer looks like a cycle start packet, we can assume that the previous data in the buffer is correctly received self ID information, and process it normally. (We inspect only the first quadlet of the cycle start packet, because this value is different enough from any valid self ID quadlet, and many controllers do not store the cycle start packet in five quadlets because they expect self ID data to have an even number of quadlets.) This bug has been observed when a bus-powered DesktopKonnekt6 is switched off with its power button. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) Date: Mon, 26 Sep 2011 21:44:30 +0200 From: Stephan Gatzka firewire: net: Use posted writes Change memory region to ohci "middle address space". This effectively reduces the number of packets by 50%. [Stefan R.:] This eliminates 1394 ack packets and improved throughput by a few percent in some tests with an S400a connection with and without gap count optimization. Since firewire-net taxes the AR-req DMA unit of a FireWire controller much more than firewire-sbp2 (which uses the middle address space with PCI posted writes too), this commit also changes a related error printk into a ratelimited one as a precaution. Side note: The IPv4-over-1394 drivers of Mac OS X 10.4, Windows XP SP3, and the Thesycon 1394 bus driver for Windows all use the middle address space too. Signed-off-by: Stephan Gatzka Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 9 ++------- drivers/firewire/ohci.c | 3 ++- 2 files changed, 4 insertions(+), 8 deletions(-) Date: Sun, 19 Jun 2011 10:10:43 +0000 (+0200) From: Clemens Ladisch ALSA: isight: remove superfluous field Remove a field that is not used at all. This remained from earlier tests, but the current driver has decided not to handle iris notifications. Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 1 - 1 file changed, 1 deletion(-) Date: Mon, 19 Sep 2011 00:20:48 +0200 From: Stefan Richter firewire: use clamp and min3 macros Use kernel.h's convenience macros. Also omit a printk that should never happen and won't matter much if it ever happened. Signed-off-by: Stefan Richter [[2.6.36 backport without min3]] --- drivers/firewire/core-transaction.c | 4 ++-- drivers/firewire/net.c | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) Date: Mon, 19 Sep 2011 09:29:30 +0200 From: Stefan Richter firewire: ohci: optimize TSB41BA3D detection Takes less source code and machine code, and less runtime with PHYs other than TSB41BA3D (e.g. TSB81BA3 with device ID 0x831304 which takes one instead of six read_paged_phy_reg now). Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) Date: Mon, 19 Sep 2011 00:17:37 +0200 From: Stefan Richter firewire: ohci: TSB41BA3D support tweaks Fix: phy_reg_mutex must be held over the write/read_phy_reg pair which gets PHY port status. Only print to the log when a TSB41BA3D was found. By far most TSB82AA2 cards have a TSB81BA3, and firewire-ohci can keep quiet about that. Shorten some strings and comments. Change some whitespace. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 74 ++++++++++++---------------------------- 1 file changed, 23 insertions(+), 51 deletions(-) Date: Mon, 12 Sep 2011 22:23:53 +0200 From: Stephan Gatzka firewire: ohci: Add support for TSB41BA3D phy This patch implements a work around for the Texas Instruments PHY TSB41BA3D. This phy has a bug at least in combination with the TI LLCs TSB82AA2B and TSB12LV26. The selfid coming from the locally connected phy is not propagated into the selfid buffer of the OHCI (see http://www.ti.com/litv/pdf/sllz059 for details). The main idea is to construct the selfid ourselves. Signed-off-by: Stephan Gatzka Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 185 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+), 2 deletions(-) Date: Mon, 25 Jul 2011 22:16:24 +0200 From: Stephan Gatzka firewire: ohci: Move code from the bus reset tasklet into a workqueue Code inside bus_reset_work may now sleep. This is a prerequisite to support a phy from Texas Instruments cleanly. The patch to support this phy will be submitted later. Signed-off-by: Stephan Gatzka Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) Date: Wed, 31 Aug 2011 10:45:46 +0800 From: Ming Lei firewire: ohci: add no MSI quirk for O2Micro controller This fixes https://bugs.launchpad.net/ubuntu/+source/linux/+bug/801719 . An O2Micro PCI Express FireWire controller, "FireWire (IEEE 1394) [0c00]: O2 Micro, Inc. Device [1217:11f7] (rev 05)" which is a combination device together with an SDHCI controller and some sort of storage controller, misses SBP-2 status writes from an attached FireWire HDD. This problem goes away if MSI is disabled for this FireWire controller. The device reportedly does not require QUIRK_CYCLE_TIMER. Signed-off-by: Ming Lei Signed-off-by: Stefan Richter (amended changelog) Cc: --- drivers/firewire/ohci.c | 3 +++ 1 file changed, 3 insertions(+) From fdc9cca4a7ffb213425fee7cdc3bf16ca5e72313 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 19:02:32 +0200 [PATCH 8/8] ALSA: dice: remove 10s period length limit Since commit f2b3614cefb6 (Don't check DMA time-out too shortly), we need no longer to restrict the period length to less than 10 s. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From 87406ea1b9c8486c4e16d2c6c61f0fe3e3c20d53 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 18:32:44 +0200 [PATCH 7/8] ALSA: dice: avoid superflous write at bus reset When a bus reset happens, the enable register is automatically cleared, so we do not need to clear it manually when stopping the stream. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 5 +++++ 1 file changed, 5 insertions(+) From 7f5cede774247f6a5cb0d32083ed104dfaeb1212 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 18:25:54 +0200 [PATCH 6/8] ALSA: firewire: extend snd_fw_transaction() Add a flag to snd_fw_transaction() to allow it to abort when a bus reset happens. This removes most of the duplicated error handling loops that were required around calls to the low-level fw_run_transaction(). Also add a flag to suppress error messages; errors are expected when we attempt to clean up after the device was unplugged. Signed-off-by: Clemens Ladisch --- sound/firewire/cmp.c | 48 ++++----- sound/firewire/dice.c | 207 ++++++++++++-------------------------- sound/firewire/fcp.c | 2 sound/firewire/isight.c | 43 ++++---- sound/firewire/lib.c | 24 +++- sound/firewire/lib.h | 7 + sound/firewire/speakers.c | 2 7 files changed, 130 insertions(+), 203 deletions(-) From 3c5079443753f50618422e9a0203781f06a1a89a Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 18:12:28 +0200 [PATCH 5/8] ALSA: dice: optimize reading of consecutive registers Instead of reading two consecutive register with two quadlet requests, use one block read request. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) From 30aea89da4b916306c602f34c5b19f5bc5dfeca5 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sat, 25 Jun 2011 21:43:10 +0200 [PATCH 4/8] ALSA: dice: support dual-wire stream format at 192 kHz Change the AMDTP streaming code to handle the non-standard stream format that DICE devices use at sample rates greater than 96 kHz. Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 157 +++++++++++++++++++++++++++++++------- sound/firewire/amdtp.h | 41 +++------- sound/firewire/dice.c | 29 +++++-- sound/firewire/speakers.c | 6 + 4 files changed, 165 insertions(+), 68 deletions(-) From f9e0df98ff3ad1146ee67738ed061386727f1991 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 17:29:29 +0200 [PATCH 3/8] ALSA: dice: fix device detection for other vendors DICE devices do not have a unique specifier ID in their unit directory (it's always the same as the device vendor's ID), so rely on just the version ID for driver loading, and use a heuristic in the probe callback to detect actual DICE devices. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 102 +++++++++++++++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 18 deletions(-) From 5d3de9436c06691a22d0605fa373302eab985cb3 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 17:18:48 +0200 [PATCH 2/8] ALSA: dice: reorganize interface definitions Move the DICE interface symbols into a separate header file, and add more documentation. Signed-off-by: Clemens Ladisch --- sound/firewire/dice-interface.h | 371 ++++++++++++++++++++++++++++++++ sound/firewire/dice.c | 209 ------------------ 2 files changed, 373 insertions(+), 207 deletions(-) create mode 100644 sound/firewire/dice-interface.h From 5ac97683122b2d326d1d644a42f8343f85fdfd70 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 19 Jun 2011 15:23:04 +0200 [PATCH 1/8] ALSA: firewire: introduce amdtp_out_stream_running() Introduce the helper function amdtp_out_stream_running(). This makes many checks in amdtp.c clearer and frees the device drivers from having to track this with a separate variable. Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 10 +++++----- sound/firewire/amdtp.h | 6 ++++++ sound/firewire/dice.c | 17 +++++------------ sound/firewire/speakers.c | 8 ++------ 4 files changed, 18 insertions(+), 23 deletions(-) Date: Sat, 27 Aug 2011 18:53:03 +0200 From: Stefan Richter firewire: move fw_device reference counting from drivers to core fw_unit device drivers invariably need to talk to the fw_unit's parent (an fw_device) and grandparent (an fw_card). firewire-core already maintains an fw_card reference for the entire lifetime of an fw_device. Likewise, let firewire-core maintain an fw_device reference for the entire lifetime of an fw_unit so that fw_unit drivers don't have to. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 2 ++ drivers/firewire/core.h | 13 +++++++++++++ include/linux/firewire.h | 12 ------------ sound/firewire/dice.c | 5 ----- sound/firewire/isight.c | 4 +--- sound/firewire/speakers.c | 4 ---- 6 files changed, 16 insertions(+), 24 deletions(-) Date: Sat, 27 Aug 2011 15:35:23 +0200 From: Stefan Richter firewire: sbp2: fold two functions into one sbp2_release_target() is folded into its primary user, sbp2_remove(). The only other caller, a failure path in sbp2_probe(), now uses sbp2_remove(). This adds unnecessary cancel_delayed_work_sync() calls to that failure path but results in less code and text. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) Date: Sat, 27 Aug 2011 15:34:32 +0200 From: Stefan Richter firewire: sbp2: move some code to more sensible places Implement sbp2_queue_work(), which is now a very simple accessor to one of the struct sbp2_logical_unit members, right after the definition of struct sbp2_logical_unit. Put the sbp2_reconnect() implementation right after the sbp2_login() implementation. They are both part of the SBP-2 access protocol. Implement the driver methods sbp2_probe(), spp2_update(), sbp2_remove() in this order, reflecting the lifetime of an SBP-2 target. Place the sbp2_release_target() implementation right next to sbp2_remove() which is its primary user, and after sbp2_probe() which is the counterpart to sbp2_release_target(). There are no changes to the implementations here, or at least not meant to be. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 213 ++++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 106 deletions(-) Date: Sat, 27 Aug 2011 15:33:34 +0200 From: Stefan Richter firewire: sbp2: remove obsolete reference counting Since commit 0278ccd9d53e07c4e699432b2fed9de6c56f506c "firewire: sbp2: fix panic after rmmod with slow targets", the lifetime of an sbp2_target instance does no longer extent past the return of sbp2_remove(). Therefore it is no longer necessary to call fw_unit_get/put() and fw_device_get/put() in sbp2_probe/remove(). Furthermore, said commit also ensures that lu->work is not going to be executed or requeued at a time when the sbp2_target is no longer in use. Hence there is no need for sbp2_target reference counting for lu->work. Other concurrent contexts: - Processes which access the sysfs of the SCSI host device or of one of its subdevices are safe because these interfaces are all removed by scsi_remove_device/host() in sbp2_release_target(). - SBP-2 command block ORB transactions are finished when scsi_remove_device() in sbp2_release_target() returns. - SBP-2 management ORB transactions are finished when cancel_delayed_work_sync(&lu->work) before sbp2_release_target() returns. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 57 ++++++++++++---------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) Date: Mon, 22 Aug 2011 21:38:38 +0100 From: Chris Boot firewire: sbp2: fix panic after rmmod with slow targets If firewire-sbp2 starts a login to a target that doesn't complete ORBs in a timely manner (and has to retry the login), and the module is removed before the operation times out, you end up with a null-pointer dereference and a kernel panic. [SR: This happens because sbp2_target_get/put() do not maintain module references. scsi_device_get/put() do, but at occasions like Chris describes one, nobody holds a reference to an SBP-2 sdev.] This patch cancels pending work for each unit in sbp2_remove(), which hopefully means there are no extra references around that prevent us from unloading. This fixes my crash. Signed-off-by: Chris Boot Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Sun, 7 Aug 2011 15:20:18 +0200 From: Stefan Richter firewire: core: handle ack_busy when fetching the Config ROM Some older Panasonic made camcorders (Panasonic AG-EZ30 and NV-DX110, Grundig Scenos DLC 2000) reject requests with ack_busy_X if a request is sent immediately after they sent a response to a prior transaction. This causes firewire-core to fail probing of the camcorder with "giving up on config rom for node id ...". Consequently, programs like kino or dvgrab are unaware of the presence of a camcorder. Such transaction failures happen also with the ieee1394 driver stack (of the 2.4...2.6 kernel series until 2.6.36 inclusive) but with a lower likelihood, such that kino or dvgrab are generally able to use these camcorders via the older driver stack. The cause for firewire-ohci's or firewire-core's worse behavior is not yet known. Gap count optimization in firewire-core is not the cause. Perhaps the slightly higher latency of transaction completion in the older stack plays a role. (ieee1394: AR-resp DMA context tasklet -> packet completion ktread -> user process; firewire-core: tasklet -> user process.) This change introduces retries and delays after ack_busy_X into firewire-core's Config ROM reader, such that at least firewire-core's probing and /dev/fw* creation are successful. This still leaves the problem that userland processes are facing transaction failures. gscanbus's built-in retry routines deal with them successfully, but neither kino's nor dvgrab's do ever succeed. But at least DV capture with "dvgrab -noavc -card 0" works now. Live video preview in kino works too, but not actual capture. One way to prevent Configuration ROM reading failures in application programs is to modify libraw1394 to synthesize read responses by means of firewire-core's Configuration ROM cache. This would only leave CMP and FCP transaction failures as a potential problem source for applications. Reported-and-tested-by: Thomas Seilund Reported-and-tested-by: René Fritz Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) Date: Thu, 11 Aug 2011 20:40:42 +0200 From: Stefan Richter firewire: ohci: fix DMA unmapping in an error path If request_irq failed, we would pass wrong arguments to dma_free_coherent. https://bugzilla.redhat.com/show_bug.cgi?id=728185 Reported-by: Mads Kiilerich Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Date: Thu, 11 Aug 2011 00:06:04 +0200 From: Stefan Richter firewire: cdev: fix 32 bit userland on 64 bit kernel compat corner cases Clemens points out that we need to use compat_ptr() in order to safely cast from u64 to addresses of a 32-bit usermode client. Before, our conversion went wrong - in practice if the client cast from pointer to integer such that sign-extension happened, (libraw1394 and libdc1394 at least were not doing that, IOW were not affected) or - in theory on s390 (which doesn't have FireWire though) and on the tile architecture, regardless of what the client does. The bug would usually be observed as the initial get_info ioctl failing with "Bad address" (EFAULT). Reported-by: Carl Karsten Reported-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) Date: Sun, 10 Jul 2011 00:23:03 +0200 From: Stefan Richter firewire: ohci: do not bind to Pinnacle cards, prevent panic When firewire-ohci is bound to a Pinnacle MovieBoard, eventually a "Register access failure" is logged and an interrupt storm or a kernel panic happens. https://bugzilla.kernel.org/show_bug.cgi?id=36622 Until this is sorted out (if that is going to succeed at all), let's just prevent firewire-ohci from touching these devices. Signed-off-by: Stefan Richter Cc: --- drivers/firewire/ohci.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Sat, 9 Jul 2011 16:48:29 +0200 From: Stefan Richter firewire: document the sysfs ABIs of firewire-core and firewire-sbp2. Signed-off-by: Stefan Richter --- Documentation/ABI/stable/sysfs-bus-firewire | 122 ++++++++++++++++++++ 1 file changed, 122 insertions(+) Date: Thu, 14 Jul 2011 21:08:39 +0200 From: Stefan Richter firewire: cdev: ABI documentation enhancements Add overview documentation in Documentation/ABI/stable/firewire-cdev. Improve the inline reference documentation in firewire-cdev.h: - Add /* available since kernel... */ comments to event numbers consistent with the comments on ioctl numbers. - Shorten some documentation on an event and an ioctl that are less interesting to current programming because there are newer preferable variants. - Spell Configuration ROM (name of an IEEE 1212 register) in upper case. - Move the dummy FW_CDEV_VERSION out of the reader's field of vision. We should remove it from the header next year or so. Signed-off-by: Stefan Richter --- Documentation/ABI/stable/firewire-cdev | 103 +++++++++++++++++++++++++ include/linux/firewire-cdev.h | 75 ++++++++---------- 2 files changed, 137 insertions(+), 41 deletions(-) Date: Sat, 9 Jul 2011 16:43:22 +0200 From: Stefan Richter firewire: cdev: prevent race between first get_info ioctl and bus reset event queuing Between open(2) of a /dev/fw* and the first FW_CDEV_IOC_GET_INFO ioctl(2) on it, the kernel already queues FW_CDEV_EVENT_BUS_RESET events to be read(2) by the client. The get_info ioctl is practically always issued right away after open, hence this condition only occurs if the client opens during a bus reset, especially during a rapid series of bus resets. The problem with this condition is twofold: - These bus reset events carry the (as yet undocumented) @closure value of 0. But it is not the kernel's place to choose closures; they are privat to the client. E.g., this 0 value forced from the kernel makes it unsafe for clients to dereference it as a pointer to a closure object without NULL pointer check. - It is impossible for clients to determine the relative order of bus reset events from get_info ioctl(2) versus those from read(2), except in one way: By comparison of closure values. Again, such a procedure imposes complexity on clients and reduces freedom in use of the bus reset closure. So, change the ABI to suppress queuing of bus reset events before the first FW_CDEV_IOC_GET_INFO ioctl was issued by the client. Note, this ABI change cannot be version-controlled. The kernel cannot distinguish old from new clients before the first FW_CDEV_IOC_GET_INFO ioctl. We will try to back-merge this change into currently maintained stable/ longterm series, and we only document the new behaviour. The old behavior is now considered a kernel bug, which it basically is. Signed-off-by: Stefan Richter Cc: --- drivers/firewire/core-cdev.c | 18 ++++++++++-------- include/linux/firewire-cdev.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) Date: Sat, 9 Jul 2011 16:42:26 +0200 From: Stefan Richter firewire: cdev: return -ENOTTY for unimplemented ioctls, not -EINVAL On Jun 27 Linus Torvalds wrote: > The correct error code for "I don't understand this ioctl" is ENOTTY. > The naming may be odd, but you should think of that error value as a > "unrecognized ioctl number, you're feeding me random numbers that I > don't understand and I assume for historical reasons that you tried to > do some tty operation on me". [...] > The EINVAL thing goes way back, and is a disaster. It predates Linux > itself, as far as I can tell. You'll find lots of man-pages that have > this line in it: > > EINVAL Request or argp is not valid. > > and it shows up in POSIX etc. And sadly, it generally shows up > _before_ the line that says > > ENOTTY The specified request does not apply to the kind of object > that the descriptor d references. > > so a lot of people get to the EINVAL, and never even notice the ENOTTY. [...] > At least glibc (and hopefully other C libraries) use a _string_ that > makes much more sense: strerror(ENOTTY) is "Inappropriate ioctl for > device" So let's correct this in the ABI while it is still young, relative to distributor adoption. Side note: We return -ENOTTY not only on _IOC_TYPE or _IOC_NR mismatch, but also on _IOC_SIZE mismatch. An ioctl with an unsupported size of argument structure can be seen as an unsupported version of that ioctl. Signed-off-by: Stefan Richter Cc: --- drivers/firewire/core-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Wed, 6 Jul 2011 19:33:15 +0200 From: Stefan Richter [media] firedtv: change some -EFAULT returns to more fitting error codes Mauro Carvalho Chehab wrote: > I'm validating if all drivers are behaving equally with respect to the > error codes returned to userspace, and double-checking with the API. > > On almost all places, -EFAULT code is used only to indicate when > copy_from_user/copy_to_user fails. However, firedtv uses a lot of > -EFAULT, where it seems to me that other error codes should be used > instead (like -EIO for bus transfer errors and -EINVAL/-ERANGE for > invalid/out of range parameters). This concerns only the CI (CAM) related code of firedtv of which I know little. Let's just pass through the error returns of lower level I/O code where applicable, and -EACCES (permission denied) when a seemingly valid but negative FCP response or an unknown-to-firedtv CA message is received. Signed-off-by: Stefan Richter Cc: Henrik Kurelid --- drivers/media/dvb/firewire/firedtv-avc.c | 2 drivers/media/dvb/firewire/firedtv-ci.c | 34 +++++++++++------------ 2 files changed, 17 insertions(+), 19 deletions(-) Date: Sun, 3 Jul 2011 17:39:26 +0200 From: Stefan Richter firewire: ohci: skip soft reset retries after card ejection The software reset in firewire-ohci's pci_remove does not have a great prospect of success if the card was already physically removed at this point. So let's skip the 500 ms that were spent in retries here. Also, replace a defined constant by its open-coded value. This is not a constant from a specification but an arbitrarily chosen retry limit. It was only used in this single place. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) Date: Wed, 22 Jun 2011 21:05:08 +0200 From: Stefan Richter firewire: ohci: fix PHY reg access after card ejection Detect and handle ejection of FireWire CardBus cards in PHY register accesses: - The last attempt of firewire-core to reset the bus during shutdown caused a spurious "firewire_ohci: failed to write phy reg" error message in the log. Skip this message as well as the prior retry loop that needlessly took 100 milliseconds. - In the unlikely case that a PHY register was read right after card ejection, a bogus value was obtained and possibly acted upon. Instead, fail the read attempt. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Tue, 21 Jun 2011 15:24:26 +0200 From: Stefan Richter firewire: ohci: add a comment on PHY reg access serialization Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 ++++++ 1 file changed, 6 insertions(+) From cf6f1ff17f56c275424c5a341fc4d27ccbbfa71c Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 17 Jun 2011 08:18:35 +0200 [PATCH] ALSA: isight: adjust for new queueing API Since commit 13882a82ee16 (optimize iso queueing by setting wake only after the last packet), drivers are required to call fw_iso_context_queue_flush() after queueing a batch of packets. The missing call would have an effect only if the controller queue underruns, but then the DMA would stop completely. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/firewire/isight.c | 1 + 1 file changed, 1 insertion(+) Date: Wed, 22 Jun 2011 20:39:03 +0200 From: Stefan Richter ALSA: fireworks: adjust for new queueing API --- sound/firewire/fireworks.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Sun, 12 Jun 2011 17:00:56 +0200 From: Stefan Richter ALSA: fireworks: avoid duplicate variable name 'index' Pointed out by sparse: "symbol 'index' shadows an earlier one". Could also be fixed by static int interface_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; module_param_array_named(index, interface_index, int, NULL, 0444); [...] err = snd_card_create(interface_index[card_index], id[card_index], THIS_MODULE, --- sound/firewire/fireworks.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) Date: Sun, 12 Jun 2011 17:00:56 +0200 From: Stefan Richter ALSA: fireworks: fix lock imbalance in an error path Pointed out by sparse: "context imbalance in 'capture_iso_callback' - different lock contexts for basic block". --- sound/firewire/fireworks.c | 1 + 1 file changed, 1 insertion(+) From 2a2405fac5f900608eff5ea89926480aad475877 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:49:53 +0200 [PATCH 12/12] ALSA: fireworks: add MIDI output --- sound/firewire/fireworks.c | 195 ++++++++++++++++++++++++++++++------- 1 file changed, 158 insertions(+), 37 deletions(-) From 331f4c14546bbfd5ab42dc646b087898bc18df62 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:49:42 +0200 [PATCH 11/12] ALSA: fireworks: allow PCM streams to be started synchronously --- sound/firewire/fireworks.c | 75 ++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 42 deletions(-) From bad1f8034d68fd4c7d722cf7cd27573d4d556277 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:49:31 +0200 [PATCH 10/12] ALSA: fireworks: add PCM playback --- sound/firewire/fireworks.c | 627 ++++++++++++++++++++++++++++++++++++- 1 file changed, 617 insertions(+), 10 deletions(-) From 513450c9e03dbf56f238019f232dcad2b6016470 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:49:19 +0200 [PATCH 09/12] ALSA: fireworks: check received CIP headers for consistency --- sound/firewire/fireworks.c | 97 ++++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 19 deletions(-) From 4c0e62d5d862d187b2e92070e6016a7037380da9 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:49:07 +0200 [PATCH 08/12] ALSA: fireworks: add identify control --- sound/firewire/fireworks.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) From b5fcebfec4f6e6a8858e708d97979d83d2ccb471 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:48:55 +0200 [PATCH 07/12] ALSA: fireworks: add polled values control --- sound/firewire/fireworks.c | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) From 86b939359167083c1e6d6edc3181ee2fb3229a66 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:48:43 +0200 [PATCH 06/12] ALSA: fireworks: add hardware capabilities control --- sound/firewire/fireworks.c | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) From dd80a554f38649b8768717e772e8b0d0b8dd0e49 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:48:26 +0200 [PATCH 05/12] ALSA: fireworks: synchronize PCM stream start with fw data --- sound/firewire/fireworks.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) From 6afe12c0d1ef003fb6e57e6d34df01b1f391a50d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:48:10 +0200 [PATCH 04/12] ALSA: fireworks: add PCM capture --- sound/firewire/fireworks.c | 236 +++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) From 38d7d9f0974b2265ba50931b9d0be3066d0bb210 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:47:49 +0200 [PATCH 03/12] ALSA: fireworks: fix bus reset handling --- sound/firewire/fireworks.c | 74 +++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 4 deletions(-) From bfd3510a4340c9cf2d3722baf262d84756acd970 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:46:27 +0200 [PATCH 02/12] ALSA: fireworks: add MIDI capture --- sound/firewire/fireworks.c | 431 +++++++++++++++++++++++++++++++++++++ 1 file changed, 431 insertions(+) From fb9ed6a705e827f49f65de123d698171ad72d6e3 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 30 Sep 2010 14:46:10 +0200 [PATCH 01/12] ALSA: add Echo Fireworks support skeleton driver only [StefanR: - forward-merge to 2.6.39 + firewire patches + snd-dice patches, - added #include ] --- Documentation/sound/alsa/ALSA-Configuration.txt | 7 + sound/firewire/Kconfig | 15 + sound/firewire/Makefile | 2 + sound/firewire/fireworks.c | 606 ++++++++++++++++ sound/firewire/fireworks.h | 201 +++++ 5 files changed, 831 insertions(+) create mode 100644 sound/firewire/Kconfig create mode 100644 sound/firewire/Makefile create mode 100644 sound/firewire/fireworks.c create mode 100644 sound/firewire/fireworks.h Date: Sun, 12 Jun 2011 14:30:57 +0200 From: Stefan Richter firewire: ohci: reduce potential context_stop latency Stopping an isochronous reception DMA context takes two loop iterations in context_stop on several controllers (JMicron, NEC, VIA). But there is no extra delay necessary between these two reg_read trials; the MMIO reads themselves are slow enough. Hence bring back the behavior from before commit dd6254e5c0efe01ad255188898cb3dadf98cb56d "firewire: ohci: remove superfluous posted write flushes" on these controllers by means of an "if (i)" condition. Isochronous context stop is performed in preemptible contexts (and only rarely), hence this change is of little impact. (Besides, Agere and TI controllers always, or almost always, have the context stopped already at the first ContextControl read.) More important is asynchronous transmit context stop, which is performed while local interrupts are disabled (on the two AT DMAs in bus_reset_tasklet, i.e. after a self-ID-complete event). In my experience with several controllers, tested with a usermode AT-request transmitter as well as with FTP transmission over firewire-net, the AT contexts were luckily already stopped at the first ContextControl read, i.e. never required another MMIO read let alone mdelay. A possible explanation for this is that the controllers which I tested perhaps stop AT DMA before they perform the self-ID reception DMA. But we cannot be sure about that and should keep the interrupts-disabled busy loop as short as possible. Hence, query the ContextControl register in 1000 udelay(10) intervals instead of 10 udelay(1000) intervals. I understand from an estimation by Clemens Ladisch that stopping a busy DMA context should take microseconds or at worst tens of microseconds, not milliseconds. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Date: Mon, 16 May 2011 08:10:10 +0200 From: Clemens Ladisch firewire: ohci: remove superfluous posted write flushes The call to flush_writes() in context_stop() is superfluous because another register read is done immediately afterwards. The call to flush_writes() in ar_context_run() does not need to be done individually for each AR context, so move it to ohci_enable(). This also makes ohci_enable() clearer because it no longer depends on a side effect of ar_context_run() to flush its own register writes. Finally, the setting of a context's wake bit does not need to be flushed because neither the driver logic nor the API require the CPU to wait for this action. This removes the last MMIO reads from the packet queueing code paths. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) Date: Sun, 29 May 2011 19:07:19 +0200 From: August Lilleaas firewire: net: replacing deprecated __attribute__((packed)) with __packed Fixing a deprecation, replacing __attribute__((packed)) with __packed. It was deprecated for portability, specifically to avoid GCC specific code. See commit 82ddcb040570411fc2d421d96b3e69711c670328. Signed-off-by: August Lilleaas Signed-off-by: Stefan Richter (added include compiler.h) --- drivers/firewire/net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) From ed4d975dde2fd0ea129d7043f0c98c90b96dcb2e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 28 Apr 2011 08:03:43 +0200 ALSA: dice: clear device lock when closing hwdep device Ensure that misbehaving or aborted userspace programs do not accidentally keep the lock. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) Date: Wed, 11 May 2011 11:07:09 +0200 From: Clemens Ladisch ALSA: isight: fix locking Lockdep complains about conflicts between isight->mutex, ALSA's register_mutex, mm->mmap_sem, and pcm->open_mutex. This can be fixed by moving the calls to isight_pcm_abort(), snd_card_disconnect(), and fw_iso_resources_update() out of isight->mutex. These functions are designed to be called asynchronously; the mutex needs to protect only the device streaming state modified by isight_start/stop_streaming(). Signed-off-by: Clemens Ladisch Reported-by: Stefan Richter Signed-off-by: Takashi Iwai --- sound/firewire/isight.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Date: Wed, 11 May 2011 10:54:41 +0200 From: Clemens Ladisch ALSA: isight: remove experimental status Experiments have shown this driver to work now. Signed-off-by: Clemens Ladisch Tested-by: Stefan Richter Signed-off-by: Takashi Iwai --- sound/firewire/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Date: Mon, 02 May 2011 09:33:56 +0200 From: Clemens Ladisch firewire: optimize iso queueing by setting wake only after the last packet When queueing iso packets, the run time is dominated by the two MMIO accesses that set the DMA context's wake bit. Because most drivers submit packets in batches, we can save much time by removing all but the last wakeup. The internal kernel API is changed to require a call to fw_iso_context_queue_flush() after a batch of queued packets. The user space API does not change, so one call to FW_CDEV_IOC_QUEUE_ISO must specify multiple packets to take advantage of this optimization. In my measurements, this patch reduces the time needed to queue fifty skip packets from userspace to one sixth on a 2.5 GHz CPU, or to one third at 800 MHz. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 5 +++++ drivers/firewire/core-cdev.c | 1 + drivers/firewire/core-iso.c | 6 ++++++ drivers/firewire/core.h | 2 ++ drivers/firewire/net.c | 4 +++- drivers/firewire/ohci.c | 19 +++++++++++++++---- drivers/media/dvb/firewire/firedtv-fw.c | 1 + include/linux/firewire.h | 1 + sound/firewire/amdtp.c | 1 + 9 files changed, 35 insertions(+), 5 deletions(-) Date: Mon, 2 May 2011 13:33:42 -0400 From: "B.J. Buchalter" firewire: Fix for broken configrom updates in quick succession Current implementation of ohci_set_config_rom() uses a deferred bus reset via fw_schedule_bus_reset(). If clients add multiple unit descriptors to the config_rom in quick succession, the deferred bus reset may not have fired before succeeding update requests have come in. This can lead to an incorrect partial update of the config_rom for both addition and removal of config_rom descriptors, as the ohci_set_config_rom() routine will return -EBUSY if a previous pending update has not been completed yet; the requested update just gets dropped on the floor. This patch recognizes that the "in-flight" update can be modified until it has been processed by the bus-reset, and the locking in the bus_reset_tasklet ensures that the update is done atomically with respect to modifications made by ohci_set_config_rom(). The -EBUSY error case is simply removed. [Stefan R: The bug always existed at least theoretically. But it became easy to trigger since 2.6.36 commit 02d37bed188c "firewire: core: integrate software-forced bus resets with bus management" which introduced long mandatory delays between janitorial bus resets.] Signed-off-by: Benjamin Buchalter Signed-off-by: Stefan Richter (trivial style changes) Cc: # 2.6.36.y and newer --- drivers/firewire/ohci.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) Date: Sun, 1 May 2011 20:50:31 +0200 From: Stefan Richter firewire: sbp2: parallelize login, reconnect, logout The struct sbp2_logical_unit.work items can all be executed in parallel but are not reentrant. Furthermore, reconnect or re-login work must be executed in a WQ_MEM_RECLAIM workqueue. Hence replace the old single-threaded firewire-sbp2 workqueue by a concurrency-managed but non-reentrant workqueue with rescuer. firewire-core already maintains one, hence use this one. In earlier versions of this change, I observed occasional failures of parallel INQUIRY to an Initio INIC-2430 FireWire 800 to dual IDE bridge. More testing indicates that parallel INQUIRY is not actually a problem, but too quick successions of logout and login + INQUIRY, e.g. a quick sequence of cable plugout and plugin, can result in failed INQUIRY. This does not seem to be something that should or could be addressed by serialization. Another dual-LU device to which I currently have access to, an OXUF924DSB FireWire 800 to dual SATA bridge with firmware from MacPower, has been successfully tested with this too. This change is beneficial to environments with two or more FireWire storage devices, especially if they are located on the same bus. Management tasks that should be performed as soon and as quickly as possible, especially reconnect, are no longer held up by tasks on other devices that may take a long time, especially login with INQUIRY and sd or sr driver probe. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 4 ++-- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-device.c | 5 +++-- drivers/firewire/core-transaction.c | 12 ++++++------ drivers/firewire/core.h | 2 -- drivers/firewire/sbp2.c | 9 +-------- include/linux/firewire.h | 2 ++ 7 files changed, 15 insertions(+), 21 deletions(-) Date: Sun, 1 May 2011 21:06:42 +0200 From: Stefan Richter firewire: sbp2: octlet AT payloads can be stack-allocated We do not need slab allocations for ORB pointer write transactions anymore in order to satisfy streaming DMA mapping constraints, thanks to commit da28947e7e36 "firewire: ohci: avoid separate DMA mapping for small AT payloads". (Besides, the slab-allocated buffers that firewire-sbp2 used to provide for 8-byte write requests were still not fully portable since they shared a cacheline with unrelated CPU-accessed data.) Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Wed Oct 13 13:39:46 CEST 2010 From: Stefan Richter firewire: core: use non-reentrant workqueue with rescuer firewire-core manages the following types of work items: fw_card.br_work: - resets the bus on a card and possibly sends a PHY packet before that - does not sleep for long or not at all - is scheduled via fw_schedule_bus_reset() by - firewire-ohci's pci_probe method - firewire-ohci's set_config_rom method, called by kernelspace protocol drivers and userspace drivers which add/remove Configuration ROM descriptors - userspace drivers which use the bus reset ioctl - itself if the last reset happened less than 2 seconds ago fw_card.bm_work: - performs bus management duties - usually does not (but may in corner cases) sleep for long - is scheduled via fw_schedule_bm_work() by - firewire-ohci's self-ID-complete IRQ handler tasklet - firewire-core's fw_device.work instances whenever the root node device was (successfully or unsuccessfully) discovered, refreshed, or rediscovered - itself in case of resource allocation failures or in order to obey the 125ms bus manager arbitration interval fw_device.work: - performs node probe, update, shutdown, revival, removal; including kernel driver probe, update, shutdown and bus reset notification to userspace drivers - usually sleeps moderately long, in corner cases very long - is scheduled by - firewire-ohci's self-ID-complete IRQ handler tasklet via the core's fw_node_event - firewire-ohci's pci_remove method via core's fw_destroy_nodes/ fw_node_event - itself during retries, e.g. while a node is powering up iso_resource.work: - accesses registers at the Isochronous Resource Manager node - usually does not (but may in corner cases) sleep for long - is scheduled via schedule_iso_resource() by - the owning userspace driver at addition and removal of the resource - firewire-core's fw_device.work instances after bus reset - itself in case of resource allocation if necessary to obey the 1000ms reallocation period after bus reset fw_card.br_work instances should not, and instances of the others must not, be executed in parallel by multiple CPUs -- but were not protected against that. Hence allocate a non-reentrant workqueue for them. fw_device.work may be used in the memory reclaim path in case of SBP-2 device updates. Hence we need a workqueue with rescuer and cannot use system_nrt_wq. Signed-off-by: Stefan Richter Reviewed-by: Tejun Heo --- drivers/firewire/core-card.c | 6 +++--- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-device.c | 30 ++++++++++++++++++---------- drivers/firewire/core-transaction.c | 12 ++++++++++- drivers/firewire/core.h | 2 ++ 5 files changed, 36 insertions(+), 16 deletions(-) Date: Fri, 22 Apr 2011 15:13:54 +0200 From: Stefan Richter firewire: octlet AT payloads can be stack-allocated We do not need slab allocations anymore in order to satisfy streaming DMA mapping constraints, thanks to commit da28947e7e36 "firewire: ohci: avoid separate DMA mapping for small AT payloads". (Besides, the slab-allocated buffers that firewire-core, firewire-sbp2, and firedtv used to provide for 8-byte write and lock requests were still not fully portable since they crossed cacheline boundaries or shared a cacheline with unrelated CPU-accessed data. snd-firewire-lib got this aspect right by using an extra kmalloc/ kfree just for the 8-byte transaction buffer.) This change replaces kmalloc'ed lock transaction scratch buffers in firewire-core, firedtv, and snd-firewire-lib by local stack allocations. Perhaps the most notable result of the change is simpler locking because there is no need to serialize usages of preallocated per-device buffers anymore. Also, allocations and deallocations are simpler. Signed-off-by: Stefan Richter Acked-by: Clemens Ladisch --- drivers/firewire/core-card.c | 16 ++++++++-------- drivers/firewire/core-cdev.c | 4 +--- drivers/firewire/core-iso.c | 21 +++++++++++---------- drivers/firewire/core-transaction.c | 7 ++++--- drivers/media/dvb/firewire/firedtv-avc.c | 15 +-------------- include/linux/firewire.h | 3 +-- sound/firewire/cmp.c | 3 +-- sound/firewire/iso-resources.c | 12 +++--------- sound/firewire/iso-resources.h | 1 - 9 files changed, 30 insertions(+), 52 deletions(-) From 793175a06225da8a2c06102092bf7ab97c8eeb8c Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Wed, 13 Apr 2011 08:25:04 +0200 ALSA: dice: msleep needs delay.h build requirement on 2.6.39 x86-64 Signed-off-by: Stefan Richter Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 1 + 1 file changed, 1 insertion(+) Date: Tue, 12 Apr 2011 07:54:59 +0200 From: Clemens Ladisch firewire: ohci: optimize find_branch_descriptor() When z==2, the condition "key == 2" is superfluous because it cannot occur without "b == 3", as a descriptor with b!=3 and key==2 would be an OUTPUT_MORE_IMMEDIATE descriptor which cannot be used alone. Also remove magic numbers and needless computations on the b field. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) Date: Mon, 11 Apr 2011 09:57:54 +0200 From: Clemens Ladisch firewire: ohci: avoid separate DMA mapping for small AT payloads For AT packet payloads of up to eight bytes, we have enough unused space in the DMA descriptors list so that we can put a copy of the payload there and thus avoid having to create a separate streaming DMA mapping for the payload buffer. In a CPU-bound microbenchmark that just sends 8-byte packets, bandwidth was measured to increase by 5.7 %, from 1009 KB/s to 1067 KB/s. In practice, the only performance-sensitive usage of small asynchronous packets is the SBP-2 driver's write to the ORB_POINTER register during SCSI command submission. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) Date: Mon, 11 Apr 2011 09:56:12 +0200 From: Clemens Ladisch firewire: ohci: do not start DMA contexts before link is enabled OHCI 1.1 5.7.3 not only forbids enabling or starting any DMA contexts before the linkEnable bit is set, but also explicitly warns of undefined behaviour if this order is violated. Don't violate it then. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) From 619f53e05526e5edaf8ac0c198f25cc650161524 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 4 Apr 2011 08:48:06 +0200 ALSA: dice: implement hwdep device Implement the hwdep locking and notification mechanisms. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 225 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 203 insertions(+), 22 deletions(-) From 4546822e8450e4d13a19c447f4c544d575df16c2 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 4 Apr 2011 08:44:30 +0200 ALSA: dice: fix typo in firewire.h Signed-off-by: Clemens Ladisch --- include/sound/firewire.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From f8e8bb824aac9472b0a40d195e14f13877715c4b Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 31 Mar 2011 08:07:13 +0200 ALSA: dice: change ioctl numbers Change the (fortunately not yet implemented) ioctl numbers from F1..F3 to F8..FA to prevent a conflict with the new hid-roccat driver. Signed-off-by: Clemens Ladisch --- Documentation/ioctl/ioctl-number.txt | 2 +- include/sound/firewire.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) From f075c67d8bd5736fd612e5cec5ceafa4d58ef47d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Wed, 30 Mar 2011 08:28:09 +0200 ALSA: dice: fix hang when unplugging a running device When aborting a PCM stream, the xrun is signaled only if the stream is running. When disconnecting a PCM stream, calling snd_card_disconnect() too early would change the stream into a non-running state and thus prevent the xrun from being noticed by user space. To prevent this, move the snd_card_disconnect() call after the xrun. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) From 8a495f6184eb533d5641d7dd5703d5582fa834a5 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Wed, 30 Mar 2011 08:27:46 +0200 ALSA: isight: fix hang when unplugging a running device When aborting a PCM stream, the xrun is signaled only if the stream is running. When disconnecting a PCM stream, calling snd_card_disconnect() too early would change the stream into a non-running state and thus prevent the xrun from being noticed by user space. To prevent this, move the snd_card_disconnect() call after the xrun. Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) From 2725fb2c0e7081f99dd2a24b3b2ea9a93b0d236d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Wed, 30 Mar 2011 08:27:26 +0200 ALSA: firewire-speakers: fix hang when unplugging a running device When aborting a PCM stream, the xrun is signaled only if the stream is running. When disconnecting a PCM stream, calling snd_card_disconnect() too early would change the stream into a non-running state and thus prevent the xrun from being noticed by user space. To prevent this, move the snd_card_disconnect() call after the xrun. Signed-off-by: Clemens Ladisch --- sound/firewire/speakers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) From 7365ec51bd8653d141bc98b5632f2c53580d2b36 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 29 Mar 2011 10:12:55 +0200 ALSA: dice, firewire-lib: add blocking mode Allow AMDTP output streams to use blocking mode. Use it for DICE devices, because the old DICE-II chip will in some cases not be able to lock to non-blocking streams (erratum E7). Signed-off-by: Clemens Ladisch --- sound/firewire/amdtp.c | 54 ++++++++++++++++++++++------------------- sound/firewire/amdtp.h | 7 ++++- sound/firewire/dice.c | 2 +- 3 files changed, 36 insertions(+), 27 deletions(-) From bc0bfef119e31d419e65b6758260e9d26e4828f8 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 29 Mar 2011 10:11:40 +0200 ALSA: dice: reduce noisy logging The notification bits are not of general interest; log them only when debugging. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From 00725b6b475b19d1146543003675e76b5d01d926 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 29 Mar 2011 10:11:15 +0200 ALSA: dice: allow all sample rates Instead of forcing a constant 44.1 kHz, read the current sample rate from the device when opening the PCM device. Actually changing the sample rate requires some separate controller application. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 55 ++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 13 deletions(-) From 86b653383da011338ead9e6cfc2fcda26d49b3d4 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 29 Mar 2011 10:05:07 +0200 ALSA: isight: msleep needs delay.h Fixes compilation on some non-x86 architectures. Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 1 + 1 file changed, 1 insertion(+) From 7184c2aeb0e086f1e574951f89729d94e5ca864b Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Tue, 29 Mar 2011 10:03:12 +0200 ALSA: isight: wrap up register accesses Signed-off-by: Stefan Richter [cl: removed superfluous variable] Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 76 ++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 46 deletions(-) From d0c2f9d61f33aed11c9f15d92aeddb9a373afb18 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Tue, 29 Mar 2011 09:58:05 +0200 ALSA: isight: add AudioEnable register write which is needed to get the iSight to talk. Signed-off-by: Stefan Richter Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) From e7e8eaf935563e2aa15980702c2737294f5b04b0 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 25 Mar 2011 08:04:20 +0100 ALSA: isight: fix divide error when queueing packets Set the .header_size field when queueing packets to avoid a division by zero. Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 1 + 1 file changed, 1 insertion(+) From 2101f62975990add05d60ae70f93422722c3aaef Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 25 Mar 2011 07:59:49 +0100 ALSA: isight: fix packet requeueing After handling a received packet, we want to resubmit the same packet, so do not increase the packet index too early. Signed-off-by: Clemens Ladisch --- sound/firewire/isight.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) From afb74299dd59eace12ccd7f1e79fdf6c6c867076 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 22 Mar 2011 17:14:47 +0100 ALSA: isight: fix isight_pcm_abort() crashes Fix crashes in isight_pcm_abort() that happen when the driver tries to access isight->pcm->runtime which does not exist when the device is not open. Introduce a new field pcm_active to track this state. Signed-off-by: Clemens Ladisch Reported-by: Stefan Richter --- sound/firewire/isight.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) From 49120234746353325aedf5148f71997a264fda6f Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Mon, 21 Mar 2011 08:34:20 +0100 ALSA: dice: depends on snd_hwdep Signed-off-by: Stefan Richter Signed-off-by: Clemens Ladisch --- sound/firewire/Kconfig | 1 + 1 file changed, 1 insertion(+) From 5f2e1b69fadb9dbe23215e3cdee4643ceec41dbf Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 18 Mar 2011 11:12:50 +0100 ALSA: dice: optimize bus reset handling After a bus reset, do not stop the stream completely to avoid having to reconfigure the device when restarting the stream. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 148 ++++++++++++++++++++++++++---------------- 1 file changed, 93 insertions(+), 55 deletions(-) From c9d4b44721322a091f358466342fcee1b7ba0e4e Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 17 Mar 2011 08:39:29 +0100 ALSA: add DICE driver incomplete driver for DICE devices: * only playback (so no clock source except the bus clock) * only 44.1 kHz * no MIDI * recovery after bus reset is slow * hwdep device is created, but not actually implemented Signed-off-by: Clemens Ladisch --- Documentation/ioctl/ioctl-number.txt | 1 + include/sound/Kbuild | 1 + include/sound/asound.h | 3 + include/sound/firewire.h | 51 + sound/firewire/Kconfig | 13 + sound/firewire/Makefile | 2 + sound/firewire/dice.c | 1017 +++++++++++++++++++++++++++ 7 files changed, 1087 insertions(+), 1 deletion(-) create mode 100644 include/sound/firewire.h create mode 100644 sound/firewire/dice.c From 876f1d82e2f62bbfa99d75176f637f2669cc4320 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Thu, 17 Mar 2011 08:37:14 +0100 ALSA: add Apple iSight microphone driver WARNING: extremely untested! Signed-off-by: Clemens Ladisch --- sound/firewire/Kconfig | 12 + sound/firewire/Makefile | 2 + sound/firewire/isight.c | 743 ++++++++++++++++++++++++++++++++ sound/firewire/iso-resources.c | 5 + sound/firewire/packets-buffer.c | 2 + 5 files changed, 764 insertions(+) create mode 100644 sound/firewire/isight.c From 5de0ee574be8f6922a6c33f2fbc7e9b130a2f626 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Wed, 16 Mar 2011 17:39:28 +1100 ALSA: firewire - msleep needs delay.h fixes this error: sound/firewire/fcp.c: In function 'fcp_avc_transaction': sound/firewire/fcp.c:103: error: implicit declaration of function 'msleep' Signed-off-by: Stephen Rothwell Signed-off-by: Takashi Iwai --- sound/firewire/fcp.c | 1 + 1 file changed, 1 insertion(+) From ec00f5e444706cb1902731655f3dcd04fc3df7b0 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 15 Mar 2011 07:57:24 +0100 ALSA: firewire-lib, firewire-speakers: handle packet queueing errors Add an AMDTP stream error state that occurs when we fail to queue another packet. In this case, the stream is stopped, and the error can be reported when the application tries to restart the PCM stream. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/firewire/amdtp.c | 33 +++++++++++++++++++++------------ sound/firewire/amdtp.h | 14 +++++++++++++- sound/firewire/speakers.c | 3 +++ 3 files changed, 37 insertions(+), 13 deletions(-) From 5b2599a07eaee53d713fb68f5343eba88fa249c0 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 15 Mar 2011 07:55:50 +0100 ALSA: firewire-lib: allocate DMA buffer separately For correct cache coherency on some architectures, DMA buffers must be allocated in a different cache line than data that is concurrently used by the CPU. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/firewire/cmp.c | 5 ++++- sound/firewire/iso-resources.c | 10 +++++++++- sound/firewire/iso-resources.h | 6 +++--- 3 files changed, 16 insertions(+), 5 deletions(-) From be454366324b31922a2460c63c65d5e3cebe9641 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 15 Mar 2011 07:55:02 +0100 ALSA: firewire-lib: use no-info SYT for packets without SYT sample In non-blocking mode, the SYT_INTERVAL is larger than the number of audio frames in each packet, so there are packets that do not contain any frame to which the SYT could be applied. For these packets, the SYT must not be the timestamp of the next valid SYT frame, but the special no-info SYT value. This fixes broken playback on the FireWave at 44.1 kHz. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/firewire/amdtp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) From 31ef9134eb52636d383a7d0626cbbd345cb94f2f Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 15 Mar 2011 07:53:21 +0100 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 v3: cache the iPCR value v4: FireWave constraints; fix fw_device reference counting; fix PCR caching; small changes and fixes v5: volume/mute support; fix crashing due to pcm stop races v6: fix build; one-channel volume for LaCie v7: use signed values to make volume (range checks) work; fix function block IDs for volume/mute; always use channel 0 for LaCie volume Signed-off-by: Clemens Ladisch Acked-by: Stefan Richter Tested-by: Jay Fenlason Signed-off-by: Takashi Iwai --- 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 | 549 +++++++++++++++++++++ sound/firewire/amdtp.h | 157 ++++++ sound/firewire/cmp.c | 305 +++++++++++ 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 | 85 +++ sound/firewire/lib.h | 19 + sound/firewire/packets-buffer.c | 74 +++ sound/firewire/packets-buffer.h | 26 + sound/firewire/speakers.c | 855 ++++++++++++++++++++++++++++++++ 20 files changed, 2651 insertions(+), 4 deletions(-) create mode 100644 sound/firewire/Kconfig create mode 100644 sound/firewire/Makefile create mode 100644 sound/firewire/amdtp.c create mode 100644 sound/firewire/amdtp.h create mode 100644 sound/firewire/cmp.c create mode 100644 sound/firewire/cmp.h create mode 100644 sound/firewire/fcp.c create mode 100644 sound/firewire/fcp.h create mode 100644 sound/firewire/iso-resources.c create mode 100644 sound/firewire/iso-resources.h create mode 100644 sound/firewire/lib.c create mode 100644 sound/firewire/lib.h create mode 100644 sound/firewire/packets-buffer.c create mode 100644 sound/firewire/packets-buffer.h create mode 100644 sound/firewire/speakers.c Date: Tue, 15 Mar 2011 00:08:41 +0100 From: Stefan Richter firewire: core: ignore link-active bit of new nodes, fix device recognition Like the older ieee1394 core driver, firewire-core skipped scanning of any new node whose PHY sent a self ID without "link active" bit. If a device had this bit off mistakenly, it meant that it was inaccessible to kernel drivers with the old IEEE 1394 driver stack but could still be accessed by userspace drivers through the raw1394 interface. But with firewire-core, userspace drivers don't get to see such buggy devices anymore. This is effectively a driver regression since this device bug is otherwise harmless. We now attempt to scan all devices, even repeaters that don't have a link or powered-down devices that have everything but their PHY shut down when plugged in. This results in futile repeated scanning attempts in case of such devices that really don't have an active link, but this doesn't hurt since recent workqueue infrastructure lets us run more concurrent scanning jobs than we can shake a stick at. This should fix accessibility of Focusrite Saffire PRO 26 I/O: http://sourceforge.net/mailarchive/forum.php?thread_name=20110314215622.5c751bb0%40stein&forum_name=ffado-user Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) Date: Tue, 15 Mar 2011 00:04:42 +0100 From: Stefan Richter firewire: sbp2: revert obsolete 'fix stall with "Unsolicited response"' Now that firewire-core sets the local node's SPLIT_TIMEOUT to 2 seconds per default, commit a481e97d3cdc40b9d58271675bd4f0abb79d4872 is no longer required. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) Date: Mon, 07 Mar 2011 11:21:15 +0100 From: Clemens Ladisch firewire: core: increase default SPLIT_TIMEOUT value The SPLIT_TIMEOUT mechanism is intended to detect requests that somehow got lost. However, when the timeout value is too low, transactions that could have been completed successfully will be cancelled. Furthermore, there are chips whose firmwares ignore the configured split timeout and send late split response; known examples are the DM1x00 (BeBoB), TCD22x0 (DICE), and some OXUF936QSE firmwares. This patch changes the default timeout to two seconds, which happens to be the default on other OSes, too. Actual lost requests are extremely rare, so there should be no practical downside to increasing the split timeout even on devices that work correctly. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) Date: Fri, 11 Mar 2011 04:17:27 +0300 From: Oleg Drokin firewire: ohci: Misleading kfree in ohci.c::pci_probe/remove It seems drivers/firewire/ohci.c is making some optimistic assumptions about struct fw_ohci and that member "card" will always remain the first member of the struct. Plus it's probably going to confuse a lot of static code analyzers too. So I wonder if there is a good reason not to free the ohci struct just like it was allocated instead of the tricky &ohci->card way? Signed-off-by: Oleg Drokin It is perhaps just a rudiment from before mainline submission of the driver. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sat, 26 Feb 2011 15:08:35 +0100 From: Stefan Richter firewire: ohci: omit IntEvent.busReset check rom AT queueing Since commit 82b662dc4102 "flush AT contexts after bus reset for OHCI 1.2", the driver takes care of any AT packets that were enqueued during a bus reset phase. The check from commit 76f73ca1b291 is therefore no longer necessary and the MMIO read can be avoided. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) Date: Sun, 6 Feb 2011 15:41:44 +0100 From: Stefan Richter firedtv: drop obsolete backend abstraction Since the drivers/ieee1394/ backend was removed from firedtv, its I/O no longer needs to be abstracted as exchangeable backend methods. Also, ieee1394 variants of module and device probe and removal are no longer there. Move module probe and removal into firedtv-fw.c where device probe and removal are implemented. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 15 +- drivers/media/dvb/firewire/firedtv-dvb.c | 130 -------------------- drivers/media/dvb/firewire/firedtv-fe.c | 8 drivers/media/dvb/firewire/firedtv-fw.c | 146 +++++++++++++++++++---- drivers/media/dvb/firewire/firedtv.h | 31 ++--- 5 files changed, 140 insertions(+), 190 deletions(-) Date: Sat, 5 Feb 2011 13:07:39 +0000 (+0100) From: Hans Verkuil firedtv: remove dependency on the deleted ieee1394 stack. X-Git-Url: http://git.linuxtv.org/hverkuil/media_tree.git?a=commitdiff_plain;h=f02c316436eef3baf349c489545edc7ade419ff6 The IEEE1394 stack was removed in 2.6.37, but not in this driver. Due to incorrect Kconfig dependencies this driver wasn't build since 2.6.37. This patch removes the IEEE1394 dependencies and fixes the Kconfig dependency, allowing it to be compiled once again. Signed-off-by: Hans Verkuil CC: Stefan Richter --- Date: Wed, 23 Feb 2011 09:27:40 +0100 From: Clemens Ladisch firewire: ohci: prevent starting of iso contexts with empty queue If a misguided program tried to start an isochronous context before it has queued any packets, the call would appear to succeed, but the context would not actually go into the running state, and the OHCI controller would then raise an unrecoverableError interrupt because the first Z value is zero and thus invalid. The driver logs such errors, but there is no mechanism to report this back to the program. Add an explicit check so that this error can be returned synchronously. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Wed, 16 Feb 2011 10:32:11 +0100 From: Clemens Ladisch firewire: ohci: prevent iso completion callbacks after context stop To prevent the iso packet callback from being called after fw_iso_context_stop() has returned, make sure that the context's tasklet has finished executing before that. This fixes access-after-free bugs that have so far been observed only in the upcoming snd-firewire-speakers driver, but can theoretically also happen in the firedtv driver. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 1 + 1 file changed, 1 insertion(+) Date: Mon, 31 Jan 2011 11:58:58 +0100 From: Clemens Ladisch firewire: core: rename some variables In manage_channel(), rename the variables "c" and "i" to the more expressive "bit" and "channel". Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) Date: Sun, 23 Jan 2011 12:26:51 +0100 From: Stefan Richter firewire: nosy: should work on Power Mac G4 PCI too The first board generation of Power Mac G4 ("Yikes!", those with PCI graphics) still had a PCILynx controller like their G3 predecessors, but not the later AGP models. (Jonathan Woithe recalls to have heard of it, and some web sources reinforce it.) Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Sat, 22 Jan 2011 15:05:03 +0100 From: Clemens Ladisch firewire: core: fix card->reset_jiffies overflow On a 32-bit machine with, e.g., HZ=1000, jiffies will overflow after about 50 days, so if there are between 25 and 50 days between bus resets, the card->reset_jiffies comparisons can get wrong results. To fix this, ensure that this timestamp always uses 64 bits. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-card.c | 5 +++-- drivers/firewire/core-cdev.c | 3 ++- drivers/firewire/core-device.c | 3 ++- drivers/firewire/core-topology.c | 2 +- include/linux/firewire.h | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) Date: Mon, 10 Jan 2011 17:29:03 +0100 From: Clemens Ladisch firewire: cdev: remove unneeded reference For outbound transactions, the IDR's and the callback's references now have exactly the same lifetime, so we do not need both of them. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-cdev.c | 5 ----- 1 file changed, 5 deletions(-) Date: Mon, 10 Jan 2011 17:28:39 +0100 From: Clemens Ladisch firewire: cdev: always wait for outbound transactions to complete We must not use fw_cancel_transaction() because it cannot correctly abort still-active transactions. The only place in core-cdev where this matters is when the file is released. Instead of trying to abort the transactions, we wait for them to complete normally, i.e., until all outbound transaction resources have been removed from the IDR tree. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-cdev.c | 42 +++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 14 deletions(-) Date: Mon, 10 Jan 2011 17:28:27 +0100 From: Clemens Ladisch firewire: cdev: remove unneeded idr_find() from complete_transaction() Outbound transactions are never aborted with release_client_resource(), so it is not necessary for complete_transaction() to check whether the resource is still registered. Only shutdown_resource() can abort such an transaction, and this is already handled with the in_shutdown check. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-cdev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) Date: Mon, 10 Jan 2011 17:21:35 +0100 From: Clemens Ladisch firewire: ohci: log dead DMA contexts When a DMA context goes into the dead state (and the controller thus stops working correctly), logging this error and the controller's error code might be helpful for debugging. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 59 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) Date: Thu, 20 Jan 2011 00:07:46 +0100 From: Stefan Richter firewire: net: is not experimental anymore thanks to Clemens' and Maxim's fixes to firewire-ohci and -net in the last two kernel releases. Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) Date: Sun, 16 Jan 2011 05:39:21 -0300 From: Stefan Richter [media] firedtv: fix remote control with newer Xorg evdev After a recent update of xf86-input-evdev and xorg-server, I noticed that X11 applications did not receive keypresses from the FireDTV infrared remote control anymore. Instead, the Xorg log featured lots of "FireDTV remote control: dropping event due to full queue!" exclamations. The Linux console did not have an issue with the FireDTV's RC though. The fix is to insert EV_SYN events after the key-down/-up events. Signed-off-by: Stefan Richter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-rc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Date: Thu, 13 Jan 2011 10:12:17 +0100 From: Clemens Ladisch firewire: ohci: fix compilation on arches without PAGE_KERNEL_RO PAGE_KERNEL_RO is not available on all architectures, so its use in the new AR code broke compilation on sparc64. Because the read-only mapping was just a debugging aid, just use PAGE_KERNEL instead. Signed-off-by: Clemens Ladisch James Bottomley wrote: > On Thu, 2011-01-13 at 08:27 +0100, Clemens Ladisch wrote: >> firewire: ohci: fix compilation on arches without PAGE_KERNEL_RO, e.g. sparc >> >> PAGE_KERNEL_RO is not available on all architectures, so its use in the >> new AR code broke compilation on sparc64. >> >> Because the R/O mapping is only used to catch drivers that try to write >> to the reception buffer and not actually required for correct operation, >> we can just use a normal PAGE_KERNEL mapping where _RO is not available. [...] >> +/* >> + * For archs where PAGE_KERNEL_RO is not supported; >> + * mapping the AR buffers readonly for the CPU is just a debugging aid. >> + */ >> +#ifndef PAGE_KERNEL_RO >> +#define PAGE_KERNEL_RO PAGE_KERNEL >> +#endif > > This might cause interesting issues on sparc64 if it ever acquired a > PAGE_KERNEL_RO. Sparc64 has extern pgprot_t for it's PAGE_KERNEL types > rather than #defines, so the #ifdef check wouldn't see this. > > I think either PAGE_PROT_RO becomes part of our arch API (so all > architectures are forced to add it), or, if it's not part of the API, > ohci isn't entitled to use it. The latter seems simplest since you have > no real use for write protection anyway. Reported-by: Andrew Morton Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Mon, 13 Dec 2010 14:56:02 +0100 From: Clemens Ladisch firewire: use split transaction timeout only for split transactions Instead of starting the split transaction timeout timer when any request is submitted, start it only when the destination's ACK_PENDING has been received. This prevents us from using a timeout that is too short, and, if the controller's AT queue is emptying very slowly, from cancelling a packet that has not yet been sent. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 45 ++++++++++++++++++++-------- include/linux/firewire.h | 2 2 files changed, 33 insertions(+), 14 deletions(-) Date: Sat, 1 Jan 2011 15:17:05 +0100 From: Stefan Richter firewire: ohci: consolidate context status flags "firewire: ohci: restart iso DMA contexts on resume from low power mode" added the flag struct context.active and "firewire: ohci: cache the context run bit" added struct context.running. These flags contain the same information; combine them. Also, normalize whitespace in pci_resume(). Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) Date: Fri, 24 Dec 2010 14:42:46 +0100 From: Clemens Ladisch firewire: ohci: cache the context run bit The DMA context run control bit is entirely controlled by software, so it is safe to cache it. This allows the driver to avoid doing an additional MMIO read when queueing an AT packet. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sat, 1 Jan 2011 15:15:40 +0100 From: Stefan Richter firewire: ohci: flush AT contexts after bus reset - addendum Add comments - on why bus_reset_tasklet flushes AT queues, - that commit 76f73ca1b291 can possibly be reverted now. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++++++ 1 file changed, 7 insertions(+) Date: Fri, 24 Dec 2010 14:40:15 +0100 From: Clemens Ladisch firewire: ohci: flush AT contexts after bus reset for OHCI 1.2 The OHCI 1.2 (draft) specification, clause 7.2.3.3, allows and recommends that, after a bus reset, the controller does not flush all the packets in the AT queues. Therefore, the driver has to do this itself. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 46 ++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) Date: Fri, 17 Dec 2010 22:22:33 +0100 From: Stefan Richter firewire: net: set carrier state at ifup At ifup, carrier status would be shown on even if it actually was off. [[On 2.6.37, also add an include for ethtool_ops rather than to rely on the one from netdevice.h.]] Note, we can alas not use fwnet_device_mutex to serialize access to dev->peer_count (as I originally wanted). This would cause a lock inversion: - fwnet_probe | takes fwnet_device_mutex + register_netdev | takes rtnl_mutex - devinet_ioctl | takes rtnl_mutex + fwnet_open | ...must not take fwnet_device_mutex Hence use the dev->lock spinlock for serialization. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) Date: Wed, 8 Dec 2010 04:22:57 +0200 From: Maxim Levitsky firewire: net: add carrier detection To make userland, e.g. NetworkManager work with firewire, we need to detect whether cable is plugged or not. Simple and correct way of doing that is just counting number of peers. No peers - no link and vice versa. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) Date: Mon, 29 Nov 2010 04:09:53 +0200 From: Maxim Levitsky firewire: net: ratelimit error messages Unfortunately its easy to trigger such error messages by removing the cable while sending streams of data over the link. Such errors are normal, and therefore this patch stops firewire-net from flooding the kernel log with these errors, by combining series of same errors together. Signed-off-by: Maxim Levitsky (Stefan R:) Eventually we should remove this logging when firewire-net and related firewire-ohci facilities have been stabilized. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) Date: Mon, 29 Nov 2010 04:09:50 +0200 From: Maxim Levitsky firewire: ohci: restart iso DMA contexts on resume from low power mode Restore iso channels DMA so that iso channels could continue to work after resume from RAM/disk. Signed-off-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 54 ++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) Date: Mon, 29 Nov 2010 04:09:49 +0200 From: Maxim Levitsky firewire: ohci: restore GUID on resume. Some lousy BIOSes, e.g. my Aspire 5720 BIOS forget to restore the GUID register on resume from RAM. Fix that by setting it to the last value that was read from it. Signed-off-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++++++ 1 file changed, 7 insertions(+) Date: Tue, 30 Nov 2010 08:25:17 +0100 From: Clemens Ladisch firewire: ohci: use common buffer for self IDs and AR descriptors The buffers used for the selfIDs packets and the AR request and response descriptors end up using three pages because dma_alloc_coherent() allocates at least one page per call. However, these data structures would all fit into 4 KB, so we can save space by using a common buffer for them. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 66 +++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 32 deletions(-) Date: Tue, 30 Nov 2010 08:25:05 +0100 From: Clemens Ladisch firewire: ohci: optimize iso context checks in the interrupt handler When the isochRx/isochTx bit is clear, we do not need to read the corresponding iso interrupt event register. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) Date: Tue, 30 Nov 2010 08:24:47 +0100 From: Clemens Ladisch firewire: make PHY packet header format consistent Change the header of PHY packets to be sent to include a pseudo transaction code. This makes the header consistent with that of received PHY packets, and allows at_context_queue_packet() and log_ar_at_event() to see the packet type directly instead of having to deduce it from the header length or even from the header contents. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 7 ++-- drivers/firewire/core-transaction.c | 7 ++-- drivers/firewire/core.h | 4 ++- drivers/firewire/ohci.c | 44 ++++++++++++++-------------- 4 files changed, 33 insertions(+), 29 deletions(-) Date: Tue, 30 Nov 2010 08:24:32 +0100 From: Clemens Ladisch firewire: ohci: properly clear posted write errors To remove the error information from the controller's queue and to allow more posted writes, the driver has to read the failed posted write address before clearing the postedWriteErr interrupt bit. Signed-off-by: Clemens Ladisch (Stefan R:) The spec is somewhat fuzzy about the actual requirements. To err on the safe side, let's do these two read accesses. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) Date: Tue, 30 Nov 2010 08:24:19 +0100 From: Clemens Ladisch firewire: ohci: flush MMIO writes in the interrupt handler Make sure that interrupt event clear bit writes are executed before the interrupt handler returns. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Tue, 30 Nov 2010 08:24:01 +0100 From: Clemens Ladisch firewire: ohci: fix AT context initialization error handling Add proper error handling for the context_init() calls. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) Date: Fri, 26 Nov 2010 08:57:31 +0100 From: Clemens Ladisch firewire: ohci: Asynchronous Reception rewrite Move the AR DMA descriptors out of the buffer pages, and map the buffer pages linearly into the kernel's address space. This allows the driver to ignore any page boundaries in the DMA data and thus to avoid any copying around of packet payloads. This fixes the bug where S800 packets that are so big (> 4080 bytes) that they can be split over three pages were not handled correctly. Due to the changed algorithm, we can now use arbitrarily many buffer pages, which improves performance because the controller can more easily unload its DMA FIFO. Furthermore, using streaming DMA mappings should improve perfomance on architectures where coherent DMA mappings are not cacheable. Even on other architectures, the caching behaviour should be improved slightly because the CPU no longer writes to the buffer pages. v2: Detect the last filled buffer page by searching the descriptor's residual count value fields in order (like in the old code), instead of going backwards through the transfer status fields; it looks as if some controllers do not set the latter correctly. v3: Fix an old resume bug that would now make the handler run into a BUG_ON, and replace that check with more useful error handling. Increase the buffer size for better performance with non-TI chips. Signed-off-by: Clemens Ladisch Maxim Levitsky writes: Works almost perfectly. I can still see RCODE_BUSY errors sometimes, not very often though. 64K here eliminates these errors completely. This is most likely due to nouveau drivers and lowest perf level I use to lower card temperature. That increases latencies too much I think. Besides that the IO is just perfect. Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 2 drivers/firewire/Kconfig | 2 drivers/firewire/ohci.c | 415 ++++++++++++++++++++++++++------------- 2 files changed, 280 insertions(+), 137 deletions(-) Date: Sat, 30 Oct 2010 14:08:27 -0700 From: Joe Perches firewire: core: Update WARN uses Add missing newlines. Signed-off-by: Joe Perches Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Date: Wed, 13 Oct 2010 14:25:44 +0200 (CEST) From: Stefan Richter firewire: nosy: char device is not seekable Amend .open handler accordingly and add proper .llseek handler. (The only client that uses this interface is nosy-dump in linux/tools/firewire and it knows not to seek in this char dev.) Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Sun, 14 Nov 2010 14:35:40 +0100 (CET) From: Stefan Richter firewire: net: throttle TX queue before running out of tlabels This prevents firewire-net from submitting write requests in fast succession until failure due to all 64 transaction labels were used up for unfinished split transactions. The netif_stop/wake_queue API is used for this purpose. Without this stop/wake mechanism, datagrams were simply lost whenever the tlabel pool was exhausted. Plus, tlabel exhaustion by firewire-net also prevented other unrelated outbound transactions to be initiated. The chosen queue depth was checked by me to hit the maximum possible throughput with an OS X peer whose receive DMA is good enough to never reject requests due to busy inbound request FIFO. Current Linux peers show a mixed picture of -5%...+15% change in bandwidth; their current bottleneck are RCODE_BUSY situations (fewer or more, depending on TX queue depth) due to too small AR buffer in firewire-ohci. Maxim Levitsky tested this change with similar watermarks with a Linux peer and some pending firewire-ohci improvements that address the RCODE_BUSY problem and confirmed that these TX queue limits are good. Note: This removes some netif_wake_queue from reception code paths. They were apparently copy&paste artefacts from a nonsensical netif_wake_queue use in the older eth1394 driver. This belongs only into the transmit path. Signed-off-by: Stefan Richter Tested-by: Maxim Levitsky --- drivers/firewire/net.c | 59 ++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 24 deletions(-) Date: Sat, 6 Nov 2010 23:18:23 +0100 (CET) From: Stefan Richter firewire: net: replace lists by counters The current transmit code does not at all make use of - fwnet_device.packet_list and only very limited use of - fwnet_device.broadcasted_list, - fwnet_device.queued_packets. Their current function is to track whether the TX soft-IRQ finished dealing with an skb when the AT-req tasklet takes over, and to discard pending tx datagrams (if there are any) when the local node is removed. The latter does actually contain a race condition bug with TX soft-IRQ and AT-req tasklet. Instead of these lists and the corresponding link in fwnet_packet_task, - a flag in fwnet_packet_task to track whether fwnet_tx is done, - a counter of queued datagrams in fwnet_device do the job as well. The above mentioned theoretic race condition is resolved by letting fwnet_remove sleep until all datagrams were flushed. It may sleep almost arbitrarily long since fwnet_remove is executed in the context of a multithreaded (concurrency managed) workqueue. The type of max_payload is changed to u16 here to avoid waste in struct fwnet_packet_task. This value cannot exceed 4096 per IEEE 1394:2008 table 16-18 (or 32678 per specification of packet headers, if there is ever going to be something else than beta mode). Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 73 +++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 47 deletions(-) Date: Sat, 6 Nov 2010 16:57:28 +0100 (CET) From: Stefan Richter firewire: net: fix memory leaks a) fwnet_transmit_packet_done used to poison ptask->pt_link by list_del. If fwnet_send_packet checked later whether it was responsible to clean up (in the border case that the TX soft IRQ was outpaced by the AT-req tasklet on another CPU), it missed this because ptask->pt_link was no longer shown as empty. b) If fwnet_write_complete got an rcode other than RCODE_COMPLETE, we missed to free the skb and ptask entirely. Also, count stats.tx_dropped and stats.tx_errors when rcode != 0. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) Date: Sat, 6 Nov 2010 12:36:13 +0100 (CET) From: Stefan Richter firewire: net: count stats.tx_packets and stats.tx_bytes Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Date: Mon, 25 Oct 2010 11:43:05 +0200 From: Clemens Ladisch firewire: ohci: fix race when reading count in AR descriptor If the controller is storing a split packet and therefore changing d->res_count to zero between the two reads by the driver, we end up with an end pointer that is not at a packet boundary, and therefore overflow the buffer when handling the split packet. To fix this, read the field once, atomically. The compiler usually merges the two reads anyway, but for correctness, we have to enforce it. Signed-off-by: Clemens Ladisch Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Date: Mon, 25 Oct 2010 11:42:42 +0200 From: Clemens Ladisch firewire: ohci: avoid reallocation of AR buffers Freeing an AR buffer page just to allocate a new page immediately afterwards is not only a pointless effort but also dangerous because the allocation can fail, which would result in an oops later. Split ar_context_add_page() into two functions so that we can reuse the old page directly. Signed-off-by: Clemens Ladisch Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) Date: Mon, 1 Mar 2010 11:56:42 +0000 (-0300) From: Henrik Kurelid firedtv: add parameter to fake ca_system_ids in CA_INFO The Digital Everywhere firmware have the shortcoming that ca_info_enq and ca_info are not supported. This means that we can never retrieve the correct ca_system_id to present in the CI message CA_INFO. Currently the driver uses the application id retrieved using app_info_req and app_info, but this id only match the correct ca_system_id as given in ca_info in some cases. This patch adds a parameter to the driver in order for the user to override what will be returned in the CA_INFO CI message. Up to four ca_system_ids can be specified. This is needed for users with CAMs that have different manufacturer id and ca_system_id and that uses applications that take this into account, like MythTV. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-avc.c | 31 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) Date: Sun, 10 Oct 2010 00:54:02 +0200 From: Stefan Richter ieee1394: move init_ohci1394_dma to drivers/firewire/ because drivers/ieee1394/ will be deleted. Additional changes: - add some #include directives - adjust to use firewire/ohci.h instead of ieee1394/ohci1394.h, replace struct ti_ohci by a minimal struct ohci, replace quadlet_t from ieee1394_types.h by u32 - two or three trivial stylistic changes - __iomem annotation Signed-off-by: Stefan Richter --- drivers/firewire/Makefile | 1 + drivers/firewire/init_ohci1394_dma.c | 309 +++++++++++++++++++++++++++ drivers/ieee1394/Makefile | 2 - drivers/ieee1394/init_ohci1394_dma.c | 285 ------------------------- 4 files changed, 310 insertions(+), 287 deletions(-) Date: Sun, 12 Sep 2010 21:03:45 +0200 From: Tommy Jonsson V4L/DVB: firedtv: support for PSK8 for S2 devices. To watch HD. This is the first i have ever developed for linux, cant really wrap my head around how to submit this.. Hope im sending this correctly, diff made with 'hg diff' from latest "hg clone http://linuxtv.org/hg/v4l-dvb" It adds support for tuning with PSK8 modulation, pilot and rolloff with the S2 versions of firedtv. Signed-off-by: Tommy Jonsson Signed-off-by: Stefan Richter (trivial simplification) --- drivers/media/dvb/firewire/firedtv-avc.c | 30 +++++++++++++++++-- drivers/media/dvb/firewire/firedtv-fe.c | 36 ++++++++++++++++++++++- 2 files changed, 60 insertions(+), 6 deletions(-)