kernel-ark/include/sound
Lars-Peter Clausen 92a99ea439 ASoC: dapm: Use more aggressive caching
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28 00:19:59 +00:00
..
ac97_codec.h Sound updates for 3.7-rc1 2012-10-09 07:07:14 +09:00
aci.h
ad1816a.h Sound updates for 3.7-rc1 2012-10-09 07:07:14 +09:00
ad1843.h
adau1373.h ASoC: Add ADAU1373 codec support 2011-08-17 00:53:54 +09:00
aess.h ASoC: TI AESS: add autogating-enable function, callable from architecture code 2013-02-10 11:22:23 -07:00
ak4xxx-adda.h
ak4113.h
ak4114.h ALSA: ak4114: Fix wrong register array size 2013-10-29 16:42:36 +01:00
ak4117.h
ak4531_codec.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
ak4641.h ASoC: Asahi Kasei AK4641 codec driver 2011-05-19 14:10:45 -07:00
alc5623.h ASoC: add support for alc562[123] codecs 2010-10-21 13:51:13 -07:00
asequencer.h UAPI: (Scripted) Disintegrate include/sound 2012-10-09 09:49:13 +01:00
asound.h UAPI: (Scripted) Disintegrate include/sound 2012-10-09 09:49:13 +01:00
asoundef.h ALSA: Add definitions for CEA-861 Audio InfoFrames 2012-04-18 08:00:36 +02:00
atmel-abdac.h dmaengine: dw: move dw_dmac.h to where it belongs to 2014-09-11 11:48:12 +05:30
atmel-ac97c.h dmaengine: dw: move dw_dmac.h to where it belongs to 2014-09-11 11:48:12 +05:30
compress_driver.h ALSA: compress: fix drain calls blocking other compress functions (v6) 2013-11-07 10:12:27 +01:00
control.h ALSA: control: Define SNDRV_CTL_TLV_OP_* constants 2014-07-15 16:31:01 +02:00
core.h ALSA: control: Protect user controls against concurrent access 2014-06-18 15:12:33 +02:00
cs42l52.h ASoC: cs42l52: Make MICA/B mixer dependent on mic config 2013-11-28 10:20:51 +00:00
cs42l56.h ASoC: Add support for CS42L56 CODEC 2014-05-05 18:20:22 -07:00
cs42l73.h ASoC: cs42l73: Add platform data support for cs42l73 codec 2013-10-18 00:37:29 +01:00
cs4231-regs.h
cs4271.h ALSA: ASoC: cs4271: add optional soft reset workaround 2012-12-24 15:53:28 +00:00
cs8403.h
cs8427.h ALSA: cs8427: separate HW initialization 2014-04-03 14:59:48 +02:00
da7213.h ASoC: codecs: Add da7213 codec 2013-02-14 17:27:17 +00:00
da9055.h ASoC: codecs: Add DA9055 codec driver 2012-09-28 14:21:54 +01:00
designware_i2s.h ASoC: Add support for synopsys i2s controller as per ASoC framework. 2012-06-22 10:25:45 +01:00
dmaengine_pcm.h ASoC: dmaengine: add custom DMA config to snd_dmaengine_pcm_config 2013-12-09 18:45:01 +00:00
emu10k1_synth.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
emu10k1.h Revert "ALSA: emu10k1: Fix warning: "CCR" redefined" 2014-03-11 07:54:14 +01:00
emu8000_reg.h
emu8000.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
emux_legacy.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
emux_synth.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
es1688.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
gus.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
hda_hwdep.h
hda_verbs.h ALSA: hda - Split verb definitions into sound/hda_verbs.h 2013-12-09 17:31:40 +01:00
hwdep.h ALSA: hwdep: Allow to assign the given parent 2014-02-25 12:12:50 +01:00
i2c.h
info.h switch procfs to umode_t use 2012-01-03 22:54:56 -05:00
initval.h ALSA: isa: Move snd_legacy_find_free_ioport to initval.h 2012-08-03 12:57:44 +02:00
jack.h ALSA: Use a define for the number of jack switch types 2012-02-27 17:34:44 +01:00
l3.h
max9768.h ASoC: max9768: add driver for max9768 amplifier 2012-01-30 21:50:55 +00:00
max98088.h ASoC: Restore MAX98088 CODEC driver 2010-10-18 16:46:27 -07:00
max98090.h ASoC:: max98090: Remove executable bit 2013-03-20 10:54:12 +01:00
max98095.h ASoC: max98095: Single bit bitfields should be unsigned 2012-05-13 23:33:53 +01:00
memalloc.h ALSA: Remove memory reservation code from memalloc helper 2014-01-09 07:32:10 +01:00
minors.h ALSA: core: add support for compressed devices 2011-12-23 10:07:46 +01:00
mixer_oss.h ALSA: core: sparse cleanups 2011-02-14 17:10:11 +01:00
mpu401.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
omap-pcm.h ASoC: omap-pcm: Move omap-pcm under include/sound 2014-05-26 15:32:32 +01:00
opl3.h
opl4.h
pcm_oss.h
pcm_params.h ALSA: Add params_width() helpers 2013-12-30 12:19:26 +00:00
pcm-indirect.h
pcm.h ALSA: pcm: add new DSD sampleformat for native DSD playback on XMOS based devices 2014-09-08 17:11:00 +02:00
pt2258.h
pxa2xx-lib.h ASoC: pxa: use snd_dmaengine_dai_dma_data 2013-08-15 11:29:07 +01:00
rawmidi.h ALSA: rawmidi: remove undefined functions. 2014-02-21 12:06:12 +01:00
rcar_snd.h ASoC: rsnd: SSI + DMA can select BUSIF 2014-06-28 14:41:19 +01:00
rt286.h ASoC: add RT286 CODEC driver 2014-07-04 18:50:51 +01:00
rt5640.h ASoC: rt5640: Use the platform data for DMIC settings 2014-04-14 17:27:41 +01:00
rt5645.h ASoC: rt5645: Add headset detect function 2014-10-01 19:28:44 +01:00
rt5651.h ASoC: add RT5651 CODEC driver 2014-04-18 18:52:18 +01:00
rt5670.h ASoC: add RT5670 CODEC driver 2014-07-02 20:49:25 +01:00
rt5677.h ASoC: rt5677: Add dts properties for input/output differential configuration 2014-09-29 19:46:20 +01:00
s3c24xx_uda134x.h
sb16_csp.h UAPI: (Scripted) Disintegrate include/sound 2012-10-09 09:49:13 +01:00
sb.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
seq_device.h
seq_kernel.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
seq_midi_emul.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
seq_midi_event.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
seq_oss_legacy.h
seq_oss.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
seq_virmidi.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
sh_dac_audio.h
sh_fsi.h ASoC: fsi: cleanup sh_fsi.h 2012-12-24 15:57:20 +00:00
simple_card.h ASoC: simple-card: add slot information parsing supports 2014-02-23 14:26:37 +09:00
snd_wavefront.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
soc-dai.h ASoC: core: Add initial support for DAI multicodec 2014-07-16 22:58:49 +01:00
soc-dapm.h ASoC: dapm: Use more aggressive caching 2014-10-28 00:19:59 +00:00
soc-dpcm.h ASoC: DPCM: make some DPCM API calls non static for compressed usage 2014-01-17 17:56:21 +00:00
soc.h Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/dmic', 'asoc/topic/drivers', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next 2014-10-06 12:48:57 +01:00
soundfont.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
spear_dma.h ASoC: SPEAr: remove custom DMA alloc compat function 2013-12-18 18:55:06 +00:00
spear_spdif.h ASoC: SPEAr spdif_in: Add spdif IN support 2012-06-23 11:58:10 +01:00
sta32x.h ASoC: sta32x: add workaround for ESD reset issue 2011-11-14 21:36:43 +00:00
sta350.h ASoC: sta350: add support for bits in miscellaneous registers 2014-05-05 12:52:59 -07:00
tas2552-plat.h ASoC: tas2552: Support TI TAS2552 Amplifier 2014-07-17 17:57:05 +01:00
tas5086.h ALSA: ASoC: add codec driver for TI TAS5086 2013-03-08 21:06:09 +08:00
tea6330t.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
timer.h
tlv320aic3x.h ASoC: tlv320aic3x: Convert mic bias to a supply widget 2013-02-04 18:35:19 +00:00
tlv320aic32x4.h ASoC: tlv320aic32x4: Add rstn gpio to platform data. 2012-11-01 14:35:56 +00:00
tlv320dac33-plat.h ASoC: tlv320dac33: Update e-mail address 2011-05-11 16:12:35 +01:00
tlv.h ALSA: Add comment for control TLV API 2013-05-08 15:43:56 +02:00
tpa6130a2-plat.h ASoC: tpa6130a2: Remove model_id from platform data 2011-09-21 16:07:45 +01:00
uda134x.h
uda1380.h
util_mem.h
vx_core.h ALSA: vx: Use nonatomic PCM ops 2014-09-15 15:52:03 +02:00
wavefront.h
wm0010.h ASoC: wm0010: Add initial wm0010 DSP driver 2012-08-23 16:12:12 +01:00
wm1250-ev1.h ASoC: Add platform data for WM1250 EV1 GPIOs 2011-09-23 17:05:38 +01:00
wm2000.h ASoC: wm2000: Use clock API integration to configure MCLK divisor 2012-12-24 15:42:35 +00:00
wm2200.h ASoC: wm2200: Provide platform data for MICBIAS configuration 2013-02-05 15:53:07 +00:00
wm5100.h ASoC: Add WM5100 driver 2011-09-20 16:02:16 +01:00
wm8903.h ASoC: WM8903: Fix platform data gpio_cfg confusion 2011-12-06 10:29:22 +00:00
wm8904.h
wm8955.h
wm8960.h ASoC: wm8960: remove 'dres' field from platform data structure 2012-09-21 08:35:06 -04:00
wm8962.h ASoC: wm8962: Let CODEC driver enable and disable its own MCLK 2014-07-31 20:51:26 +01:00
wm8993.h ASoC: wm_hubs: Allow configuration of MICBIAS power up delay via pdata 2012-08-22 19:00:37 +01:00
wm8996.h ASoC: Rename WM8915 to WM8996 2011-08-08 14:30:37 +09:00
wm9081.h ASoC: Add platform data for WM9081 IRQ pin configuration 2011-03-01 23:30:53 +00:00
wm9090.h
wss.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00