1. 16 Jul, 2016 2 commits
  2. 05 Jul, 2016 1 commit
  3. 01 Jul, 2016 1 commit
  4. 29 Jun, 2016 1 commit
    • Kuninori Morimoto's avatar
      ASoC: add new simple-card-utils.c · abd3147e
      Kuninori Morimoto authored
      Current ALSA SoC has simple-card driver which is supporting both
      platform and DT probe.
      Now, some sound cards driver are created based on simple-card.
      They have similar feature or function, but implemented separately
      on each drivers. This is a waste of code.
      OTOH, merging these driver into same driver is highly risk,
      because it will be very difficult to keep compatibility.
      More over, ALSA SoC want to have graph base of DT feature in the
      future. Maybe it want to use simple-card like feature / function.
      Because of these background, this patch creates simple-card
      helper utils, and provides common function to each drivers.
      1st is asoc_simple_card_parse_daifmt()
      Signed-off-by: 's avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      abd3147e
  5. 27 Jun, 2016 2 commits
    • Kuninori Morimoto's avatar
      ASoC: hdmi-codec: callback function will be called with private data · efc9194b
      Kuninori Morimoto authored
      Current hdmi-codec driver is assuming that it will be registered
      from HDMI driver. Because of this assumption, each callback function
      has struct device pointer which is parent device (= HDMI).
      Then, it can use dev_get_drvdata() to get private data.
      
      OTOH, on some SoC/HDMI case, SoC has VIDEO/SOUND and HDMI IPs.
      This case, it needs SoC VIDEO, SoC SOUND and HDMI video, HDMI codec
      driver. In DesignWare HDMI IP case, SoC VIDEO (= DRM/KMS) driver tries
      to bind DesignWare HDMI video driver, and HDMI codec driver
      (= hdmi-codec). This case, above "parent device" of HDMI codec driver
      is DRM/KMS driver and its "device" already has private data.
      
      And, from DT and ASoC CPU/Codec/Card binding point of view, HDMI codec
      (= hdmi-codec) needs to have "parent device" (= DRM/KMS), otherwise,
      it never detect sound card.
      
      Because of these reasons, some driver can't use dev_get_drvdata() to
      get private data on hdmi-codec driver. This patch add new void pointer
      on hdmi_codec_pdata for private data, and callback function will be
      called with it.
      Signed-off-by: 's avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      efc9194b
    • Paul Handrigan's avatar
      ASoC: cs35l33: Initial commit of the cs35l33 CODEC driver. · 3333cb71
      Paul Handrigan authored
      Initial commit of the Cirrus Logic cs35l33 8V boosted class D
      amplifier.
      Signed-off-by: 's avatarPaul Handrigan <Paul.Handrigan@cirrus.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      3333cb71
  6. 13 Jun, 2016 1 commit
    • Charles Keepax's avatar
      ALSA: compress: Add function to indicate the stream has gone bad · a4f2d87c
      Charles Keepax authored
      Currently, the avail IOCTL doesn't pass any error status, which
      means typically on error it simply shows no data available. This
      can lead to situations where user-space is waiting indefinitely
      for data that will never come as the DSP has suffered an
      unrecoverable error.
      
      Add snd_compr_stop_error which end drivers can call to indicate
      the stream has suffered an unrecoverable error and stop it. The
      avail and poll IOCTLs are then updated to report if the stream is
      in an error state to user-space. Allowing the error to propagate
      out. Processing of the actual snd_compr_stop needs to be deferred
      to a worker thread as the end driver may detect the errors during
      an existing operation callback.
      Signed-off-by: 's avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: 's avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      a4f2d87c
  7. 03 Jun, 2016 1 commit
  8. 30 May, 2016 2 commits
    • Srinivas Kandagatla's avatar
      ASoC: Introduce SOC_SINGLE_S8_TLV() macro · dcc0799b
      Srinivas Kandagatla authored
      This patch introduces SOC_SINGLE_S8_TLV() macro for volume control
      on chips which supports both negative and positive gains with sign
      bit on a 8 bit register, Gain ranges from -128 to +127 with a
      predefined step size.
      Currently we only have support to DOUBLE_S8_TLV() which does not fit
      for cases where we just have separate gain control register for each
      channel.
      
      One of the Qualcomm SOC msm8916 has such gain control register whose gain
      range is from -38.4dB to +38.4dB with step size of 0.3dB.
      Signed-off-by: 's avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      dcc0799b
    • Piotr Stankiewicz's avatar
      ASoC: dapm: support user-defined stop condition in dai_get_connected_widgets · 6742064a
      Piotr Stankiewicz authored
      Certain situations may warrant examining DAPM paths only to a certain
      arbitrary point, as opposed to always following them to the end. For
      instance, when establishing a connection between a front-end DAI link
      and a back-end DAI link in a DPCM path, it does not make sense to walk
      the DAPM graph beyond the first widget associated with a back-end link.
      
      This patch introduces a mechanism which lets a user of
      dai_get_connected_widgets supply a function which will be called for
      every node during the graph walk. When invoked, this function can
      execute arbitrary logic to decide whether the walk, given a DAPM widget
      and walk direction, should be terminated at that point or continued
      as normal.
      Signed-off-by: 's avatarPiotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      6742064a
  9. 13 May, 2016 1 commit
  10. 12 May, 2016 1 commit
  11. 27 Apr, 2016 1 commit
    • Matthias Reichl's avatar
      ASoC: dmaengine_pcm: Add support for packed transfers · 73fe01cf
      Matthias Reichl authored
      dmaengine_pcm currently only supports setups where FIFO reads/writes
      correspond to exactly one sample, eg 16-bit sample data is transferred
      via 16-bit FIFO accesses, 32-bit data via 32-bit accesses.
      
      This patch adds support for setups with fixed width FIFOs where
      multiple samples are packed into a larger word.
      
      For example setups with a 32-bit wide FIFO register that expect
      16-bit sample transfers to be done with the left+right sample data
      packed into a 32-bit word.
      
      Support for packed transfers is controlled via the
      SND_DMAENGINE_PCM_DAI_FLAG_PACK flag in snd_dmaengine_dai_dma_data.flags
      
      If this flag is set dmaengine_pcm doesn't put any restriction on the
      supported formats and sets the DMA transfer width to undefined.
      
      This means control over the constraints is now transferred to the DAI
      driver and it's responsible to provide proper configuration and
      check for possible corner cases that aren't handled by the ALSA core.
      Signed-off-by: 's avatarMatthias Reichl <hias@horus.com>
      Acked-by: 's avatarLars-Peter Clausen <lars@metafoo.de>
      Tested-by: 's avatarMartin Sperl <kernel@martin.sperl.org>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      73fe01cf
  12. 26 Apr, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: hda - Update BCLK also at hotplug for i915 HSW/BDW · bb03ed21
      Takashi Iwai authored
      The recent bug report suggests that BCLK setup for i915 HSW/BDW needs
      to be updated at each HDMI hotplug, not only at initialization and
      resume.  That is, we need to update HSW_EM4 and HSW_EM5 registers at
      ELD notification, too.  Otherwise the HDMI audio may be out of sync
      and played in a wrong pitch.
      
      However, the HDA codec driver has no access to the controller
      registers, and currently the code managing these registers is in
      hda_intel.c, i.e. local to the controller driver.  For allowing the
      explicit BCLK update from the codec driver, as in this patch, the
      former haswell_set_bclk() in hda_intel.c is moved to hdac_i915.c and
      exposed as snd_hdac_i915_set_bclk().  This is called from both the HDA
      controller driver and intel_pin_eld_notify() in HDMI codec driver.
      
      Along with this change, snd_hdac_get_display_clk() gets dropped as
      it's no longer used.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91410
      Cc: <stable@vger.kernel.org> # v4.5+
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      bb03ed21
  13. 21 Apr, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: hda - Fix possible race on regmap bypass flip · 3194ed49
      Takashi Iwai authored
      HD-audio driver uses regmap cache bypass feature for reading a raw
      value without the cache.  But this is racy since both the cached and
      the uncached reads may occur concurrently.  The former is done via the
      normal control API access while the latter comes from the proc file
      read.
      
      Even though the regmap itself has the protection against the
      concurrent accesses, the flag set/reset is done without the
      protection, so it may lead to inconsistent state of bypass flag that
      doesn't match with the current read and occasionally result in a
      kernel WARNING like:
        WARNING: CPU: 3 PID: 2731 at drivers/base/regmap/regcache.c:499 regcache_cache_only+0x78/0x93
      
      One way to work around such a problem is to wrap with a mutex.  But in
      this case, the solution is simpler: for the uncached read, we just
      skip the regmap and directly calls its accessor.  The verb execution
      there is protected by itself, so basically it's safe to call
      individually.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116171Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      3194ed49
  14. 20 Apr, 2016 2 commits
  15. 18 Apr, 2016 1 commit
  16. 06 Apr, 2016 1 commit
  17. 04 Apr, 2016 1 commit
    • Subhransu S. Prusty's avatar
      ALSA: hda - Update chmap tlv to report sink's capability · 44fde3b8
      Subhransu S. Prusty authored
      The existing TLV callback implementation copies all of the
      cea_channel_speaker_allocation map table to the TLV container
      irrespective of what is reported by sink. This is of little use
      to the userspace application.
      
      With this patch, it parses the spk_alloc block as queried from
      the ELD, and copies only the corresponding mapping channel
      allocation entries from the cea channel speaker allocation table.
      Thus the user can parse the TLV container to identify sink's
      capability and set the channel map accordingly.
      
      It shouldn't impact the behavior in AMD chipset, as this makes
      use of already parsed spk alloc block to calculate the channel
      map.
      Signed-off-by: 's avatarSubhransu S. Prusty <subhransu.s.prusty@intel.com>
      Signed-off-by: 's avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      44fde3b8
  18. 28 Mar, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: hda - Add the pin / port mapping on Intel ILK and VLV · d745f5e7
      Takashi Iwai authored
      Intel IronLake and ValleyView platforms have different HDMI widget pin
      and digital port mapping from other newer ones.  The recent ones
      (HSW+) have NID 0x05 to 0x07 for port B to port D, while these chips
      have NID 0x04 to 0x06.
      
      For adapting this mapping, pass the codec object instead of the bus
      object to snd_hdac_sync_audio_rate() and snd_hdac_acomp_get_eld() so
      that they can check the codec ID and calculate the mapping properly.
      
      The changes in the HDMI codec driver side will follow in the later
      patch.
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      d745f5e7
  19. 08 Mar, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: hda - Fix unexpected resume through regmap code path · fc4f000b
      Takashi Iwai authored
      HD-audio driver has a mechanism to trigger the runtime resume
      automatically at accessing the verbs.  This auto-resume, however,
      causes the mutex deadlock when invoked from the regmap handler since
      the regmap keeps the mutex while auto-resuming.  For avoiding that,
      there is some tricky check in the HDA regmap handler to return -EAGAIN
      error to back-off when the codec is powered down.  Then the caller of
      regmap r/w will retry after properly turning on the codec power.
      
      This works in most cases, but there seems a slight race between the
      codec power check and the actual on-demand auto-resume trigger.  This
      resulted in the lockdep splat, eventually leading to a real deadlock.
      
      This patch tries to address the race window by getting the runtime PM
      refcount at the check time using pm_runtime_get_if_in_use().  With
      this call, we can keep the power on only when the codec has been
      already turned on, and back off if not.
      
      For keeping the code consistency, the code touching the runtime PM is
      stored in hdac_device.c although it's used only locally in
      hdac_regmap.c.
      Reported-by: 's avatarJiri Slaby <jslaby@suse.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      fc4f000b
  20. 07 Mar, 2016 7 commits
  21. 26 Feb, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: hda - Loop interrupt handling until really cleared · 473f4145
      Takashi Iwai authored
      Currently the interrupt handler of HD-audio driver assumes that no irq
      update is needed while processing the irq.  But in reality, it has
      been confirmed that the HW irq is issued even during the irq
      handling.  Since we clear the irq status at the beginning, process the
      interrupt, then exits from the handler, the lately issued interrupt is
      left untouched without being properly processed.
      
      This patch changes the interrupt handler code to loop over the
      check-and-process.  The handler tries repeatedly as long as the IRQ
      status are turned on, and either stream or CORB/RIRB is handled.
      
      For checking the stream handling, snd_hdac_bus_handle_stream_irq()
      returns a value indicating the stream indices bits.  Other than that,
      the change is only in the irq handler itself.
      Reported-by: 's avatarLibin Yang <libin.yang@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      473f4145
  22. 23 Feb, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: jack: Allow building the jack layer without input device · fe0d128c
      Takashi Iwai authored
      Since the recent integration of kctl jack and input jack layers, we
      can basically build the jack layer even without input devices.  That
      is, the jack layer itself can be built with conditional to enable the
      input device support or not, while the users may enable always
      CONFIG_SND_JACK unconditionally.
      
      For achieving it, this patch changes the following:
      - A new Kconfig, CONFIG_SND_JACK_INPUT_DEV, was introduced to indicate
        whether the jack layer supports the input device,
      - A few items in snd_jack struct and relevant codes are conditionally
        built upon CONFIG_SND_JACK_INPUT_DEV,
      - The users of CONFIG_SND_JACK drop the messy dependency on
        CONFIG_INPUT.
      
      This change also automagically fixes a potential bug in HD-audio
      driver Arnd reported, where the NULL or uninitialized jack instance is
      dereferenced.
      Reported-by: 's avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: 's avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      fe0d128c
  23. 15 Feb, 2016 2 commits
  24. 05 Feb, 2016 1 commit
  25. 03 Feb, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: rawmidi: Make snd_rawmidi_transmit() race-free · 06ab3003
      Takashi Iwai authored
      A kernel WARNING in snd_rawmidi_transmit_ack() is triggered by
      syzkaller fuzzer:
        WARNING: CPU: 1 PID: 20739 at sound/core/rawmidi.c:1136
      Call Trace:
       [<     inline     >] __dump_stack lib/dump_stack.c:15
       [<ffffffff82999e2d>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
       [<ffffffff81352089>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482
       [<ffffffff813522b9>] warn_slowpath_null+0x29/0x30 kernel/panic.c:515
       [<ffffffff84f80bd5>] snd_rawmidi_transmit_ack+0x275/0x400 sound/core/rawmidi.c:1136
       [<ffffffff84fdb3c1>] snd_virmidi_output_trigger+0x4b1/0x5a0 sound/core/seq/seq_virmidi.c:163
       [<     inline     >] snd_rawmidi_output_trigger sound/core/rawmidi.c:150
       [<ffffffff84f87ed9>] snd_rawmidi_kernel_write1+0x549/0x780 sound/core/rawmidi.c:1223
       [<ffffffff84f89fd3>] snd_rawmidi_write+0x543/0xb30 sound/core/rawmidi.c:1273
       [<ffffffff817b0323>] __vfs_write+0x113/0x480 fs/read_write.c:528
       [<ffffffff817b1db7>] vfs_write+0x167/0x4a0 fs/read_write.c:577
       [<     inline     >] SYSC_write fs/read_write.c:624
       [<ffffffff817b50a1>] SyS_write+0x111/0x220 fs/read_write.c:616
       [<ffffffff86336c36>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185
      
      Also a similar warning is found but in another path:
      Call Trace:
       [<     inline     >] __dump_stack lib/dump_stack.c:15
       [<ffffffff82be2c0d>] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
       [<ffffffff81355139>] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482
       [<ffffffff81355369>] warn_slowpath_null+0x29/0x30 kernel/panic.c:515
       [<ffffffff8527e69a>] rawmidi_transmit_ack+0x24a/0x3b0 sound/core/rawmidi.c:1133
       [<ffffffff8527e851>] snd_rawmidi_transmit_ack+0x51/0x80 sound/core/rawmidi.c:1163
       [<ffffffff852d9046>] snd_virmidi_output_trigger+0x2b6/0x570 sound/core/seq/seq_virmidi.c:185
       [<     inline     >] snd_rawmidi_output_trigger sound/core/rawmidi.c:150
       [<ffffffff85285a0b>] snd_rawmidi_kernel_write1+0x4bb/0x760 sound/core/rawmidi.c:1252
       [<ffffffff85287b73>] snd_rawmidi_write+0x543/0xb30 sound/core/rawmidi.c:1302
       [<ffffffff817ba5f3>] __vfs_write+0x113/0x480 fs/read_write.c:528
       [<ffffffff817bc087>] vfs_write+0x167/0x4a0 fs/read_write.c:577
       [<     inline     >] SYSC_write fs/read_write.c:624
       [<ffffffff817bf371>] SyS_write+0x111/0x220 fs/read_write.c:616
       [<ffffffff86660276>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185
      
      In the former case, the reason is that virmidi has an open code
      calling snd_rawmidi_transmit_ack() with the value calculated outside
      the spinlock.   We may use snd_rawmidi_transmit() in a loop just for
      consuming the input data, but even there, there is a race between
      snd_rawmidi_transmit_peek() and snd_rawmidi_tranmit_ack().
      
      Similarly in the latter case, it calls snd_rawmidi_transmit_peek() and
      snd_rawmidi_tranmit_ack() separately without protection, so they are
      racy as well.
      
      The patch tries to address these issues by the following ways:
      - Introduce the unlocked versions of snd_rawmidi_transmit_peek() and
        snd_rawmidi_transmit_ack() to be called inside the explicit lock.
      - Rewrite snd_rawmidi_transmit() to be race-free (the former case).
      - Make the split calls (the latter case) protected in the rawmidi spin
        lock.
      
      BugLink: http://lkml.kernel.org/r/CACT4Y+YPq1+cYLkadwjWa5XjzF1_Vki1eHnVn-Lm0hzhSpu5PA@mail.gmail.com
      BugLink: http://lkml.kernel.org/r/CACT4Y+acG4iyphdOZx47Nyq_VHGbpJQK-6xNpiqUjaZYqsXOGw@mail.gmail.comReported-by: 's avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: 's avatarDmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      06ab3003
  26. 21 Jan, 2016 1 commit
  27. 12 Jan, 2016 1 commit
    • Heiner Kallweit's avatar
      ALSA: hda_intel: add card number to irq description · de65360b
      Heiner Kallweit authored
      Currently the info in /proc/interrupts doesn't allow to figure out which
      interrupt belongs to which card (HDMI, PCH, ..).
      Therefore add card details to the interrupt description.
      With the patch the info in /proc/interrupts looks like this:
      
      PCI-MSI 442368-edge      snd_hda_intel:card1
      PCI-MSI 49152-edge      snd_hda_intel:card0
      
      NOTE: this patch adds the new irq_descr field snd_card struct that is
      filled automatically at a card object creation.  This can be used
      generically for other drivers as well.  The changes for others will
      follow later -- tiwai
      Signed-off-by: 's avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
      de65360b
  28. 10 Jan, 2016 2 commits
    • Mengdong Lin's avatar
      ASoC: Make aux_dev more like a generic component · f2ed6b07
      Mengdong Lin authored
      aux_dev is mainly used by the machine driver to specify analog devices,
      which are registered as codecs. Making it more like a generic component
      can help the machine driver to use it to specify any component with
      topology info by name.
      
      Details:
      - Remove the stub 'rtd_aux' array from the soc card.
      - Add a list 'aux_comp_list' to store the components of aux_devs.
        And add a list head 'list_aux' to struct snd_soc_component, for adding
        such components to the above list.
      - Add a 'init' ops to a component for machine specific init.
        soc_bind_aux_dev() will set it to be aux_dev's init. And it will be
        called when probing the component.
      - soc_bind_aux_dev() will also search components by name of an aux_dev,
        since it may not be a codec.
      - Move probing of aux_devs before checking new DAI links brought by
        topology.
      - Move removal of aux_devs later than removal of links. Because topology
        of aux components may register DAIs and the DAI drivers will go with
        removal of the aux components, we want soc_remove_link_dais() to remove
        the DAIs at first.
      Signed-off-by: 's avatarMengdong Lin <mengdong.lin@linux.intel.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      f2ed6b07
    • Maruthi Srinivas Bayyavarapu's avatar
      ASoC: dwc: add quirk to override COMP_PARAM_1 register · a242cac1
      Maruthi Srinivas Bayyavarapu authored
      DWC for capture in ACP 2.x IP reports playback and capture capabilities
      though it supports only capture. Added a quirk to override default value
      to represent capture capability only.
      Signed-off-by: 's avatarMaruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
      Signed-off-by: 's avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
      a242cac1