1. 03 5月, 2017 1 次提交
    • V
      drm/i915: Fix runtime PM for LPE audio · 183c0035
      Ville Syrjälä 提交于
      Not calling pm_runtime_enable() means that runtime PM can't be
      enabled at all via sysfs. So we definitely need to call it
      from somewhere.
      
      Calling it from the driver seems like a bad idea because it
      would have to be paired with a pm_runtime_disable() at driver
      unload time, otherwise the core gets upset. Also if there's
      no LPE audio driver loaded then we couldn't runtime suspend
      i915 either.
      
      So it looks like a better plan is to call it from i915 when
      we register the platform device. That seems to match how
      pci generally does things. I cargo culted the
      pm_runtime_forbid() and pm_runtime_set_active() calls from
      pci as well.
      
      The exposed runtime PM API is massive an thorougly misleading, so
      I don't actually know if this is how you're supposed to use the API
      or not. But it seems to work. I can now runtime suspend i915 again
      with or without the LPE audio driver loaded, and reloading the
      LPE audio driver also seems to work.
      
      Note that powertop won't auto-tune runtime PM for platform devices,
      which is a little annoying. So I'm not sure that leaving runtime
      PM in "on" mode by default is the best choice here. But I've left
      it like that for now at least.
      
      Also remove the comment about there not being much benefit from
      LPE audio runtime PM. Not allowing runtime PM blocks i915 runtime
      PM, which will also block s0ix, and that could have a measurable
      impact on power consumption.
      
      Cc: stable@vger.kernel.org
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Fixes: 0b6b524f ("ALSA: x86: Don't enable runtime PM as default")
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20170427160231.13337-2-ville.syrjala@linux.intel.comReviewed-by: NTakashi Iwai <tiwai@suse.de>
      183c0035
  2. 22 2月, 2017 2 次提交
    • T
      ALSA: x86: Don't enable runtime PM as default · 0b6b524f
      Takashi Iwai 提交于
      Unlike HSW and newer, BYT/CHT devices have no fine control of audio
      power domain in i915 side.  Since there is little gain by runtime PM
      on BYT/CHT, so far, this commit removes the pm_runtime_enable() call
      as default.
      
      User who still wants the runtime PM may adjust the corresponding
      sysfs files (power/control and power/autosuspend_delay_ms)
      appropriately, of course.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0b6b524f
    • T
      ALSA: x86: Use runtime PM autosuspend · 3002b9fb
      Takashi Iwai 提交于
      This patch adds a few lines to the driver to use autosuspend for the
      runtime PM.  It'll become useful with the combination of the keep-link
      feature.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3002b9fb
  3. 16 2月, 2017 8 次提交
  4. 13 2月, 2017 2 次提交
    • T
      ALSA: x86: Drop unused stream.running field · df42cb49
      Takashi Iwai 提交于
      The pcm_stream_info.running field is only set in the PCM trigger
      callback but never referred, thus it can be safely removed.
      
      Also, properly cover the spinlock in both the trigger START and STOP
      to protect had_enable_audio() calls.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      df42cb49
    • T
      ALSA: x86: Handle reset at prepare callback · e2acecf2
      Takashi Iwai 提交于
      Currently the driver handles some reset procedure at the trigger STOP
      and the underrun functions, where both are executed in the interrupt
      context.  Especially the underrun function has a sync-loop to clear
      the UNDERRUN status bit, and this is supposed to be one of plausible
      causes of GPU hangup.
      
      Since the job to be done in the interrupt handler should be minimum,
      we move the reset function out of trigger and underrun, and push it
      into the prepare (and hw_free) callbacks instead.  Here a new flag,
      need_reset, is introduced to indicate the requirement of the reset
      procedure.  This is for avoiding the multiple resets when PCM prepare
      is called sequentially.
      
      Also in the UNDERRUN bit-clear sync loop, take a longer pause to be in
      the safer side.  Taking a longer delay is no longer a problem now
      because we're running in the normal context.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e2acecf2
  5. 10 2月, 2017 5 次提交
  6. 07 2月, 2017 6 次提交
    • T
      ALSA: x86: Cache AUD_CONFIG register value · 40ce4b5d
      Takashi Iwai 提交于
      At enabling the audio, we modify AUD_CONFIG register bit 0.  So far,
      it does read-modify-write procedure with a special hack for the
      channel bits due to the silicon bug.  But we can optimize it by
      remembering the AUD_CONFIG register value privately.  This simplifies
      the things a lot.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      40ce4b5d
    • T
      ALSA: x86: Rearrange defines · 77531bee
      Takashi Iwai 提交于
      We have two header files and everything is mixed up chaotically.
      Move the chip-specific definitions like the hardware registers to
      intel_hdmi_lpe_audio.h, and the rest, the implementation specific
      stuff into intel_hdmi_audio.h.
      
      In addition, put some more comments to the register fields, and fix
      the incorrect name prefix for AUD_HDMI_STATUS bits, too.
      
      The whole changes are merely a code shuffling, and there is no
      functional change.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      77531bee
    • A
      ALSA: x86: mark hdmi suspend/resume functions as __maybe_unused · 1df98924
      Arnd Bergmann 提交于
      The two functions are unused when CONFIG_PM_SLEEP is disabled:
      
      sound/x86/intel_hdmi_audio.c:1633:12: error: 'hdmi_lpe_audio_resume' defined but not used [-Werror=unused-function]
      sound/x86/intel_hdmi_audio.c:1622:12: error: 'hdmi_lpe_audio_suspend' defined but not used [-Werror=unused-function]
      
      Marking them as __maybe_unused avoids the warning without introducing an
      ugly #ifdef.
      
      Fixes: 182cdf23 ("ALSA: x86: Implement runtime PM")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      1df98924
    • T
      ALSA: x86: Fix driver name string overflow · 873ab035
      Takashi Iwai 提交于
      The driver sets card->driver name string over its size (16 bytes).
      Shorten the name string to fit with it.
      
      Also, set more verbose string to card->shortname and ->longname.
      This doesn't have to be identical with card->driver at all.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      873ab035
    • T
      ALSA: x86: Rename had_enable_audio_int() to had_ack_irqs() · 075a1d46
      Takashi Iwai 提交于
      had_enable_audio_int() came from the LPE audio shell set_caps
      callback with ENABLE_INT and DISABLE_INT caps.  I interpreted as these
      correspond to enabling / disabling the audio interface, but the actual
      implementation is only to clear (send ACK) to both BUFFER_DONE and
      BUFFER_UNDERRUN interrupts unconditionally.  And, there is no
      counterpart, DISABLE_INT, code at all.
      
      For avoiding the further misunderstanding, rename the function to the
      more fitting one, had_ack_irqs(), and drop the calls with enable=false
      in allover places.  There is no functional changes at all.
      
      After this patch, there is only one caller at the PCM trigger start.
      Then it's doubtful whether this call is still really needed or not; I
      bet it not, but let's stay in the safer side for now and keep it as
      was.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      075a1d46
    • T
      ALSA: x86: Drop suspicious U24 format support · 3e21a76c
      Takashi Iwai 提交于
      U24 format is declared to be supported by the driver, but this looks
      really doubtful, as there is no corresponding code.  Better to drop
      it.  This format is very uncommon, so there should be practically no
      impact by this change.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3e21a76c
  7. 06 2月, 2017 1 次提交
    • T
      ALSA: x86: Refactor PCM process engine · e1b239f3
      Takashi Iwai 提交于
      This is again a big rewrite of the driver; now it touches the code to
      process PCM stream transfers.
      
      The most fundamental change is that the driver may support more than
      four periods.  Instead of keeping the same index between both the ring
      buffer (with the fixed four buffer descriptors) and the PCM buffer
      periods, we keep difference indices for both (bd_head and pcm_head
      fields).  In addition, when the periods are more than four, we need to
      track both head and next indices.  That is, we now have three indices:
      bd_head, pcm_head and pcm_filled.
      
      Also, the driver works better for periods < 4, too: the remaining BDs
      out of four are marked as invalid, so that the hardware skips those
      BDs in its loop.
      
      By this flexibility, we can use even ALSA-lib dmix plugin, which
      requires 16 periods as default.
      
      The buffer size could be up to 20bit, so the max buffer size was
      increased accordingly.  However, the buffer pre-allocation is kept as
      the old value (600kB) as default.  The reason is the limited number of
      BDs: since it doesn't suffice for the useful SG page management that
      can fit with the usual page allocator like some other drivers, we have
      to still allocate continuous pages, hence we shouldn't take too big
      memories there.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e1b239f3
  8. 05 2月, 2017 4 次提交
  9. 04 2月, 2017 11 次提交
    • T
      ALSA: x86: Rename drv_status to connected · 91b0cb0c
      Takashi Iwai 提交于
      After the rewrite of the runtime PM code, we have only two driver
      status: CONNECTED and DISCONNECTED.  So it's clearer to use a boolean
      flag, and name it easier one, "connected".
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      91b0cb0c
    • T
      ALSA: x86: Yet more tidy-up and clean-ups · 73997b05
      Takashi Iwai 提交于
      - Add a few more comments to functions.
      
      - Move the initialization of some PCM state variables to open and
        prepare callbacks, where these are clearer places.
      
      - Remove superfluous NULL checks.
      
      - Get rid of the bogus drv_status change to CONNECTED at close;
        this doesn't make any sense.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      73997b05
    • T
      ALSA: x86: Simplify comments · 44684f61
      Takashi Iwai 提交于
      It's a stand-alone small driver code, and we don't have to describe
      too much formalized comments in kernel-doc style for local functions
      at all.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      44684f61
    • T
      ALSA: x86: Set CA bits for DisplayPort too · 36ed3466
      Takashi Iwai 提交于
      This is a guess work.  Usually the DP audio info frame is just 8-bit
      shifted from HDMI AI, so let's try to put CA in DIP frame 2 [24-31].
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      36ed3466
    • T
      ALSA: x86: Create ELD control element · 4aedb946
      Takashi Iwai 提交于
      Like other drivers, expose the ELD bytes via a control element so that
      user-space can parse it.
      
      For the simplicity, the code to register the ctl elements is
      refactored using an array.  Also, since ELD ctl read copies the bytes
      also during disconnection, clear the ELD bytes at hot-unplug, in order
      to avoid the leak of the previous bogus ELD.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4aedb946
    • T
      ALSA: x86: Clean up unused defines and inclusions · 03c34377
      Takashi Iwai 提交于
      Many defines and constants are left unused.  Clean them up.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      03c34377
    • T
      ALSA: x86: Reduce redundant register field names · 7ceba75f
      Takashi Iwai 提交于
      Currently each register definition contains the own prefix in the
      union struct itself; for example, union aud_ch_status_0 has
      status_0_regx and status_0_regval fields.  These are simply
      superfluous, since usually the type of the variable is seen in its
      declaration or in its name.
      
      In this patch, we cut off these prefixes.  Now all register
      definitions have regx and regval fields consistently, instead.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7ceba75f
    • T
      ALSA: x86: Use the standard ELD bytes definitions · df0435db
      Takashi Iwai 提交于
      We have some constants defined in drm/drm_edid.h, and clean up our own
      definitions.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      df0435db
    • T
      ALSA: x86: Move stream status into pcm_stream_info · f69bd104
      Takashi Iwai 提交于
      The only remaining field in struct had_stream_data is stream_type that
      holds the current stream status.  Such information fits better in
      struct pcm_stream_info, so move it as a boolean "running" field to be
      clearer.
      
      This allows us to get rid or had_stream_data definition and
      references.
      
      Also, the superfluous status check get removed in a couple of places
      where we can call PCM helpers in anyway.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f69bd104
    • T
      ALSA: x86: Implement runtime PM · 182cdf23
      Takashi Iwai 提交于
      Although the driver has some PM callbacks, it doesn't do it right:
      - the suspend callback doesn't handle to suspend the running PCM,
      - the runtime PM ops are missing,
      - pm_runtime_get_sync() isn't used at the right place.
      
      This patch covers the above and provides the basic runtime PM
      functionality.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      182cdf23
    • T
      ALSA: x86: Properly manage PCM substream lifetype · 313d9f28
      Takashi Iwai 提交于
      The PCM substream is referred not only in the PCM callbacks but also
      in the irq handler and in the hotplug/unplug codes.  The latter code
      paths don't take the PCM lock, thus the PCM may be released
      unexpectedly while calling PCM helper functions or accessing
      pcm->runtime fields.
      
      This patch implements a simple refcount to assure the PCM substream
      accessibility while the other codes are accessing.  It needed some
      code refactoring in the relevant functions for avoiding the doubly
      spinlocks.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      313d9f28