linux/sound/soc
Lars-Peter Clausen 6dd98b0a3e ASoC: dapm: Introduce toplevel widget categories
DAPM widgets can be classified into four categories:
	* supply: Supply widgets do not affect the power state of their
		non-supply widget neighbors and unlike other widgets a
		supply widget is not powered up when it is on an active
		path, but when at least on of its neighbors is powered up.
	* source: A source is a widget that receives data from outside the
		DAPM graph or generates data. This can for example be a
		microphone, the playback DMA or a signal generator. A source
		widget will be considered powered up if there is an active
		path to a sink widget.
	* sink: A sink is a widget that transmits data to somewhere outside
		of the DAPM graph. This can e.g. be a speaker or the capture
		DMA. A sink widget will be considered powered up if there is
		an active path from a source widget.
	* normal: Normal widgets are widgets not covered by the categories
		above. A normal widget will be considered powered up if it
		is on an active path between a source widget and a sink
		widget.

The way the number of input and output paths for a widget is calculated
depends on its category. There are a bunch of factors which decide which
category a widget is. Currently there is no formal classification of these
categories and we calculate the category of the widget based on these
factors whenever we want to know it. This is at least once for every widget
during each power update sequence. The factors which determine the category
of the widgets are mostly static though and if at all change rather seldom.
This patch introduces three new per widget flags, one for each of non-normal
widgets categories. Instead of re-computing the category each time we want
to know them the flags will be checked. For the majority of widgets the
category is solely determined by the widget id, which means it never changes
and only has to be set once when the widget is created. The only widgets
with dynamic categories are:

	snd_soc_dapm_dai_out: Is considered a sink iff the capture stream is
		active, otherwise normal.
	snd_soc_dapm_dai_in: Is considered a source iff the playback stream
		is active, otherwise normal.
	snd_soc_dapm_input: Is considered a sink iff it has no outgoing
		paths, otherwise normal.
	snd_soc_dapm_output: Is considered a source iff it has no incoming
		paths, otherwise normal.
	snd_soc_dapm_line: Is considered a sink iff it has no outgoing paths
		and is considered a source iff it has no incoming paths,
		otherwise normal.

For snd_soc_dapm_dai_out/snd_soc_dapm_dai_in widgets the category will be
updated when a stream is started or stopped. For the other dynamic widgets
the category will be updated when a path connecting to it is added or
removed.

Introducing those new widget categories allows to make
is_connected_{output,input}_ep, which are among the hottest paths of the
DAPM algorithm, more generic and significantly shorter.

The before and after sizes for is_connected_{output,input}_ep are:

On ARM (defconfig + CONFIG_SND_SOC):
	function                                     old     new   delta
	is_connected_output_ep                       480     340    -140
	is_connected_input_ep                        456     352    -104

On amd64 (defconfig + CONFIG_SND_SOC):
	function                                     old     new   delta
	is_connected_output_ep                       579     427    -152
	is_connected_input_ep                        563     427    -136

Which is about a 25%-30% decrease, other architectures are expected to have
similar numbers. At the same time the size of the snd_soc_dapm_widget struct
does not change since the new flags are stored in the same word as the
existing flags.

Note: that since the per widget 'ext' flag was only used to decide whether a
snd_soc_dapm_input or snd_soc_dapm_output widget was a source or a sink it
is now unused and can be removed.

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
..
adi
atmel Merge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/cirrus' and 'asoc/topic/cleanup' into asoc-next 2014-08-04 16:31:29 +01:00
au1x MIPS: Alchemy: remove au_read/write/sync 2014-07-30 13:56:34 +02:00
bcm
blackfin ASoC: blackfin: use samples to set silence 2014-07-17 12:27:56 +01:00
cirrus Merge remote-tracking branch 'asoc/topic/cirrus' into asoc-next 2014-03-13 14:19:11 +00:00
codecs Changes to existing drivers: 2014-10-15 06:58:16 +02:00
davinci 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
dwc ASoC: Update email id of the author 2014-09-09 10:49:41 +01:00
fsl Merge remote-tracking branches 'asoc/fix/88pm860x', 'asoc/fix/fsl', 'asoc/fix/imx', 'asoc/fix/mc13783', 'asoc/fix/rockchip' and 'asoc/fix/simple' into asoc-linus 2014-10-08 16:44:50 +01:00
generic ASoC: simple-card: Initialize headphone and mic GPIO numbers 2014-10-07 18:24:01 +01:00
intel Merge remote-tracking branches 'asoc/topic/fsl-easi', 'asoc/topic/fsl-sai', 'asoc/topic/fsl-ssi' and 'asoc/topic/intel' into asoc-next 2014-10-06 12:48:59 +01:00
jz4740 Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
kirkwood ASoC: kirkwood: Remove ARCH_KIRKWOOD dependency 2014-07-29 20:35:23 +01:00
mxs
nuc900 ASoC: nuc900: export nuc900_ac97_data 2014-04-30 20:32:20 -07:00
omap Merge remote-tracking branch 'asoc/topic/component' into asoc-next 2014-10-06 12:48:51 +01:00
pxa Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2014-10-18 18:11:04 -07:00
rockchip ASoC: rockchip-i2s: fix infinite loop in rockchip_snd_txctrl 2014-10-08 12:29:38 +01:00
s6000 ASoC: s6105-ipcam: Fix build for I2C dependencies 2014-07-05 18:00:34 +01:00
samsung Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5677', 'asoc/topic/samsung', 'asoc/topic/sgtl5000' and 'asoc/topic/sh' into asoc-next 2014-10-06 12:49:03 +01:00
sh Merge remote-tracking branches 'asoc/topic/rt5645', 'asoc/topic/rt5677', 'asoc/topic/samsung', 'asoc/topic/sgtl5000' and 'asoc/topic/sh' into asoc-next 2014-10-06 12:49:03 +01:00
sirf ASoC: sirf: usp: Add bitclock inversion support 2014-08-16 17:06:42 -05:00
spear ASoC: Update email id of the author 2014-09-09 10:49:41 +01:00
tegra Merge remote-tracking branches 'asoc/topic/suspend', 'asoc/topic/tas2552', 'asoc/topic/tegra', 'asoc/topic/tlv320aic31xx' and 'asoc/topic/tlv320aic3x' into asoc-next 2014-10-06 12:49:07 +01:00
txx9 ASoC: txx9: Don't opencode DMAengine API calls 2014-08-19 11:44:18 -05:00
ux500 ASoC: mop500_ab8500: Replace instances of rtd->codec->card with rtd->card 2014-05-20 22:55:39 +01:00
Kconfig ASoC: add driver for Rockchip RK3xxx I2S controller 2014-07-09 09:39:29 +02:00
Makefile ASoC: add driver for Rockchip RK3xxx I2S controller 2014-07-09 09:39:29 +02:00
soc-cache.c ASoC: Move name and id from CODEC/platform to component 2014-06-21 21:04:24 +01:00
soc-compress.c ASoC: soc-compress: fix double unlock of fe card mutex 2014-09-24 11:38:55 +01:00
soc-core.c Merge remote-tracking branch 'asoc/fix/core' into asoc-linus 2014-10-08 16:44:49 +01:00
soc-dapm.c ASoC: dapm: Introduce toplevel widget categories 2014-10-28 00:19:59 +00:00
soc-devres.c ASoC: Export devm_snd_soc_register_platform() 2014-04-22 22:00:42 +01:00
soc-generic-dmaengine-pcm.c ASoC: Consolidate platform and CODEC probe/remove 2014-08-19 10:59:45 -05:00
soc-io.c ASoC: Automatically initialize regmap for all components 2014-08-19 10:59:47 -05:00
soc-jack.c ASoC: Move card field form platform/codec to component 2014-07-22 23:15:57 +01:00
soc-pcm.c Merge remote-tracking branch 'asoc/fix/core' into asoc-linus 2014-10-08 16:44:49 +01:00
soc-utils.c