summaryrefslogtreecommitdiff
path: root/sound/soc/soc-dapm.c
AgeCommit message (Collapse)Author
2011-03-29ASoC: Add post-CODEC bias level callback for machine driverMark Brown
Currently the machine driver can only do bias level configuration before the CODEC bias level is brought up. This means that the machine cannot do any configuration which depends on the CODEC bias level being maintained. Provide a post-CODEC callback which allows the machine driver to do things like enable the FLL on a CODEC which is brought down to BIAS_OFF when idle. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Cherry-picked from mainline kernel. Change-Id: Ib0a8533e3762dfc67ee21209a28e9a6603d31a37 Reviewed-on: http://git-master/r/23058 Tested-by: Sumit Bhattacharya <sumitb@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com>
2010-05-20Merge branch 'topic/asoc' into for-linusTakashi Iwai
Conflicts: sound/soc/codecs/ad1938.c
2010-05-10ASoC: Support leaving paths enabled over system suspendMark Brown
Some devices can usefully run audio while the Linux system is suspended. One of the most common examples is smartphone systems, which are normally designed to allow audio to be run between the baseband and the CODEC without passing through the CPU and so can suspend the CPU when on a voice call for additional power savings. Support such systems by providing an API snd_soc_dapm_ignore_suspend(). This can be used to mark DAPM endpoints as not being sensitive to system suspend. When the system is being suspended paths between endpoints which are marked as ignoring suspend will be kept active. Both source and sink must be marked, and there must already be an active path between the two endpoints prior to suspend. When paths are active over suspend the bias management will hold the device bias in the ON state. This is used to avoid suspending the CODEC while it is still in use. Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-05-10ASoC: Refactor DAPM suspend handlingMark Brown
Instead of using stream events to handle power down during suspend integrate the handling with the normal widget path checking by replacing all cases where we report a connected endpoint in a path with a function snd_soc_dapm_suspend_check() which looks at the ALSA power state for the card and reports false if we are in a D3 state. Since the core moves us into D3 prior to initating the suspend all power checks during suspend will cause the widgets to be powered down. In order to ensure that widgets are powered up on resume set the card to D2 at the start of resume handling (ALSA API calls require D0 so we are still protected against userspace access). Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-05-10ASoC: Remove unused DAPM suspend flagMark Brown
We now manage suspend within the main power analysis rather than by flipping the state of widgets. Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-22ASoC: Allow force enabled pins to be disabledMark Brown
Some systems, such as those with mechanical jack detection, may wish to force enable a pin (typically mic bias) only some of the time. Support such systems by having disable_pin() also coveer force enabled pins. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-03-17ASoC: Remove current PGA control handlingMark Brown
A code audit reveals that there are currently no users of the widget controls on PGAs. This is likely to continue to be the case since while there are useful things that can be done with integrating the PGA gain and mute controls with the power sequencing userspace generally wants stereo controls for output stages which this doesn't map onto well. In preparation for implementing something more useful strip out the existing code, leaving the parameters there for use by the new code. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-03-16ASoC: Allow pins to be force enabledMark Brown
Allow pins to be forced on regardless of their power state. This is intended for use with microphone bias supplies which need to be enabled in order to support microphone detection - in systems without appropriate hardware leaving the microphone unbiased when not in use saves power. The force done at power check time in order to avoid disrupting other power detection logic. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-03-05ASoC: Improve DAPM pop_wait delaysMark Brown
Currently during pop/click debug we're inserting a delay both after every log message we generate and at explicit points in the sequence, slowing things down even further than they need to be especially when many writes get coalesced by the sequence generation code. Remove the per-printk delay and ensure that we have explicit delays where we say we want them. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-01-21ASoC: Support turning off bias when the CODEC is idleMark Brown
Currently ASoC always maintains the bias of the CODEC while the system is active. With older mobile CODECs this is required since the outputs are referenced to a non-zero voltage and enabling or disabling this voltage without audible pops or clicks in the output takes too long to do when starting or stopping audio. As a result of features such as ground referenced outputs and class D speaker drivers current generation devices are able to power on and off much more quickly without these system level issues so provide a new flag idle_bias_off in snd_soc_codec which will cause the core to turn off the CODEC bias. The distinction between STANDBY and OFF is still maintained. This is partly for consistency but also allows for potential future extensions such as per-machine overrides or deferring the bias removal. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-01-21ASoC: Remove console DAPM debug codeMark Brown
The same information is now visible via debugfs and with large modern devices dumping everything to the console can be very resource intensive, causing more harm than good. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-12-16ASoC: Sort DAPM sequences by CODEC as wellMark Brown
In preparation for multiple device support. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-12-16ASoC: Push registers out of mixer power decisionMark Brown
No need for the mixers to know about this, and it allows for virtual controls. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-12-04ASoC: Display the power register in DAPM widget debugfsMark Brown
Make it a bit easier to tie DAPM widgets in with the register map without referring to the source by including the register location controlled by the widget. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-11-23Merge branch 'for-2.6.32' into for-2.6.33Mark Brown
2009-11-23ASoC: Fix suspend with active audio streamsMark Brown
When we get a stream suspend event force the power down since otherwise the stream would remain marked as active. In future we'll probably want to make this stream-specific and add an interface to make the power down of other widgets optional in order to support leaving bypass paths active while suspending the processor. Cc: stable@kernel.org Reported-by: Joonyoung Shim <jy0922.shim@samsung.com> Tested-by: Joonyoung Shim <jy0922.shim@samsung.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-15Merge branch 'for-2.6.32' into for-2.6.33Mark Brown
2009-10-13ASoC: Serialize access to dapm_power_widgets()Eero Nurkkala
Access to damp_power_widgets() is assumed to be single-threaded. Concurrent accesses to dapm_power_widgets() may result in unpredictable behavior. Calls from: close_delayed_work() soc_codec_close() soc_pcm_prepare() soc_suspend() soc_resume_deferred() to snd_soc_dapm_stream_event() do not have the codec->mutex taken to cover the call to dapm_power_widgets(). Thus, take the mutex in these paths also to assure single-threaded use of dapm_power_widgets(). Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-06ASoC: Add virtual enumeration support for DAPM muxesMark Brown
Sometimes it is desirable to have a mux which does not reflect any direct register configuration but which will instead only have an effect implicitly (for example, as a result of changing which parts of the device are powered up). Provide a virtual mux for this purpose. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-06ASoC: Push DAPM enumeration register change test outMark Brown
Don't assume that enumerations are backed by registers when updating mux power. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-06ASoC: Simplify code for DAPM widget updatesMark Brown
We don't need to check for an event callback since we also check for an appropriate event flag when applying mux status changes. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-05Merge branch 'for-2.6.32' into for-2.6.33Mark Brown
2009-10-02ASoC: Fix SND_SOC_DAPM_LINE handlingPeter Ujfalusi
Since the SND_SOC_DAPM_LINE can be input or output, additional check is needed in order to determine if the widget is connected as input or output. When checking for connected outputs, if the widget is line, than check if the sources list is not empty (line is connected as output) For input endpoint check, when the widget is line, also check if the sinks list is not empty (line is connected as input). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-09-18Merge branch 'for-2.6.32' into for-2.6.33Mark Brown
2009-09-14ASoC: Fix display of stream name in DAPM debugfsMark Brown
Also display streams all the time while we're here. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-09-08ASoC: Allow per-route connectedness checks for suppliesMark Brown
Some chips with complex internal supply (particularly clocking) arragements may have multiple options for some of the supply connections. Since these don't affect user-visible audio routing the expectation would be that they would be managed automatically by one of the drivers. Support these users by allowing routes to have a connected function which is queried before the connectedness of the path is checked as normal. Currently this is only done for supplies, other widgets could be supported but are not currently since the expectation for them is that audio routing will be under the control of userspace. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-08-24Merge branch 'topic/digital-mixing' into for-2.6.32Mark Brown
2009-08-24ASoC: add missing inclusion of debugfs.hTakashi Iwai
To fix compile errors. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-21ASoC: Add DAPM widget power decision debugfs filesMark Brown
Currently when built with DEBUG DAPM will dump information about the power state decisions it is taking for each widget to dmesg. This isn't an ideal way of getting the information - it requires a kernel build to turn it on and off and for large hub CODECs the volume of information is so large as to be illegible. When the output goes to the console it can also cause a noticable impact on performance simply to print it out. Improve the situation by adding a dapm directory to our debugfs tree containing a file per widget with the same information in it. This still requires a decision to build with debugfs support but is easier to navigate and much less intrusive. In addition to the previously displayed information active streams are also shown in these files. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-08-19ASoC: Provide default set_bias_level() implementationMark Brown
If the CODEC does not provide a set_bias_level() then update the bias_level variable for it since other parts of the system expect that to be maintained. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-08-18ASoC: Add input and output AIF widgetsMark Brown
Currently DAPM interfaces with the audio streams to and from the processor at the DAC and ADC widgets. As the digital capabilities of parts increases this is becoming a less and less able to meet the needs of parts. To meet the needs of these devices create new widgets interfacing with the TDM bus but not integrated into any other functionality. Audio can then be routed to and from these widgets using existing routing widgets. A slot number is provided in the definition but this is currently not used yet. This is intended to support devices which can use more than one TDM slot on a single interface. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-08-17ASoC: Power speakers and headphones simultaneouslyMark Brown
Speaker and headphone outputs do not need to be handled separately since they can't be part of the same path. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-08-17ASoC: Fix handling of bias levels for non-DAPM codecsMark Brown
If the system doesn't have any DAPM widgets then we can't use their state to check if the bias level for the codec should be up. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-07-13ASoC: fix checking for external widgets bugRongrong Cao
In SOC DAPM layer of SOUND subsystem, when add signal route (in the function snd_soc_dapm_add_route() ), the original code has wrong logic when dapm layer check each widget whether an external one. Signed-off-by: Rongrong Cao <rrcao@ambarella.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-07-08ASoC: Add pop delay debug at end of DAPM sequencingMark Brown
Provide an interval after the end of DAPM sequencing so that we can distinguish between a pop in the final step of the sequence and a pop generated from some other source outside DAPM. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-26ASoC: Fix widget powerdown on shutdownMark Brown
We need to set the widget power state we want to implement. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-23ASoC: Add a shutdown callbackMark Brown
Ensure that the audio subsystem is powered down cleanly when the system shuts down by providing a shutdown operation. This ensures that all the components have been returned to an off state cleanly which should avoid audio issues from partially charged capacitors or noise on digital inputs if the system is restarted quickly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Tested-by: Ben Dooks <ben-linux@fluff.org>
2009-06-11Merge branch 'dapm' into for-2.6.32Mark Brown
2009-06-08ASoC: Make DAPM power sequence lists local variablesMark Brown
They are now only accessed within dapm_power_widgets() so can be local to that function. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-08ASoC: Coalesce power updates for PGAsMark Brown
Handle gain ramping for PGAs so we can coalesce their power updates too. This is not ideal since we can't cope properly with gain ramping for stereo paths but that was the case without coalescing and gain ramping is relatively infrequently used so the effects are limited. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-08ASoC: Coalesce power updates for DAPM widgets with eventsMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-08ASoC: Sort specialised mixers and muxes togetherMark Brown
The more flexible value muxes and named mixers don't need to be sorted differently from a power management point of view, they are different only in terms of the control interface and not in terms of seqencing behaviour. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-08ASoC: Coalesce register writes for DAPM sequencesMark Brown
Reduce the number of register writes we need to set the power state for a CODEC by coalescing updates to widgets with the same sequence order and same register into a single write. This can be a noticable performance improvement with slow or heavily contended control buses, such as I2C controllers with a low clock frequency, and is particularly noticable when resuming. It can also reduce the noticability of and pops and clicks by ensuring that left and right channels are powered simultaneously if they are in the same register. Currently widgets that have events are not coalesced, including PGAs which may use the volume ramping control. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-08ASoC: Allow 32 bit registers for DAPMDaniel Ribeiro
Replace the remaining unsigned shorts with unsigned ints. Tested with pcap2 codec (25 bits registers). Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-07ASoC: Factor out DAPM sequence executionMark Brown
Lump the list walk into a single function, and pull in the power application too so we can do some further refactoring. Pure code motion. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-07ASoC: Sort DAPM power sequences while building listsMark Brown
In the past the DAPM power sequencing was done by iterating over the list of widgets once for each widget type and powering widgets of that type. Instead of doing that do the sorting at the time we insert the widgets into the lists of widgets to apply power changes to. This reduces the amount of computation required for seqencing still further, though the costs are generally dwarfed by the costs of the register writes implementing them. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-06ASoC: Apostrophe patrolMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-05-18ASoC: Add debug trace for bias level transitionsMark Brown
A standard way of making sure we know when the bias level changes. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-05-18ASoC: Integrate bias management with DAPM power managementMark Brown
Rather than managing the bias level of the system based on if there is an active audio stream manage it based on there being an active DAPM widget. This simplifies the code a little, moving the power handling into one place, and improves audio performance for bypass paths when no playbacks or captures are active. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>