1. 06 Feb, 2019 1 commit
  2. 05 Feb, 2019 4 commits
  3. 04 Feb, 2019 2 commits
  4. 01 Feb, 2019 3 commits
  5. 31 Jan, 2019 1 commit
  6. 29 Jan, 2019 7 commits
    • Takashi Iwai's avatar
      ALSA: hda - Use standard device registration for beep · 45571bb8
      Takashi Iwai authored
      Currently the registration and free of beep input device was done
      manually from the register and the disconnect callbacks of the
      assigned codec object.  This seems working in most cases, but this may
      be a cause of some races at probe.  Moreover, due to these manual
      calls, the total code became unnecessarily lengthy.
      
      This patch rewrites the beep registration code to follow the standard
      sound device object style.  This allows us reducing the code, in
      addition to avoiding the nested device registration calls.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      45571bb8
    • Takashi Iwai's avatar
      Merge branch 'topic/hda-pm-state' into for-next · 9a19c902
      Takashi Iwai authored
      Pull HD-audio PM fixes.  They are applied on top of the latest 5.0
      development branch.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9a19c902
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Apply ALC294 hp init also for S4 resume · f6ef4e0e
      Takashi Iwai authored
      The init sequence for ALC294 headphone stuff is needed not only for
      the boot up time but also for the resume from hibernation, where the
      device is switched from the boot kernel without sound driver to the
      suspended image.  Since we record the PM event in the device
      power_state field, we can now recognize the call pattern and apply the
      sequence conditionally.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f6ef4e0e
    • Takashi Iwai's avatar
      ALSA: hda - Record the current power state before suspend/resume calls · 98081ca6
      Takashi Iwai authored
      Currently we deal with single codec and suspend codec callbacks for
      all S3, S4 and runtime PM handling.  But it turned out that we want
      distinguish the call patterns sometimes, e.g. for applying some init
      sequence only at probing and restoring from hibernate.
      
      This patch slightly modifies the common PM callbacks for HD-audio
      codec and stores the currently processed PM event in power_state of
      the codec's device.power field, which is currently unused.  The codec
      callback can take a look at this event value and judges which purpose
      it's being called.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      98081ca6
    • Kailang Yang's avatar
      ALSA: hda/realtek - Fixed hp_pin no value · 693abe11
      Kailang Yang authored
      Fix hp_pin always no value.
      
      [More notes on the changes:
      
       The hp_pin value that is referred in alc294_hp_init() is always zero
       at the moment the function gets called, hence this is actually
       useless as in the current code.
      
       And, this kind of init sequence should be called from the codec init
       callback, instead of the parser function.  So, the first fix in this
       patch to move the call call into its own init_hook.
      
       OTOH, this function is needed to be called only once after the boot,
       and it'd take too long for invoking at each resume (where the init
       callback gets called).  So we add a new flag and invoke this only
       once as an additional fix.
      
       The one case is still not covered, though: S4 resume.  But this
       change itself won't lead to any regression in that regard, so we
       leave S4 issue as is for now and fix it later.  -- tiwai ]
      
      Fixes: bde1a745 ("ALSA: hda/realtek - Fixed headphone issue for ALC700")
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      693abe11
    • Jussi Laako's avatar
      ALSA: usb-audio: Cleanup DSD whitelist · 202e69e6
      Jussi Laako authored
      XMOS/Thesycon family of USB Audio Class firmware flags DSD altsetting
      separate from the PCM ones. Thus the DSD altsetting can be auto-detected
      based on the flag and doesn't need maintaining specific altsetting
      whitelist.
      
      In addition, static VID:PID-to-altsetting whitelisting causes problems
      when firmware update changes the altsetting, or same VID:PID is reused
      for another device that has different kind of firmware.
      
      This patch removes existing explicit whitelist mappings for XMOS VID
      (0x20b1) and Thesycon VID (0x152a).
      
      Also corrects placement of Hegel HD12 and NuPrime DAC-10 to keep list
      sorted based on VID.
      Signed-off-by: default avatarJussi Laako <jussi@sonarnerd.net>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      202e69e6
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · 286406c2
      Takashi Iwai authored
      Pull 5.0 branch for further development of USB-audio quirks
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      286406c2
  7. 28 Jan, 2019 1 commit
    • Takashi Sakamoto's avatar
      ALSA: dice: add support for Solid State Logic Duende Classic/Mini · b2e9e1c8
      Takashi Sakamoto authored
      Duende Classic was produced by Solid State Logic in 2006, as a
      first model of Duende DSP series. The following model, Duende Mini
      was produced in 2008. They are designed to receive isochronous
      packets for PCM frames via IEEE 1394 bus, perform signal processing by
      downloaded program, then transfer isochronous packets for converted
      PCM frames.
      
      These two models includes the same embedded board, consists of several
      ICs below:
       - Texus Instruments Inc, TSB41AB3 for physical layer of IEEE 1394 bus
       - WaveFront semiconductor, DICE II STD ASIC for link/protocol layer
       - Altera MAX 3000A CPLD for programs
       - Analog devices, SHARC ADSP-21363 for signal processing (4 chips)
      
      This commit adds support for the two models to ALSA dice driver. Like
      support for the other devices, packet streaming is just available.
      Userspace applications should be developed if full features became
      available; e.g. program uploader and parameter controller.
      
      $ ./hinawa-config-rom-printer /dev/fw1
      { 'bus-info': { 'adj': False,
                      'bmc': False,
                      'chip_ID': 349771402425,
                      'cmc': True,
                      'cyc_clk_acc': 255,
                      'generation': 1,
                      'imc': True,
                      'isc': True,
                      'link_spd': 2,
                      'max_ROM': 1,
                      'max_rec': 512,
                      'name': '1394',
                      'node_vendor_ID': 20674,
                      'pmc': False},
        'root-directory': [ ['VENDOR', 20674],
                            ['DESCRIPTOR', 'Solid State Logic'],
                            ['MODEL', 112],
                            ['DESCRIPTOR', 'Duende board'],
                            [ 'NODE_CAPABILITIES',
                              { 'addressing': {'64': True, 'fix': True, 'prv': True},
                                'misc': {'int': False, 'ms': False, 'spt': True},
                                'state': { 'atn': False,
                                           'ded': False,
                                           'drq': True,
                                           'elo': False,
                                           'init': False,
                                           'lst': True,
                                           'off': False},
                                'testing': {'bas': False, 'ext': False}}],
                            [ 'UNIT',
                              [ ['SPECIFIER_ID', 20674],
                                ['VERSION', 1],
                                ['MODEL', 112],
                                ['DESCRIPTOR', 'Duende board']]]]}
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b2e9e1c8
  8. 25 Jan, 2019 4 commits
    • Takashi Iwai's avatar
      ALSA: pcm: Fix tight loop of OSS capture stream · e190161f
      Takashi Iwai authored
      When the trigger=off is passed for a PCM OSS stream, it sets the
      start_threshold of the given substream to the boundary size, so that
      it won't be automatically started.  This can be problematic for a
      capture stream, unfortunately, as detected by syzkaller.  The scenario
      is like the following:
      
      - In __snd_pcm_lib_xfer() that is invoked from snd_pcm_oss_read()
        loop, we have a check whether the stream was already started or the
        stream can be auto-started.
      - The function at this check returns 0 with trigger=off since we
        explicitly disable the auto-start.
      - The loop continues and repeats calling __snd_pcm_lib_xfer() tightly,
        which may lead to an RCU stall.
      
      This patch fixes the bug by simply allowing the wait for non-started
      stream in the case of OSS capture.  For native usages, it's supposed
      to be done by the caller side (which is user-space), hence it returns
      zero like before.
      
      (In theory, __snd_pcm_lib_xfer() could wait even for the native API
       usage cases, too; but I'd like to stay in a safer side for not
       breaking the existing stuff for now.)
      
      Reported-by: syzbot+fbe0496f92a0ce7b786c@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e190161f
    • Olek Poplavsky's avatar
      ALSA: usb-audio: Add Opus #3 to quirks for native DSD support · 9e696664
      Olek Poplavsky authored
      This patch adds quirk VID/PID IDs for the Opus #3 DAP (made by 'The Bit')
      in order to enable Native DSD support.
      
      [ NOTE: this could be handled in the generic way with fp->dvd_raw if
        we add 0x10cb to the vendor whitelist, but since 0x10cb shows a
        different vendor name (Erantech), put to the individual entry at
        this time -- tiwai ]
      Signed-off-by: default avatarOlek Poplavsky <woodenbits@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9e696664
    • Takashi Iwai's avatar
      ALSA: pcm: Use the common error path in __snd_pcm_lib_xfer() · 315d9f1b
      Takashi Iwai authored
      An open-coded error path in __snd_pcm_lib_xfer() can be replaced with
      the simple goto to the common error path.  This also makes the error
      handling more consistent, i.e. when some samples have been already
      processed, return that size instead of the error code.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      315d9f1b
    • Dan Carpenter's avatar
      ALSA: fireface: Off by one in latter_handle_midi_msg() · 2dee43ec
      Dan Carpenter authored
      The > should be >= or otherwise we potentially read one element beyond
      the end of the ff->tx_midi_substreams[] array.
      
      Fixes: 73f5537f ("ALSA: fireface: support tx MIDI functionality of Fireface UCX")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2dee43ec
  9. 24 Jan, 2019 5 commits
  10. 23 Jan, 2019 3 commits
    • Takashi Iwai's avatar
      ALSA: pcm: Cleanup snd_pcm_stream_lock() & co · ef2056b8
      Takashi Iwai authored
      After the previous code refactoring, the PCM stream locking code
      became nothing but the PCM group lock with self_group object.  Use the
      existing helper function for simplifying the code.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ef2056b8
    • Takashi Iwai's avatar
      ALSA: pcm: Remove down_write() hack for snd_pcm_link_rwsem · ecb41f0f
      Takashi Iwai authored
      Remove the hackish down_write_nonfifo() that was introduced as a
      workaround of rwsem deadlock.
      
      It used to be a problem for non-atomic PCM streams that take the rwsem
      for the locking and hit the high lock contention.  Since the current
      PCM locking refactoring, we'll no longer hit it as the hot code-paths
      don't take global locks.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ecb41f0f
    • Takashi Iwai's avatar
      ALSA: pcm: More fine-grained PCM link locking · f57f3df0
      Takashi Iwai authored
      We have currently two global locks, a rwlock and a rwsem, that are
      used for managing linking the PCM streams.  Due to these global locks,
      once when a linked stream is used, the lock granularity suffers a
      lot.
      
      This patch attempts to eliminate the former global lock for atomic
      ops.  The latter rwsem needs remaining because of the loosy way of the
      loop calls in snd_pcm_action_nonatomic(), as well as for avoiding the
      deadlock at linking.  However, these are used far rarely, actually
      only by two actions (prepare and  reset), where both are no timing
      critical ones.  So this can be still seen as a good improvement.
      
      The basic strategy to eliminate the rwlock is to assure group->lock at
      adding or removing a stream to / from the group.  Since we already
      takes the group lock whenever taking the all substream locks under the
      group, this shouldn't be a big problem.  The reference to group
      pointer in snd_pcm_substream object is protected by the stream lock
      itself.
      
      However, there are still pitfalls: a race window at re-locking and the
      lifecycle of group object.  The former is a small race window for
      dereferencing the substream group object opened while snd_pcm_action()
      performs re-locking to avoid ABBA deadlocks.  This includes the unlink
      of group during that window, too.  And the latter is the kfree
      performed after all streams are removed from the group while it's
      still dereferenced.
      
      For addressing these corner cases, two new tricks are introduced:
      - After re-locking, the group assigned to the stream is checked again;
        if the group is changed, we retry the whole procedure.
      - Introduce a refcount to snd_pcm_group object, so that it's freed
        only when it's empty and really no one refers to it.
      
      (Some readers might wonder why not RCU for the latter.  RCU in this
      case would cost more than refcounting, unfortunately.  We take the
      group lock sooner or later, hence the performance improvement by RCU
      would be negligible.  Meanwhile, because we need to deal with
      schedulable context depending on the pcm->nonatomic flag, it'll become
      dynamic RCU/SRCU switch, and the grace period may become too long.)
      
      Along with these changes, there are a significant amount of code
      refactoring.  The complex group re-lock & ref code is factored out to
      snd_pcm_stream_group_ref() function, for example.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f57f3df0
  11. 22 Jan, 2019 9 commits
    • Takashi Sakamoto's avatar
      ALSA: fireface: support rx MIDI functionality for Fireface UCX · f0f9f497
      Takashi Sakamoto authored
      In latter model of Fireface series, asynchronous transaction includes
      a prefix byte to indicate the way to decode included MIDI bytes.
      
      Upper 4 bits of the prefix byte indicates port number, and the rest 4
      bits indicate the way to decode rest of bytes for MIDI messages.
      
      Basically the rest bits indicates the number of bytes for MIDI message.
      However, if the last byte of each MIDi message is included, the rest
      bits are 0xf. For example:
      
      message: f0 00 00 66 14 20 00 00 f7
      offset: content (big endian, port 0)
       '0030: 0x02f00000
       '0030: 0x03006614
       '0030: 0x03200000
       '0030: 0x0ff70000
      
      This commit supports encoding scheme for the above and allows
      applications to transfer MIDI messages via ALSA rawmidi interface.
      An unused member (running_status) is reused to keep state of
      transmission of system exclusive messages.
      
      For your information, this is a dump of config rom.
      
      $ sudo ./hinawa-config-rom-printer /dev/fw1
      { 'bus-info': { 'bmc': False,
                      'chip_ID': 13225063715,
                      'cmc': False,
                      'cyc_clk_acc': 0,
                      'imc': False,
                      'isc': True,
                      'max_rec': 512,
                      'name': '1394',
                      'node_vendor_ID': 2613},
        'root-directory': [ [ 'NODE_CAPABILITIES',
                              { 'addressing': {'64': True, 'fix': True, 'prv': False},
                                'misc': {'int': False, 'ms': False, 'spt': True},
                                'state': { 'atn': False,
                                           'ded': False,
                                           'drq': True,
                                           'elo': False,
                                           'init': False,
                                           'lst': True,
                                           'off': False},
                                'testing': {'bas': False, 'ext': False}}],
                            ['VENDOR', 2613],
                            ['DESCRIPTOR', 'RME!'],
                            ['EUI_64', 2873037108442403],
                            [ 'UNIT',
                              [ ['SPECIFIER_ID', 2613],
                                ['VERSION', 4],
                                ['MODEL', 1054720],
                                ['DESCRIPTOR', 'Fireface UCX']]]]}
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f0f9f497
    • Takashi Sakamoto's avatar
      ALSA: fireface: add protocol-specific operation to fill transaction buffer with MIDI messages · 82b6297b
      Takashi Sakamoto authored
      Between former and latter models, content of asynchronous transaction
      for MIDI messages from driver to device is different.
      
      This commit is a preparation to support latter models. A protocol-specific
      operation is added to encode MIDI messages to the transaction.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      82b6297b
    • Takashi Sakamoto's avatar
      ALSA: fireface: add model-dependent parameter for address to receive async... · 481e09ac
      Takashi Sakamoto authored
      ALSA: fireface: add model-dependent parameter for address to receive async transaction for MIDI messages
      
      Between former and latter models, destination address to receive
      asynchronous transactions for MIDI messages is different.
      
      This commit adds model-dependent parameter for the addresses.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      481e09ac
    • Takashi Sakamoto's avatar
      ALSA: fireface: support tx MIDI functionality of Fireface UCX · 73f5537f
      Takashi Sakamoto authored
      Fireface UCX transfers asynchronous transactions for MIDI messages.
      One transaction includes quadlet data therefore it can transfer 3
      message bytes as maximum. Base address of the destination is
      configured by two settings; a register for higher 8 byte of the
      address, and a bitflag to option register indicates lower 8byte.
      
      The register for higher address is 0x'ffff'0000'0034. Unfortunately,
      firmware v24 includes a bug to ignore registered value for the
      destination address and transfers to 0x0001xxxxxxxx always. This
      driver doesn't work well if the bug exists, therefore users should
      install the latest firmware (v27).
      
      The bitflag is a part of value to be written to option register
      (0x'ffff'0000'0014).
      
      lower addr:  bitflag (little endian)
       '0000'0000: 0x00002000
       '0000'0080: 0x00004000
       '0000'0100: 0x00008000
       '0000'0180: 0x00010000
      
      This register includes more options but they are not relevant to
      packet streaming or MIDI functionality. This driver don't touch it.
      
      Furthermore, the transaction is sent to address offset incremented
      by 4 byte to the offset in previous time. When it reaches base address
      plus 0x7c, next offset is the base address.
      
      Content of the transaction includes a prefix byte. Upper 4 bits of
      the byte indicates port number, and the rest 4 bits indicate the way
      to decode rest of bytes for MIDI message.
      
      Except for system exclusive messages, the rest bits are the same as
      status bits of the message without channel bits. For system exclusive
      messages, the rest bits are encoded according to included message bytes.
      For example:
      
      message: f0 7e 7f 09 01 f7
      offset: content (little endian, port 0)
       '0000: 0x04f07e7f
       '0004: 0x070901f7
      
      message: f0 00 00 66 14 20 00 00 00 f7
      offset: content (little endian, port 1)
       '0014: 0x14f00000
       '0018: 0x14661420
       '001c: 0x14000000
       '0020: 0x15f70000
      
      message: f0 00 00 66 14 20 00 00 f7
      offset: content (little endian, port 0)
       '0078: 0x04f00000
       '007c: 0x04661420
       '0000: 0x070000f7
      
      This commit supports decoding scheme for the above and allows
      applications to receive MIDI messages via ALSA rawmidi interface.
      The lower 8 bytes of destination address is fixed to 0x'0000'0000,
      thus this driver expects userspace applications to configure option
      register with bitflag 0x00002000 in advance.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      73f5537f
    • Takashi Sakamoto's avatar
      ALSA: fireface: add model-dependent parameter for address range to receive async transaction · 90089677
      Takashi Sakamoto authored
      In Fireface series, drivers can register destination address for
      asynchronous transaction which transfers MIDI messages from device.
      
      In former models, all of the transactions arrive at the registered
      address without any offset. In latter models, each of the transaction
      arrives at the registered address with sequential offset within 0x00
      to 0x7f. This seems to be for discontinuity detection.
      
      This commit adds model-dependent member for the address range.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      90089677
    • Takashi Sakamoto's avatar
      ALSA: fireface: change prototype of handler for async transaction with MIDI messages · 6c644e4e
      Takashi Sakamoto authored
      In a series of Fireface, devices transfer asynchronous transaction with
      MIDI messages. In the transaction, content is different depending on
      models. ALSA fireface driver has protocol-dependent handler to pick up
      MIDI messages from the content.
      
      In latter models of the series, the transaction is transferred to range
      of address sequentially. This seems to check continuity of transferred
      messages.
      
      This commit changes prototype of the handler to receive offset of
      address for received transactions.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6c644e4e
    • Sameer Pujar's avatar
      ALSA: hda/tegra: add driver flag for runtime PM · 9935d55b
      Sameer Pujar authored
      AZX_DCAPS_PM_RUNTIME flag is added to indicate support for runtime PM.
      azx_has_pm_runtime() is used to check if above is enabled and thus
      forbid runtime PM calls if needed.
      Signed-off-by: default avatarSameer Pujar <spujar@nvidia.com>
      Reviewed-by: default avatarRavindra Lokhande <rlokhande@nvidia.com>
      Reviewed-by: default avatarMohan Kumar D <mkumard@nvidia.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9935d55b
    • Sameer Pujar's avatar
      ALSA: hda/tegra: implement runtime suspend/resume · 707e0759
      Sameer Pujar authored
      This patch moves clock enable/disable from system resume/suspend to
      runtime resume/suspend respectively. Along with this hda controller
      chip init or stop is also moved. System resume/suspend can invoke
      runtime callbacks and do necessary setup.
      
      chip->running can be used to check for probe completion and device
      access during runtime_resume or runtime_suspend can be avoided if
      probe is not yet finished. This helps to avoid kernel panic during
      boot where runtime PM callbacks can happen from system PM.
      Signed-off-by: default avatarSameer Pujar <spujar@nvidia.com>
      Reviewed-by: default avatarRavindra Lokhande <rlokhande@nvidia.com>
      Reviewed-by: default avatarMohan Kumar D <mkumard@nvidia.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      707e0759
    • Sameer Pujar's avatar
      ALSA: hda/tegra: remove redundant clock enable API · 091aa420
      Sameer Pujar authored
      Explicit clock enable is not required during probe, as this would be
      managed by runtime PM calls. Clock can be enabled/disabled in runtime
      resume/suspend. This way it is easier to balance clock enable/disable
      counts.
      Signed-off-by: default avatarSameer Pujar <spujar@nvidia.com>
      Reviewed-by: default avatarRavindra Lokhande <rlokhande@nvidia.com>
      Reviewed-by: default avatarMohan Kumar D <mkumard@nvidia.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      091aa420