1. 22 10月, 2015 3 次提交
  2. 11 9月, 2015 1 次提交
  3. 29 8月, 2015 1 次提交
  4. 13 8月, 2015 3 次提交
    • L
      ASoC: dapm: Consolidate path trace events · 6e588a0d
      Lars-Peter Clausen 提交于
      The snd_soc_dapm_input_path and snd_soc_dapm_output_path trace events are
      identical except for the direction. Instead of having two events have a
      single one that has a field that contains the direction.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6e588a0d
    • 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
    • L
      ASoC: dapm: dapm_dai_get_connected_widgets: Fix missing mutex unlock · 30abbe77
      Lars-Peter Clausen 提交于
      Make sure to unlock the DAPM mutex when dapm_widget_list_create() fails.
      
      This means the function will now generate a trace_snd_soc_dapm_connected
      event, even if the creation of the list fails. But that was the behavior
      before the patch that introduced the unlock issue, so that should be fine.
      
      Fixes: 1ce43acf ("ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets()")
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      30abbe77
  5. 29 7月, 2015 3 次提交
    • L
      ASoC: dapm: Add widget path iterators · e63bfd45
      Lars-Peter Clausen 提交于
      Add helper iterator macros for iterating over the source and sink paths of
      widget. This will make it easier to change the implementation later on.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      e63bfd45
    • L
      ASoC: dapm: Simplify list creation in dapm_dai_get_connected_widgets() · 1ce43acf
      Lars-Peter Clausen 提交于
      When running dapm_dai_get_connected_widgets() currently in
      is_connected_{input,output}_ep() for each widget that gets added the array
      is resized and the code also loops over all existing entries to avoid
      adding a widget multiple times.
      
      The former can be avoided by collecting the widgets in a linked list and
      only once we have all widgets allocate the array.
      
      The later can be avoided by changing when the widget is added. Currently it
      is added when walking the neighbor lists of a widget. Since a widget can be
      neighbors with multiple other widgets it could get added twice and hence
      the check is necessary. But the main body of is_connected_{input,output}_ep
      is guaranteed to be only executed at most once per widget. So adding the
      widget to the list at the beginning of the function automatically makes
      sure that each widget gets only added once. The only difference is that
      using this method the starting point itself will also end up on the list,
      but it can easily be skipped when creating the array.
      
      Overall this reduces the code size and speeds things slightly up.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      1ce43acf
    • L
      ASoC: dapm: Drop always true checks · 787126eb
      Lars-Peter Clausen 提交于
      list_first_entry() always returns non NULL and since the code previously
      checked that list is not empty it will also be a valid pointer. Furthermore
      a path has always a sink or a source widget. So both checks are redundant
      and can be removed.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      787126eb
  6. 22 7月, 2015 2 次提交
    • L
      ASoC: dapm: Avoid duplicating immutable strings · 48068961
      Lars-Peter Clausen 提交于
      When creating a new widget from a template the name string of the template
      is duplicated for the newly created widget. This is necessary because in
      some cases the string might be stored on the stack or other volatile
      memory locations.
      
      But most of the time the string is static const data, which means it is
      possible to use it directly without having to worry that it might get freed
      or changed.
      
      Use kstrdup_const() to handle duplicating the string. This function is
      capable of detecting whether a string is immutable and if it is returns the
      input without duplicating it. This will slightly reduce the runtime memory
      footprint of DAPM and also speed up initialization.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      48068961
    • L
      ASoC: dapm: Add helper function to free a widget · b97e2698
      Lars-Peter Clausen 提交于
      snd_soc_tplg_widget_remove_all() has a verbatim copy of an older version of
      the widget freeing code from dapm_free_widgets(). Add a new helper function
      that takes care of freeing a widget and use it in both places.
      
      This removes the duplicated code and also makes sure that future changes to
      the widget freeing code only have to be made in one location.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      b97e2698
  7. 21 7月, 2015 1 次提交
    • L
      ASoC: dapm: Don't add prefix to widget stream name · a798c24a
      Lars-Peter Clausen 提交于
      Commit fdb6eb0a ("ASoC: dapm: Modify widget stream name according to
      prefix") fixed the case where a DAPM route between a DAI widget and a
      DAC/ADC/AIF widget with a matching stream name was not created when the
      DAPM context was using a prefix.
      
      Unfortunately the patch introduced a few issues on its own like leaking the
      dynamically allocated stream name memory and also not checking whether the
      allocation succeeded in the first place.
      
      It is also incomplete in that it still does not handle the case where
      stream name of the widget is a substring of the stream name of the DAI,
      which is explicitly allowed and works fine if no DAPM prefix is used.
      
      Revert the commit and take a slightly different approach to solving the
      issue. Instead of comparing the widget's stream name to the name of the DAI
      widget compare it to the stream name of the DAI widget. The stream name of
      the DAI widget is identical to the name of the DAI widget except that it
      wont have the DAPM prefix added. So this approach behaves identical
      regardless to whether the DAPM context uses a prefix or not.
      
      We don't have to worry about potentially matching with a widget with the
      same stream name, but from a different DAPM context with a different
      prefix, since the code already makes sure that both the DAI widget and the
      matched widget are from the same DAPM context.
      
      Fixes: fdb6eb0a ("ASoC: dapm: Modify widget stream name according to prefix")
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      a798c24a
  8. 09 7月, 2015 1 次提交
  9. 08 7月, 2015 1 次提交
    • S
      ASoC: core: Don't probe the component which is dummy · 6e78108b
      Shengjiu Wang 提交于
      Dummy dai can be used by multiple sound card. But it only belong to one
      card's dapm list. If another card use it, there will be dapm_assert_locked
      warning.
      
      [   20.015782] WARNING: CPU: 1 PID: 661 at sound/soc/soc-dapm.c:124 dapm_assert_locked.isra.36+0x4c/0x58()
      [   20.025249] Modules linked in:
      [   20.028349] CPU: 1 PID: 661 Comm: aplay Not tainted 4.1.0-rc6-next-20150605-00004-gaee05d8-dirty #92
      [   20.037528] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      [   20.044110] Backtrace:
      [   20.046614] [<80012e00>] (dump_backtrace) from [<80012fa0>] (show_stack+0x18/0x1c)
      [   20.054229]  r6:809e8060 r5:00000000 r4:00000000 r3:00000000
      [   20.060002] [<80012f88>] (show_stack) from [<807a0f74>] (dump_stack+0x80/0x9c)
      [   20.067293] [<807a0ef4>] (dump_stack) from [<8002b144>] (warn_slowpath_common+0x7c/0xb4)
      [   20.075427]  r5:0000007c r4:00000000
      [   20.079065] [<8002b0c8>] (warn_slowpath_common) from [<8002b1a0>] (warn_slowpath_null+0x24/0x2c)
      [   20.087898]  r8:00000001 r7:88007c28 r6:ed94a680 r5:809e83e4 r4:ed83d6c0
      [   20.094747] [<8002b17c>] (warn_slowpath_null) from [<8058403c>] (dapm_assert_locked.isra.36+0x4c/0x58)
      [   20.104101] [<80583ff0>] (dapm_assert_locked.isra.36) from [<805842ec>] (dapm_mark_dirty+0x64/0xa4)
      [   20.113165] [<80584288>] (dapm_mark_dirty) from [<805853a8>] (soc_dapm_dai_stream_event.isra.42+0x30/0xc8)
      [   20.122863]  r8:ed9b5dbc r7:00000000 r6:00000001 r5:00000001 r4:ed83d6c0
      [   20.129706] [<80585378>] (soc_dapm_dai_stream_event.isra.42) from [<80587e28>] (snd_soc_dapm_stream_event+0x78/0xa0)
      [   20.140264]  r5:ee2ee62c r4:00000001
      [   20.143918] [<80587db0>] (snd_soc_dapm_stream_event) from [<8058957c>] (soc_pcm_prepare+0x138/0x21c)
      [   20.153058]  r8:ed8d9480 r7:00000000 r6:ed9b0e00 r5:00000001 r4:ee2ee62c r3:00000000
      ...
      
      This patch is to not probe the dummy component in soc_probe_component. Then
      there is no widget created for dummy DAI, and also don't need to check the
      dummy dai in dapm_connect_dai_link_widgets().
      Signed-off-by: NShengjiu Wang <shengjiu.wang@freescale.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      6e78108b
  10. 07 7月, 2015 2 次提交
  11. 26 6月, 2015 1 次提交
  12. 04 6月, 2015 1 次提交
  13. 03 6月, 2015 1 次提交
    • V
      ASoC: dapm: fix snd_soc_dapm_new_control() implicit declaration · 5353f65b
      Vladimir Zapolskiy 提交于
      The change fixes the following compilation problem:
      
        sound/soc/soc-dapm.c: In function 'dapm_kcontrol_data_alloc':
        sound/soc/soc-dapm.c:388:4: error: implicit declaration of function
          'snd_soc_dapm_new_control' [-Werror=implicit-function-declaration]
          data->widget = snd_soc_dapm_new_control(widget->dapm,
          ^
      
        sound/soc/soc-dapm.c:387:17: warning: assignment makes pointer
          from integer without a cast [enabled by default]
          data->widget = snd_soc_dapm_new_control(widget->dapm,
                       ^
        sound/soc/soc-dapm.c: At top level:
        sound/soc/soc-dapm.c:3269:1: error: conflicting types for
          'snd_soc_dapm_new_control'
        snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
        ^
      
      In addition to the fix add static qualifier to
      snd_soc_dapm_new_control() function to silence checkpatch.
      
      Fixes: 02aa78ab ("ASoC: DAPM: Add APIs to create individual DAPM controls.")
      Signed-off-by: NVladimir Zapolskiy <vz@mleia.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      5353f65b
  14. 29 5月, 2015 1 次提交
  15. 13 5月, 2015 1 次提交
  16. 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
  17. 11 5月, 2015 1 次提交
  18. 08 5月, 2015 1 次提交
  19. 07 5月, 2015 5 次提交
    • 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
    • L
      ASoC: dapm: Add new widgets to the end of the widget list · 92fa1242
      Lars-Peter Clausen 提交于
      Currently new widgets are appended to the beginning of the cards widget
      list. This has the effect that widgets that are created while iterating
      over the widget list in snd_soc_dapm_new_widgets() (like e.g. the
      auto-disable widgets) are not covered during that invocation of the
      function. If no further invocations of snd_soc_dapm_new_widgets() happen
      these widgets will not be fully initialized and e.g. no debugfs entries are
      created for them.
      
      By adding new widgets to the end of the widget list we make sure that
      widgets that are created in snd_soc_dapm_new_widgets() will still be
      handled during the same snd_soc_dapm_new_widgets() invocation and are
      always fully initialized.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      92fa1242
    • L
      ASoC: dapm: Add new widgets to the end of the widget list · c38a1ffb
      Lars-Peter Clausen 提交于
      Currently new widgets are appended to the beginning of the cards widget
      list. This has the effect that widgets that are created while iterating
      over the widget list in snd_soc_dapm_new_widgets() (like e.g. the
      auto-disable widgets) are not covered during that invocation of the
      function. If no further invocations of snd_soc_dapm_new_widgets() happen
      these widgets will not be fully initialized and e.g. no debugfs entries are
      created for them.
      
      By adding new widgets to the end of the widget list we make sure that
      widgets that are created in snd_soc_dapm_new_widgets() will still be
      handled during the same snd_soc_dapm_new_widgets() invocation and are
      always fully initialized.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      c38a1ffb
    • C
      ASoC: dapm: Add support for autodisable mux controls · 561ed680
      Charles Keepax 提交于
      Commit 57295073 ("ASoC: dapm: Implement mixer input auto-disable")
      added support for autodisable controls, controls whose values are only
      written to the hardware when their respective widgets are powered up.
      But it only added support for controls based on the mixer abstraction.
      
      This patch add support for mux controls (DAPM controls based on the
      enum abstraction) to be auto-disabled as well. As each mux can only have
      a single control, there is no need to tie the autodisable widget to the
      inputs (as is done for the mixer controls) it can be tided directly to
      the mux widget itself.
      
      Note that it is assumed that the first entry in a autodisable mux
      control will always represent the off state for the mux and is what the
      mux will be set to whilst it is disabled.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Reviewed-by: NLars-Peter Clausen <lars@metafoo.de>
      Tested-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      561ed680
    • C
      ASoC: dapm: Append "Autodisable" to autodisable widget names · 773da9b3
      Charles Keepax 提交于
      This makes it a little easier to follow what is happening in debugfs.
      Additionally is also useful in facilitating work to add autodisable
      muxes because the control name is already used for the mux widget and
      thus shouldn't be reused for the autodisable widget.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Reviewed-by: NLars-Peter Clausen <lars@metafoo.de>
      Tested-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      773da9b3
  20. 04 5月, 2015 1 次提交
  21. 28 4月, 2015 2 次提交
    • L
      ASoC: Move bias level update to the core · f4bf8d77
      Lars-Peter Clausen 提交于
      All drivers have the same line at the end of the set_bias_level callback to
      update the bias_level state. Move this update into
      snd_soc_dapm_force_bias_level() and remove them from the drivers.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      f4bf8d77
    • 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
  22. 09 4月, 2015 1 次提交
  23. 25 3月, 2015 1 次提交
  24. 18 3月, 2015 1 次提交
  25. 16 3月, 2015 1 次提交
  26. 03 2月, 2015 1 次提交
  27. 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