20 Jan, 2021

2 commits

  • commit 9f65df9c589f249435255da37a5dd11f1bc86f4d 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
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20210111130251.361335-3-geert+renesas@glider.be
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • commit e7c22eeaff8565d9a8374f320238c251ca31480b 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]
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20210111130251.361335-2-geert+renesas@glider.be
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     

14 Nov, 2020

1 commit

  • 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: 555e8a8f7f14 ("ALSA: fireworks: Add command/response functionality into hwdep interface")
    Signed-off-by: Dan Carpenter
    Acked-by: Takashi Sakamoto
    Cc:
    Link: https://lore.kernel.org/r/20201113101241.GB168908@mwanda
    Signed-off-by: Takashi Iwai

    Dan Carpenter
     

12 Oct, 2020

2 commits


07 Oct, 2020

1 commit

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

    Fixes: 618eabeae711 ("ALSA: bebob: Add hwdep interface")
    Signed-off-by: Dan Carpenter
    Acked-by: Takashi Sakamoto
    Cc:
    Link: https://lore.kernel.org/r/20201007074928.GA2529578@mwanda
    Signed-off-by: Takashi Iwai

    Dan Carpenter
     

12 Sep, 2020

1 commit

  • The tasklet is an old API that should be deprecated, usually can be
    converted to another decent API. In FireWire driver, a tasklet is
    still used for offloading the AMDTP PCM stream handling. It can be
    achieved gracefully with a work queued, too.

    This patch replaces the tasklet usage in firewire-lib driver with a
    simple work. The conversion is fairly straightforward but for the
    in_interrupt() checks that are replaced with the check using the
    current_work().

    Note that in_interrupt() in amdtp_packet tracepoint is still kept as
    is. This is the place that is probed by both softirq of 1394 OHCI and
    a user task of a PCM application, and the work handling is already
    filtered in amdtp_domain_stream_pcm_pointer().

    Tested-by: Takashi Sakamoto
    Acked-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200909163659.21708-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

02 Sep, 2020

2 commits


23 Aug, 2020

2 commits

  • 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
    Fixes: 9edf723fd858 ("ALSA: firewire-digi00x: add skeleton for Digi 002/003 family")
    Cc: # 4.4+
    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200823075545.56305-1-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • 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 53b3ffee7885 ("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: 53b3ffee7885 ("ALSA: firewire-tascam: change device probing processing")
    Cc: # 4.4+
    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200823075537.56255-1-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

07 Jul, 2020

1 commit

  • Fix W=1 warning. Remove excess function parameter from description

    Fixes: 7bc93821a70a ("ALSA: firewire-lib: split allocation of isochronous resources from establishment of connection")
    Acked-by: Takashi Sakamoto
    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200702193604.169059-13-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Takashi Iwai

    Pierre-Louis Bossart
     

15 Jun, 2020

1 commit

  • It costs expensive to change clock configuration for models of protocol
    version 3. In current implementation, speculative strategy is used to
    finish the operation; just waiting for 4 seconds. As long as I investigate,
    when accepting and changing clock status actually, the device sends
    notification with mask.

    This commit uses wise way to wait for the notification after changing
    sampling clock rate during 4 seconds.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200614141221.53527-1-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

28 May, 2020

1 commit


25 May, 2020

1 commit

  • UltraLite-mk3 was shipped 2008 by MOTU. This model has two lineups;
    FireWire-only and FireWire/USB2.0 Hybrid model. Additionally, the latter
    has two variants in respect of the type of IEEE 1394 connector; alpha
    and beta connector.

    This commit adds support for the FireWire-only model, which is already
    discontinued.

    $ python3 crpp < /sys/bus/firewire/devices/fw1/config_rom
    ROM header and bus information block
    -----------------------------------------------------------------
    400 0410353a bus_info_length 4, crc_length 16, crc 13626
    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 000902c7 device_id 00000902c7 | EUI-64 0001f200000902c7

    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 00035556 directory_length 3, crc 21846
    42c 120001f2 specifier id
    430 13000019 version
    434 17100800 model

    eui-64 leaf at 438
    -----------------------------------------------------------------
    438 0002f3c5 leaf_length 2, crc 62405
    43c 0001f200 company_id 0001f2 |
    440 000902c7 device_id 00000902c7 | EUI-64 0001f200000902c7

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200523071733.170129-1-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

22 May, 2020

14 commits


11 May, 2020

1 commit


10 May, 2020

6 commits

  • Fireface UFX was shipped by RME GmbH in 2010, and now discontinued.
    Although this model has some enhanced feature which Fireface 802
    doesn't have (e.g. on-board USB mass storage device class, configuration
    interface with color display), the functionality relevant to
    packet communication on IEEE 1394 bus seems to be the same as
    Fireface 802 (e.g. available number of channels for PCM frame in
    each sampling transfer frequency).

    With the assumption, this commit adds support for Fireface UFX. In ALSA
    fireface driver, these two models are handled as the same one.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200510074301.116224-7-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Fireface 802 was shipped by RME GmbH in 2014. This model supports later
    protocol for management of isochronous communication and synchronization
    of sampling transmission frequency.

    This model consists of below ICs:
    * TI TSB41AB2
    * Xilinx Spartan-6 FPGA XC6SLX16
    * TI TMS320 C6747
    * SMSC USB3250

    Especially, this model just supports IEEE 1394a, against its name which
    evokes Fireface 800.

    This commit adds support for Fireface 802 (tested). Userspace applications
    can transfer PCM frames and MIDI messages via ALSA PCM/Rawmidi interface.
    I note that 4 channels for ADAt1 and ADAT2 are disabled at higher sampling
    transfer frequency since isochronous resources reservation fails due to
    bandwidth limitation of IEEE 1394a.

    The value read from LATTER_SYNC_STATUS register is slightly different
    from the one of Fireface UCX. The higher 4 bits and lower 4 bits are
    swapped within the same byte.

    Without any assist of userspace application, transmitted MIDI messages
    from the device are not going to be processed. For detail, please refer
    to my comment in code of latter protocol.

    $ python crpp < /sys/bus/firewire/devices/fw1/config_rom
    ROM header and bus information block
    -----------------------------------------------------------------
    400 0404ffff bus_info_length 4, crc_length 4, crc 65535 (should be 26805)
    404 31333934 bus_name "1394"
    408 20008000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 8 (512)
    40c 000a3504 company_id 000a35 |
    410 38077423 device_id 0438077423 | EUI-64 000a350438077423

    root directory
    -----------------------------------------------------------------
    414 0005ffff directory_length 5, crc 65535 (should be 9514)
    418 0c0083c0 node capabilities per IEEE 1394
    41c 03000a35 vendor
    420 8100000b --> descriptor leaf at 44c
    424 8d000007 --> eui-64 leaf at 440
    428 d1000001 --> unit directory at 42c

    unit directory at 42c
    -----------------------------------------------------------------
    42c 0004ffff directory_length 4, crc 65535 (should be 45134)
    430 12000a35 specifier id
    434 13000005 version
    438 17101800 model
    43c 81000008 --> descriptor leaf at 45c

    eui-64 leaf at 440
    -----------------------------------------------------------------
    440 0002ffff leaf_length 2, crc 65535 (should be 60131)
    444 000a3504 company_id 000a35 |
    448 38077423 device_id 0438077423 | EUI-64 000a350438077423

    descriptor leaf at 44c
    -----------------------------------------------------------------
    44c 0003ffff leaf_length 3, crc 65535 (should be 469)
    450 00000000 textual descriptor
    454 00000000 minimal ASCII
    458 524d4521 "RME!"

    descriptor leaf at 45c
    -----------------------------------------------------------------
    45c 0005ffff leaf_length 5, crc 65535 (should be 10561)
    460 00000000 textual descriptor
    464 00000000 minimal ASCII
    468 46697265 "Fire"
    46c 66616365 "face"
    470 20383032 " 802"

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200510074301.116224-6-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • This commit uses enumeration constants as index of table for the
    list of name of sound card.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200510074301.116224-5-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In RME fireface series, version field of unit directory in configuration
    ROM is used to distinguish each model. The value of field is known and
    it's better to use enumeration constants for code representation.

    This commit adds enumeration constants for model identification.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200510074301.116224-4-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In the latter models of RME Fireface series, device start to transfer
    packets several dozens of milliseconds. On the other hand, ALSA fireface
    driver starts IR context 2 milliseconds after the start. This results
    in loss to handle incoming packets on the context.

    This commit changes to start IR context immediately instead of
    postponement. For Fireface 800, this affects nothing because the device
    transfer packets 100 milliseconds or so after the start and this is
    within wait timeout.

    Cc:
    Fixes: acfedcbe1ce4 ("ALSA: firewire-lib: postpone to start IR context")
    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200510074301.116224-3-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • 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:
    Fixes: 60aec494b389 ("ALSA: fireface: support allocate_resources operation in latter protocol")
    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200510074301.116224-2-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

08 May, 2020

4 commits

  • In previous commit, the sequence of syt offset and the number of data
    blocks per packet is calculated for pool in AMDTP domain structure in
    advance of processing outgoing packets.

    This commit uses the sequence for outgoing packet processing to obsolete
    per-stream processing of the sequence.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-11-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In current implementation, sequence of syt offset and the number of data
    blocks is generated when packets for outgoing stream are going to be
    queued.

    This commit generates and pools the sequence independently of the
    processing of outgoing packets for future extension.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-10-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • For future extension, storage is required to store packet sequence in
    incoming AMDTP stream to recover media clock for outgoing AMDTP stream.

    This commit adds the storage to AMDTP domain for this purpose. The
    packet sequence is represented by 'struct seq_desc' which has two
    members; syt_offset and the number of data blocks. The size of storage
    is decided according to the size of packet queue.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-9-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • When calculating the number of data blocks per packet, some states are
    stored in AMDTP stream structure. This is inconvenient when reuse the
    calculation from non-stream structure.

    This commit applies refactoring to helper function for the calculation
    so that the function doesn't touch AMDTP stream structure.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-8-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto