Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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 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
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
Clemens Ladisch e84d15f619 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch d13109673a ALSA: dice: reduce noisy logging
The notification bits are not of general interest; log them only when
debugging.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 341682cd4f 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 6abce9e63d 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 <clemens@ladisch.de>
2013-10-20 22:07:57 +02:00
Clemens Ladisch 82fbb4f7b4 ALSA: add DICE driver
As a start point for further development, this is an 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

Contains compilation fixes by Stefan Richter.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-17 21:18:32 +02:00