09 May, 2018

1 commit

  • commit 52759c0963510a2843774aac9b65ccaed3308dc0 upstream.

    At a commit f91c9d7610a ('ALSA: firewire-lib: cache maximum length of
    payload to reduce function calls'), maximum size of payload for tx
    isochronous packet is cached to reduce the number of function calls.

    This cache was programmed to updated at a first callback of ohci1394 IR
    context. However, the maximum size is required to queueing packets before
    starting the isochronous context.

    As a result, the cached value is reused to queue packets in next time to
    starting the isochronous context. Then the cache is updated in a first
    callback of the isochronous context. This can cause kernel NULL pointer
    dereference in a below call graph:

    (sound/firewire/amdtp-stream.c)
    amdtp_stream_start()
    ->queue_in_packet()
    ->queue_packet()
    (drivers/firewire/core-iso.c)
    ->fw_iso_context_queue()
    ->struct fw_card_driver.queue_iso()
    (drivers/firewire/ohci.c)
    = ohci_queue_iso()
    ->queue_iso_packet_per_buffer()
    buffer->pages[page]

    The issued dereference occurs in a case that:
    - target unit supports different stream formats for sampling transmission
    frequency.
    - maximum length of payload for tx stream in a first trial is bigger
    than the length in a second trial.

    In this case, correct number of pages are allocated for DMA and the 'pages'
    array has enough elements, while index of the element is wrongly calculated
    according to the old value of length of payload in a call of
    'queue_in_packet()'. Then it causes the issue.

    This commit fixes the critical bug. This affects all of drivers in ALSA
    firewire stack in Linux kernel v4.12 or later.

    [12665.302360] BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
    [12665.302415] IP: ohci_queue_iso+0x47c/0x800 [firewire_ohci]
    [12665.302439] PGD 0
    [12665.302440] P4D 0
    [12665.302450]
    [12665.302470] Oops: 0000 [#1] SMP PTI
    [12665.302487] Modules linked in: ...
    [12665.303096] CPU: 1 PID: 12760 Comm: jackd Tainted: P OE 4.13.0-38-generic #43-Ubuntu
    [12665.303154] Hardware name: /DH77DF, BIOS KCH7710H.86A.0069.2012.0224.1825 02/24/2012
    [12665.303215] task: ffff9ce87da2ae80 task.stack: ffffb5b8823d0000
    [12665.303258] RIP: 0010:ohci_queue_iso+0x47c/0x800 [firewire_ohci]
    [12665.303301] RSP: 0018:ffffb5b8823d3ab8 EFLAGS: 00010086
    [12665.303337] RAX: ffff9ce4f4876930 RBX: 0000000000000008 RCX: ffff9ce88a3955e0
    [12665.303384] RDX: 0000000000000000 RSI: 0000000034877f00 RDI: 0000000000000000
    [12665.303427] RBP: ffffb5b8823d3b68 R08: ffff9ce8ccb390a0 R09: ffff9ce877639ab0
    [12665.303475] R10: 0000000000000108 R11: 0000000000000000 R12: 0000000000000003
    [12665.303513] R13: 0000000000000000 R14: ffff9ce4f4876950 R15: 0000000000000000
    [12665.303554] FS: 00007f2ec467f8c0(0000) GS:ffff9ce8df280000(0000) knlGS:0000000000000000
    [12665.303600] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [12665.303633] CR2: 0000000000000030 CR3: 00000002dcf90004 CR4: 00000000000606e0
    [12665.303674] Call Trace:
    [12665.303698] fw_iso_context_queue+0x18/0x20 [firewire_core]
    [12665.303735] queue_packet+0x88/0xe0 [snd_firewire_lib]
    [12665.303770] amdtp_stream_start+0x19b/0x270 [snd_firewire_lib]
    [12665.303811] start_streams+0x276/0x3c0 [snd_dice]
    [12665.303840] snd_dice_stream_start_duplex+0x1bf/0x480 [snd_dice]
    [12665.303882] ? vma_gap_callbacks_rotate+0x1e/0x30
    [12665.303914] ? __rb_insert_augmented+0xab/0x240
    [12665.303936] capture_prepare+0x3c/0x70 [snd_dice]
    [12665.303961] snd_pcm_do_prepare+0x1d/0x30 [snd_pcm]
    [12665.303985] snd_pcm_action_single+0x3b/0x90 [snd_pcm]
    [12665.304009] snd_pcm_action_nonatomic+0x68/0x70 [snd_pcm]
    [12665.304035] snd_pcm_prepare+0x68/0x90 [snd_pcm]
    [12665.304058] snd_pcm_common_ioctl1+0x4c0/0x940 [snd_pcm]
    [12665.304083] snd_pcm_capture_ioctl1+0x19b/0x250 [snd_pcm]
    [12665.304108] snd_pcm_capture_ioctl+0x27/0x40 [snd_pcm]
    [12665.304131] do_vfs_ioctl+0xa8/0x630
    [12665.304148] ? entry_SYSCALL_64_after_hwframe+0xe9/0x139
    [12665.304172] ? entry_SYSCALL_64_after_hwframe+0xe2/0x139
    [12665.304195] ? entry_SYSCALL_64_after_hwframe+0xdb/0x139
    [12665.304218] ? entry_SYSCALL_64_after_hwframe+0xd4/0x139
    [12665.304242] ? entry_SYSCALL_64_after_hwframe+0xcd/0x139
    [12665.304265] ? entry_SYSCALL_64_after_hwframe+0xc6/0x139
    [12665.304288] ? entry_SYSCALL_64_after_hwframe+0xbf/0x139
    [12665.304312] ? entry_SYSCALL_64_after_hwframe+0xb8/0x139
    [12665.304335] ? entry_SYSCALL_64_after_hwframe+0xb1/0x139
    [12665.304358] SyS_ioctl+0x79/0x90
    [12665.304374] ? entry_SYSCALL_64_after_hwframe+0x72/0x139
    [12665.304397] entry_SYSCALL_64_fastpath+0x24/0xab
    [12665.304417] RIP: 0033:0x7f2ec3750ef7
    [12665.304433] RSP: 002b:00007fff99e31388 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    [12665.304465] RAX: ffffffffffffffda RBX: 00007fff99e312f0 RCX: 00007f2ec3750ef7
    [12665.304494] RDX: 0000000000000000 RSI: 0000000000004140 RDI: 0000000000000007
    [12665.304522] RBP: 0000556ebc63fd60 R08: 0000556ebc640560 R09: 0000000000000000
    [12665.304553] R10: 0000000000000001 R11: 0000000000000246 R12: 0000556ebc63fcf0
    [12665.304584] R13: 0000000000000000 R14: 0000000000000007 R15: 0000000000000000
    [12665.304612] Code: 01 00 00 44 89 eb 45 31 ed 45 31 db 66 41 89 1e 66 41 89 5e 0c 66 45 89 5e 0e 49 8b 49 08 49 63 d4 4d 85 c0 49 63 ff 48 8b 14 d1 8b 72 30 41 8d 14 37 41 89 56 04 48 63 d3 0f 84 ce 00 00 00
    [12665.304713] RIP: ohci_queue_iso+0x47c/0x800 [firewire_ohci] RSP: ffffb5b8823d3ab8
    [12665.304743] CR2: 0000000000000030
    [12665.317701] ---[ end trace 9d55b056dd52a19f ]---

    Fixes: f91c9d7610a ('ALSA: firewire-lib: cache maximum length of payload to reduce function calls')
    Cc: # v4.12+
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     

02 May, 2018

2 commits

  • commit 0f925660a7bc49b269c163249a5d06da3a0c7b0a upstream.

    In error path of snd_dice_stream_init_duplex(), stream data for incoming
    packet can be left to be initialized.

    This commit fixes it.

    Fixes: 436b5abe2224 ('ALSA: dice: handle whole available isochronous streams')
    Cc: # v4.6+
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     
  • commit 10412c420af9ba1f3de8483a95d360e5eb5bfc84 upstream.

    OUI for TC Electronic is 0x000166, for TC GROUP A/S. 0x001486 is for Echo
    Digital Audio Corporation.

    Fixes: 7cafc65b3aa1 ('ALSA: dice: force to add two pcm devices for listed models')
    Cc: # v4.6+
    Reference: http://standards-oui.ieee.org/oui/oui.txt
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Sakamoto
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

12 Sep, 2017

1 commit


23 Aug, 2017

1 commit


22 Aug, 2017

2 commits


21 Aug, 2017

2 commits

  • MOTU Audio Express is one of third generation in MOTU FireWire
    series, produced in 2011. This model consists of three chips:
    * TI TSB41AB2 (Physical layer for IEEE 1394 bus)
    * Microchip USB3300 (Hi-Speed USB Device with ULPI interface)
    * Xilinx Spartan-3A FPGA, XC3S400A (Link layer for IEEE 1394 bus, packet
    processing and data block processing layer)

    This commit adds support for this model. As I expected, it works with
    current implementaion of protocol version 3. On the other hand, the unit
    has a quirk to request subaction originated by any driver.

    11:45:51.287643 firewire_ohci 0000:03:00.0: AT spd 2 tl 1f, ffc1 -> ffc0, -reserved-, QW req, fffff0000b14 = 02000200
    11:45:51.289193 firewire_ohci 0000:03:00.0: AR spd 2 tl 1f, ffc0 -> ffc1, ack_complete, W resp
    11:45:51.289381 fireire_core 0000:03:00.0: unsolicited response (source ffc0, tlabel 1f)
    11:45:51.313071 firewire_ohci 0000:03:00.0: AT spd 2 tl 20, ffc1 -> ffc0, ack_pending , QW req, fffff0000b14 = 02000200
    11:45:51.314539 firewire_ohci 0000:03:00.0: AR spd 2 tl 20, ffc0 -> ffc1, ack_complete, W resp

    In 1394 OHCI (rev.1.1), after OUTPUT_LAST* descriptors is processed,
    'xferStaus' field is filled with 'ContextControl[0:15]' (see clause 7.1.3).
    5 bits in LSB side of the field has ack code in acknowledge from the unit
    (see clause 7.2.2). A list of the code is shown in Table 3-2.

    As long as I investigated, in a case of the '-reserved-' acknowledge
    message from the unit, the field has 0x10. On the table, this value is
    'Reserved for definition by future 1394 standards'. As long as I know,
    any specifications of IEEE 1394 has no such extensions, thus the unit is
    out of specification. Besides, I note that the unit does not always
    acknowledge with the invalid code. I guess this is a bug of firmware. I
    confirmed the bug in firmware version 1.04 and this is the latest one.

    $ cd linux-firewire-utils
    $ python2 ./src/crpp < /sys/bus/firewire/devices/fw1/config_rom
    ROM header and bus information block
    -----------------------------------------------------------------
    400 0410a756 bus_info_length 4, crc_length 16, crc 42838
    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 000a8a7b device_id 00000a8a7b | EUI-64 0001f200000a8a7b

    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 00031680 directory_length 3, crc 5760
    42c 120001f2 specifier id
    430 13000033 version
    434 17104800 model

    eui-64 leaf at 438
    -----------------------------------------------------------------
    438 00025ef3 leaf_length 2, crc 24307
    43c 0001f200 company_id 0001f2 |
    440 000a8a7b device_id 00000a8a7b | EUI-64 0001f200000a8a7b

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In protocols of MOTU FireWire series, when transferring MIDI messages,
    transmitter set existence flag to one byte on first several quadlets. The
    position differs depending on protocols and models, however two cases are
    confirmed; in 5th byte and 8th byte from MSB side.

    This commit adds a series of specification flag to describe them. When
    the existence flag is in the 5th byte, SND_MOTU_SPEC_[R|T]X_MIDI_2ND_Q is
    used. Else, another set of the flag is used. Here, '_Q' means quadlet.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

20 Aug, 2017

2 commits

  • When failing sound card registration after initializing stream data, this
    module leaves allocated data in stream data. This commit fixes the bug.

    Fixes: 9b2bb4f2f4a2 ('ALSA: firewire-motu: add stream management functionality')
    Cc: # v4.12+
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • When calling 'iso_resource_free()' for uninitialized data, this function
    causes NULL pointer dereference due to its 'unit' member. This occurs when
    unplugging audio and music units on IEEE 1394 bus at failure of card
    registration.

    This commit fixes the bug. The bug exists since kernel v4.5.

    Fixes: 324540c4e05c ('ALSA: fireface: postpone sound card registration') at v4.12
    Fixes: 8865a31e0fd8 ('ALSA: firewire-motu: postpone sound card registration') at v4.12
    Fixes: b610386c8afb ('ALSA: firewire-tascam: deleyed registration of sound card') at v4.7
    Fixes: 86c8dd7f4da3 ('ALSA: firewire-digi00x: delayed registration of sound card') at v4.7
    Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card') at v4.7
    Fixes: 7d3c1d5901aa ('ALSA: fireworks: delayed registration of sound card') at v4.7
    Fixes: 04a2c73c97eb ('ALSA: bebob: delayed registration of sound card') at v4.7
    Fixes: b59fb1900b4f ('ALSA: dice: postpone card registration') at v4.5
    Cc: # v4.5+
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

19 Aug, 2017

1 commit


15 Aug, 2017

1 commit


20 Jun, 2017

1 commit


19 Jun, 2017

1 commit

  • At Linux v3.5, packet processing can be done in process context of ALSA
    PCM application as well as software IRQ context for OHCI 1394. Below is
    an example of the callgraph (some calls are omitted).

    ioctl(2) with e.g. HWSYNC
    (sound/core/pcm_native.c)
    ->snd_pcm_common_ioctl1()
    ->snd_pcm_hwsync()
    ->snd_pcm_stream_lock_irq
    (sound/core/pcm_lib.c)
    ->snd_pcm_update_hw_ptr()
    ->snd_pcm_udpate_hw_ptr0()
    ->struct snd_pcm_ops.pointer()
    (sound/firewire/*)
    = Each handler on drivers in ALSA firewire stack
    (sound/firewire/amdtp-stream.c)
    ->amdtp_stream_pcm_pointer()
    (drivers/firewire/core-iso.c)
    ->fw_iso_context_flush_completions()
    ->struct fw_card_driver.flush_iso_completion()
    (drivers/firewire/ohci.c)
    = flush_iso_completions()
    ->struct fw_iso_context.callback.sc
    (sound/firewire/amdtp-stream.c)
    = in_stream_callback() or out_stream_callback()
    ->...
    ->snd_pcm_stream_unlock_irq

    When packet queueing error occurs or detecting invalid packets in
    'in_stream_callback()' or 'out_stream_callback()', 'snd_pcm_stop_xrun()'
    is called on local CPU with disabled IRQ.

    (sound/firewire/amdtp-stream.c)
    in_stream_callback() or out_stream_callback()
    ->amdtp_stream_pcm_abort()
    ->snd_pcm_stop_xrun()
    ->snd_pcm_stream_lock_irqsave()
    ->snd_pcm_stop()
    ->snd_pcm_stream_unlock_irqrestore()

    The process is stalled on the CPU due to attempt to acquire recursive lock.

    [ 562.630853] INFO: rcu_sched detected stalls on CPUs/tasks:
    [ 562.630861] 2-...: (1 GPs behind) idle=37d/140000000000000/0 softirq=38323/38323 fqs=7140
    [ 562.630862] (detected by 3, t=15002 jiffies, g=21036, c=21035, q=5933)
    [ 562.630866] Task dump for CPU 2:
    [ 562.630867] alsa-source-OXF R running task 0 6619 1 0x00000008
    [ 562.630870] Call Trace:
    [ 562.630876] ? vt_console_print+0x79/0x3e0
    [ 562.630880] ? msg_print_text+0x9d/0x100
    [ 562.630883] ? up+0x32/0x50
    [ 562.630885] ? irq_work_queue+0x8d/0xa0
    [ 562.630886] ? console_unlock+0x2b6/0x4b0
    [ 562.630888] ? vprintk_emit+0x312/0x4a0
    [ 562.630892] ? dev_vprintk_emit+0xbf/0x230
    [ 562.630895] ? do_sys_poll+0x37a/0x550
    [ 562.630897] ? dev_printk_emit+0x4e/0x70
    [ 562.630900] ? __dev_printk+0x3c/0x80
    [ 562.630903] ? _raw_spin_lock+0x20/0x30
    [ 562.630909] ? snd_pcm_stream_lock+0x31/0x50 [snd_pcm]
    [ 562.630914] ? _snd_pcm_stream_lock_irqsave+0x2e/0x40 [snd_pcm]
    [ 562.630918] ? snd_pcm_stop_xrun+0x16/0x70 [snd_pcm]
    [ 562.630922] ? in_stream_callback+0x3e6/0x450 [snd_firewire_lib]
    [ 562.630925] ? handle_ir_packet_per_buffer+0x8e/0x1a0 [firewire_ohci]
    [ 562.630928] ? ohci_flush_iso_completions+0xa3/0x130 [firewire_ohci]
    [ 562.630932] ? fw_iso_context_flush_completions+0x15/0x20 [firewire_core]
    [ 562.630935] ? amdtp_stream_pcm_pointer+0x2d/0x40 [snd_firewire_lib]
    [ 562.630938] ? pcm_capture_pointer+0x19/0x20 [snd_oxfw]
    [ 562.630943] ? snd_pcm_update_hw_ptr0+0x47/0x3d0 [snd_pcm]
    [ 562.630945] ? poll_select_copy_remaining+0x150/0x150
    [ 562.630947] ? poll_select_copy_remaining+0x150/0x150
    [ 562.630952] ? snd_pcm_update_hw_ptr+0x10/0x20 [snd_pcm]
    [ 562.630956] ? snd_pcm_hwsync+0x45/0xb0 [snd_pcm]
    [ 562.630960] ? snd_pcm_common_ioctl1+0x1ff/0xc90 [snd_pcm]
    [ 562.630962] ? futex_wake+0x90/0x170
    [ 562.630966] ? snd_pcm_capture_ioctl1+0x136/0x260 [snd_pcm]
    [ 562.630970] ? snd_pcm_capture_ioctl+0x27/0x40 [snd_pcm]
    [ 562.630972] ? do_vfs_ioctl+0xa3/0x610
    [ 562.630974] ? vfs_read+0x11b/0x130
    [ 562.630976] ? SyS_ioctl+0x79/0x90
    [ 562.630978] ? entry_SYSCALL_64_fastpath+0x1e/0xad

    This commit fixes the above bug. This assumes two cases:
    1. Any error is detected in software IRQ context of OHCI 1394 context.
    In this case, PCM substream should be aborted in packet handler. On the
    other hand, it should not be done in any process context. TO distinguish
    these two context, use 'in_interrupt()' macro.
    2. Any error is detect in process context of ALSA PCM application.
    In this case, PCM substream should not be aborted in packet handler
    because PCM substream lock is acquired. The task to abort PCM substream
    should be done in ALSA PCM core. For this purpose, SNDRV_PCM_POS_XRUN is
    returned at 'struct snd_pcm_ops.pointer()'.

    Suggested-by: Clemens Ladisch
    Fixes: e9148dddc3c7("ALSA: firewire-lib: flush completed packets when reading PCM position")
    Cc: # 4.9+
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

08 Jun, 2017

1 commit


07 Jun, 2017

2 commits

  • ALSA fireface driver has ALSA specific operations for MIDI/PCM data.
    Structured data for the operations can be constified. Additionally,
    The structured data can be function local.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In recent commit for ALSA PCM core, some arrangement is done for
    'struct snd_pcm_ops.ack' callback. This is called when appl_ptr is
    explicitly moved in intermediate buffer for PCM frames, except for
    some cases described later.

    For drivers in ALSA firewire stack, usage of this callback has a merit to
    reduce latency between time of PCM frame queueing and handling actual
    packets in recent isochronous cycle, because no need to wait for software
    IRQ context from isochronous context of OHCI 1394.

    If this works well in a case that mapped page frame is used for the
    intermediate buffer, user process should execute some commands for ioctl(2)
    to tell the number of handled PCM frames in the intermediate buffer just
    after handling them. Therefore, at present, with a combination of below
    conditions, this doesn't work as expected and user process should wait for
    the software IRQ context as usual:
    - when ALSA PCM core judges page frame mapping is available for status
    data (struct snd_pcm_mmap_status) and control data
    (struct snd_pcm_mmap_control).
    - user process handles PCM frames by loop just with 'snd_pcm_mmap_begin()'
    and 'snd_pcm_mmap_commit()'.
    - user process uses PCM hw plugin in alsa-lib to operate I/O without
    'sync_ptr_ioctl' option.

    Unfortunately, major use case include these three conditions.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

30 May, 2017

1 commit

  • Declare snd_kcontrol_new structures as const as they are only passed an
    argument to the function snd_ctl_new1. This argument is of type const,
    so snd_kcontrol_new structures having this property can be made const.
    Done using Coccinelle:

    @r disable optional_qualifier@
    identifier x;
    position p;
    @@
    static struct snd_kcontrol_new x@p={...};

    @ok@
    identifier r.x;
    position p;
    @@
    snd_ctl_new1(&x@p,...)

    @bad@
    position p != {r.p,ok.p};
    identifier r.x;
    @@
    x@p

    @depends on !bad disable optional_qualifier@
    identifier r.x;
    @@
    +const
    struct snd_kcontrol_new x;

    Cross compiled these files:
    sound/aoa/codecs/tas.c - powerpc
    sound/mips/{hal2.c/sgio2audio.c} - mips
    sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc
    sound/soc/sh/siu_dai.c - sh
    Could not find an architecture to compile sound/sh/aica.c.

    Signed-off-by: Bhumika Goyal
    Acked-by: Mark Brown
    Signed-off-by: Takashi Iwai

    Bhumika Goyal
     

22 May, 2017

1 commit

  • In IEC 61883-6, AM824 is described as format of data block. In this
    format, one data block consists of several data channels, which is aligned
    to 32 bit. One data channel has 8 bit label field and 24 bit data field.
    PCM frames are transferred in Multi Bit Linear Audio (MBLA) data channel.
    This channel can include 16/20/24 bit PCM sample.

    As long as I know, models which support IEC 61883-1/6 doesn't allow to
    switch bit length of PCM sample in MBLA data channel. They always
    transmit/receive PCM frames of 24 bit length. This can be seen for the
    other models which support protocols similar to IEC 61883-1/6.

    On the other hand, current drivers for these protocols supports 16 bit
    length PCM sample in playback substream. In this case, PCM sample is put
    into the MBLA data channel with 8 bit padding in LSB side. Although 16
    bit PCM sample is major because it's in CD format, this doesn't represent
    device capability as is.

    This commit removes support for 16 bit PCM samples in playback substream.

    Signed-off-by: Takashi Sakamoto
    Acked-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

20 Apr, 2017

2 commits

  • In development period for Linux v4.10, ktime_t became an alias of s64,
    instead of union. I forgot it. We can just assign zero, instead of usage
    of ktime_set(0, 0).

    Fixes: 19174295788 ("ALSA: fireface: add transaction support")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Two functions were introduced for the purpose of tracing but cause warnings
    when tracing is disabled:

    sound/firewire/motu/amdtp-motu.c:284:13: error: 'copy_message' defined but not used [-Werror=unused-function]
    static void copy_message(u64 *frames, __be32 *buffer, unsigned int data_blocks,
    sound/firewire/motu/amdtp-motu.c:271:13: error: 'copy_sph' defined but not used [-Werror=unused-function]
    static void copy_sph(u32 *frames, __be32 *buffer, unsigned int data_blocks,

    Marking them as __maybe_unused will do the right thing here.

    Fixes: 17909c1b3058 ("ALSA: firewire-motu: add tracepoints for SPH in IEC 61883-1 fashion")
    Fixes: c6b0b9e65f09 ("ALSA: firewire-motu: add tracepoints for messages for unique protocol")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Takashi Iwai

    Arnd Bergmann
     

14 Apr, 2017

10 commits

  • ALSA driver for TASCAM FireWire series transfers MIDI messages in system
    workqueue. In current design of the driver, applications should wait for
    sequence of transmission when they close ALSA rawmidi character devices.
    However, when considering design of rawmidi interface, it's preferable
    to wait in drain ioctl.

    This commit adds support for the drain ioctl to wait for the end of
    the transmission.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Units on TASCAM FireWire series handle MIDI messages with support for
    running status. Drivers for the series should remember current running
    status and transfer valid MIDI messages. For this purpose, current
    ALSA driver for the series has some members in its top-level structure.
    This is due to better abstraction of async midi port. Nowadays, the
    abstraction was localized just for the driver.

    This commit moves the members to structure for async midi port.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In current design of ALSA driver for TASCAM FireWire series, initialization
    of members in asymc midi port structure is done at device probing. Some of
    the members should be initialized every time to use rawmidi devices because
    they're changed in sequence of transmission for MIDI messages.

    This commit adds a new function to initialize them. Invariant parameters
    during object lifetime are kept as is.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • ALSA driver for TASCAM FireWire series internally allocates 4 byte buffer
    for asynchronous transaction to transfer MIDI messages. However, the buffer
    can be allocated with memory object of parent structure.

    This commit adds 4 byte array as a member of the structure and obsoletes
    the redundant allocation. This is deallocated with memory object of parent
    structure.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Units on TASCAM FireWire series receive MIDI messages by asynchronous
    transactions on IEEE 1394 bus. Although the transaction is sent to a
    certain register, current ALSA driver for this series has a redundant design.

    This commit use the same address for the transaction.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • TASCAM FireWire series uses asynchronous transactions with fixed length
    payload for MIDI messaging. On the other hand, ALSA driver for the series
    has a redundant design to handle different length of payload.

    This commit removes the redundant abstraction.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • As a result of localization of async midi port, ALSA driver for TASCAM
    FireWire series can call helper function directly instead of callback
    registration.

    This commit removes the redundant design.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In Linux kernel 4.4, firewire-lib got a feature called as 'async midi port'
    for transmission of MIDI message via IEEE 1394 asynchronous communication,
    however actual consumer of this feature is ALSA driver for TASCAM FireWire
    series only. When adding this feature, I assumed that ALSA driver for
    Digi00x might also be a consumer, actually it's not.

    This commit moves the feature from firewire-lib to firewire-tascam module.
    Two minor kernel APIs are removed.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Back-merge to prepare for applying more FireWire updates.

    Takashi Iwai
     
  • An abstraction of asynchronous transaction for transmission of MIDI
    messages was introduced in Linux v4.4. Each driver can utilize this
    abstraction to transfer MIDI messages via fixed-length payload of
    transaction to a certain unit address. Filling payload of the transaction
    is done by callback. In this callback, each driver can return negative
    error code, however current implementation assigns the return value to
    unsigned variable.

    This commit changes type of the variable to fix the bug.

    Reported-by: Julia Lawall
    Cc: # 4.4+
    Fixes: 585d7cba5e1f ("ALSA: firewire-lib: add helper functions for asynchronous transactions to transfer MIDI messages")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

12 Apr, 2017

2 commits


11 Apr, 2017

3 commits

  • MOTU units transfer/receive messages in each data block of their
    isochronous packet payload. A part of content in the message is cleard for
    MIDI message transmission, while the rest is unknown yet. Additional
    features are required to assist users and developers to reveal the
    details.

    This commit adds tracepoints for the purpose. The tracepoints are designed
    for MOTU's protocol version 2 and 3 (Protocol version 1 is not upstreamed
    yet). In the tracepoints, events are probed to gather first two 24 bit
    data chunks of each data block. The chunks are formatted into elements
    of 64 bit array with padding in MSB.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Unique protocol is used for MOTU FireWire series. In this protocol,
    data block format is not compliant to AM824 in IEC 61883-1/6. Each of
    the data block consists of 24 bit data chunks, except for a first
    quadlet. The quadlet is used for source packet header (SPH) described
    in IEC 61883-1.

    The sequence of SPH seems to represent presentation timestamp
    corresponding to included data. Developers have experienced that invalid
    sequence brings disorder of units in the series.

    Unfortunately, current implementation of ALSA IEC 61883-1/6 engine and
    firewire-motu driver brings periodical noises to the units at sampling
    transmission frequency based on 44.1 kHz. The engine generates the SPH with
    even interval and this mechanism seems not to be suitable to the units.
    Further work is required for this issue and infrastructure is preferable
    to assist the work.

    This commit adds tracepoints for the purpose. In the tracepoints, events
    are probed to gather the SPHs from each data blocks.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Unique protocol is used for RME Fireface series. In this protocol,
    payload format for isochronous packet is not compliant to CIP in
    IEC 61883-1/6. The packet includes data blocks just with data channels,
    without headers and any metadata.

    In previous commits, ALSA IEC 61883-1/6 engine supports this protocol.
    However, tracepoints are not supported yet, unlike implementation for
    IEC 61883-1/6 protocol. This commit adds support of tracepoints for
    the protocol.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

06 Apr, 2017

2 commits

  • In ALSA firewire stack, some AV/C commands are supported, including
    vendor's extensions. Drivers includes response parser of each command,
    according to its requirements, while the parser is written with loose
    fashion in two points; error check and length check. This doesn't cause
    any issues such as kernel corruption, but should be improved.

    This commit modifies evaluations of return value on each parsers.

    Reported-by: Dan Carpenter
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In protocol version 3, drivers can read current sampling clock status from
    register 0x'ffff'f000'0b14. 8 bits of LSB of this register represents type
    of signal as source of clock.

    Current driver code includes invalid bitshift to handle the parameter. This
    commit fixes the bug.

    Reported-by: Dan Carpenter
    Fixes: 5992e30034c4 ("ALSA: firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto