1. 12 2月, 2018 1 次提交
  2. 22 11月, 2017 1 次提交
    • T
      ALSA: hda - Fix yet remaining issue with vmaster 0dB initialization · d6c0615f
      Takashi Iwai 提交于
      The previous fix for addressing the breakage in vmaster slave
      initialization, commit a91d6612 ("ALSA: hda - Fix incorrect TLV
      callback check introduced during set_fs() removal"), introduced a new
      helper to process over each slave kctl.  However, this helper passes
      only the original kctl, not the virtual slave kctl.  As a result,
      HD-audio driver (which is the only user so far) couldn't initialize
      the slave correctly because it's trying to update the value directly
      with the original kctl, not with the mapped kctl.
      
      This patch fixes the situation again by passing both the mapped slaved
      and original slave kctls to the function.  Luckily there is a single
      caller as of now, so changing the call signature is no big matter.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197959
      Fixes: a91d6612 ("ALSA: hda - Fix incorrect TLV callback check introduced during set_fs() removal")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d6c0615f
  3. 19 10月, 2017 1 次提交
    • T
      ALSA: hda: Avoid racy recreation of widget kobjects · 9780ded3
      Takashi Iwai 提交于
      The refresh of HD-audio widget sysfs kobjects via
      snd_hdac_refresh_widget_sysfs() is slightly racy.
      The driver recreates the whole tree from scratch after deleting the
      whole.  When CONFIG_DEBUG_KOBJECT_RELEASE option is used, kobject
      release doesn't happen immediately but delayed, while the re-creation
      of the same named kobject happens soon after invoking kobject_put().
      This may end up with the conflicts of duplicated kobjects, as found in
      the bug report below.
      
      In this patch, we take another approach to refresh the tree: instead
      of recreating the whole tree, just add the new nodes and delete the
      non-existing nodes.  Since the refresh happens only once at
      initialization, no longer race would happen.
      
      Along with the code change, merge snd_hdac_refresh_widget_sysfs() with
      the existing snd_hdac_refresh_widgets() with an additional bool flag
      for simplifying the code.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197307Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9780ded3
  4. 18 10月, 2017 2 次提交
    • T
      ALSA: hda - Fix incorrect TLV callback check introduced during set_fs() removal · a91d6612
      Takashi Iwai 提交于
      The commit 99b5c5bb ("ALSA: hda - Remove the use of set_fs()")
      converted the get_kctl_0dB_offset() call for killing set_fs() usage in
      HD-audio codec code.  The conversion assumed that the TLV callback
      used in HD-audio code is only snd_hda_mixer_amp() and applies the TLV
      calculation locally.
      
      Although this assumption is correct, and all slave kctls are actually
      with that callback, the current code is still utterly buggy; it
      doesn't hit this condition and falls back to the next check.  It's
      because the function gets called after adding slave kctls to vmaster.
      By assigning a slave kctl, the slave kctl object is faked inside
      vmaster code, and the whole kctl ops are overridden.  Thus the
      callback op points to a different value from what we've assumed.
      
      More badly, as reported by the KERNEXEC and UDEREF features of PaX,
      the code flow turns into the unexpected pitfall.  The next fallback
      check is SNDRV_CTL_ELEM_ACCESS_TLV_READ access bit, and this always
      hits for each kctl with TLV.  Then it evaluates the callback function
      pointer wrongly as if it were a TLV array.  Although currently its
      side-effect is fairly limited, this incorrect reference may lead to an
      unpleasant result.
      
      For addressing the regression, this patch introduces a new helper to
      vmaster code, snd_ctl_apply_vmaster_slaves().  This works similarly
      like the existing map_slaves() in hda_codec.c: it loops over the slave
      list of the given master, and applies the given function to each
      slave.  Then the initializer function receives the right kctl object
      and we can compare the correct pointer instead of the faked one.
      
      Also, for catching the similar breakage in future, give an error
      message when the unexpected TLV callback is found and bail out
      immediately.
      
      Fixes: 99b5c5bb ("ALSA: hda - Remove the use of set_fs()")
      Reported-by: NPaX Team <pageexec@freemail.hu>
      Cc: <stable@vger.kernel.org> # v4.13
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a91d6612
    • T
      ALSA: hda: Remove superfluous '-' added by printk conversion · 6bf88a34
      Takashi Iwai 提交于
      While converting the error messages to the standard macros in the
      commit 4e76a883 ("ALSA: hda - Replace with standard printk"), a
      superfluous '-' slipped in the code mistakenly.  Its influence is
      almost negligible, merely shows a dB value as negative integer instead
      of positive integer (or vice versa) in the rare error message.
      So let's kill this embarrassing byte to show more correct value.
      
      Fixes: 4e76a883 ("ALSA: hda - Replace with standard printk")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6bf88a34
  5. 03 9月, 2017 1 次提交
    • W
      ALSA: hda: Fix regression of hdmi eld control created based on invalid pcm · 1f7f51a6
      Wang YanQing 提交于
      Commit fb087eaa ("ALSA: hda - hdmi eld control created based on pcm")
      forget to filter out invalid pcm numbers, if there is only one invalid pcm
      number, then this issue causes we create eld control for invalid pcm silently,
      but when there are more than one invalid pcm numbers, then this issue bring
      probe error looks like below dmesg:
      "
      kernel: [    1.647283] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops 0xc2967540)
      kernel: [    1.651192] snd_hda_intel 0000:00:03.0: Too many HDMI devices
      kernel: [    1.651195] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y
      kernel: [    1.651197] snd_hda_intel 0000:00:03.0: Too many HDMI devices
      kernel: [    1.651199] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y
      kernel: [    1.651201] snd_hda_intel 0000:00:03.0: Too many HDMI devices
      kernel: [    1.651203] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y
      kernel: [    1.651676] snd_hda_intel 0000:00:03.0: control 3:0:0:ELD:0 is already present
      kernel: [    1.651787] snd_hda_codec_hdmi: probe of hdaudioC0D0 failed with error -16
      "
      
      This patch add invalid pcm number filter before calling hdmi_create_eld_ctl.
      
      Fixes: fb087eaa ("ALSA: hda - hdmi eld control created based on pcm")
      Signed-off-by: NWang YanQing <udknight@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      1f7f51a6
  6. 17 5月, 2017 5 次提交
  7. 22 2月, 2017 1 次提交
    • B
      ALSA: pci: constify snd_kcontrol_new structures · f3b827e0
      Bhumika Goyal 提交于
      Declare snd_kcontrol_new structures as const as they are only passed as
      an argument to the function snd_ctl_new1. This argument is of type
      const, so snd_kcontrol_new structures having the same property can be
      made const too.
      Done using Coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct snd_kcontrol_new i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      expression e1;
      @@
      snd_ctl_new1(&i@p,e1)
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct snd_kcontrol_new i;
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f3b827e0
  8. 12 1月, 2017 2 次提交
  9. 16 6月, 2016 1 次提交
  10. 20 10月, 2015 1 次提交
    • T
      ALSA: hda - Fix deadlock at error in building PCM · d289619a
      Takashi Iwai 提交于
      The HDA codec driver issues snd_hda_codec_reset() at the error path of
      PCM build.  This was needed in the earlier code base, but the recent
      rewrite to use the standard bus binding made this a deadlock:
       modprobe        D 0000000000000005     0   720    716 0x00000080
       Call Trace:
        [<ffffffff816a5dbe>] schedule+0x3e/0x90
        [<ffffffff816a61a5>] schedule_preempt_disabled+0x15/0x20
        [<ffffffff816a7ae5>] __mutex_lock_slowpath+0xb5/0x120
        [<ffffffff816a7b6b>] mutex_lock+0x1b/0x30
        [<ffffffff8148656b>] device_release_driver+0x1b/0x30
        [<ffffffff81485c15>] bus_remove_device+0x105/0x180
        [<ffffffff814822b9>] device_del+0x139/0x260
        [<ffffffffa05e0ec5>] snd_hdac_device_unregister+0x25/0x30 [snd_hda_core]
        [<ffffffffa074fa6a>] snd_hda_codec_reset+0x2a/0x70 [snd_hda_codec]
        [<ffffffffa075007b>] snd_hda_codec_build_pcms+0x18b/0x1b0 [snd_hda_codec]
        [<ffffffffa074a44e>] hda_codec_driver_probe+0xbe/0x140 [snd_hda_codec]
        [<ffffffff81486ac4>] driver_probe_device+0x1f4/0x460
        [<ffffffff81486dc0>] __driver_attach+0x90/0xa0
        [<ffffffff81484844>] bus_for_each_dev+0x64/0xa0
        [<ffffffff814862de>] driver_attach+0x1e/0x20
        [<ffffffff81485e7b>] bus_add_driver+0x1eb/0x280
        [<ffffffff81487680>] driver_register+0x60/0xe0
        [<ffffffffa074a0da>] __hda_codec_driver_register+0x5a/0x60 [snd_hda_codec]
        [<ffffffffa070a01e>] realtek_driver_init+0x1e/0x1000 [snd_hda_codec_realtek]
        [<ffffffff810002f3>] do_one_initcall+0xb3/0x200
        [<ffffffff816a1fc5>] do_init_module+0x60/0x1f8
        [<ffffffff810ee5c3>] load_module+0x1653/0x1bd0
        [<ffffffff810eed48>] SYSC_finit_module+0x98/0xc0
        [<ffffffff810eed8e>] SyS_finit_module+0xe/0x10
        [<ffffffff816aa032>] entry_SYSCALL_64_fastpath+0x16/0x75
      
      The simple fix is just to remove this call, since we don't need to
      think about unbinding at there any longer.
      
      Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=948758
      Cc: <stable@vger.kernel.org> # v4.1+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d289619a
  11. 18 10月, 2015 1 次提交
    • T
      ALSA: hda - Fix bogus codec address check for mixer name assignment · 2f0eaad9
      Takashi Iwai 提交于
      The recent commit [7fbe824a: ALSA: hda - Update mixer name for the
      lower codec address] tried to improve the mixer chip name assignment
      in the order of codec address.  However, this fix was utterly bogus;
      it checks the field set in each codec, thus this value is reset at
      each codec creation, of course.  For really handling this priority,
      the assignment has to be remembered in the common place, namely in
      hda_bus, instead of hda_codec.
      
      Fixes: 7fbe824a ('ALSA: hda - Update mixer name for the lower codec address')
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2f0eaad9
  12. 15 10月, 2015 1 次提交
    • T
      ALSA: hda - Update mixer name for the lower codec address · 7fbe824a
      Takashi Iwai 提交于
      In most cases, we prefer the onboard codec as the primary device, thus
      it's better to set it as the mixer name.  Currently, however, the
      mixer name is updated per the device instantiation order, and user
      gets often HDMI/DP or other seen as a mixer chip name.  Also, if a
      codec name is renamed by the driver, the old chip name might be left
      still as the mixer name.
      
      This patch addresses these issues by remembering the chip address that
      was referred as the mixer name.  When a codec with the same or lower
      address gives its name, renew the mixer name accordingly, as it's
      either the update of the codec name or we get likely the more
      appropriate chip as the reference.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7fbe824a
  13. 09 10月, 2015 1 次提交
  14. 26 8月, 2015 1 次提交
  15. 25 8月, 2015 1 次提交
    • T
      ALSA: hda - Refresh sysfs at snd_hda_codec_update_widgets() · 9dcc144b
      Takashi Iwai 提交于
      In the commit [fa4f18b4: ALSA: hda - Refresh widgets sysfs at
      probing Haswell+ HDMI codecs], snd_hdac_refresh_widget_sysfs() is
      explicitly called in the codec driver.  But this results in refreshing
      twice, as snd_hdac_refresh_widget_sysfs() itself calls
      snd_hdac_refresh_widgets() function.
      
      Instead, we can replace the call in snd_hda_codec_update_widgets()
      with snd_hdac_refresh_widget_sysfs().  This also fixes the missing
      sysfs update for ca0132, too.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9dcc144b
  16. 24 8月, 2015 1 次提交
  17. 17 8月, 2015 1 次提交
    • T
      ALSA: hda - Make some helper functions local · d2c6b63d
      Takashi Iwai 提交于
      A few helper functions to convert the pin information to strings have
      been exported with assumption that they were used by other drivers.
      But they are referred only in the proc interface in the end.
      
      Let's make them local so that we can get rid of a few exports.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d2c6b63d
  18. 17 7月, 2015 1 次提交
  19. 11 6月, 2015 2 次提交
    • T
      ALSA: hda - Fix link power unbalance at device removal · a457782a
      Takashi Iwai 提交于
      snd_hdac_link_power() has to be called after unregistering the codec
      device.  Otherwise the device might be already runtime-suspended, thus
      the refcount goes under zero, triggering a warning like:
      
        WARNING: CPU: 7 PID: 2014 at sound/hda/hdac_i915.c:63 snd_hdac_display_power+0x106/0x120 [snd_hda_core]()
        CPU: 7 PID: 2014 Comm: modprobe Not tainted 4.1.0-rc7-test+ #1
        Call Trace:
         [<ffffffff81697fe3>] dump_stack+0x4c/0x6e
         [<ffffffff810696da>] warn_slowpath_common+0x8a/0xc0
         [<ffffffff810697ca>] warn_slowpath_null+0x1a/0x20
         [<ffffffffa02dd526>] snd_hdac_display_power+0x106/0x120 [snd_hda_core]
         [<ffffffffa030b422>] azx_intel_link_power+0x12/0x20 [snd_hda_intel]
         [<ffffffffa037139f>] azx_link_power+0x1f/0x30 [snd_hda_codec]
         [<ffffffffa02d89fe>] snd_hdac_link_power+0x2e/0x40 [snd_hda_core]
         [<ffffffffa0368524>] snd_hda_codec_dev_free+0x34/0x50 [snd_hda_codec]
         [<ffffffffa0252061>] __snd_device_free+0x51/0xa0 [snd]
         .....
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a457782a
    • T
      ALSA: hda - Re-add the lost fake mute support · a686ec4c
      Takashi Iwai 提交于
      Yet another regression by the transition to regmap cache; for better
      usability, we had the fake mute control using the zero amp value for
      Conexant codecs, and this was forgotten in the new hda core code.
      
      Since the bits 4-7 are unused for the amp registers (as we follow the
      syntax of AMP_GET verb), the bit 4 is now used to indicate the fake
      mute.  For setting this flag, snd_hda_codec_amp_update() becomes a
      function from a simple macro.  The bonus is that it gained a proper
      function description.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a686ec4c
  20. 09 6月, 2015 2 次提交
  21. 29 4月, 2015 1 次提交
  22. 27 4月, 2015 2 次提交
  23. 17 4月, 2015 1 次提交
    • T
      ALSA: hda - Replace hda_bus_ops with static binding · 0a50575b
      Takashi Iwai 提交于
      Originally hda_bus takes its own ops (hda_bus_ops) to allow different
      controller drivers giving individual implementations of PCM
      attachment, etc.  But this never happened and we finally merged both
      codec and controller helper codes.  Thus there is no merit to keep the
      indirect accesses to functions via hda_bus_ops.
      
      This patch replaces these calls with the direct local function calls
      for simplification.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0a50575b
  24. 16 4月, 2015 6 次提交
  25. 14 4月, 2015 1 次提交
  26. 08 4月, 2015 1 次提交
    • T
      ALSA: hda - Work around races of power up/down with runtime PM · 664c7155
      Takashi Iwai 提交于
      Currently, snd_hdac_power_up()/down() helpers checks whether the codec
      is being in pm (suspend/resume), and skips the call of runtime get/put
      during it.  This is needed as there are lots of power up/down
      sequences called in the paths that are also used in the PM itself.  An
      example is found in hda_codec.c::codec_exec_verb(), where this can
      power up the codec while it may be called again in its power up
      sequence, too.
      
      The above works in most cases, but sometimes we really want to wait
      for the real power up.  For example, the control element get/put may
      want explicit power up so that the value change is assured to reach to
      the hardware.   Using the current snd_hdac_power_up(), however,
      results in a race, e.g. when it's called during the runtime suspend is
      being performed.  In the worst case, as found in patch_ca0132.c, it
      can even lead to the deadlock because the code assumes the power up
      while it was skipped due to the check above.
      
      For dealing with such cases, this patch makes snd_hdac_power_up() and
      _down() to two variants: with and without in_pm flag check.  The
      version with pm flag check is named as snd_hdac_power_up_pm() while
      the version without pm flag check is still kept as
      snd_hdac_power_up().  (Just because the usage of the former is fewer.)
      
      Then finally, the patch replaces each call potentially done in PM with
      the new _pm() variant.
      
      In theory, we can implement a unified version -- if we can distinguish
      the current context whether it's in the pm path.  But such an
      implementation is cumbersome, so leave the code like this a bit messy
      way for now...
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96271Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      664c7155