aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-03-18Merge branch 'topic/asoc' into for-linusTakashi Iwai1-115/+285
2012-03-12ASoC: Revert widget I/O locking for 3.4Mark Brown1-28/+6
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 Brown1-2/+2
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 Girdwood1-6/+28
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 Girdwood1-1/+1
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 Brown1-2/+3
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 Brown1-3/+9
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 Brown1-1/+3
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 Brown1-26/+17
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 Brown1-8/+127
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 Brown1-9/+16
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 Brown1-21/+14
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 Brown1-3/+2
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 Brown1-10/+10
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 Girdwood1-4/+6
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 Girdwood1-7/+14
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 Girdwood1-8/+2
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 Girdwood1-12/+9
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>
2012-01-26ASoC: dapm: Ignore isolated signal generators for power purposesMark Brown1-1/+5
A signal generator has no power control itself and so shouldn't cause a power up of the device. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-26ASoC: dapm: Drop runtime PM references asynchronouslyMark Brown1-1/+1
We don't really care if any action is taken immediately so let the PM core defer things if it wants to. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-26ASoC: Provide REGULATOR_SUPPLY widget typeMark Brown1-2/+49
Modern devices allow systems to enable and disable individual supplies on the device, allowing additional power saving by switching off regulators which power portions of the device which are not currently in use. Add a new SND_SOC_DAPM_REGULATOR_SUPPLY widget type factoring out the code for managing such widgets from individual drivers. The widget name will be used as the supply name when requesting the regulator from the regulator API. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-01-21ASoC: Use regmap update bits operation for drivers using regmapMark Brown1-10/+17
If a driver is using regmap directly ensure that we're coherent with non-ASoC register updates by using the regmap API directly to do our read/modify/write cycles. This will bypass the ASoC cache but drivers using regmap directly should not be using the ASoC cache. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-16ASoC: dapm - Fix check for codec context in dapm_power_widgets().Liam Girdwood1-1/+1
Fixes a NULL pointer dereference in dapm_power_widgets() if the dapm context has no codec. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-10ASoC: Dynamically allocate the rtd device for a non-empty release()Mark Brown1-2/+1
The device model needs a release() function so it can free devices when they become dereferenced. Do that for rtds. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-08ASoC: Take a pm_runtime reference on DAPM devices that are enabledMark Brown1-0/+7
As for PCMs take a runtime power management reference to devices that are in a non-off bias, avoiding the need to do this in individual drivers. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02ASoC: Add signal generator widget typeMark Brown1-0/+7
A signal generator behaves as an input would but is not considered for any of the special behaviour associated with external input pins. This is especially useful when automatically working out not connected widgets. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2011-11-27ASoC: Log automatic pin disconnection per CODEC rather than per cardMark Brown1-3/+3
This makes the output a bit less confusing on multi-CODEC systems as the same pin may appear in multiple CODECs. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23ASoC: Implement fully_routed card propertyStephen Warren1-0/+73
A card is fully routed if the DAPM route table describes all connections on the board. When a card is fully routed, some operations can be automated by the ASoC core. The first, and currently only, such operation is described below, and implemented by this patch. Codecs often have a large number of external pins, and not all of these pins will be connected on all board designs. Some machine drivers therefore call snd_soc_dapm_nc_pin() for all the unused pins, in order to tell the ASoC core never to activate them. However, when a card is fully routed, the information needed to derive the set of unused pins is present in card->dapm_routes. In this case, have the ASoC core automatically call snd_soc_dapm_nc_pin() for each unused codec pin. This has been tested with soc/tegra/tegra_wm8903.c and soc/tegra/trimslice.c. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-10ASoC: Fix DAPM sync for TLV320AIC3x custom DAPM widgetMark Brown1-1/+2
We really should be doing this in the core, not in a driver... Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Tested-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
2011-10-09ASoC: Cache connected input and output recursionsMark Brown1-15/+45
The number of connected input and output endpoints for a given widgets can't change during a DAPM run so there is no need to redo the recursion through branches of the tree we've already visited. Doing this on one of my test systems gives an improvement of: Power Path Neighbour Before: 63 607 731 After: 63 141 181 which scales up well as more widgets are involved in paths. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-08ASoC: Assign power_check when we allocate DAPM widgetsMark Brown1-28/+39
This ensures none of the rest of the code ever encounters a widget which does not have a power check function. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-08ASoC: Suppress early calls to snd_soc_dapm_sync()Mark Brown1-0/+7
Ensure we only have one sync during the initial startup of the card by making snd_soc_dapm_sync() a noop on non-instantiated cards. This avoids any bounces due to things like jacks reporting their initial state on partially initialised cards. The callers that don't also get called at runtime should just be removed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-05ASoC: Use dapm_mark_dirty() for new DAPM widgets for consistencyMark Brown1-1/+1
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-05ASoC: Stop checking for supplied widgets after we find the firstMark Brown1-6/+3
We don't really care how many widgets a supply is supplying, we just care if the number is non-zero. This didn't actually produce any improvement in the test cases I've been using but seems obviously sensible enough that I'm pushing it out anyway. We could do a similar thing for other widgets but this may be unhelpful for further refactorings Liam was working on aiming to allow us to identify connected audio paths. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-05ASoC: Don't mark the outputs of supplies as dirty on state changesMark Brown1-4/+11
The whole point of supply widgets is that they aren't inputs to their sinks so a state change in a supply should never affect the state of the widget being supplied and we don't need to mark them as dirty. Power Path Neighbour Before: 69 727 905 After: 63 607 731 This is particularly useful where supplies affect large portions of the chip (eg, a bandgap supplying the analogue sections). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-05ASoC: Only run power_check() on a widget once per runMark Brown1-2/+13
Some widgets will get power_check() run on them more than once during a DAPM run, most commonly due to supply widgets checking to see if their consumers are powered up. It's wasteful to do this so cache the result of power_check() during a run. For one system I tested this on I got an improvement of: Power Path Neighbour Before: 106 970 1186 After: 69 727 905 from this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-05ASoC: Add verbose debugging showing why widgets get marked dirtyMark Brown1-11/+15
Help diagnose why we're checking widgets by providing some logging when we first dirty them. This should possibly be a trace point if it's useful but can be absurdly verbose if enabled, we can always change it later if desired. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Reduce the number of neigbours we mark dirty when updating powerMark Brown1-6/+20
If two widgets are not currently connected then there is no need to propagate a power state change between them as we mark the affected widgets when we change a connection. Similarly if a neighbour widget is already in the state being set for the current widget then there is no need to recheck. On one system I tested this gave: Power Path Neighbour Before: 114 1066 1327 After: 106 970 1186 which is an improvement, although relatively small. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Do DAPM power checks only for widgets changed since last runMark Brown1-6/+55
In order to reduce the number of DAPM power checks we run keep a list of widgets which have been changed since the last DAPM run and iterate over that rather than the full widget list. Whenever we change the power state for a widget we add all the source and sink widgets it has to the dirty list, ensuring that all widgets in the path are checked. This covers more widgets than we need to as some of the neighbour widgets won't be connected but it's simpler as a first step. On one system I tried this gave: Power Path Neighbour Before: 207 1939 2461 After: 114 1066 1327 which seems useful. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Mark headphone, mic, speaker and line widgets as always connectedMark Brown1-4/+4
We're not actually doing any dynamic power management based on connection and output drivers (which are pretty much the same thing) are marked as unconditionally connected already. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Factor out widget power check operationMark Brown1-11/+10
We've got the same code in two different places, let's have it in a single place instead. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Ensure all DAPM widgets have a power check callbackMark Brown1-3/+8
Makes the code simpler. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Move bias level decision into main dapm_power_widgets()Mark Brown1-21/+23
Future patches will try to reduce the number of widgets we check on each DAPM run but we're still going to need to look and see if the devices is on at all so we can manage the overall device bias. Move these checks out into the main dapm_power_widgets() function so we don't have to think about them for now. Once we're doing more incremental updates it'll probably be worth using refcounts for each bias level to avoid having to do the sweep over all widgets but that's not going to be where the big performance wins are. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04ASoC: Factor write of widget power out into a separate functionMark Brown1-11/+18
Split the decision about what the new power should be out from the implementation of that decision. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-28ASoC: Also count neighbour checks for suppliesMark Brown1-0/+2
Missed when the stat was originally added. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-23ASoC: Don't force bias on ground referenced devicesMark Brown1-2/+5
Currently we force all devices in the system to be at the same bias level. This is due to concerns about power or pop/click impacts from either ramping VMID or mismatching VMID on the analogue I/O lines between connected devices but does mean we power devices up more often than we really need to. If a device flags idle_bias_off this will usually mean that it's either all digital or ground referenced (in which case the idle and powered bias levels are identical) so this concern does not apply and we can save some power by leaving it off when not needed itself. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-22ASoC: Add another DAPM stat for neighbour checksMark Brown1-0/+4
The number of times we look at a potentially connected neighbour is just as important as the number of times we actually recurse into looking at that neighbour so also collect that statistic. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-21ASoC: Factor out per-widget DAPM power checksMark Brown1-52/+60
The indentation is getting a little deep. Should be straight code motion, no functional changes. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-21ASoC: Trace and collect statistics for DAPM graph walkingMark Brown1-0/+17
One of the longest standing areas for improvement in ASoC has been the DAPM algorithm - it repeats the same checks many times whenever it is run and makes no effort to limit the areas of the graph it checks meaning we do an awful lot of walks over the full graph. This has never mattered too much as the size of the graph has generally been small in relation to the size of the devices supported and the speed of CPUs but it is annoying. In preparation for work on improving this insert a trace point after the graph walk has been done. This gives us specific timing information for the walk, and in order to give quantifiable (non-benchmark) numbers also count every time we check a link or check the power for a widget and report those numbers. Substantial changes in the algorithm may require tweaks to the stats but they should be useful for simpler things. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-19ASoC: Display the error code when we fail to add a DAPM controlMark Brown1-2/+2
Useful for diagnostics. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>