1
0
Fork 0
Commit Graph

97 Commits (1017abed18ae7087e7f3e256c48421d09d83176e)

Author SHA1 Message Date
Takashi Sakamoto 1017abed18 ALSA: firewire-lib: Add some AV/C general commands
This commit adds three commands, which may be used by some firewire device
drivers. These commands are defined in 'AV/C Digital Interface Command Set
General Specification Version 4.2 (2004006, 1394TA)'.

1. PLUG INFO command (clause 10.1)
2. INPUT PLUG SIGNAL FORMAT command (clause 10.10)
3. OUTPUT PLUG SIGNAL FORMAT command (clause 10.11)

By the command 1, the drivers can get the number of plugs for AV/C unit or
subunit.
By the command 2 and 3, the drivers can get/set sampling frequency.

The 'firewire-speakers' already uses INPUT PLUG SIGNAL FORMAT command to set
sampling rate. So this commit also affects the driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:23:13 +02:00
Takashi Sakamoto 00a7bb81c2 ALSA: firewire-lib: Add support for deferred transaction
Some devices based on BeBoB use this type of AV/C transaction.

'Deferred Transaction' is defined in 'AV/C Digital Interface Command Set
General Specification' and is used by targets to make a response deferred
during processing it.

If a target may not be able to complete a command within 100msec since
receiving the command, then the target shall return INTERIM response,
to which final response will follow later. CONTROL/NOTIFY commands are
allowed for deferred transaction.

In the specification, devices allow to send INTERIM response just one time.
But this commit allows to handle several INTERIM response with two reasons.
One reason is to simplify codes, and another reason is to prepare for
devices which is out of specification.

There is an issue. In the specification, the interval between INTERIM
response and final response is 'Unspecified interval'. The specification
depends on each subunit specification for this interval.

But we promise to finish this function for caller. In this reason, I use
FCP_TIMEOUT_MS for this interval. Currently it's 125msec. When we find
devices which needs more time for this interval, then let us add some codes
to apply more interval for 'Unspecified interval'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:22:56 +02:00
Takashi Sakamoto b04479fb85 ALSA: firewire-lib: Add a new function to check others' connection
Plug Control Registers have two fields related to the number of established
connections, one is 'Broadcast connection counter' and another is
'Point-to-point connection counter'. The driver can know there are established
connections or not to check these fields.

This commit is for considering about JACK/FFADO streaming. Currently, when
JACK/FFADO starts its streaming to the device, cmp_connection_establish() is
failed expectedly. This seems to be enough but there are some devices which
needs to change sampling frequency before trying to establish connections.
For such devices, this functionality is needed.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:22:46 +02:00
Takashi Sakamoto 44aff6980a ALSA: firewire-lib: Add handling output connection by CMP
This patch adds some macros, codes with condition of direction and new functions
to handle output connection. Once cmp_connection_init() is executed with its
direction, CMP input and output connection can be handled by the same way.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:22:37 +02:00
Takashi Sakamoto c68a1c6584 ALSA: firewire-lib: Add 'direction' member to 'cmp_connection' structure
This patch adds 'direction' member to 'cmp_connection' structure to indicate
the direction of connection. This patch also adds 'direction' argument to
cmp_connection_init() function to determine the direction.

The cmp_connection_init() function is exported and used in snd-firewire-speakers
so this patch also affect it.

This patch just add them. Actual implementation will be done by followed
patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:22:14 +02:00
Takashi Sakamoto a7fa0d047f ALSA: firewire-lib: Rename macros, variables and functions for CMP
Referring to IEC 61883-1, oMPR and iMPR, oPCR and iPCR have some fields with
the same role in the same position. This patch renames some macros, variables
and function arguments with "i" in its prefix to reuse them between oMPR and
iMPR, oPCR and iPCR.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:21:57 +02:00
Takashi Sakamoto c8de6dbbbb ALSA: firewire-lib: Restrict calling flush_context_completion() when context exists
Currently, drivers can bring XRUN state for PCM substreams when error to
queue packets or detecting discontinuity of packet. The application may try to
recover this state by calling snd_pcm_prepare().

Depending on each driver, .prepare() includes restart streaming. Then there
is a state that PCM substreams are running but isochronous contexts are
stopped. In this case, when .pointer() is called, it refers to error pointer.

This commit is for a prevention of this bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:21:56 +02:00
Takashi Sakamoto 7b2d99fa6b ALSA: firewire-lib/dice/speakers: Add common PCM constraints for AMDTP streams
This commit adds common PCM constraints according to current firewire-lib
implementation.

1.Maximum width for each sample is limited by 24.
AM824 in IEC 61883-6 can deliver 24bit data.

2. Minimum time for period is 5msec.
Apply the old value. For shorter latency, further works are needed.

3. In blocking mode, frames per period/buffer is aligned to 32.
Each packet can include some frames depending on its sampling rate. In
blocking mode, the number equals to SYT_INTERVAL. Currently firewire-lib
can schedule snd_pcm_period_elapsed() for each packet. So, for accurate
PCM interrupt, the number of frames per period/buffer should be aligned
to SYT_INTERVAL.
Currently firewire-lib is lack of better rules to achieve this. So LCM of
each value of SYT_INTERVALs (=32) is applied. This can be improved for
further work.

[Fixed the compile error due to the missing "&" by tiwai]

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:21:46 +02:00
Takashi Sakamoto 10550bea44 ALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRE
In previous commit, AMDTP functionality in firewire-lib supports mapping
for PCM data channels. With this mapping, firewire-lib can obsolete
a flag, CIP_HI_DUALWIRE, but Dice driver still keeps dual wire mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:15:10 +02:00
Takashi Sakamoto 77d2a8a4f6 ALSA: firewire-lib: Add support for channel mapping
Some devices arrange the position of PCM/MIDI data channel in AMDTP packet.
This commit allows drivers to set channel mapping.

To be simple, the mapping table is an array with fixed length. Then the number
of channels for PCM is restricted by 64 channels.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:14:41 +02:00
Takashi Sakamoto 7b3b0d8583 ALSA: firewire-lib: Add support for duplex streams synchronization in blocking mode
Generally, the devices can synchronize to handle 'presentation timestamp'
in CIP packets. This commit adds functionality to pick up this timestamp from
in-packets transmitted by the device, then use it for out packets.

In current implementation, this module generated the timestamp by itself. This
is 'SYT Match' mode. Then drivers with this module acts as synchronization
master. This commit allows this module to act as synchronization slave.

This commit restricts this mechanism is only available in blocking mode because
handling the timestamp in non-blocking mode is more complicated than in
blocking mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:13:59 +02:00
Takashi Sakamoto ccccad8646 ALSA: firewire-lib: Give syt value as parameter to handle_out_packet()
For duplex streams with synchronization, drivers should pick up
'presentation timestamp' from in-packets and use the timestamp for
out-packets. This commit is preparation for this.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:13:44 +02:00
Takashi Sakamoto 83d8d72dff ALSA: firewire-lib: Add support for MIDI capture/playback
For capturing/playbacking MIDI messages, this commit adds one MIDI conformant
data channel. This data channel has multiplexed 8 MIDI data streams. So this
data channel can transfer messages from/to 8 MIDI ports.

And this commit allows to set PCM format even if AMDTP streams already start.
I suppose the case that PCM substreams are going to be joined into AMDTP
streams when AMDTP streams are already started for MIDI substreams. Each
driver must count how many PCM/MIDI substreams use AMDTP streams to stop
AMDTP streams.

There are differences between specifications about MIDI conformant data.

About the multiplexing, IEC 61883-6:2002, itself, has no information. It
describes labels and bytes for MIDI messages and refers to MMA/AMEI RP-027
for 'successfull implementation'. MMA/AMEI RP-027 describes 8 MPX-MIDI data
streams for one MIDI conformant data channel. IEC 61883-6:2005 adds
'sequence multiplexing' and apply this way and describe incompatibility
between 2002 and 2005.

So this commit applies IEC 61883-6:2005. When we find some devices compliant
to IEC 61883-6:2002, then this difference should be handles as device quirk
in additional work.

About the number of bytes in an MIDI conformant data, IEC 61883-6:2002 describe
0,1,2,3 bytes. MMA/AMEI RP-027 describes 'MIDI1.0-1x-SPEED', 'MIDI1.0-2x-SPEED',
'MIDI1.0-3x-SPEED' modes and the maximum bytes for each mode corresponds to 1,
2, 3 bytes. The 'MIDI1.0-2x/3x-SPEED' modes are accompanied with 'negotiation
procedure' and 'encapsulation details' but there is no specifications for them.

So this commit implements 'MIDI1.0-1x-SPEED' mode for playback, but allows
to pick up 1-3 bytes for capturing.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:12:44 +02:00
Takashi Sakamoto 2b3fc456fe ALSA: firewire-lib: Add support for AMDTP in-stream and PCM capture
For capturing PCM, this commit adds the functionality to handle in-stream.
This is also applied for dual-wire mode.

Currently, capturing 32bit samples are supported.

When the sequence of in-packet has discontinuity of dbc, in-stream isn't handled
and amdtp_streaming_error() returns true.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:12:35 +02:00
Takashi Sakamoto 4b7da117e5 ALSA: firewire-lib: Split some codes into functions to reuse for both streams
Some codes can be reused to handle in-stream. This commit adds new functions.
This commit also renames some functions to keep naming consistency.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:11:57 +02:00
Takashi Sakamoto 3ff7e8f0d4 ALSA: firewire-lib: Add 'direction' member to 'amdtp_stream' structure
This patch adds 'direction' member to amdtp_stream structure to indicate its
direction. This patch also adds 'direction' argument to amdtp_stream_init()
function to determine its direction.

The amdtp_stream_init() function is exported and used by firewire-speakers and
dice so this patch also affects them.

This patch just add them. Actual implementation will be done by followed
patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:11:42 +02:00
Takashi Sakamoto b445db440c ALSA: firewire-lib: Add macros instead of fixed value for AMDTP
This patch adds some macros instead of fixed value for AMDTP according to
IEC 61883-1/6. These macros will also be used by followed patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:11:22 +02:00
Takashi Sakamoto be4a28940a ALSA: firewire-lib: Rename functions, structure, member for AMDTP
This patch renames some functions, a structure and its member to reuse them
in both AMDTP in/out stream.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26 14:11:10 +02:00
Takashi Iwai 06b45f00a4 ALSA: firewire: Convert to snd_card_new() with a device pointer
Also remove superfluous snd_card_set_dev() calls.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-14 08:13:31 +01:00
Dan Carpenter 4d6ff25085 ALSA: dice: fix array limits in dice_proc_read()
The array limits are supposed to be in units of u32 instead of in bytes.
The current code has a potential array overflow.

Fixes: c614475b0e ('ALSA: dice: add a proc file to show device information')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-29 10:23:04 +01:00
Takashi Iwai 049da9e8f8 Merge branch 'fix/firewire' into for-linus 2013-11-26 18:37:40 +01:00
Linus Torvalds e48f88a30d sound fixes #2 for 3.13-rc1
A collection of small fixes in HD-audio quirks and runtime PM, ASoC
 rcar, abs8500 and other codecs.  Most of commits are for stable
 kernels, too.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJSj0b6AAoJEGwxgFQ9KSmkPikP/RxVJr4XnKFXFVmRx/5W+GeL
 185TPqE6d0aS/+99+cVmUSG3m1X2AMsFWN4aStmttwNl8TqVW9KSpeOOAeP0nOHW
 vraV37A8Bfe5gjx2CGRTWzqmC+IjCPJ9foXc6zfFBFeJj0CYWJ7+RE2P6eHSCAFf
 2YDVYNKtvjaqg6sL7ngD3i3ubX0+WRAjqd27XS3sPSpQz4Ah2Uw2TPpExREcGy1x
 DgyX9XjTO5ChDnLvRe9FiLlFaiziUp97a7ueuMQMs9z/1ERCOLWOsY+dO/fk7Dg1
 RHkIz5yRuoVliPbJPqysuwG5c12b+eb2LJQyTqWiP4raG+83ZwejAs0+oMGBa015
 EHqxOJ7aJ2LFHUTUgioHjqGIS6aqIoFW5OaG3lKjjTPd3HlriojjQ/Vnm2kuFHQ2
 nZ8s1tNhnQwei5BNY7oZJPMMOB92Z11EuJfDtSscDGGUqiPNb2rubt0icULp1rOd
 RXjvpPR4Iw88Zsf8yXKBtE8VvH+GcqL18RfHS6TyM/apMY/5EftDGPA+OGl6YG7q
 UYdcyspg9RDexlww6/kL5b40I5JUQIZATjsReSrW/p6f4ze+4A9ZDAR0bucge1hr
 yHwPvrQ3x1DrpAyTCOzXvBujbidjUbN0hCxtHeSAyC6qmRtzUA+G1rGPaXgcCuMz
 oIfsn4cSGggRGYqlzxuf
 =zoMb
 -----END PGP SIGNATURE-----

Merge tag 'sound-fix2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull second set of sound fixes from Takashi Iwai:
 "A collection of small fixes in HD-audio quirks and runtime PM, ASoC
  rcar, abs8500 and other codecs.  Most of commits are for stable
  kernels, too"

* tag 'sound-fix2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Set current_headset_type to ALC_HEADSET_TYPE_ENUM (janitorial)
  ALSA: hda - Provide missing pin configs for VAIO with ALC260
  ALSA: hda - Add headset quirk for Dell Inspiron 3135
  ALSA: hda - Fix the headphone jack detection on Sony VAIO TX
  ALSA: hda - Fix missing bass speaker on ASUS N550
  ALSA: hda - Fix unbalanced runtime PM notification at resume
  ASoC: arizona: Set FLL to free-run before disabling
  ALSA: hda - A casual Dell Headset quirk
  ASoC: rcar: fixup dma_async_issue_pending() timing
  ASoC: rcar: off by one in rsnd_scu_set_route()
  ASoC: wm5110: Add post SYSCLK register patch for rev D chip
  ASoC: ab8500: Revert to using custom I/O functions
  ALSA: hda - Also enable mute/micmute LED control for "Lenovo dock" fixup
  ALSA: firewire-lib: include sound/asound.h to refer to snd_pcm_format_t
  ALSA: hda - Select FW_LOADER from CONFIG_SND_HDA_CODEC_CA0132_DSP
  ALSA: hda - Enable mute/mic-mute LEDs for more Thinkpads with Realtek codec
  ASoC: rcar: fixup mod access before checking
2013-11-22 10:57:31 -08:00
Takashi Sakamoto 82755abfe8 ALSA: firewire-lib: fix wrong value for FDF field as an empty packet
This commit fix out of specification about the value of FDF field in out packet
with 'no data'. This affects blocking mode.

According to IEC 61883-6, there is two way to generate AMDTP packets include no
data in blocking mode.

Way 1. an empty packet defined in IEC 61883-1
 - Size of packet is 2 quadlets.
 - The value of FDF is sfc.
 - The packet includes only CIP headers

Way 2. a special non-empty packet defined in IEC 61883-6
 - Size of packet is following to blocking mode
 - The value of FDF is 0xff. This value is 'NO-DATA'. This means 'The receiver'
   must ignore all the data in a CIP with this FDF code'.
 - The packet includes dummy data.

But current implementation is a combination of them.
 - Size of packet is 2 (way 1)
 - FDF = 0xff (way 2)
This causes BeBoB chipset cannot sound.

This patch applies Way 1.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-22 15:30:46 +01:00
Takashi Sakamoto 777fb574a5 ALSA: firewire-lib: include sound/asound.h to refer to snd_pcm_format_t
'snd_pcm_format_t' is used by amdtp_out_stream_set_pcm_format().

Currently, when just including amdtp.h, compiler cannot find this type because
this type is defined in uapi/sound/asound.h and this header is not included by
amdtp.h.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-19 08:07:20 +01:00
Wolfram Sang 16735d022f tree-wide: use reinit_completion instead of INIT_COMPLETION
Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.

[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-11-15 09:32:21 +09:00
Takashi Iwai 861e66d341 Merge branch 'dice-driver-playback-only' of git://git.alsa-project.org/alsa-kprivate into for-next 2013-10-22 10:02:57 +02:00
Clemens Ladisch b20be8de1b ALSA: dice: restrict the driver to playback-only devices
At the moment, this driver supports only playback, while FFADO supports
(only) full-duplex devices.  So, prevent conflicts by not claiming
devices that would be better handled by FFADO.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch a471fcde8c 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 <rolf.anderegg@weiss.ch>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch ed7e48264c 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 61b8cf0222 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch c614475b0e 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 640d9b421d ALSA: dice: check clock change timeout
Output a warning if the wait for the clock change notification times
out.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 4edeb831f3 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 15a75c8bed 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 5ea4018e43 ALSA: dice: allow notifications during initialization
Reorganize the initialization order so that the driver can receive
notifications earlier.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch a0301998ae 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch c5280e996f ALSA: dice: make amdtp_rates[] const
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Stefan Richter a8c558f6a3 ALSA: dice: fix locking
Avoid a lock inversion between dice->mutex and pcm->open_mutex.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 8709f1e4d6 ALSA: dice: remove superfluous field
The pcm field was not actually used.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 435a9be8bd ALSA: dice: remove 10s period length limit
Since commit f2b3614cef (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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch eadce07faa 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 1b70485f13 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch a644a9473f 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch a7304e3bf0 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch cbab328ddc 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 54e72f0ba3 ALSA: dice: reorganize interface definitions
Move the DICE interface symbols into a separate header file, and add
more documentation.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 20b65dd040 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 9dd81e3143 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 0c29c9180f ALSA: dice: implement hwdep device
Implement the hwdep locking and notification mechanisms.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 4ed31f20bb 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00