1
0
Fork 0
Commit Graph

810 Commits (redonkable)

Author SHA1 Message Date
Geert Uytterhoeven 548e4168e6 ALSA: firewire-tascam: Fix integer overflow in midi_port_work()
commit 9f65df9c58 upstream.

As snd_fw_async_midi_port.consume_bytes is unsigned int, and
NSEC_PER_SEC is 1000000000L, the second multiplication in

    port->consume_bytes * 8 * NSEC_PER_SEC / 31250

always overflows on 32-bit platforms, truncating the result.  Fix this
by precalculating "NSEC_PER_SEC / 31250", which is an integer constant.

Note that this assumes port->consume_bytes <= 16777.

Fixes: 531f471834 ("ALSA: firewire-lib/firewire-tascam: localize async midi port")
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210111130251.361335-3-geert+renesas@glider.be
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-19 18:26:19 +01:00
Geert Uytterhoeven 68e67535e2 ALSA: fireface: Fix integer overflow in transmit_midi_msg()
commit e7c22eeaff upstream.

As snd_ff.rx_bytes[] is unsigned int, and NSEC_PER_SEC is 1000000000L,
the second multiplication in

    ff->rx_bytes[port] * 8 * NSEC_PER_SEC / 31250

always overflows on 32-bit platforms, truncating the result.  Fix this
by precalculating "NSEC_PER_SEC / 31250", which is an integer constant.

Note that this assumes ff->rx_bytes[port] <= 16777.

Fixes: 1917429578 ("ALSA: fireface: add transaction support")
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210111130251.361335-2-geert+renesas@glider.be
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-19 18:26:18 +01:00
Dan Carpenter 090ac65f8c ALSA: firewire: Clean up a locking issue in copy_resp_to_buf()
commit 02a9c6ee41 upstream.

The spin_lock/unlock_irq() functions cannot be nested.  The problem is
that presumably we would want the IRQs to be re-enabled on the second
call the spin_unlock_irq() but instead it will be enabled at the first
call so IRQs will be enabled earlier than expected.

In this situation the copy_resp_to_buf() function is only called from
one function and it is called with IRQs disabled.  We can just use
the regular spin_lock/unlock() functions.

Fixes: 555e8a8f7f ("ALSA: fireworks: Add command/response functionality into hwdep interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201113101241.GB168908@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-24 13:29:20 +01:00
Dan Carpenter 8bedcbceaa ALSA: bebob: potential info leak in hwdep_read()
commit b41c15f4e1 upstream.

The "count" variable needs to be capped on every path so that we don't
copy too much information to the user.

Fixes: 618eabeae7 ("ALSA: bebob: Add hwdep interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201007074928.GA2529578@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-29 09:57:25 +01:00
Takashi Sakamoto a253fe3566 ALSA; firewire-tascam: exclude Tascam FE-8 from detection
commit 0bd8bce897 upstream.

Tascam FE-8 is known to support communication by asynchronous transaction
only. The support can be implemented in userspace application and
snd-firewire-ctl-services project has the support. However, ALSA
firewire-tascam driver is bound to the model.

This commit changes device entries so that the model is excluded. In a
commit 53b3ffee78 ("ALSA: firewire-tascam: change device probing
processing"), I addressed to the concern that version field in
configuration differs depending on installed firmware. However, as long
as I checked, the version number is fixed. It's safe to return version
number back to modalias.

Fixes: 53b3ffee78 ("ALSA: firewire-tascam: change device probing processing")
Cc: <stable@vger.kernel.org> # 4.4+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200823075537.56255-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-09 19:12:33 +02:00
Takashi Sakamoto cebaed0330 ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
commit acd46a6b6d upstream.

Avid Adrenaline is reported that ALSA firewire-digi00x driver is bound to.
However, as long as he investigated, the design of this model is hardly
similar to the one of Digi 00x family. It's better to exclude the model
from modalias of ALSA firewire-digi00x driver.

This commit changes device entries so that the model is excluded.

$ python3 crpp < ~/git/am-config-rom/misc/avid-adrenaline.img
               ROM header and bus information block
               -----------------------------------------------------------------
400  04203a9c  bus_info_length 4, crc_length 32, crc 15004
404  31333934  bus_name "1394"
408  e064a002  irmc 1, cmc 1, isc 1, bmc 0, cyc_clk_acc 100, max_rec 10 (2048)
40c  00a07e01  company_id 00a07e     |
410  00085257  device_id 0100085257  | EUI-64 00a07e0100085257

               root directory
               -----------------------------------------------------------------
414  0005d08c  directory_length 5, crc 53388
418  0300a07e  vendor
41c  8100000c  --> descriptor leaf at 44c
420  0c008380  node capabilities
424  8d000002  --> eui-64 leaf at 42c
428  d1000004  --> unit directory at 438

               eui-64 leaf at 42c
               -----------------------------------------------------------------
42c  0002410f  leaf_length 2, crc 16655
430  00a07e01  company_id 00a07e     |
434  00085257  device_id 0100085257  | EUI-64 00a07e0100085257

               unit directory at 438
               -----------------------------------------------------------------
438  0004d6c9  directory_length 4, crc 54985
43c  1200a02d  specifier id: 1394 TA
440  13014001  version: Vender Unique and AV/C
444  17000001  model
448  81000009  --> descriptor leaf at 46c

               descriptor leaf at 44c
               -----------------------------------------------------------------
44c  00077205  leaf_length 7, crc 29189
450  00000000  textual descriptor
454  00000000  minimal ASCII
458  41766964  "Avid"
45c  20546563  " Tec"
460  686e6f6c  "hnol"
464  6f677900  "ogy"
468  00000000

               descriptor leaf at 46c
               -----------------------------------------------------------------
46c  000599a5  leaf_length 5, crc 39333
470  00000000  textual descriptor
474  00000000  minimal ASCII
478  41647265  "Adre"
47c  6e616c69  "nali"
480  6e650000  "ne"

Reported-by: Simon Wood <simon@mungewell.org>
Fixes: 9edf723fd8 ("ALSA: firewire-digi00x: add skeleton for Digi 002/003 family")
Cc: <stable@vger.kernel.org> # 4.4+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200823075545.56305-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-09 19:12:32 +02:00
Takashi Sakamoto c1bcf01aea ALSA: firewire-lib: fix invalid assignment to union data for directional parameter
[ Upstream commit 8304cf77c9 ]

Although the value of FDF is used just for outgoing stream, the assignment
to union member is done for both directions of stream. At present this
causes no issue because the value of same position is reassigned later for
opposite stream. However, it's better to add if statement.

Fixes: d3d10a4a1b ("ALSA: firewire-lib: use union for directional parameters")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200508043635.349339-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-24 17:50:25 +02:00
Takashi Sakamoto 13c18353c9 ALSA: fireface: fix configuration error for nominal sampling transfer frequency
commit bbd6aac3ae upstream.

128000 and 192000 are congruence modulo 32000, thus it's wrong to
distinguish them as multiple of 32000 and 48000 by modulo 32000 at
first.

Additionally, used condition statement to detect quadruple speed can
cause missing bit flag.

Furthermore, counter to ensure the configuration is wrong and it
causes false positive.

This commit fixes the above three bugs.

Cc: <stable@vger.kernel.org>
Fixes: 60aec494b3 ("ALSA: fireface: support allocate_resources operation in latter protocol")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200510074301.116224-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-17 16:40:27 +02:00
Takashi Sakamoto 95827ac652 ALSA: firewire-lib: fix 'function sizeof not defined' error of tracepoints format
[ Upstream commit 1034872123 ]

The snd-firewire-lib.ko has 'amdtp-packet' event of tracepoints. Current
printk format for the event includes 'sizeof(u8)' macro expected to be
extended in compilation time. However, this is not done. As a result,
perf tools cannot parse the event for printing:

$ mount -l -t debugfs
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
$ cat /sys/kernel/debug/tracing/events/snd_firewire_lib/amdtp_packet/format
...
print fmt: "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s",
  REC->second, REC->cycle, REC->src, REC->dest, REC->channel,
  REC->payload_quadlets, REC->data_blocks, REC->data_block_counter,
  REC->packet_index, REC->irq, REC->index,
  __print_array(__get_dynamic_array(cip_header),
                __get_dynamic_array_len(cip_header),
                sizeof(u8))

$ sudo perf record -e snd_firewire_lib:amdtp_packet
  [snd_firewire_lib:amdtp_packet] function sizeof not defined
  Error: expected type 5 but read 0

This commit fixes it by obsoleting the macro with actual size.

Cc: <stable@vger.kernel.org>
Fixes: bde2bbdb30 ("ALSA: firewire-lib: use dynamic array for CIP header of tracing events")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200503045718.86337-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-05-20 08:20:19 +02:00
Takashi Sakamoto 4b536fe632 ALSA: firewire-tascam: fix corruption due to spin lock without restoration in SoftIRQ context
commit 747d1f076d upstream.

ALSA firewire-tascam driver can bring corruption due to spin lock without
restoration of IRQ flag in SoftIRQ context. This commit fixes the bug.

Cc: Scott Bahling <sbahling@suse.com>
Cc: <stable@vger.kernel.org> # v4.21
Fixes: d716742243 ("ALSA: firewire-tascam: queue events for change of control surface")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113085719.26788-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:31 +01:00
Takashi Sakamoto 4aeac091e2 ALSA: dice: fix fallback from protocol extension into limited functionality
commit 3e2dc6bdb5 upstream.

At failure of attempt to detect protocol extension, ALSA dice driver
should be fallback to limited functionality. However it's not.

This commit fixes it.

Cc: <stable@vger.kernel.org> # v4.18+
Fixes: 58579c056c ("ALSA: dice: use extended protocol to detect available stream formats")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113084630.14305-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23 08:22:30 +01:00
Takashi Iwai bbfc067c21 ALSA: firewire-motu: Correct a typo in the clock proc string
commit 0929249e3b upstream.

Just fix a typo of "S/PDIF" in the clock name string.

Fixes: 4638ec6ede ("ALSA: firewire-motu: add proc node to show current statuc of clock and packet formats")
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030100921.3826-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09 10:20:01 +01:00
Takashi Sakamoto 86b2eb94b0 ALSA: bebob: expand sleep just after breaking connections for protocol version 1
[ Upstream commit d3eabe939a ]

As long as I investigated, some devices with BeBoB protocol version 1
can be freezed during several hundreds milliseconds after breaking
connections. When accessing during the freezed time, any transaction
is corrupted. In the worst case, the device is going to reboot.

I can see this issue in:
 * Roland FA-66
 * M-Audio FireWire Solo

This commit expands sleep just after breaking connections to avoid
the freezed time as much as possible. I note that the freeze/reboot
behaviour is similar to below models:
 * Focusrite Saffire Pro 10 I/O
 * Focusrite Saffire Pro 26 I/O

The above models certainly reboot after breaking connections.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191101131323.17300-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:44:32 +01:00
Takashi Sakamoto dc4f813f1d ALSA: oxfw: fix return value in error path of isochronous resources reservation
commit 59a126aa31 upstream.

Even if isochronous resources reservation fails, error code doesn't return
in pcm.hw_params callback.

Cc: <stable@vger.kernel.org> #5.3+
Fixes: 4f380d0070 ("ALSA: oxfw: configure packet format in pcm.hw_params callback")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191209151655.GA8090@workstation
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:27 +01:00
Takashi Sakamoto d3a811fd78 ALSA: fireface: fix return value in error path of isochronous resources reservation
commit 480136343c upstream.

Even if isochronous resources reservation fails, error code doesn't return
in pcm.hw_params callback.

Cc: <stable@vger.kernel.org> #5.3+
Fixes: 55162d2bb0 ("ALSA: fireface: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191209151655.GA8090@workstation
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:56:27 +01:00
Takashi Sakamoto 706ad6746a ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series
For Focusrite Saffire Pro i/o, the lowest 8 bits of register represents
configured source of sampling clock. The next lowest 8 bits represents
whether the configured source is actually detected or not just after
the register is changed for the source.

Current implementation evaluates whole the register to detect configured
source. This results in failure due to the next lowest 8 bits when the
source is connected in advance.

This commit fixes the bug.

Fixes: 25784ec2d0 ("ALSA: bebob: Add support for Focusrite Saffire/SaffirePro series")
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191102150920.20367-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-04 09:03:06 +01:00
Takashi Sakamoto f2bbdbcb07 ALSA: bebob: Fix prototype of helper function to return negative value
A helper function of ALSA bebob driver returns negative value in a
function which has a prototype to return unsigned value.

This commit fixes it by changing the prototype.

Fixes: eb7b3a056c ("ALSA: bebob: Add commands and connections/streams management")
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191026030620.12077-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-26 09:06:20 +02:00
Takashi Sakamoto 3a9236e972 ALSA: dice: fix wrong packet parameter for Alesis iO26
At higher sampling rate (e.g. 192.0 kHz), Alesis iO26 transfers 4 data
channels per data block in CIP.

Both iO14 and iO26 have the same contents in their configuration ROM.
For this reason, ALSA Dice driver attempts to distinguish them according
to the value of TX0_AUDIO register at probe callback. Although the way is
valid at lower and middle sampling rate, it's lastly invalid at higher
sampling rate because because the two models returns the same value for
read transaction to the register.

In the most cases, users just plug-in the device and ALSA dice driver
detects it. In the case, the device runs at lower sampling rate and
the driver detects expectedly. For this reason, this commit leaves the
way to detect as is.

Fixes: 28b208f600 ("ALSA: dice: add parameters of stream formats for models produced by Alesis")
Cc: <stable@vger.kernel.org> # v4.18+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20190916101851.30409-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-16 23:46:14 +02:00
Takashi Iwai d3f9990f1b Merge branch 'for-next' into for-linus
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-14 17:26:10 +02:00
Takashi Sakamoto e1a00b5b25 ALSA: firewire-tascam: check intermediate state of clock status and retry
2 bytes in MSB of register for clock status is zero during intermediate
state after changing status of sampling clock in models of TASCAM FireWire
series. The duration of this state differs depending on cases. During the
state, it's better to retry reading the register for current status of
the clock.

In current implementation, the intermediate state is checked only when
getting current sampling transmission frequency, then retry reading.
This care is required for the other operations to read the register.

This commit moves the codes of check and retry into helper function
commonly used for operations to read the register.

Fixes: e453df44f0 ("ALSA: firewire-tascam: add PCM functionality")
Cc: <stable@vger.kernel.org> # v4.4+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20190910135152.29800-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-10 16:16:46 +02:00
Takashi Sakamoto 2617120f4d ALSA: firewire-tascam: handle error code when getting current source of clock
The return value of snd_tscm_stream_get_clock() is ignored. This commit
checks the value and handle error.

Fixes: e453df44f0 ("ALSA: firewire-tascam: add PCM functionality")
Cc: <stable@vger.kernel.org> # v4.4+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20190910135152.29800-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-10 16:16:00 +02:00
Takashi Iwai 7711fb7dac ASoC: Updates for v5.4
Quite a big update this time around, particularly in the core
 where we've had a lot of cleanups from Morimoto-san - there's
 not much functional change but quite a bit of modernization
 going on.  We've also seen a lot of driver work, a lot of it
 cleanups but also some particular drivers.
 
  - Lots and lots of cleanups from Morimoto-san and Yue Haibing.
  - Lots of cleanups and enhancements to the Freescale, sunxi dnd
    Intel rivers.
  - Initial Sound Open Firmware suppot for i.MX8.
  - Removal of w90x900 and nuc900 drivers as the platforms are
    being removed.
  - New support for Cirrus Logic CS47L15 and CS47L92, Freescale
    i.MX 7ULP and 8MQ, Meson G12A and NXP UDA1334
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl13cr4THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0NKuB/9fvRIh6bJ4pUA26Bc7+shJQ1BtC/MN
 jo1G4maN+hY5ZUwE5hvg04S6W6Unm1iNotQecKcF43Vh/4SZNiLtfSEM4b/6IBWw
 IFUU6xDz8Q4HbF4HJMotpKQKMABpfds5flH2e1YrrNoMH+KlkC9kJOR26B2W36xW
 TZclfquCDICxr8M7eYGM7N5hOqSrlugyWBZqTTnTDnsMrW4SAaH2HYwFhaeayd+I
 ECyaXIoUHvo4FX5ueZv/mzBiMl0z4rgXn3tuqI6a8LoWJdRZTkcSQabtuIC+wmxb
 P734RY6vjSUYZrv03cAtxHDrSVoC/RYedOzhT+iFF6y/NHzdu701lsJb
 =aD0T
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v5.4

Quite a big update this time around, particularly in the core
where we've had a lot of cleanups from Morimoto-san - there's
not much functional change but quite a bit of modernization
going on.  We've also seen a lot of driver work, a lot of it
cleanups but also some particular drivers.

 - Lots and lots of cleanups from Morimoto-san and Yue Haibing.
 - Lots of cleanups and enhancements to the Freescale, sunxi dnd
   Intel rivers.
 - Initial Sound Open Firmware suppot for i.MX8.
 - Removal of w90x900 and nuc900 drivers as the platforms are
   being removed.
 - New support for Cirrus Logic CS47L15 and CS47L92, Freescale
   i.MX 7ULP and 8MQ, Meson G12A and NXP UDA1334
2019-09-10 13:03:08 +02:00
Takashi Sakamoto 8d0d5c3fa1 ALSA: firewire-lib: remove WARN_ON() at destruction of AMDTP domain
The destructor of AMDTP domain has WARN_ON() for the list of associated
AMDTP stream. Although this reminds a case that developers forget to
program consumer drivers to stop AMDTP domain, it hits when AMDTP domain
is not initialized yet. This occurs when initialization of sound card
fails as well and it's superfluous.

This commit removes the WARN_ON. Although the API to AMDTP domain does
nothing, it's left for future usage.

Fixes: 3ec3d7a3ff ("ALSA: firewire-lib: add AMDTP domain structure to handle several isoc contexts")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20190906131414.15370-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-07 08:39:23 +02:00
Takashi Sakamoto e6e2fe2b8f ALSA: firewire-tascam: add note for FE-8
TASCAM FE-8 is the rest of model in TASCAM FireWire series. This device
has no functionality to process audio signal and MIDI messages. Instead,
it transfers control messages to host system corresponding to operations
for some faders, buttons and knobs on its surface.

Unlike the other devices in this series, the control messages are
transmitted by asynchronous transactions. Some registers of device are
used for registration of destination address for the transaction. The
transaction includes quadlet-aligned data up to 32 quadlets.

Userspace applications can receive the transaction and parse it for
control message via Linux FireWire subsystem, without any support by
ALSA firewire-tascam driver. Therefore the driver gives no support
for it.

This commit removes placeholder for FE-8 and add some comment for its
functionalities as notes.

$ python2 linux-firewire-utils/src/crpp < ~/git/am-config-rom/tascam/tascam-fe8.img
               ROM header and bus information block
               -----------------------------------------------------------------
400  040f4798  bus_info_length 4, crc_length 15, crc 18328 (should be 14256)
404  31333934  bus_name "1394"
408  20ff7002  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
40c  00022eff  company_id 00022e     |
410  a094dcb7  device_id ffa094dcb7  | EUI-64 00022effa094dcb7

               root directory
               -----------------------------------------------------------------
414  0004bccc  directory_length 4, crc 48332
418  0300022e  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  8d000006  --> eui-64 leaf at 438
424  d1000001  --> unit directory at 428

               unit directory at 428
               -----------------------------------------------------------------
428  0003eda4  directory_length 3, crc 60836
42c  1200022e  specifier id
430  13800001  version
434  d4000004  --> dependent info directory at 444

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  0002461e  leaf_length 2, crc 17950
43c  00022eff  company_id 00022e     |
440  a094dcb7  device_id ffa094dcb7  | EUI-64 00022effa094dcb7

               dependent info directory at 444
               -----------------------------------------------------------------
444  0002ae47  directory_length 2, crc 44615
448  81000002  --> descriptor leaf at 450
44c  82000006  --> bus dependent info leaf at 464

               descriptor leaf at 450
               -----------------------------------------------------------------
450  0004a79e  leaf_length 4, crc 42910
454  00000000  textual descriptor
458  00000000  minimal ASCII
45c  54415343  "TASC"
460  414d0000  "AM"

               bus dependent info leaf at 464
               -----------------------------------------------------------------
464  0004a7d8  leaf_length 4, crc 42968
468  00000000
46c  00000000
470  46452d38
474  00000000

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20190906125544.13800-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-06 14:59:43 +02:00
Takashi Sakamoto 6af86bdb8a ALSA: firewire-motu: add support for MOTU 4pre
MOTU 4pre was launched in 2012 by MOTU, Inc. This commit allows userspace
applications can transmit and receive PCM frames and MIDI messages for
this model via ALSA PCM interface and RawMidi/Sequencer interfaces.

The device supports MOTU protocol version 3. Unlike the other devices, the
device is simply designed. The size of data block is fixed to 10 quadlets
during available sampling rates (44.1 - 96.0 kHz). Each data block
includes 1 source packet header, 2 data chunks for messages, 8 data chunks
for PCM samples and 2 data chunks for padding to quadlet alignment. The
device has no MIDI, optical, BNC and AES/EBU interfaces.

Like support for the other MOTU devices, the quality of playback sound
is not enough good with periodical noise yet.

$ python2 crpp < ~/git/am-config-rom/motu/motu-4pre.img
               ROM header and bus information block
               -----------------------------------------------------------------
400  041078cc  bus_info_length 4, crc_length 16, crc 30924
404  31333934  bus_name "1394"
408  20ff7000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
40c  0001f200  company_id 0001f2     |
410  000a41c5  device_id 00000a41c5  | EUI-64 0001f200000a41c5

               root directory
               -----------------------------------------------------------------
414  0004ef04  directory_length 4, crc 61188
418  030001f2  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  d1000002  --> unit directory at 428
424  8d000005  --> eui-64 leaf at 438

               unit directory at 428
               -----------------------------------------------------------------
428  0003ceda  directory_length 3, crc 52954
42c  120001f2  specifier id
430  13000045  version
434  17103800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  0002d248  leaf_length 2, crc 53832
43c  0001f200  company_id 0001f2     |
440  000a41c5  device_id 00000a41c5  | EUI-64 0001f200000a41c5

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-30 07:34:28 +02:00
Takashi Sakamoto f155e79ab5 ALSA: firewire-lib: fix isoc cycle count to which rx packet is scheduled
When introducing the list of packet descriptor, for rx packet, the
calculation of scheduled isoc cycle is omitted. This commit fixes the
bug.

Fixes: f4f6ae7b7c ("ALSA: firewire-lib: use packet descriptor for IT context")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-29 17:00:45 +02:00
Takashi Sakamoto 6e26d193d1 ALSA: dice: fix error path for initialization of stream structures
When introducing AMDTP domain to ALSA dice driver, error path does not
handle error correctly. This commit fixes the bug.

Fixes: e9f21129b8 ("ALSA: dice: support AMDTP domain")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-29 17:00:37 +02:00
Takashi Sakamoto 2fd2329393 ALSA: oxfw: fix to handle correct stream for PCM playback
When userspace application calls ioctl(2) to configure hardware for PCM
playback substream, ALSA OXFW driver handles incoming AMDTP stream.
In this case, outgoing AMDTP stream should be handled.

This commit fixes the bug for v5.3-rc kernel.

Fixes: 4f380d0070 ("ALSA: oxfw: configure packet format in pcm.hw_params callback")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-26 16:00:30 +02:00
Takashi Sakamoto 4c098dab12 ALSA: oxfw: fix NULL pointer dereference to unused stream structure
ALSA oxfw driver supports Griffin FireWave. This device supports one
isochronous stream for PCM playback. Current driver executes code to
wait event for stream structure of opposite direction. This causes
NULL pointer dereference.

This commit fixes the bug.

Fixes: ac5d77864c ("ALSA: oxfw: support AMDTP domain")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-26 15:56:01 +02:00
Takashi Iwai 744f51e863 Merge branch 'topic/usb-validation' into for-next
Pull USB validation patches.  It's based on the latest 5.3 development
branch, so we shall catch up the whole things.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-22 15:42:03 +02:00
Wenwen Wang 1be3c1fae6 ALSA: firewire: fix a memory leak bug
In iso_packets_buffer_init(), 'b->packets' is allocated through
kmalloc_array(). Then, the aligned packet size is checked. If it is
larger than PAGE_SIZE, -EINVAL will be returned to indicate the error.
However, the allocated 'b->packets' is not deallocated on this path,
leading to a memory leak.

To fix the above issue, free 'b->packets' before returning the error code.

Fixes: 31ef9134eb ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # v2.6.39+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-08 11:12:26 +02:00
Takashi Sakamoto 74f94e4182 ALSA: firewire-lib: localize kernel APIs to start/stop each AMDTP stream
As a result to support AMDTP domain, no drivers call kernel APIs to
start/stop each AMDTP stream. This commit localize these APIs.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:29 +02:00
Takashi Sakamoto c9a9ce899c ALSA: fireface: support AMDTP domain
This commit adds AMDTP domain support for ALSA fireface driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:28 +02:00
Takashi Sakamoto ccc6c1b0e6 ALSA: firewire-motu: support AMDTP domain
This commit adds AMDTP domain support for ALSA firewire-motu driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:28 +02:00
Takashi Sakamoto c281d46a51 ALSA: firewire-tascam: support AMDTP domain
This commit adds AMDTP domain support for ALSA firewire-tascam driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:27 +02:00
Takashi Sakamoto 9a08067ec3 ALSA: firewire-digi00x: support AMDTP domain
This commit adds AMDTP domain support for ALSA firewire-digi00x driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:26 +02:00
Takashi Sakamoto e9f21129b8 ALSA: dice: support AMDTP domain
This commit adds AMDTP domain support for ALSA dice driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:25 +02:00
Takashi Sakamoto ac5d77864c ALSA: oxfw: support AMDTP domain
This commit adds AMDTP domain support for ALSA oxfw driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:24 +02:00
Takashi Sakamoto db40eeb246 ALSA: fireworks: support AMDTP domain
This commit adds AMDTP domain support for ALSA fireworks driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:24 +02:00
Takashi Sakamoto b0db4d5129 ALSA: bebob: support AMDTP domain
This commit adds AMDTP domain support for ALSA bebob driver.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:23 +02:00
Takashi Sakamoto 42355abb9c ALSA: fireface: code refactoring for initialization/destruction of AMDTP stream
This commit is a preparation to support AMDTP domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:22 +02:00
Takashi Sakamoto 39e522a5a4 ALSA: firewire-motu: code refactoring for initialization/destruction of AMDTP stream
This commit is a preparation to support AMDTP domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:22 +02:00
Takashi Sakamoto 5f9625a5ba ALSA: firewire-tascam: code refactoring for initialization/destruction of AMDTP stream
This commit is a preparation to support AMDTP domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:21 +02:00
Takashi Sakamoto d79360ebe9 ALSA: firewire-digi00x: code refactoring for initialization/destruction of AMDTP stream
This commit is a preparation to support AMDTP domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:20 +02:00
Takashi Sakamoto 7eb7b18e9f ALSA: fireworks: code refactoring for bus reset handler
This commit is a preparation to support AMDTP domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:20 +02:00
Takashi Sakamoto 94491c175d ALSA: fireworks: code refactoring for initialization/destruction of AMDTP streams
This commit is a preparation to support AMDTP domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:19 +02:00
Takashi Sakamoto 9b4702b06c ALSA: firewire-lib: add a kernel API to start AMDTP streams in AMDTP domain
This commit adds a kernel API to start a couple of isochronous contexts
for some AMDTP streams.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:19 +02:00
Takashi Sakamoto 157a53eef6 ALSA: firewire-lib: add a kernel API to add AMDTP stream into AMDTP domain
This commit adds a kernel API to insert AMDTP stream to list in AMDTP
domain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:18 +02:00
Takashi Sakamoto 6261f90bdb ALSA: firewire-lib: add a kernel API to stop a couple of AMDTP streams in AMDTP domain
This commit adds a kernel API to stop a couple of isochronous contexts
for AMDTP streams. The API is not protected with any lock primitive.
Callers should use this with enough lock against concurrent access.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:17 +02:00
Takashi Sakamoto 3ec3d7a3ff ALSA: firewire-lib: add AMDTP domain structure to handle several isoc contexts
This commit adds 'struct amdtp_domain' structure. This structure
has list of instance of AMDTP stream to handle a couple of
isochronous contexts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05 19:57:16 +02:00