1. 05 8月, 2019 3 次提交
  2. 22 7月, 2019 1 次提交
  3. 07 2月, 2019 1 次提交
  4. 03 2月, 2019 1 次提交
    • C
      ASoC: dapm: Only power up active channels from a DAI · 078a85f2
      Charles Keepax 提交于
      Currently all widgets attached to a DAI link will be powered
      up when the DAI is active, however this may include routes
      that are not actually in use if there are unused channels
      available on the DAI.
      
      The macros for creating AIF widgets already include an entry for
      slot, it is proposed to change that to channel. The effective
      difference here being respresenting the logical channel index
      rather than the physical slot index. The CODECs currently
      using the slot entry on the DAPM_AIF macros are using it in
      a manner consistent with this, the CODECs not using it just
      have the field set to zero.
      
      A variable is added to snd_soc_dapm_widget to represent
      this channel index and then for each AIF widget attached to
      a DAI this is compared against the number of channels on
      the stream. Enabling the links for those which will be in
      use. This has the nice property that the CODECs which haven't
      used the slot/channel entry in the macro will function exactly
      as before due to all the AIF widgets having a channel of zero
      and a stream by definition having at least one channel.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      078a85f2
  5. 30 1月, 2019 1 次提交
  6. 06 9月, 2018 2 次提交
  7. 15 8月, 2018 1 次提交
    • C
      ASoC: dapm: Fix NULL pointer deference on CODEC to CODEC DAIs · 249dc495
      Charles Keepax 提交于
      Commit a655de80 ("ASoC: core: Allow topology to override
      machine driver FE DAI link config.") caused soc_dai_hw_params to
      be come dependent on the substream private_data being set with
      a pointer to the snd_soc_pcm_runtime. Currently, CODEC to CODEC
      links don't set this, which causes a NULL pointer dereference:
      
      [<4069de54>] (soc_dai_hw_params) from
      [<40694b68>] (snd_soc_dai_link_event+0x1a0/0x380)
      
      Since the ASoC core in general assumes that the substream
      private_data will be set to a pointer to the snd_soc_pcm_runtime,
      update the CODEC to CODEC links to respect this.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      249dc495
  8. 02 7月, 2018 1 次提交
  9. 14 3月, 2018 1 次提交
  10. 30 6月, 2017 1 次提交
  11. 02 11月, 2016 3 次提交
  12. 05 7月, 2016 1 次提交
  13. 30 5月, 2016 1 次提交
    • P
      ASoC: dapm: support user-defined stop condition in dai_get_connected_widgets · 6742064a
      Piotr Stankiewicz 提交于
      Certain situations may warrant examining DAPM paths only to a certain
      arbitrary point, as opposed to always following them to the end. For
      instance, when establishing a connection between a front-end DAI link
      and a back-end DAI link in a DPCM path, it does not make sense to walk
      the DAPM graph beyond the first widget associated with a back-end link.
      
      This patch introduces a mechanism which lets a user of
      dai_get_connected_widgets supply a function which will be called for
      every node during the graph walk. When invoked, this function can
      execute arbitrary logic to decide whether the walk, given a DAPM widget
      and walk direction, should be terminated at that point or continued
      as normal.
      Signed-off-by: NPiotr Stankiewicz <piotrs@opensource.wolfsonmicro.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6742064a
  14. 12 5月, 2016 1 次提交
  15. 25 11月, 2015 1 次提交
  16. 11 11月, 2015 1 次提交
  17. 22 10月, 2015 1 次提交
  18. 13 8月, 2015 1 次提交
    • L
      ASoC: dapm: Consolidate input and output path handling · a3423b02
      Lars-Peter Clausen 提交于
      After the recent cleanups and generalizations of the DAPM algorithm the
      handling of input and output paths is now fully symmetric. This means by
      making some slight changes to the data structure and using arrays with one
      entry for each direction, rather than separate fields, it is possible to
      create a generic implementation that is capable of handling both input and
      output paths.
      
      Unfortunately this generalization significantly increases the code size on
      the hot path of is_connected_{input,output}_ep() and
      dapm_widget_invalidate_{input,output}_paths(), which has a negative impact
      on the overall performance. The inner loops of those functions are quite
      small and the generic implementation adds extra pointer arithmetic in a few
      places.
      
      Testing on ARM shows that the combined code size of the specialized
      functions is about 50% larger than the generalized function in relative
      numbers. But in absolute numbers its less than 200 bytes, which is still
      quite small. On the other hand the generalized function increases the
      execution time of dapm_power_one_widget() by 30%. Given that this function
      is one of the most often called functions of the DAPM framework the
      trade-off of getting better performance at expense of generating slightly
      larger code at seems to be worth it.
      
      To avoid this still keep two versions of these functions around, one for
      input and one for output. But have a generic implementation of the
      algorithm which gets inlined by those two versions. And then let the
      compiler take care of optimizing it and removing he extra instructions.
      
      This still reduces the source code size as well as the makes making changes
      to the implementation more straight forward since the same change does no
      longer need to be done in two separate places. Also on the slow paths we
      can use a generic implementations that handle both input and output paths.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      a3423b02
  19. 29 7月, 2015 1 次提交
  20. 22 7月, 2015 1 次提交
  21. 04 6月, 2015 2 次提交
    • L
      ASoC: topology: Add topology core · 8a978234
      Liam Girdwood 提交于
      The topology core parses the FW topology file for known block types and
      instanciates any common ALSA/ASoC objects that it discovers. The core
      also passes any block that is does not understand to client component
      drivers for enumeration.
      
      The core exports some APIs to client drivers in order to load and unload
      firmware topology data as use case require.
      
      Currently the core deals with the following object types :-
      
       o kcontrols. This includes TLV, enumerated and bytes controls.
       o DAPM widgets. All types with any associated kcontrol.
       o DAPM graph.
       o FE PCM. FE PCM capabilities and configuration can be defined.
       o BE DAI Link. BE DAI link capabilities and configuration can be defined.
       o Codec <-> codec style links capabilities and configuration.
      Signed-off-by: NLiam Girdwood <liam.r.girdwood@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      8a978234
    • L
      ASoC: topology: Add topology UAPI header · c147c0e1
      Liam Girdwood 提交于
       The ASoC topology UAPI header defines the structures
       required to define any DSP firmware audio topology and control objects from
       userspace.
      
      The following objects are supported :-
       o kcontrols including TLV controls.
       o DAPM widgets and graph elements
       o Vendor bespoke objects.
       o Coefficient data
       o FE PCM capabilities and config.
       o BE link capabilities and config.
       o Codec <-> codec link capabilities and config.
       o Topology object manifest.
      
      The file format is simple and divided into blocks for each object type and
      each block has a header that defines it's size and type. Blocks can be in
      any order of type and can either all be in a single file or spread across
      more than one file. Blocks also have a group identifier ID so that they can
      be loaded and unloaded by ID.
      Signed-off-by: NLiam Girdwood <liam.r.girdwood@linux.intel.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      c147c0e1
  22. 12 5月, 2015 1 次提交
    • C
      ASoC: dapm: Add cache to speed up adding of routes · 45a110a1
      Charles Keepax 提交于
      Some CODECs have a significant number of DAPM routes and for each route,
      when it is added to the card, the entire card widget list must be
      searched. When adding routes it is very likely, however, that adjacent
      routes will require adjacent widgets. For example all the routes for a
      mux are likely added in a block and the sink widget will be the same
      each time and it is also quite likely that the source widgets are
      sequential located in the widget list.
      
      This patch adds a cache to the DAPM context, this cache will hold the
      source and sink widgets from the last call to snd_soc_dapm_add_route for
      that context. A small search of the widget list will be made from those
      points for both the sink and source. Currently this search only checks
      both the last widget and the one adjacent to it.
      
      On wm8280 which has approximately 500 widgets and 30000 routes (one of
      the largest CODECs in mainline), the number of paths that hit the cache
      is 24000, which significantly improves probe time.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      45a110a1
  23. 07 5月, 2015 1 次提交
    • L
      ASoC: dapm: Add demux support · d714f97c
      Lars-Peter Clausen 提交于
      A demux is conceptually similar to a mux. Where a mux has multiple input
      and one output and selects one of the inputs to be connected to the output,
      the demux has one input and multiple outputs and selects one of the outputs
      to which the input gets connected.
      
      This similarity makes it straight forward to support them in DAPM using the
      existing mux support, we only need to swap sinks and sources when initially
      setting up the paths.
      
      The only slightly tricky part is that there can only be one control per
      path. Since mixers/muxes are at the sink of a path and a demux is at the
      source and both types want a control it is not possible to directly connect
      a demux output to a mixer/mux input. The patch adds some sanity checks to
      make sure that this does not happen.
      
      Drivers who want to model hardware which directly connects a demux output
      to a mixer/mux input can do this by inserting a dummy widget between the
      two. E.g.:
      
      	{ "Dummy", "Demux Control", "Demux" },
      	{ "Mixer", "Mixer Control", "Dummy" },
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      d714f97c
  24. 28 4月, 2015 1 次提交
    • L
      ASoC: Add helper functions bias level management · fa880775
      Lars-Peter Clausen 提交于
      Currently drivers are responsible for managing the bias_level field of
      their DAPM context. The DAPM state itself is managed by the DAPM core
      though and the core has certain expectations on how and when the bias_level
      field should be updated. If drivers don't adhere to these undefined
      behavior can occur.
      
      This patch adds a few helper functions for manipulating the DAPM context
      state, each function with a description on when it should be used and what
      its effects are. This will also help us to move more of the bias_level
      management from drivers to the DAPM core.
      
      For convenience also add snd_soc_codec_* wrappers around these helpers.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      fa880775
  25. 23 4月, 2015 1 次提交
  26. 02 4月, 2015 2 次提交
  27. 18 3月, 2015 1 次提交
  28. 16 3月, 2015 1 次提交
  29. 03 2月, 2015 1 次提交
  30. 15 1月, 2015 1 次提交
    • L
      ASoC: Remove codec field from snd_soc_dapm_widget · 96da4e5b
      Lars-Peter Clausen 提交于
      There are no more users of this field left so it can finally be removed.
      New users should use snd_soc_dapm_to_codec(w->dapm);
      
      The reason why it is removed is because it doesn't fit to well anymore in
      the componentized ASoC hierarchy, where DAPM works on the snd_soc_component
      level. And the alternative of snd_soc_dapm_to_codec(w->dapm) typically
      generates the same amount of code, so there is really no reason to keep it.
      
      For automatic conversion the following coccinelle semantic patch can be used:
      // <smpl>
      @@
      struct snd_soc_dapm_widget *w;
      @@
      -w->codec
      +snd_soc_dapm_to_codec(w->dapm)
      // </smpl>
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      96da4e5b
  31. 22 12月, 2014 1 次提交
    • L
      ASoC: dapm: Simplify fully route card handling · 86d75003
      Lars-Peter Clausen 提交于
      For legacy reasons the ASoC framework assumes that a CODEC INPUT or OUTPUT
      widget that is not explicitly connected to a external source or sink is
      potentially connected to a source or a sink and hence the framework treats
      the widget itself as source (for INPUT) or sink (for OUTPUT). For this
      reason a INPUT or OUTPUT widget that is really not connected needs to be
      explicitly marked as so.
      
      Setting the card's fully_routed flag will cause the ASoC core, once that all
      widgets and routes have been registered, to go through the list of all
      widgets and mark all INPUT and OUTPUT that are not externally connected as
      non-connected. This essentially negates the default behaviour of treating
      INPUT or OUTPUT widgets without external routes as sources or sinks.
      
      This patch takes a different approach while getting the same result. Instead
      of first marking INPUT and OUTPUT widgets as sinks/sources and then later
      marking them as non-connected, just never mark them as a sink or a source if
      the fully_routed flag is set on a card.
      
      This requires a lot less code and also results in a slightly faster card
      initialization since there is no need to iterate over all widgets and check
      whether the INPUT and OUTPUT widgets are connected or not.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      86d75003
  32. 28 10月, 2014 2 次提交
    • L
      ASoC: dapm: Use more aggressive caching · 92a99ea4
      Lars-Peter Clausen 提交于
      Currently we cache the number of input and output paths going to/from a
      widget only within a power update sequence. But not in between power update
      sequences.
      
      But we know how changes to the DAPM graph affect the number of input (form a
      source) and output (to a sink) paths of a widget and only need to
      recalculate them if a operation has been performed that might have changed
      them.
      	* Adding/removing or connecting/disconnecting a path means that the for
      	  the source of the path the number of output paths can change and for
      	  the sink the number of input paths can change.
      	* Connecting/disconnecting a widget has the same effect has connecting/
      	  disconnecting all paths of the widget. So for the widget itself the
      	  number of inputs and outputs can change, for all sinks of the widget
      	  the number of inputs can change and for all sources of the widget the
      	  number of outputs can change.
      	* Activating/Deactivating a stream can either change the number of
      	  outputs on the sources of the widget associated with the stream or the
      	  number of inputs on the sinks.
      
      Instead of always invalidating all cached numbers of input and output paths
      for each power up or down sequence this patch restructures the code to only
      invalidate the cached numbers when a operation that might change them has
      been performed. This can greatly reduce the number of DAPM power checks for
      some very common operations.
      
      Since per DAPM operation typically only either change the number of inputs
      or outputs the number of path checks is reduced by at least 50%. The number
      of neighbor checks is also reduced about the same percentage, but since the
      number of neighbors encountered when walking from sink to source is not the
      same as when walking from source to sink the actual numbers will slightly
      vary from card to card (e.g. for a mixer we see 1 neighbor when walking from
      source to sink, but the number of inputs neighbors when walking from source
      to sink).
      
      Bigger improvements can be observed for widgets with multiple connected
      inputs and output (e.g. mixers probably being the most widespread form of
      this). Previously we had to re-calculate the number of inputs and outputs
      on all input and output paths. With this change we only have to re-calculate
      the number of outputs on the input path that got changed and the number of
      inputs on the output paths.
      
      E.g. imagine the following example:
      
      	A --> B ----.
      	            v
      	M --> N --> Z <-- S <-- R
      	            |
      	            v
      	            X
      
      Widget Z has multiple input paths, if any change was made that cause Z to be
      marked as dirty the power state of Z has to be re-computed. This requires to
      know the number of inputs and outputs of Z, which requires to know the
      number of inputs and outputs of all widgets on all paths from or to Z.
      Previously this meant re-computing all inputs and outputs of all the path
      going into or out of Z. With this patch in place only paths that actually
      have changed need to be re-computed.
      
      If the system is idle (or the part of the system affected by the changed
      path) the number of path checks drops to either 0 or 1, regardless of how
      large or complex the DAPM context is. 0 if there is no connected sink and no
      connected source. 1 if there is either a connected source or sink, but not
      both. The number of neighbor checks again will scale accordingly and will be
      a constant number that is the number of inputs or outputs of the widget for
      which we did the path check.
      
      When loading a state file or switching between different profiles typically
      multiple mixer and mux settings are changed, so we see the benefit of this
      patch multiplied for these kinds of operations.
      
      Testing with the ADAU1761 shows the following changes in DAPM stats for
      changing a single Mixer switch for a Mixer with 5 inputs while the DAPM
      context is idle.
      
               Power  Path  Neighbour
      Before:  2      12    30
      After:   2       1     2
      
      For the same switch, but with a active playback stream the stat changed are
      as follows.
      
               Power  Path  Neighbour
      Before:  10     20    54
      After:   10      7    21
      
      Cumulative numbers for switching the audio profile which changes 7 controls
      while the system is idle:
      
               Power  Path  Neighbour
      Before:  16      80   170
      After:   16       7    23
      
      Cumulative numbers for switching the audio profile which changes 7 controls
      while playback is active:
      
               Power  Path  Neighbour
      Before:  51     123   273
      After:   51      29   109
      
      Starting (or stopping) the playback stream:
      
               Power  Path  Neighbour
      Before:  34     34    117
      After:   34     17    69
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      92a99ea4
    • L
      ASoC: dapm: Mark endpoints instead of IO widgets dirty during suspend/resume · 8be4da29
      Lars-Peter Clausen 提交于
      The state of endpoint widgets is affected by that card's power state.
      Endpoint widgets that do no have the ignore_suspend flag set will be
      considered inactive during suspend. So they have to be re-checked and marked
      dirty after the card's power state changes. Currently the input and output
      widgets are marked dirty instead, this works most of the time since
      typically a path from one endpoint to another will go via a input or output
      widget. But marking the endpoints dirty is technically more correct and will
      also work for odd corner cases.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      8be4da29