1. 23 3月, 2015 12 次提交
    • T
      ALSA: hda - Use regmap for amp accesses · eeecd9d1
      Takashi Iwai 提交于
      This patch converts the amp access functions to the regmap helpers.
      The amp values were formerly cached in the own hash table.  Now it's
      dropped by the regmap's cache.
      
      The only tricky conversion is snd_hda_codec_amp_init().  This function
      shouldn't do anything if the amp was already initialized.  For
      achieving this behavior, a value is read once at first temporarily in
      the cache-only mode.  Only if it returns an error,  i.e. the item
      still doesn't exist in the cache, it proceeds to the update.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      eeecd9d1
    • T
      ALSA: hda - Implement uncached version of parameter reads · 9ba17b4d
      Takashi Iwai 提交于
      Sometimes we need the uncached reads, e.g. for refreshing the tree.
      This patch provides the helper function for that and uses it for
      refreshing widgets, reading subtrees and the whole proc reads.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9ba17b4d
    • T
      ALSA: hda - Use regmap for codec parameter reads · 01ed3c06
      Takashi Iwai 提交于
      Let's start converting the access functions to regmap.
      The first one is the simplest, just converting the codec parameter
      read helper function snd_hda_param_read().
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      01ed3c06
    • T
      ALSA: hda - Add regmap support · 4d75faa0
      Takashi Iwai 提交于
      This patch adds an infrastructure to support regmap-based verb
      accesses.  Because o the asymmetric nature of HD-audio verbs,
      especially the amp verbs, we need to translate the verbs as a sort of
      pseudo registers to be mapped uniquely in regmap.
      
      In this patch, a pseudo register is built from the NID, the
      AC_VERB_GET_* and 8bit parameters, i.e. almost in the form to be sent
      to HD-audio bus but without codec address field.  OTOH, for writing,
      the same pseudo register is translated to AC_VERB_SET_* automatically.
      The AC_VERB_SET_AMP_* verb is re-encoded from the corresponding
      AC_VERB_GET_AMP_* verb and parameter at writing.
      
      Some verbs has a single command for read but multiple for writes.  A
      write for such a verb is split automatically to multiple verbs.
      
      The patch provides also a few handy helper functions.  They are
      designed to be accessible even without regmap.  When no regmap is set
      up (e.g. before the codec device instantiation), the direct hardware
      access is used.  Also, it tries to avoid the unnecessary power-up.
      The power up/down sequence is performed only on demand.
      
      The codec driver needs to call snd_hdac_regmap_exit() and
      snd_hdac_regmap_exit() at probe and remove if it wants the regmap
      access.
      
      There is one flag added to hdac_device.  When the flag lazy_cache is
      set, regmap helper ignores a write for a suspended device and returns
      as if it was actually written.  It reduces the hardware access pretty
      much, e.g. when adjusting the mixer volume while in idle.  This
      assumes that the driver will sync the cache later at resume properly,
      so use it carefully.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4d75faa0
    • T
      ALSA: hda - Move generic array helpers to core lib · 71fc4c7e
      Takashi Iwai 提交于
      This will be used by the regmap support.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      71fc4c7e
    • T
      ALSA: hda - Re-add tracepoints to HD-audio core driver · e311782a
      Takashi Iwai 提交于
      Now let's take the basic tracepoints back to the HD-audio driver.
      The three bus tracepoints, hda_send_cmd, hda_get_response and
      hda_unsol_event are revived but in a slightly different form.
      Since we don't assign the card number there, print the bus device name
      instead.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e311782a
    • T
      ALSA: hda - Fix possible runtime PM refcount unbalance · c4c2533f
      Takashi Iwai 提交于
      When the driver is unloaded before the codec is bound, it still keeps
      the runtime PM refcount up, and results in the unbalance.  This patch
      covers these cases by introducing a flag indicating the runtime PM
      initialization and handling the codec registration procedure more
      properly.  It also fixes the missing input beep device as a gratis,
      too.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c4c2533f
    • T
      ALSA: hda - Support indirect execution of verbs · 05852448
      Takashi Iwai 提交于
      Add an overriding exec_verb op to struct hdac_device so that the call
      via snd_hdac_exec_verb() can switch to a different route depending on
      the setup.  The codec driver sets this field so that it can handle the
      errors or applying quirks appropriately.  Furthermore, this mechanism
      will be used for smooth transition for the regmap support in later
      patches.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      05852448
    • T
      ALSA: hda - Add widget sysfs tree · 3256be65
      Takashi Iwai 提交于
      This patch changes the sysfs files assigned to the codec device on the
      bus which were formerly identical with hwdep sysfs files.  Now it
      shows only a few core parameter, vendor_id, subsystem_id, revision_id,
      afg, mfg, vendor_name and chip_name.
      
      In addition, now a widget tree is added to the bus device sysfs
      directory for showing the widget topology and attributes.  It's just a
      flat tree consisting of subdirectories named as the widget NID
      including various attributes like widget capability bits.  The AFG
      (usually NID 0x01) is always found there, and it contains always
      amp_in_caps, amp_out_caps and power_caps files.  Each of these
      attributes show a single value.  The rest are the widget nodes
      belonging to that AFG.  Note that the child node might not start from
      0x02 but from another value like 0x0a.
      
      Each child node may contain caps, pin_caps, amp_in_caps, amp_out_caps,
      power_caps and connections files.  The caps (representing the widget
      capability bits) always contain a value.  The rest may contain
      value(s) if the attribute exists on the node.  Only connections file
      show multiple values while other attributes have zero or one single
      value.
      
      An example of ls -R output is like below:
      % ls -R /sys/bus/hdaudio/devices/hdaudioC0D0/
      /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/:
      01/  04/  07/  0a/  0d/  10/  13/  16/  19/  1c/  1f/  22/
      02/  05/  08/  0b/  0e/  11/  14/  17/  1a/  1d/  20/  23/
      03/  06/  09/  0c/  0f/  12/  15/  18/  1b/  1e/  21/
      
      /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/01:
      amp_in_caps  amp_out_caps  power_caps
      
      /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/02:
      amp_in_caps  amp_out_caps  caps  connections  pin_caps  pin_cfg
      power_caps
      
      /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/03:
      .....
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3256be65
    • 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
    • T
      ALSA: hda - Move some codes up to hdac_bus struct · d068ebc2
      Takashi Iwai 提交于
      A few basic codes for communicating over HD-audio bus are moved to
      struct hdac_bus now.  It has only command and get_response ops in
      addition to the unsolicited event handling.
      
      Note that the codec-side tracing support is disabled temporarily
      during this transition due to the code shuffling.  It will be
      re-enabled later once when all pieces are settled down.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d068ebc2
    • T
      ALSA: hda - Make snd_hda_bus_type public · e3d280fc
      Takashi Iwai 提交于
      Define the common hd-audio driver and device types to bind over
      snd_hda_bus_type publicly.  This allows to implement other type of
      device and driver code over hd-audio bus.
      
      Now both struct hda_codec and struct hda_codec_driver inherit these
      new struct hdac_device and struct hdac_driver, respectively.
      
      The bus registration is done in subsys_initcall() to assure it
      before any other driver registrations.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e3d280fc
  2. 21 3月, 2015 2 次提交
  3. 18 3月, 2015 4 次提交
    • 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 - Use the new power control for VIA codecs · 688b12cc
      Takashi Iwai 提交于
      VIA codecs used to have the own power controls but they were disabled
      at transition to the generic parser due to the coding assuming the
      fixed routes.  Now we get the proper support of equivalently fine
      power management in the generic parser, and the old kludges can be
      replaced with it.  This results in the reduction of lots of dead
      codes.
      
      The advanced PM feature is disabled as default like before for keeping
      the compatible behavior.  It's enabled via "Dynamic Power-Control"
      mixer element.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      688b12cc
    • 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
  4. 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
  5. 13 3月, 2015 4 次提交
  6. 11 3月, 2015 1 次提交
  7. 09 3月, 2015 1 次提交
    • T
      ALSA: hda - Fix regression of HD-audio controller fallback modes · a1f3f1ca
      Takashi Iwai 提交于
      The commit [63e51fd7: ALSA: hda - Don't take unresponsive D3
      transition too serious] introduced a conditional fallback behavior to
      the HD-audio controller depending on the flag set.  However, it
      introduced a silly bug, too, that the flag was evaluated in a reverse
      way.  This resulted in a regression of HD-audio controller driver
      where it can't go to the fallback mode at communication errors.
      
      Unfortunately (or fortunately?) this didn't come up until recently
      because the affected code path is an error handling that happens only
      on an unstable hardware chip.  Most of recent chips work stably, thus
      they didn't hit this problem.  Now, we've got a regression report with
      a VIA chip, and this seems indeed requiring the fallback to the
      polling mode, and finally the bug was revealed.
      
      The fix is a oneliner to remove the wrong logical NOT in the check.
      (Lesson learned - be careful about double negation.)
      
      The bug should be backported to stable, but the patch won't be
      applicable to 3.13 or earlier because of the code splits.  The stable
      fix patches for earlier kernels will be posted later manually.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94021
      Fixes: 63e51fd7 ('ALSA: hda - Don't take unresponsive D3 transition too serious')
      Cc: <stable@vger.kernel.org> # v3.14+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a1f3f1ca
  8. 06 3月, 2015 1 次提交
  9. 03 3月, 2015 9 次提交
  10. 26 2月, 2015 5 次提交