summaryrefslogtreecommitdiff
path: root/sound/soc/soc-utils.c
AgeCommit message (Collapse)Author
2017-08-14ASoC: soc-utils: make snd_soc_platform_driver constBhumika Goyal
Make this const as it is only passed as the 2nd argument to the function snd_soc_register_platform, which is of type const. Done using Coccinelle Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30ASoC: core: Add component pin control functionsRichard Fitzgerald
It's often the case that a codec driver will need to control its own pins. However, if a name_prefix has been applied to this codec it must be included in the name passed to any of the snd_soc_dapm_x_pin() functions. The behaviour of the existing pin control functions is reasonable, since you may want to search for a fully-specified name within the scope of an entire card. This means that we can't apply the prefix in these functions because it will break card-scope searches. Constructing a prefixed string "manually" in codec drivers leads to a lot of repetition of the same code. To make this tidier in codec drivers this patch adds a new set of equivalent functions that take a struct snd_soc_component instead of a dapm context and automatically add the component's name_prefix to the given name. This makes it a simple change in codec drivers to be prefix-safe. The new functions are not quite trivial enough to be inlines and the compiler won't be able to compile-away any part of them. Although it looks somewhat inefficient to have to allocate a temporary buffer and combine strings, the current design of the widget list doesn't lend itself to a more optimized implementation - it's a single list of all widgets on a card and is searched linearly for a matching string. As pin state changes are generally low-frequency events it's unlikely to be a significant issue - at least not enough to rewrite the widget list handling just for this. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-12ASoC: constify snd_pcm_ops structuresJulia Lawall
Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-31ASoC: Document snd-soc-dummy-dai purposeAnatol Pomozov
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20ASoC: : drop owner assignment from platform_driversWolfram Sang
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-01-16Merge remote-tracking branch 'asoc/topic/dapm' into for-tiwaiMark Brown
2014-01-08ASoC: utils: Add internal call to determine if DAI is dummy.Liam Girdwood
Provide a quick way to tell if a DAI is a dummy DAI or a regular DAI. This is for internal DAPM usage only and is used to determine whether to insert a DAI link connection into the DAPM graph. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-30ASoC: soc-utils: Don't set unused struct snd_pcm_hardware fieldsLars-Peter Clausen
The ASoC core assumes that the PCM component of the ASoC card transparently moves data around and does not impose any restrictions on the memory layout or the transfer speed. It ignores all fields from the snd_pcm_hardware struct for the PCM driver that are related to this. Setting these fields in the PCM driver might suggest otherwise though, so rather not set them. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17ASoC: core utils: Dont set DMA params for BE substreamsLiam Girdwood
BE substreams dont require dummy DMA configs so dont set any. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-05-17ASoC: simplify registration of snd-soc-dummy deviceUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17ASoC: define playback and capture streams in dummy codecStas Sergeev
This patch adds a playback and capture streams to the dummy codec DAI configuration. Most permissive set of sampling rates and formats is used. This patch is needed for playback and capturing on a codec-less systems, as otherwise the PCM device nodes are not even created. Signed-off-by: Stas Sergeev <stsp@users.sourceforge.net> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10ASoC: utils: remove __dev* attributesBill Pemberton
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20ASoC: utils - Add support for a dummy codec driver.Liam Girdwood
This is useful to create dummy codec devices where we need to have some DAI links without a real Codec. e.g. could be used to represent dumb FM, MODEM, etc This is also used by dynamic PCM for DAI links that have no codec. Signed-off-by: Liam Girdwood <lrg@ti.com> [Fixed the indentation -- broonie] Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-06ASoC: Provide a more complete DMA driver stubMark Brown
Allow userspace applications to do more parameter setting by providing a more complete stub DMA driver specifying a wildcard set of formats and channels and essentially random values for the DMA parameters. This is required for useful runtime operation of the dummy DMA driver until we are able to figure out how to power up links and do hw_params() from DAPM. Sending to stable as without this the dummy driver is not terribly useful. Reported-by: Kyung-Kwee Ryu <Kyung-Kwee.Ryu@wolfsonmicro.com> Tested-by: Kyung-Kwee Ryu <Kyung-Kwee.Ryu@wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
2011-10-31sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where neededPaul Gortmaker
These aren't modules, but they do make use of these macros, so they will need export.h to get that definition. Previously, they got it via the implicit module.h inclusion. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-04-28ASoC: Work around allmodconfig failureMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2011-04-27ASoC: Add more natural support for no-DMA DAIsMark Brown
Since we can now support multiple platforms allow machines to not specify a platform in a DAI link. Since the rest of the code requires that we have a struct device for all objects we do this by substituting in a dummy device that we register automatically. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> Acked-by: Liam Girdwood <lrg@ti.com>
2011-02-01ASoC: Use snd_pcm_format_width() in snd_soc_params_to_frame_size()Mark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-11-25ASoC: Add BCLK calculation utility for TDM mode tooMark Brown
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-11-12ASoC: Add bit clock rate calculator utility functionsMark Brown
Many devices need to calculate the bit clock rate desired to work out the clock configuration required for the device. Provide utility functions to do this using both hw_params structures and raw numbers. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>