1. 18 10月, 2017 2 次提交
    • T
      ALSA: pcm: Forcibly stop at disconnect callback · 6ca73de7
      Takashi Iwai 提交于
      So far we assumed that each driver implements the hotplug PCM handling
      properly, e.g. dealing with the pending PCM stream at disconnect
      callback.  But most codes don't care, and it eventually leaves the PCM
      stream inconsistent state when an abrupt disconnection like sysfs
      unbind happens.
      
      This patch is simple but a big-hammer solution: invoke snd_pcm_stop()
      at the common PCM disconnect callback always when the stream is
      running.
      Tested-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6ca73de7
    • T
      ALSA: pcm: Don't call register and disconnect callbacks for internal PCM · 8b645e4a
      Takashi Iwai 提交于
      The internal PCM (aka DPCM backend PCM) doesn't need any registration
      procedure, thus currently we bail out immediately at dev_register
      callback.  Similarly, its counterpart, dev_disconnect callback, is
      superfluous for the internal PCM.  For simplifying and avoiding the
      conflicting disconnect call for internal PCM objects, this patch drops
      dev_register and dev_disconnect callbacks for the internal ops.
      
      The only uncertain thing by this action is whether skipping the PCM
      state change to SNDRV_PCM_STATE_DISCONNECT for the internal PCM is
      mandatory.  Looking through the current implementations, this doesn't
      look so, hence dropping the whole dev_disconnect would make more
      sense.
      Tested-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      8b645e4a
  2. 25 8月, 2017 1 次提交
  3. 23 8月, 2017 2 次提交
  4. 30 6月, 2017 1 次提交
  5. 26 5月, 2017 1 次提交
  6. 18 5月, 2017 1 次提交
    • A
      ALSA: pcm: use "do {} while (0)" for empty macro · 9aee03f3
      Arnd Bergmann 提交于
      Recent compilers produce a harmless warning for the new pcm_call_notify()
      macro when CONFIG_SND_PCM_OSS is disabled:
      
      sound/core/pcm.c: In function 'snd_pcm_free':
      sound/core/pcm.c:905:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
      
      This turns the empty macro into a 'do {} while (0)' statement to avoid
      the warning.
      
      Fixes: 58f30d65 ("ALSA: pcm: Build pcm notifier code conditionally")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9aee03f3
  7. 17 5月, 2017 1 次提交
  8. 08 7月, 2016 1 次提交
    • T
      ALSA: pcm: Free chmap at PCM free callback, too · a8ff48cb
      Takashi Iwai 提交于
      The chmap ctls assigned to PCM streams are freed in the PCM disconnect
      callback.  However, since the disconnect callback isn't called when
      the card gets freed before registering, the chmap ctls may still be
      left assigned.  They are eventually freed together with other ctls,
      but it may cause an Oops at pcm_chmap_ctl_private_free(), as the
      function refers to the assigned PCM stream, while the PCM objects have
      been already freed beforehand.
      
      The fix is to free the chmap ctls also at PCM free callback, not only
      at PCM disconnect.
      Reported-by: NLaxminath Kasam <b_lkasam@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a8ff48cb
  9. 13 9月, 2015 1 次提交
    • T
      ALSA: pcm: remove structure member of 'struct snd_pcm_hwptr_log *' type... · 0052b7dc
      Takashi Sakamoto 提交于
      ALSA: pcm: remove structure member of 'struct snd_pcm_hwptr_log *' type because this structure had been removed
      
      This structure was added by 4d96eb25 ('ALSA: pcm_lib - add possibility
      to log last 10 DMA ring buffer positions') to store PCM pointers
      information of latest 10 pointer movements (=XRUN_LOG_CNT). When
      CONFIG_SND_PCM_XRUN_DEBUG is configured, 'struct snd_pcm_runtime' has
      'hwptr_log' member with a pointer to the structure. When calling
      xrun_log() in pcm_lib.c, the structure was allocated to the pointer.
      When calling snd_pcm_detach_substream() in pcm.c, the allocated pointer
      is released.
      
      In f5914908 ('ALSA: pcm: Replace PCM hwptr tracking with tracepoints'),
      the pointer logging is replaced with using Linux Kernel Tracepoints. The
      structure was also removed, while it's just declared. The member and kfree
      still remains.
      
      This commit removes the member and related codes. I think this was
      overlooked because it brings no errors/warnings to C compilers.
      
      Fixes: f5914908 ('ALSA: pcm: Replace PCM hwptr tracking with tracepoints')
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0052b7dc
  10. 23 6月, 2015 1 次提交
    • T
      ALSA: pcm: Fix pcm_class sysfs output · 60b93030
      Takashi Iwai 提交于
      The pcm_class sysfs of each PCM substream gives only "none" since the
      recent code change to embed the struct device.  Fix the code to point
      directly to the embedded device object properly.
      
      Fixes: ef46c7af ('ALSA: pcm: Embed struct device')
      Cc: <stable@vger.kernel.org> # v4.0+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      60b93030
  11. 28 5月, 2015 1 次提交
  12. 10 3月, 2015 1 次提交
  13. 21 2月, 2015 4 次提交
  14. 03 2月, 2015 1 次提交
    • T
      ALSA: Simplify snd_device_register() variants · 40a4b263
      Takashi Iwai 提交于
      Now that all callers have been replaced with
      snd_device_register_for_dev(), let's drop the obsolete device
      registration code and concentrate only on the code handling struct
      device directly.  That said,
      
      - remove the old snd_device_register(),
      - rename snd_device_register_for_dev() with snd_device_register(),
      - drop superfluous arguments from snd_device_register(),
      - change snd_unregister_device() to pass the device pointer directly
      Reviewed-by: NJaroslav Kysela <perex@perex.cz>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      40a4b263
  15. 02 2月, 2015 3 次提交
  16. 21 11月, 2014 1 次提交
  17. 04 11月, 2014 1 次提交
    • T
      ALSA: pcm: Add xrun_injection proc entry · 2b30d411
      Takashi Iwai 提交于
      This patch adds a new proc entry for PCM substreams to inject an
      XRUN.  When a PCM substream is running and any value is written to its
      xrun_injection proc file, the driver triggers XRUN.  This is a useful
      feature for debugging XRUN and error handling code paths.
      
      Note that this entry is enabled only when CONFIG_SND_PCM_XRUN_DEBUG is
      set.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2b30d411
  18. 30 10月, 2014 1 次提交
  19. 08 9月, 2014 1 次提交
  20. 03 9月, 2014 1 次提交
    • T
      ALSA: pcm: Allow nonatomic trigger operations · 257f8cce
      Takashi Iwai 提交于
      Currently, many PCM operations are performed in a critical section
      protected by spinlock, typically the trigger and pointer callbacks are
      assumed to be atomic.  This is basically because some trigger action
      (e.g. PCM stop after drain or xrun) is done in the interrupt handler.
      If a driver runs in a threaded irq, however, this doesn't have to be
      atomic.  And many devices want to handle trigger in a non-atomic
      context due to lengthy communications.
      
      This patch tries all PCM calls operational in non-atomic context.
      What it does is very simple: replaces the substream spinlock with the
      corresponding substream mutex when pcm->nonatomic flag is set.  The
      driver that wants to use the non-atomic PCM ops just needs to set the
      flag and keep the rest as is.  (Of course, it must not handle any PCM
      ops in irq context.)
      
      Note that the code doesn't check whether it's atomic-safe or not, but
      trust in 100% that the driver sets pcm->nonatomic correctly.
      
      One possible problem is the case where linked PCM substreams have
      inconsistent nonatomic states.  For avoiding this, snd_pcm_link()
      returns an error if one tries to link an inconsistent PCM substream.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      257f8cce
  21. 25 2月, 2014 1 次提交
    • T
      ALSA: Create sysfs attribute files via groups · caa751ba
      Takashi Iwai 提交于
      Instead of calling each time device_create_file(), create the groups
      of sysfs attribute files at once in a normal way.  Add a new helper
      function, snd_get_device(), to return the associated device object,
      so that we can handle the sysfs addition locally.
      
      Since the sysfs file addition is done differently now,
      snd_add_device_sysfs_file() helper function is removed.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      caa751ba
  22. 14 2月, 2014 1 次提交
  23. 10 2月, 2014 1 次提交
    • T
      ALSA: Replace with IS_ENABLED() · 8eeaa2f9
      Takashi Iwai 提交于
      Replace the lengthy #if defined(XXX) || defined(XXX_MODULE) with the
      new IS_ENABLED() macro.
      
      The patch still doesn't cover all ifdefs.  For example, the dependency
      on CONFIG_GAMEPORT is still open-coded because this also has an extra
      dependency on MODULE.  Similarly, an open-coded ifdef in pcm_oss.c and
      some sequencer-related stuff are left untouched.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      8eeaa2f9
  24. 01 11月, 2013 1 次提交
    • R
      ALSA: fix oops in snd_pcm_info() caused by ASoC DPCM · a4461f41
      Russell King 提交于
      Unable to handle kernel NULL pointer dereference at virtual address 00000008
      pgd = d5300000
      [00000008] *pgd=0d265831, *pte=00000000, *ppte=00000000
      Internal error: Oops: 17 [#1] PREEMPT ARM
      CPU: 0 PID: 2295 Comm: vlc Not tainted 3.11.0+ #755
      task: dee74800 ti: e213c000 task.ti: e213c000
      PC is at snd_pcm_info+0xc8/0xd8
      LR is at 0x30232065
      pc : [<c031b52c>]    lr : [<30232065>]    psr: a0070013
      sp : e213dea8  ip : d81cb0d0  fp : c05f7678
      r10: c05f7770  r9 : fffffdfd  r8 : 00000000
      r7 : d8a968a8  r6 : d8a96800  r5 : d8a96200  r4 : d81cb000
      r3 : 00000000  r2 : d81cb000  r1 : 00000001  r0 : d8a96200
      Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 10c5387d  Table: 15300019  DAC: 00000015
      Process vlc (pid: 2295, stack limit = 0xe213c248)
      [<c031b52c>] (snd_pcm_info) from [<c031b570>] (snd_pcm_info_user+0x34/0x9c)
      [<c031b570>] (snd_pcm_info_user) from [<c03164a4>] (snd_pcm_control_ioctl+0x274/0x280)
      [<c03164a4>] (snd_pcm_control_ioctl) from [<c0311458>] (snd_ctl_ioctl+0xc0/0x55c)
      [<c0311458>] (snd_ctl_ioctl) from [<c00eca84>] (do_vfs_ioctl+0x80/0x31c)
      [<c00eca84>] (do_vfs_ioctl) from [<c00ecd5c>] (SyS_ioctl+0x3c/0x60)
      [<c00ecd5c>] (SyS_ioctl) from [<c000e500>] (ret_fast_syscall+0x0/0x48)
      Code: e1a00005 e59530dc e3a01001 e1a02004 (e5933008)
      ---[ end trace cb3d9bdb8dfefb3c ]---
      
      This is provoked when the ASoC front end is open along with its backend,
      (which causes the backend to have a runtime assigned to it) and then the
      SNDRV_CTL_IOCTL_PCM_INFO is requested for the (visible) backend device.
      
      Resolve this by ensuring that ASoC internal backend devices are not
      visible to userspace, just as the commentry for snd_pcm_new_internal()
      says it should be.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Acked-by: NMark Brown <broonie@linaro.org>
      Cc: <stable@vger.kernel.org> [v3.4+]
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a4461f41
  25. 18 4月, 2013 1 次提交
    • D
      ALSA: add DSD formats · ef7a4f97
      Daniel Mack 提交于
      This patch adds two formats for Direct Stream Digital (DSD), a
      pulse-density encoding format which is described here:
      https://en.wikipedia.org/wiki/Direct_Stream_Digital
      
      DSD operates on 2.8, 5.6 or 11.2MHz sample rates and as a 1-bit
      stream.
      
      The two new types added by this patch describe streams that are capable
      of handling DSD samples in DOP format as 8-bit or in 16-bit (or at a x8
      or x16 data rate, respectively).
      
      DSD itself specifies samples in *bit*, while DOP and ALSA handle them
      as *bytes*. Hence, a factor of 8 or 16 has to be applied for the sample
      rare configuration, according to the following table:
      
                                                        configured hardware
              176.4KHz   352.8kHz   705.6KHz     <----       sample rate
      
      8-bit                2.8MHz     5.6MHz
      16-bit    2.8Mhz     5.6MHz    11.2MHz
      
               `-----------------------------'
                   actual DSD sample rates
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ef7a4f97
  26. 12 3月, 2013 1 次提交
  27. 21 11月, 2012 1 次提交
  28. 30 10月, 2012 2 次提交
  29. 07 9月, 2012 1 次提交
    • T
      ALSA: PCM: channel mapping API implementation · 2d3391ec
      Takashi Iwai 提交于
      This patch implements the basic data types for the standard channel
      mapping API handling.
      
      - The definitions of the channel positions and the new TLV types are
        added in sound/asound.h and sound/tlv.h, so that they can be
        referred from user-space.
      
      - Introduced a new helper function snd_pcm_add_chmap_ctls() to create
        control elements representing the channel maps for each PCM
        (sub)stream.
      
      - Some standard pre-defined channel maps are provided for
        convenience.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2d3391ec
  30. 12 3月, 2012 1 次提交
    • P
      device.h: cleanup users outside of linux/include (C files) · 51990e82
      Paul Gortmaker 提交于
      For files that are actively using linux/device.h, make sure
      that they call it out.  This will allow us to clean up some
      of the implicit uses of linux/device.h within include/*
      without introducing build regressions.
      
      Yes, this was created by "cheating" -- i.e. the headers were
      cleaned up, and then the fallout was found and fixed, and then
      the two commits were reordered.  This ensures we don't introduce
      build regressions into the git history.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      51990e82
  31. 09 2月, 2012 1 次提交
    • L
      ALSA: PCM - Add PCM creation API for internal PCMs. · 945e5038
      Liam Girdwood 提交于
      The new ASoC dynamic PCM core needs to create PCMs and substreams that are
      for use by internal ASoC drivers only and not visible to userspace for
      direct IO. These new PCMs are similar to regular PCMs expect they have no
      device nodes or procfs entries. The ASoC component drivers use them in exactly
      the same way as regular PCMs for PCM and DAI operations.
      
      The intention is that a dynamic PCM based driver will register both regular
      PCMs and internal PCMs. The regular PCMs will be used for all IO with userspace
      however the internal PCMs will be used by the driver to route digital audio
      through numerous back end DAI links (with potentially a DSP providing different
      hw_params, DAI formats based on the regular front end PCM params) to devices
      like CODECs, MODEMs, Bluetooth, FM, DMICs, etc
      
      This patch adds a new snd_pcm_new_internal() API call to create the internal PCM
      without device nodes or procfs. It also adds adds a new internal flag to snd_pcm.
      
      [fixed minor coding-style issues by tiwai]
      Signed-off-by: NLiam Girdwood <lrg@ti.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      945e5038
  32. 01 11月, 2011 1 次提交