summaryrefslogtreecommitdiff
path: root/sound/soc/soc-dapm.c
AgeCommit message (Collapse)Author
2012-07-06ASoC: dapm: Allow routes to be deleted at runtimeMark Brown
Since we're now relying on DAPM for things like enabling clocks when we reparent the clocks for widgets we need to either use conditional routes (which are expensive) or remove routes at runtime. Add a route removal API to support this use case. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-07-06ASoC: dapm: Mark widgets as dirty when a route is addedMark Brown
If we add a new route at runtime then we'll need to recheck the connections to the affected widgets. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-07-03ASoC: dapm: Remove incomplete stereo codeBenoît Thébaudeau
Stereo is not yet supported by dapm widgets, so remove stereo code from snd_soc_dapm_get_volsw(), and warn if stereo controls are detected. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-29ASoC: dapm: Fix snd_soc_dapm_put_volsw() connectBenoît Thébaudeau
snd_soc_dapm_put_volsw() sets connect incorrectly in the case max > 1 with invert. In that case, the raw disconnect value should be max, which corresponds to the userspace value 0. This use case currently does not appear upstream, but it could break SOC_DAPM_SINGLE() or SOC_DAPM_SINGLE_TLV() elsewhere or in the future. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25Merge tag 'v3.5-rc4' into for-3.6Mark Brown
Linux 3.5-rc4 contains some bug fixes which overlap with new features.
2012-06-23ASoC: dapm: Try to add all routes even if one failsMark Brown
We may as well print as many errors as we can in one go rather than requiring developers to iterate through all their typos. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-06-07ASoC: dapm: Fix input list to use source widgetsLiam Girdwood
We should only add source widgets to the input list. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-05ASoC: dapm: The clock API is even less consistent than thoughtMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-04ASoC: dapm: Bodge for lack of a widely available clk APIMark Brown
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-06-04ASoC: dapm: Fix connected widget capture path query.Liam Girdwood
Make sure we check the correct path for capture. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-04ASoC: dapm: Use devm_clk_get()Mark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-06-03ASoC: core: Add widget SND_SOC_DAPM_CLOCK_SUPPLYOla Lilja
Adds a supply-widget variant for connection to the clock-framework. This widget-type corresponds to the variant for regulators. Signed-off-by: Ola Lilja <ola.o.lilja@stericsson.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-13Merge tag 'v3.4-rc7' into for-3.5Mark Brown
Linux 3.4-rc7 Conflicts): drivers/base/regmap/regmap.c (overlap with bug fixes) sound/soc/blackfin/bf5xx-ssm2602.c (overlap with bug fixes)
2012-04-27ASoC: dapm: Move CODEC<->CODEC params off stackMark Brown
Reduce our stack consumption by moving the params off the stack, they are reasonably large and might be an issue on platforms with small stacks. Reported-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Ackeded-by: Liam Girdwood <lrg@ti.com>
2012-04-26Merge tag 'sound-3.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound fixes from Takashi Iwai: "A workaround for an ASUS laptop and a few ASoC changes; most of the commits are tagged for stable, too." * tag 'sound-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ASoC: wm8994: Improve sequencing of AIF channel enables ALSA: HDA: Add external mic quirk for Asus Zenbook UX31E ASoC: fsi: update for dmaengine prep_slave_sg fallout. ASoC: core: Fix card RTD count for deferred probe. ASoC: cs42l73: don't use negative array index ASoC: dapm: Ensure power gets managed for line widgets
2012-04-26ASoC: dpcm: Add runtime dynamic route updateLiam Girdwood
This patch allows DPCM to dynamically alter the FE to BE PCM links at runtime based on mixer setting updates. DAPM is looked up after every mixer update and we perform a DPCM runtime update if the mixer has a change of value. This patchs adds/changes the following :- o Adds DPCM runtime update core. o Changes soc_dapm_mixer_update_power() and soc_dapm_mux_update_power() to return if a change has occured rather than 0. No other users check atm. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-18ASoC: dapm: Add API call to query valid DAPM pathsLiam Girdwood
In preparation for ASoC DSP support. Add a DAPM API call to determine whether a DAPM audio path is valid between source and sink widgets. This also takes into account all kcontrol mux and mixer settings in between the source and sink widgets to validate the audio path. This will be used by the DSP core to determine the runtime DAI mappings between FE and BE DAIs in order to run PCM operations. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16ASoC: soc-dapm: Use '%llx' with 'u64' type.Fabio Estevam
Fix the following build warning: sound/soc/soc-dapm.c: In function 'snd_soc_dai_link_event': sound/soc/soc-dapm.c:2913: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'u64' '%llx' should be used with 'u64' type. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-16ASoC: core: Support transparent CODEC<->CODEC DAI linksMark Brown
Rather than having the user half start a stream but avoid any DMA to trigger data flow on links which don't pass through the CPU create a DAPM route between the two DAI widgets using a hw_params configuration provided by the machine driver with the new 'params' member of the dai_link struct. If no configuration is provided in the dai_link then use the old style even for CODEC<->CODEC links to avoid breaking systems. This greatly simplifies the userspace usage of such links, making them as simple as analogue connections with the stream configuration being completely transparent to them. This is achieved by defining a new dai_link widget type which is created when CODECs are linked and triggering the configuration of the link via the normal PCM operations from there. It is expected that the bias level callbacks will be used for clock configuration. Currently only the DAI format, rate and channel count can be configured and currently the only DAI operations which can be called are hw_params and digital_mute(). This corresponds well to the majority of CODEC drivers which only use other callbacks for constraint setting but there is obviously much room for extension here. We can't simply call hw_params() on startup as things like the system clocking configuration may change at runtime and in future it will be desirable to offer some configurability of the link parameters. At present we are also restricted to a single DAPM link for the entire DAI. Once we have better support for channel mapping it would also be desirable to extend this feature so that we can propagate per-channel power state over the link. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-16ASoC: dapm: Allow DAI widgets to be routed throughMark Brown
In order to allow CODEC<->CODEC links to function we will need to allow DAPM paths to be created that pass through DAIs rather than only ones that are source or sunk at the DAI. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-15ASoC: dapm: release lock on error pathsDan Carpenter
We added locking here but there were a couple error paths where we forgot to drop the lock before returning. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-12ASoC: dapm: Ensure power gets managed for line widgetsMark Brown
Line widgets had not been included in either the power up or power down sequences so if a widget had an event associated with it that event would never be run. Fix this minimally by adding them to the sequences, we should probably be doing away with the specific widget types as they all have the same priority anyway. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
2012-04-09Merge tag 'v3.4-rc2' into for-3.5Mark Brown
Linux 3.4-rc2 contains some bug fixes we need, including the addition of an export for regcache_sync_region().
2012-04-05simple_open: automatically convert to simple_open()Stephen Boyd
Many users of debugfs copy the implementation of default_open() when they want to support a custom read/write function op. This leads to a proliferation of the default_open() implementation across the entire tree. Now that the common implementation has been consolidated into libfs we can replace all the users of this function with simple_open(). This replacement was done with the following semantic patch: <smpl> @ open @ identifier open_f != simple_open; identifier i, f; @@ -int open_f(struct inode *i, struct file *f) -{ ( -if (i->i_private) -f->private_data = i->i_private; | -f->private_data = i->i_private; ) -return 0; -} @ has_open depends on open @ identifier fops; identifier open.open_f; @@ struct file_operations fops = { ... -.open = open_f, +.open = simple_open, ... }; </smpl> [akpm@linux-foundation.org: checkpatch fixes] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-04-01ASoC: dapm: Remove bodges for no-widget CODECsMark Brown
Now that we're creating widgets for all DAIs there should be no more need for the bodges we've been carrying for non-DAPM CODEC drivers so remove them. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Timur Tabi <timur@freescale.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-01ASoC: dapm: Only lock CODEC for I/O if not using regmapMark Brown
If we do use regmap then regmap will take care of things for us. We actually already have this check at a higher level for the current users but this makes sure we do the right thing in the future too if we need to. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-04-01ASoC: DAPM: Make sure DAPM widget IO ops hold the component mutexLiam Girdwood
Currently not all DAPM widget IO ops are holding their component mutex (codec or platform). Make sure this is now held for DAPM widget IO operations. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: dapm: Add regulator member to struct dapm_widgetLiam Girdwood
Currently DAPM widgets use the private data for their regulator. Add a regulator * for widgets to use instead of private data. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: dapm: Rename dapm mutex subclass to better match usageLiam Girdwood
Rename SND_SOC_DAPM_CLASS_PCM to SND_SOC_DAPM_CLASS_RUNTIME to better match the usage and align with card mutex too. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: dapm: Add platform stream event supportLiam Girdwood
Currently stream events are only perfomed on codec stream widgets only. There is now a need to be able to perform stream events on platform widgets too. e.g. we have the ABE platform driver with several DAI links to dummy codecs. We need to be able to perform stream events on any of the dummy codec DAI links. This patch also removes the snd_soc_dai * parameter since it's already contained within the rtd * parameter. Finally makle stream event return void since no one checks it anyway. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: dapm: lock mixer & mux update power with DAPM mutexLiam Girdwood
Both snd_soc_dapm_mux_update_power() and snd_soc_dapm_mixer_update_power() can be called internally within DAPM core (with DAPM mutex held) and externally. Provide some wrappers so that external users of both functions do not have to remember to hold the DAPM mutex. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01ASoC: dapm: Use DAPM mutex for DAPM ops instead of codec mutexLiam Girdwood
It has now become necessary to use a DAPM mutex instead of the codec mutex to lock the DAPM operations. This is due to the recent multi component support and forth coming Dynamic PCM updates. Currently we lock DAPM operations with the codec mutex of the calling RTD context. However, DAPM operations can span the whole card context and all components. This patch updates the DAPM operations that use the codec mutex to now use the DAPM mutex PCM subclass for all DAPM ops. We also add a mutex subclass for DAPM init and PCM operations. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-18Merge branch 'topic/asoc' into for-linusTakashi Iwai
2012-03-12ASoC: Revert widget I/O locking for 3.4Mark Brown
The widget locking depends on some of the other locking changes which are queued up for 3.5 not 3.4 so revert the locking changes and reapply them in 3.5. This reverts commit 66bf93212f19548f5ed221356b2d70189cc18254 and 96acc357bedad69fbc94d1b923a960af5a411c6f. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-03-07ASoC: dapm: Only lock CODEC for I/O if not using regmapMark Brown
If we do use regmap then regmap will take care of things for us. We actually already have this check at a higher level for the current users but this makes sure we do the right thing in the future too if we need to. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-03-06ASoC: DAPM: Make sure DAPM widget IO ops hold the component mutexLiam Girdwood
Currently not all DAPM widget IO ops are holding their component mutex (codec or platform). Make sure this is now held for DAPM widget IO operations. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-06ASoC: dapm: Use dev_warn for debugfs warning messageLiam Girdwood
Remove printk(KERN_WARNING) and use dev_warn() instead. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-05ASoC: dapm: Show if widgets are forced in debugfsMark Brown
The information was not otherwise visible. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-23ASoC: dapm: Check for bias level when powering downMark Brown
Recent enhancements in the bias management means that we might not be in standby when the CODEC is idle and can have active widgets without being in full power mode but the shutdown functionality assumes these things. Add checks for the bias level at each stage so that we don't do transitions other than the ON->PREPARE->STANDBY->OFF ones that the drivers are expecting. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
2012-02-17ASoC: dapm: Only mark pin widgets as dirty if we actually change stateMark Brown
Small optimisation for noop state updates. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-17ASoC: dapm: Convert stream events to use DAI widgetsMark Brown
This means we don't need to walk through every single widget in the system for each stream event which is a bit less silly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-17ASoC: dapm: Implement and instantiate DAI widgetsMark Brown
In order to allow us to do smarter things with DAI links create DAPM widgets which directly represent the DAIs in the DAPM graph. These are automatically created from the DAIs as we probe the card with references held in both directions between the widget and the DAI. The widgets are not made available for direct instantiation by drivers, they are created automatically from the DAIs. Drivers should be updated to create stream routes using DAPM maps rather than by annotating AIF and DAC widgets with streams. In order to ease transition to this model from existing drivers we automatically create DAPM routes between the DAI widgets and the existing stream widgets which are started and stopped by the DAI widgets, though the old stream handling mechanism is still in place. This also has the nice effect of removing non-DAPM devices as any device with a DAI acquires a widget automatically which will allow future simplifications to the core DAPM logic. The intention is that in future the AIF and DAI widgets will gain the ability to interact such that we are able to manage activity on individual channels independantly rather than powering up and down the entire AIF as we do currently. Currently we only generate these for CODECs, mostly as I have no systems with non-CODEC DAPM to integrate with. It should be a simple matter of programming to add the additional hookup for these. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-17ASoC: dapm: Supply the DAI and substream when calling stream eventsMark Brown
In order to allow us to do something smarter than iterate through widgets doing strcmp() to work out what to power up for stream events change the interface used to generate them to be based on the combination of a DAI and a stream direction rather than just a simple string identifying the stream. At some point we'll probably want a set of channels too. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-17ASoC: dapm: Refactor snd_soc_dapm_new_widget() to return the widgetMark Brown
Let the caller fiddle with the widget after we're done in order to facilitate further refactoring. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-17ASoC: dapm: Unexport snd_soc_dapm_new_control()Mark Brown
Everything now uses snd_soc_dapm_new_controls() instead so we don't need to make it part of the external API. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-15ASoC: dapm: Convert pin switches to use snd_soc_cardMark Brown
Since the addition of the non-CODEC control adds card controls like the DAPM pin switch have been broken as they are expecting the private data for the control to be the CODEC but it's now the card. Fix that for the pin switches, an audit of other drivers is required. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-02-15ASoC: dapm: Notify stream event to all card components.Liam Girdwood
Currently when DAPM widgets are power sequenced the stream_event() completion callback is only called for the stream_event originator DAPM context. Other components in the card may also be interested so make sure they are also notified of any widget power events. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-15ASoC: dapm - Make DAPM reset code a separate function.Liam Girdwood
It's useful to export the DAPM reset as a static function for future use by other DAPM functions. e.g. The dynamic PCM query widgets resets the DAPM graph before working out active paths. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06ASoC: dapm: Clean up header information.Liam Girdwood
Fix some spelling mistakes in the header and remove the todo items. Most todo items are now available as kcontrol options now anyway. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-06ASoC: dapm: Export mixer|mux_update_power() to public API.Liam Girdwood
Allow for the operation of custom mixer and mux DAPM widgets that can call snd_soc_dapm_mixer_update_power() and snd_soc_dapm_mux_update_power() directly after updating their status. This is useful with complex DAPM Mixer operations where we need to do additional work in addition to setting a few mixer register bits. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>