]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - include/sound/soc-dapm.h
ASoC: dapm: Consolidate input and output path handling
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 11 Aug 2015 19:38:00 +0000 (21:38 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 13 Aug 2015 11:40:16 +0000 (12:40 +0100)
commita3423b02cf745c1418f1f199646c450d6fc9ca4e
treefb31992296571629eebadfcc082802c13602d85a
parent30abbe7727b23c6661daeea5d36be36ed7a41665
ASoC: dapm: Consolidate input and output path handling

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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c