1. 05 8月, 2013 1 次提交
    • L
      ASoC: dapm: Implement mixer input auto-disable · 57295073
      Lars-Peter Clausen 提交于
      Some devices have the problem that if a internal audio signal source is disabled
      the output of the source becomes undefined or goes to a undesired state (E.g.
      DAC output goes to ground instead of VMID). In this case it is necessary, in
      order to avoid unwanted clicks and pops, to disable any mixer input the signal
      feeds into or to active a mute control along the path to the output. Often it is
      still desirable to expose the same mixer input control to userspace, so cerain
      paths can sill be disabled manually. This means we can not use conventional DAPM
      to manage the mixer input control. This patch implements a method for letting
      DAPM overwrite the state of a userspace visible control. I.e. DAPM will disable
      the control if the path on which the control sits becomes inactive. Userspace
      will then only see a cached copy of the controls state. Once DAPM powers the
      path up again it will sync the userspace setting with the hardware and give
      control back to userspace.
      
      To implement this a new widget type is introduced. One widget of this type will
      be created for each DAPM kcontrol which has the auto-disable feature enabled.
      For each path that is controlled by the kcontrol the widget will be connected to
      the source of that path. The new widget type behaves like a supply widget,
      which means it will power up if one of its sinks are powered up and will only
      power down if all of its sinks are powered down. In order to only have the mixer
      input enabled when the source signal is valid the new widget type will be
      disabled before all other widget types and only be enabled after all other
      widget types.
      
      E.g. consider the following simplified example. A DAC is connected to a mixer
      and the mixer has a control to enable or disable the signal from the DAC.
      
                           +-------+
        +-----+            |       |
        | DAC |-----[Ctrl]-| Mixer |
        +-----+       :    |       |
           |          :    +-------+
           |          :
          +-------------+
          | Ctrl widget |
          +-------------+
      
      If the control has the auto-disable feature enabled we'll create a widget for
      the control. This widget is connected to the DAC as it is the source for the
      mixer input. If the DAC powers up the control widget powers up and if the DAC
      powers down the control widget is powered down. As long as the control widget
      is powered down the hardware input control is kept disabled and if it is enabled
      userspace can freely change the control's state.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      57295073
  2. 30 7月, 2013 5 次提交
  3. 24 7月, 2013 2 次提交
    • L
      ASoC: dapm: Add a update parameter to snd_soc_dapm_{mux,mixer}_update_power · 6b3fc03b
      Lars-Peter Clausen 提交于
      In order to avoid race conditions the assignment of dapm->update should happen
      while card->dapm_mutex is being held. To allow CODEC drivers to run a register
      update when using snd_soc_dapm_mux_update_power() or
      snd_soc_dapm_mixer_update_power() add a update parameter to these two functions.
      The update parameter will be assigned to dapm->update while card->dapm_mutex is
      locked.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      6b3fc03b
    • L
      ASoC: dapm: Run widget updates for shared controls at the same time · ce6cfaf1
      Lars-Peter Clausen 提交于
      Currently when updating a control that is shared between multiple widgets the
      whole power-up/power-down sequence is being run once for each widget. The
      control register is updated during the first run, which means the CODEC internal
      routing is also updated for all widgets during this first run. The input and
      output paths for each widgets are only updated though during the respective run
      for that widget. This leads to a slight inconsistency between the CODEC's
      internal state and ASoC's state, which causes non optimal behavior in regard to
      click and pop avoidance.
      
      E.g. consider the following setup where two MUXs share the same control.
      
                +------+
       A1 ------|      |
                | MUX1 |----- C1
       B1 ------|      |
                +------+
                   |
        control ---+
                   |
                +------+
       A2 ------|      |
                | MUX2 |----- C2
       B2 ------|      |
                +------+
      
      If the control is updated to switch the MUXs from input A to input B with the
      current code the power-up/power-down sequence will look like this:
      
      Run soc_dapm_mux_update_power for MUX1
        Power-down A1
        Update MUXing
        Power-up B1
      
      Run soc_dapm_mux_update_power for MUX2
        Power-down A2
        (Update MUXing)
        Power-up B2
      
      Note that the second 'Update Muxing' is a no-op, since the register was already
      updated.
      
      While the preferred order for avoiding pops and clicks should be:
      
      Run soc_dapm_mux_update_power for control
        Power-down A1
        Power-down A2
        Update MUXing
        Power-up B1
        Power-up B2
      
      This patch changes the behavior to the later by running the updates for all
      widgets that the control is attached to at the same time.
      
      The new code is also a bit simpler since callers of
      soc_dapm_{mux,muxer}_update_power don't have to loop over each widget anymore
      and neither do we need to keep track for which of the kcontrol's widgets the
      current update is.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      ce6cfaf1
  4. 14 6月, 2013 1 次提交
  5. 07 6月, 2013 1 次提交
  6. 13 5月, 2013 1 次提交
  7. 08 3月, 2013 1 次提交
  8. 25 2月, 2013 1 次提交
    • M
      ASoC: dapm: Fix handling of loops · 8af294b4
      Mark Brown 提交于
      Currently if a path loops back on itself we correctly skip over it to
      avoid going into an infinite loop but this causes us to ignore the need
      to power up the path as we don't count the loop for the purposes of
      counting inputs and outputs. This means that internal loopbacks within a
      device that have powered devices on them won't be powered up.
      
      Fix this by treating any path that is currently in the process of being
      recursed as having a single input or output so that it is counted for
      the purposes of power decisions.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <liam.r.girdwood@linux.intel.com>
      8af294b4
  9. 26 9月, 2012 1 次提交
  10. 08 9月, 2012 1 次提交
  11. 06 9月, 2012 2 次提交
  12. 07 7月, 2012 1 次提交
  13. 03 6月, 2012 1 次提交
  14. 19 4月, 2012 1 次提交
  15. 17 4月, 2012 1 次提交
    • M
      ASoC: core: Support transparent CODEC<->CODEC DAI links · c74184ed
      Mark Brown 提交于
      Rather than having the user half start a stream but avoid any DMA to
      trigger data flow on links which don't pass through the CPU create a
      DAPM route between the two DAI widgets using a hw_params configuration
      provided by the machine driver with the new 'params' member of the
      dai_link struct.  If no configuration is provided in the dai_link then
      use the old style even for CODEC<->CODEC links to avoid breaking
      systems.
      
      This greatly simplifies the userspace usage of such links, making them
      as simple as analogue connections with the stream configuration being
      completely transparent to them.
      
      This is achieved by defining a new dai_link widget type which is created
      when CODECs are linked and triggering the configuration of the link via
      the normal PCM operations from there.  It is expected that the bias
      level callbacks will be used for clock configuration.
      
      Currently only the DAI format, rate and channel count can be configured
      and currently the only DAI operations which can be called are hw_params
      and digital_mute().  This corresponds well to the majority of CODEC
      drivers which only use other callbacks for constraint setting but there
      is obviously much room for extension here.  We can't simply call
      hw_params() on startup as things like the system clocking configuration
      may change at runtime and in future it will be desirable to offer some
      configurability of the link parameters.
      
      At present we are also restricted to a single DAPM link for the entire
      DAI.  Once we have better support for channel mapping it would also be
      desirable to extend this feature so that we can propagate per-channel
      power state over the link.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <lrg@ti.com>
      c74184ed
  16. 04 4月, 2012 1 次提交
  17. 01 4月, 2012 5 次提交
  18. 16 3月, 2012 1 次提交
    • P
      device.h: audit and cleanup users in main include dir · 313162d0
      Paul Gortmaker 提交于
      The <linux/device.h> header includes a lot of stuff, and
      it in turn gets a lot of use just for the basic "struct device"
      which appears so often.
      
      Clean up the users as follows:
      
      1) For those headers only needing "struct device" as a pointer
      in fcn args, replace the include with exactly that.
      
      2) For headers not really using anything from device.h, simply
      delete the include altogether.
      
      3) For headers relying on getting device.h implicitly before
      being included themselves, now explicitly include device.h
      
      4) For files in which doing #1 or #2 uncovers an implicit
      dependency on some other header, fix by explicitly adding
      the required header(s).
      
      Any C files that were implicitly relying on device.h to be
      present have already been dealt with in advance.
      
      Total removals from #1 and #2: 51.  Total additions coming
      from #3: 9.  Total other implicit dependencies from #4: 7.
      
      As of 3.3-rc1, there were 110, so a net removal of 42 gives
      about a 38% reduction in device.h presence in include/*
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      313162d0
  19. 18 2月, 2012 4 次提交
    • M
      ASoC: dapm: Implement and instantiate DAI widgets · 888df395
      Mark Brown 提交于
      In order to allow us to do smarter things with DAI links create DAPM
      widgets which directly represent the DAIs in the DAPM graph. These are
      automatically created from the DAIs as we probe the card with references
      held in both directions between the widget and the DAI.
      
      The widgets are not made available for direct instantiation by drivers,
      they are created automatically from the DAIs.  Drivers should be updated
      to create stream routes using DAPM maps rather than by annotating AIF
      and DAC widgets with streams.
      
      In order to ease transition to this model from existing drivers we
      automatically create DAPM routes between the DAI widgets and the existing
      stream widgets which are started and stopped by the DAI widgets, though
      the old stream handling mechanism is still in place.  This also has the
      nice effect of removing non-DAPM devices as any device with a DAI
      acquires a widget automatically which will allow future simplifications
      to the core DAPM logic.
      
      The intention is that in future the AIF and DAI widgets will gain the
      ability to interact such that we are able to manage activity on
      individual channels independantly rather than powering up and down the
      entire AIF as we do currently.
      
      Currently we only generate these for CODECs, mostly as I have no systems
      with non-CODEC DAPM to integrate with. It should be a simple matter of
      programming to add the additional hookup for these.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <lrg@ti.com>
      888df395
    • M
      ASoC: dapm: Constify lots of names that are never modified · 3056557f
      Mark Brown 提交于
      Neater and avoids warnings when used in other places where const strings
      are desired.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <lrg@ti.com>
      3056557f
    • M
      ASoC: dapm: Supply the DAI and substream when calling stream events · 7bd3a6f3
      Mark Brown 提交于
      In order to allow us to do something smarter than iterate through widgets
      doing strcmp() to work out what to power up for stream events change the
      interface used to generate them to be based on the combination of a DAI
      and a stream direction rather than just a simple string identifying the
      stream.
      
      At some point we'll probably want a set of channels too.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <lrg@ti.com>
      7bd3a6f3
    • M
      ASoC: dapm: Unexport snd_soc_dapm_new_control() · ce0e9f0e
      Mark Brown 提交于
      Everything now uses snd_soc_dapm_new_controls() instead so we don't need
      to make it part of the external API.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <lrg@ti.com>
      ce0e9f0e
  20. 07 2月, 2012 1 次提交
  21. 27 1月, 2012 1 次提交
    • M
      ASoC: Provide REGULATOR_SUPPLY widget type · 62ea874a
      Mark Brown 提交于
      Modern devices allow systems to enable and disable individual supplies on
      the device, allowing additional power saving by switching off regulators
      which power portions of the device which are not currently in use. Add a
      new SND_SOC_DAPM_REGULATOR_SUPPLY widget type factoring out the code for
      managing such widgets from individual drivers.
      
      The widget name will be used as the supply name when requesting the
      regulator from the regulator API.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLiam Girdwood <lrg@ti.com>
      62ea874a
  22. 02 12月, 2011 1 次提交
  23. 24 11月, 2011 1 次提交
    • S
      ASoC: Implement fully_routed card property · 1633281b
      Stephen Warren 提交于
      A card is fully routed if the DAPM route table describes all connections on
      the board.
      
      When a card is fully routed, some operations can be automated by the ASoC
      core. The first, and currently only, such operation is described below, and
      implemented by this patch.
      
      Codecs often have a large number of external pins, and not all of these pins
      will be connected on all board designs. Some machine drivers therefore call
      snd_soc_dapm_nc_pin() for all the unused pins, in order to tell the ASoC core
      never to activate them.
      
      However, when a card is fully routed, the information needed to derive the
      set of unused pins is present in card->dapm_routes. In this case, have
      the ASoC core automatically call snd_soc_dapm_nc_pin() for each unused
      codec pin.
      
      This has been tested with soc/tegra/tegra_wm8903.c and soc/tegra/trimslice.c.
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      1633281b
  24. 10 10月, 2011 1 次提交
  25. 09 10月, 2011 1 次提交
    • M
      ASoC: Cache connected input and output recursions · 024dc078
      Mark Brown 提交于
      The number of connected input and output endpoints for a given widgets
      can't change during a DAPM run so there is no need to redo the recursion
      through branches of the tree we've already visited. Doing this on one of
      my test systems gives an improvement of:
      
               Power    Path   Neighbour
      Before:  63       607    731
      After:   63       141    181
      
      which scales up well as more widgets are involved in paths.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      024dc078
  26. 05 10月, 2011 1 次提交
    • M
      ASoC: Only run power_check() on a widget once per run · 9b8a83b2
      Mark Brown 提交于
      Some widgets will get power_check() run on them more than once during a
      DAPM run, most commonly due to supply widgets checking to see if their
      consumers are powered up. It's wasteful to do this so cache the result
      of power_check() during a run. For one system I tested this on I got an
      improvement of:
      
                 Power    Path   Neighbour
      Before:    106      970    1186
      After:     69       727    905
      
      from this.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      9b8a83b2
  27. 04 10月, 2011 1 次提交
    • M
      ASoC: Do DAPM power checks only for widgets changed since last run · db432b41
      Mark Brown 提交于
      In order to reduce the number of DAPM power checks we run keep a list of
      widgets which have been changed since the last DAPM run and iterate over
      that rather than the full widget list. Whenever we change the power state
      for a widget we add all the source and sink widgets it has to the dirty
      list, ensuring that all widgets in the path are checked.
      
      This covers more widgets than we need to as some of the neighbour widgets
      won't be connected but it's simpler as a first step. On one system I tried
      this gave:
      
                 Power    Path   Neighbour
      Before:    207      1939   2461
      After:     114      1066   1327
      
      which seems useful.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      db432b41