1. 17 5月, 2017 1 次提交
  2. 10 4月, 2017 2 次提交
  3. 26 6月, 2016 1 次提交
    • B
      ALSA: hda - fix read before array start · 81e43960
      Bob Copeland 提交于
      UBSAN reports the following warning from accessing path->path[-1]
      in set_path_power():
      
      [   16.078040] ================================================================================
      [   16.078124] UBSAN: Undefined behaviour in sound/pci/hda/hda_generic.c:3981:17
      [   16.078198] index -1 is out of range for type 'hda_nid_t [10]'
      [   16.078270] CPU: 2 PID: 1738 Comm: modprobe Not tainted 4.7.0-rc1-wt+ #47
      [   16.078274] Hardware name: LENOVO 3443CTO/3443CTO, BIOS G6ET23WW (1.02 ) 08/14/2012
      [   16.078278]  ffff8800cb246000 ffff8800cb3638b8 ffffffff815c4fe3 0000000000000032
      [   16.078286]  ffff8800cb3638e0 ffffffffffffffff ffff8800cb3638d0 ffffffff8162443d
      [   16.078294]  ffffffffa0894200 ffff8800cb363920 ffffffff81624af7 0000000000000292
      [   16.078302] Call Trace:
      [   16.078311]  [<ffffffff815c4fe3>] dump_stack+0x86/0xd3
      [   16.078317]  [<ffffffff8162443d>] ubsan_epilogue+0xd/0x40
      [   16.078324]  [<ffffffff81624af7>] __ubsan_handle_out_of_bounds+0x67/0x70
      [   16.078335]  [<ffffffffa087665f>] set_path_power+0x1bf/0x230 [snd_hda_codec_generic]
      [   16.078344]  [<ffffffffa087880d>] add_pin_power_ctls+0x8d/0xc0 [snd_hda_codec_generic]
      [   16.078352]  [<ffffffffa087f190>] ? pin_power_down_callback+0x20/0x20 [snd_hda_codec_generic]
      [   16.078360]  [<ffffffffa0878947>] add_all_pin_power_ctls+0x107/0x150 [snd_hda_codec_generic]
      [   16.078370]  [<ffffffffa08842b3>] snd_hda_gen_parse_auto_config+0x2d73/0x49e0 [snd_hda_codec_generic]
      [   16.078376]  [<ffffffff81173360>] ? trace_hardirqs_on_caller+0x1b0/0x2c0
      [   16.078390]  [<ffffffffa089df27>] alc_parse_auto_config+0x147/0x310 [snd_hda_codec_realtek]
      [   16.078402]  [<ffffffffa08a332a>] patch_alc269+0x23a/0x560 [snd_hda_codec_realtek]
      [   16.078417]  [<ffffffffa0838644>] hda_codec_driver_probe+0xa4/0x1a0 [snd_hda_codec]
      [   16.078424]  [<ffffffff817bbac1>] driver_probe_device+0x101/0x380
      [   16.078430]  [<ffffffff817bbdf9>] __driver_attach+0xb9/0x100
      [   16.078438]  [<ffffffff817bbd40>] ? driver_probe_device+0x380/0x380
      [   16.078444]  [<ffffffff817b8d20>] bus_for_each_dev+0x70/0xc0
      [   16.078449]  [<ffffffff817bb087>] driver_attach+0x27/0x50
      [   16.078454]  [<ffffffff817ba956>] bus_add_driver+0x166/0x2c0
      [   16.078460]  [<ffffffffa0369000>] ? 0xffffffffa0369000
      [   16.078465]  [<ffffffff817bd13d>] driver_register+0x7d/0x130
      [   16.078477]  [<ffffffffa083816f>] __hda_codec_driver_register+0x6f/0x90 [snd_hda_codec]
      [   16.078488]  [<ffffffffa036901e>] realtek_driver_init+0x1e/0x1000 [snd_hda_codec_realtek]
      [   16.078493]  [<ffffffff8100215e>] do_one_initcall+0x4e/0x1d0
      [   16.078499]  [<ffffffff8119f54d>] ? rcu_read_lock_sched_held+0x6d/0x80
      [   16.078504]  [<ffffffff813701b1>] ? kmem_cache_alloc_trace+0x391/0x560
      [   16.078510]  [<ffffffff812bb314>] ? do_init_module+0x28/0x273
      [   16.078515]  [<ffffffff812bb387>] do_init_module+0x9b/0x273
      [   16.078522]  [<ffffffff811e3782>] load_module+0x20b2/0x3410
      [   16.078527]  [<ffffffff811df140>] ? m_show+0x210/0x210
      [   16.078533]  [<ffffffff813b2b26>] ? kernel_read+0x66/0xe0
      [   16.078541]  [<ffffffff811e4cfa>] SYSC_finit_module+0xba/0xc0
      [   16.078547]  [<ffffffff811e4d1e>] SyS_finit_module+0xe/0x10
      [   16.078552]  [<ffffffff81a860fc>] entry_SYSCALL_64_fastpath+0x1f/0xbd
      [   16.078556] ================================================================================
      
      Fix by checking path->depth before use.
      Signed-off-by: NBob Copeland <me@bobcopeland.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      81e43960
  4. 02 6月, 2016 1 次提交
    • T
      ALSA: hda - Turn off loopback mixing as default · fabc16fe
      Takashi Iwai 提交于
      So far, we enabled the loopback mixing control as default, as this
      behavior made somewhat compatible with the earlier HD-audio drivers
      for Realtek & co.  However, it's getting annoying as we've got more
      and more bug reports about the noise coming from the loopback route.
      Since the loopback mixing is used fairly rarely and often harmful
      (e.g. using PA), let's get rid of the default turn-on lines.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      fabc16fe
  5. 17 4月, 2016 1 次提交
    • T
      ALSA: hda - Don't trust the reported actual power state · 50fd4987
      Takashi Iwai 提交于
      We've got a regression report that the recording on Mac with a cirrus
      codec doesn't work any longer.  This turned out to be the missing
      power up to D0 by power_save_node enablement.
      
      After analyzing the traces, we found out that the culprit is that the
      codec advertises the "actual" power state of a few nodes to be D0
      while the "target" power state is D3.  This inconsistency is usually
      OK, as it implies the power transition.  But in the case of cirrus
      codec, this seems to be stuck to D3 while it's not actually D0.
      
      This patch addresses the issue by checking the power state difference
      more strictly.  It sends the power-state change verb unless both the
      target and the actual power states show the given value.
      
      We may introduce yet another flag indicating the possible broken
      hardware power state, but it's anyway safer to set the proper power
      state even in a transition (at least it's harmless as long as the
      target state is same).  So this simpler change was applied now.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=116171
      Cc: <stable@vger.kernel.org> # v4.4+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      50fd4987
  6. 12 4月, 2016 1 次提交
  7. 09 2月, 2016 1 次提交
    • T
      ALSA: hda - Fix bad dereference of jack object · 2ebab40e
      Takashi Iwai 提交于
      The hda_jack_tbl entries are managed by snd_array for allowing
      multiple jacks.  It's good per se, but the problem is that struct
      hda_jack_callback keeps the hda_jack_tbl pointer.  Since snd_array
      doesn't preserve each pointer at resizing the array, we can't keep the
      original pointer but have to deduce the pointer at each time via
      snd_array_entry() instead.  Actually, this resulted in the deference
      to the wrong pointer on codecs that have many pins such as CS4208.
      
      This patch replaces the pointer to the NID value as the search key.
      As an unexpected good side effect, this even simplifies the code, as
      only NID is needed in most cases.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2ebab40e
  8. 09 12月, 2015 1 次提交
    • T
      ALSA: hda - Implement loopback control switch for Realtek and other codecs · e7fdd527
      Takashi Iwai 提交于
      Many codecs, typically found on Realtek codecs, have the analog
      loopback path merged to the secondary input of the middle of the
      output paths.  Currently, we don't offer the dynamic switching in such
      configuration but let each loopback path mute by itself.
      
      This should work well in theory, but in reality, we often see that
      such a dead loopback path causes some background noises even if all
      the elements get muted.  Such a problem has been fixed by adding the
      quirk accordingly to disable aamix, and it's the right fix, per se.
      The only problem is that it's not so trivial to achieve it; user needs
      to pass a hint string via patch module option or sysfs.
      
      This patch gives a bit improvement on the situation: it adds "Loopback
      Mixing" control element for such codecs like other codecs (e.g. IDT or
      VIA codecs) with the individual loopback paths.  User can turn on/off
      the loopback path simply via a mixer app.
      
      For keeping the compatibility, the loopback is still enabled on these
      codecs.  But user can try to turn it off if experiencing a suspicious
      background or click noise on the fly, then build a static fixup later
      once after the problem is addressed.
      
      Other than the addition of the loopback enable/disablement control,
      there should be no changes.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e7fdd527
  9. 08 12月, 2015 2 次提交
  10. 20 10月, 2015 1 次提交
    • T
      ALSA: hda - convert to hda_device_id · b9a94a9c
      Takashi Iwai 提交于
      Finally we have a proper infrastructure to generate the modaliases
      automatically, let's move to hda_device_id from the legacy
      hda_codec_preset that contains basically the same information.
      
      The patch function hook is stored in driver_data field, which is long,
      and we need an explicit cast.  Other than that, the conversion is
      mostly straightforward.  Each entry is even simplified using a macro,
      and the lengthy (and error-prone) manual modaliases got removed.
      
      As a result, we achieved a quite good diet:
       14 files changed, 407 insertions(+), 595 deletions(-)
      Reviewed-by: NVinod Koul <vinod.koul@intel.com>
      Tested-by: NSubhransu S Prusty <subhransu.s.prusty@intel.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b9a94a9c
  11. 25 8月, 2015 2 次提交
  12. 08 7月, 2015 1 次提交
  13. 27 5月, 2015 1 次提交
  14. 20 5月, 2015 1 次提交
    • T
      ALSA: hda - Reduce verbs by node power-saves · 48f4b3a2
      Takashi Iwai 提交于
      The widget (node) power-saves restore the widget states at each
      transition from D3 to D0 on each node.  This was added in the commit
      [d545a57c:ALSA: hda - Sync node attributes at resume from widget
      power saving].  However, the test was rater false-positive; this
      wasn't needed for any codecs.
      
      Since the resync may take significant number of additional verbs to be
      executed, it's better to reduce it.  Let's disable it for now again.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      48f4b3a2
  15. 27 4月, 2015 1 次提交
    • T
      ALSA: hda - Fix click noise at start on Dell XPS13 · 3e1b0c4a
      Takashi Iwai 提交于
      Dell XPS13 produces a click noise at boot up, and Gabriele spotted out
      that it's triggered by the initial pin control of the mic (NID 0x19).
      This has to be set to Hi-Z Vref while the driver initializes to Vref
      80% as a normal mic.
      
      This patch fixes the generic parser code not to override the target
      vref if it has been already set by the driver, and adds a proper
      initialization of the target vref for this pin in the Realtek driver
      side.
      Reported-and-tested-by: NGabriele Mazzotta <gabriele.mzt@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3e1b0c4a
  16. 09 4月, 2015 4 次提交
  17. 04 4月, 2015 1 次提交
  18. 23 3月, 2015 2 次提交
    • T
      ALSA: hda - Use regmap for command verb caches, too · a551d914
      Takashi Iwai 提交于
      Like the previous patches, this patch converts also to the regmap, at
      this time, the cached verb writes are the target.  But this conversion
      needs a bit more caution than before.
      
      - In the old code, we just record any verbs as is, and restore them at
        resume.  For the regmap scheme, this doesn't work, since a few verbs
        like AMP or DIGI_CONVERT are asymmetrical.  Such verbs are converted
        either to the dedicated function (snd_hda_regmap_xxx_amp()) or
        changed to the unified verb.
      
      - Some verbs have to be declared as vendor-specific ones before
        accessing via regmap.
      
      Also, the minor optimization with codec->cached_write flag is dropped
      in a few places, as this would confuse the operation.  Further
      optimizations will be brought in the later patches, if any.
      
      This conversion ends up with a drop of significant amount of codes,
      mostly the helper codes that are no longer used.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a551d914
    • T
      ALSA: hda - Move a part of hda_codec stuff into hdac_device · 7639a06c
      Takashi Iwai 提交于
      Now some codes and functionalities of hda_codec struct are moved to
      hdac_device struct.  A few basic attributes like the codec address,
      vendor ID number, FG numbers, etc are moved to hdac_device, and they
      are accessed like codec->core.addr.  The basic verb exec functions are
      moved, too.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7639a06c
  19. 21 3月, 2015 2 次提交
  20. 18 3月, 2015 3 次提交
    • T
      ALSA: hda - Adjust power of beep widget and outputs · 5ccf835c
      Takashi Iwai 提交于
      As the widget PM may turn off the pins, this might lead to the silent
      output for beep when no explicit paths are given.  This patch adds
      fake output paths for the beep widget so that the output pins are
      dynamically powered upon beep on/off.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      5ccf835c
    • T
      ALSA: hda - Support advanced power state controls · e6feb5d0
      Takashi Iwai 提交于
      This patch enables the finer power state control of each widget
      depending on the jack plug state and streaming state in addition to
      the existing power_down_unused power optimization.  The new feature is
      enabled only when codec->power_mgmt flag is set.
      
      Two new flags, pin_enabled and stream_enabled, are introduced in
      nid_path struct for marking the two individual power states: the pin
      plug/unplug and DAC/ADC stream, respectively.  They can be set
      statically in case they are static routes (e.g. some mixer paths),
      too.
      
      The power up and down events for each pin are triggered via the
      standard hda_jack table.  The call order is hard-coded, relying on the
      current implementation of jack event chain (a la FILO/stack order).
      
      One point to be dealt carefully is that DAC/ADC cannot be powered
      on/off while streaming.  They are pinned as long as the stream is
      running.  For controlling the power of DAC/ADC, a new patch_ops is
      added.  The generic parser provides the default callback for that.
      
      As of this patch, only IDT/Sigmatel codec driver enables the flag.
      The support on other codecs will follow.
      
      An assumption we made in this code is that the widget state (e.g. amp,
      pinctl, connections) remains after the widget power transition (not
      about FG power transition).  This is true for IDT codecs, at least.
      But if the widget state is lost at widget power transition, we'd need
      to implement additional code to sync the cached amp/verbs for the
      specific NID.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e6feb5d0
    • T
      ALSA: hda - Simplify PCM setup overrides · fb83b635
      Takashi Iwai 提交于
      This patch does two things:
      - code refactoring with a local helper function,
      - allow codec drivers to provide the specific PCM stream info pointers
        only for overriding the non-NULL entries, instead of copying the
        whole.
      
      This simplifies the codec driver side (currently the only user is
      alc269's 44kHz fixed rate).
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      fb83b635
  21. 16 3月, 2015 1 次提交
    • T
      ALSA: hda - Treat stereo-to-mono mix properly · cc261738
      Takashi Iwai 提交于
      The commit [ef403edb: ALSA: hda - Don't access stereo amps for
      mono channel widgets] fixed the handling of mono widgets in general,
      but it still misses an exceptional case: namely, a mono mixer widget
      taking a single stereo input.  In this case, it has stereo volumes
      although it's a mono widget, and thus we have to take care of both
      left and right input channels, as stated in HD-audio spec ("7.1.3
      Widget Interconnection Rules").
      
      This patch covers this missing piece by adding proper checks of stereo
      amps in both the generic parser and the proc output codes.
      Reported-by: NRaymond Yau <superquad.vortex2@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      cc261738
  22. 13 3月, 2015 1 次提交
    • T
      ALSA: hda - Don't access stereo amps for mono channel widgets · ef403edb
      Takashi Iwai 提交于
      The current HDA generic parser initializes / modifies the amp values
      always in stereo, but this seems causing the problem on ALC3229 codec
      that has a few mono channel widgets: namely, these mono widgets react
      to actions for both channels equally.
      
      In the driver code, we do care the mono channel and create a control
      only for the left channel (as defined in HD-audio spec) for such a
      node.  When the control is updated, only the left channel value is
      changed.  However, in the resume, the right channel value is also
      restored from the initial value we took as stereo, and this overwrites
      the left channel value.  This ends up being the silent output as the
      right channel has been never touched and remains muted.
      
      This patch covers the places where unconditional stereo amp accesses
      are done and converts to the conditional accesses.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94581
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ef403edb
  23. 03 3月, 2015 1 次提交
    • T
      ALSA: hda - Allocate hda_pcm objects dynamically · bbbc7e85
      Takashi Iwai 提交于
      So far, the hda_codec object kept the hda_pcm list in an array, and
      the codec driver was expected to assign the array.  However, this
      makes the object life cycle management harder, because the assigned
      array is freed at the codec driver detach while it might be still
      accessed by the opened streams.
      
      In this patch, we allocate each hda_pcm object dynamically and manage
      it as a linked list.  Each object has a kref refcount, and both the
      codec driver binder and the PCM open/close touches it, so that the
      object won't be freed while in use.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      bbbc7e85
  24. 23 2月, 2015 1 次提交
    • T
      ALSA: hda - Bind codecs via standard bus · d8a766a1
      Takashi Iwai 提交于
      Now we create the standard HD-audio bus (/sys/bus/hdaudio), and bind
      the codec driver with the codec device over there.  This is the first
      step of the whole transition so that the changes to each codec driver
      are kept as minimal as possible.
      
      Each codec driver needs to register hda_codec_driver struct containing
      the currently existing preset via the new helper macro
      module_hda_codec_driver().  The old hda_codec_preset_list is replaced
      with this infrastructure.  The generic parsers (for HDMI and other)
      are also included in the preset with the special IDs to bind
      uniquely.
      
      In HD-audio core side, the device binding code is split to
      hda_bind.c.  It provides the snd_hda_bus_type implementation to match
      the codec driver with the given codec vendor ID.  It also manages the
      module auto-loading by itself like before: when the matching isn't
      found, it tries to probe the corresponding codec modules, and finally
      falls back to the generic drivers.  (The special ID mentioned above is
      set at this stage.)
      
      The only visible change to outside is that the hdaudio sysfs entry now
      appears in /sys/bus/devices, not as a sound class device.
      
      More works to move the suspend/resume and remove ops will be
      (hopefully) done in later patches.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d8a766a1
  25. 15 12月, 2014 2 次提交
  26. 30 10月, 2014 1 次提交
  27. 20 10月, 2014 2 次提交
  28. 23 9月, 2014 1 次提交