aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-12-15const: constify remaining dev_pm_opsAlexey Dobriyan1-1/+1
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-11-12ASoC: move setting ac97 platformdata earlier than ac97 read/writeBarry Song1-4/+5
While probing, AC97 codec drivers and soc-core generically execute the following sequence: snd_soc_new_ac97_codec -> snd_soc_new_pcms -> reset ac-link/read AC97 ID to detect ->... -> set platform_data to ac97 by soc-core commit 474828a40f6ddab6e2a3475a19c5c84aa3ec7d60 adds platform_data to snd_ac97 instance. But ac97 platform data hasn't given to snd_ac97 before actual ac97 operations. Then while ac97_read access platform_data of snd_ac97 for detecting, NULL pointer oops will fire. That means old platform_data patch doesn't work in real-life cases. This patch moves the operation of setting ac97 platform_data earlier than ac97 reading/writing operations. Then it makes platform_data of AC97 become practically useful. Signed-off-by: Barry Song <21cnbao@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-11-03ASoC: Factor out snd_soc_init_card()Mark Brown1-77/+64
snd_soc_init_card() is always called as the last part of the CODEC probe function so we can factor it out into the core card setup rather than have each CODEC replicate the code to do the initialiastation. This will be required to support multiple CODECs per card. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-11-03ASoC: Move sysfs and debugfs functions to head of soc-core.cMark Brown1-167/+167
A fairly hefty change in diff terms but no actual code changes, will be used by the next commit. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-30ASoC: refactor snd_soc_update_bits()Eero Nurkkala1-6/+30
Introduce a wrapper call snd_soc_update_bits_locked() that will take the codec mutex. This call is used when the codec mutex is not already taken. Drivers calling snd_soc_update_bits() may wish to make sure the codec mutex is taken from the driver. Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-30ASoC: remove io_mutexEero Nurkkala1-5/+0
Remove the io_mutex. It has a drawback of serializing all accesses to snd_soc_update_bits() even when multiple codecs are in use. In addition, it fails to actually do its task - during snd_soc_update_bits(), dapm_update_bits() may also be accessing the same register which may result in an outdated register value. Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-19Merge branch 'for-2.6.32' into for-2.6.33Mark Brown1-3/+8
2009-10-19ASoC: Fix possible codec_dai->ops NULL pointer problemsBarry Song1-3/+8
Some codec DAIs like stac9766, wm9712, wm9713, ad1980 don't register themselves then it loses to the chance to be given a null_dai_ops in snd_soc_register_dai if they have no ops. When functions like soc_pcm_open, soc_pcm_hw_params etc. access the ops field in these DAIs, panic will happen. Signed-off-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-15ASoC: Remove snd_soc_suspend_device()Mark Brown1-39/+0
The PM core will grow pm_link infrastructure in 2.6.33 which can be used to implement the intended functionality of the ASoC-specific device suspend and resume callbacks so drop them. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-02ASoC: Improve the debugfs hierarchyPeter Ujfalusi1-2/+6
Change the way the debugfs entries are created: If the codec->dev is valid, than use: debugfs/asoc/{codec->name}.{dev_name(codec->dev)}/ if the codec->dev is NULL: debugfs/asoc/{codec->name}/ as root for the debugfs entries. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-10-01ASoC: add support for multiple cards/codecs in debugfsPeter Ujfalusi1-7/+19
In order to support multiple codecs on the same system in the debugfs the directory hierarchy need to be changed by adding directory per codec under the asoc direcorty: debugfs/asoc/{dev_name(socdev->dev)}-{codec->name}/codec_reg /dapm_pop_time /dapm/{widgets} With the original implementation only the debugfs files are only created for the first codec, other codecs loaded later would fail to create the debugfs files (since they are already exist). Furthermore in this situation any of the codecs has been removed, would cause the debugfs entries to disappear, regardless if the codec, which created them are still loaded (the one which loaded first). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-09-13ASoC: Provide API for reordering channelsBarry Song1-0/+24
The patch adds an interface to set the relationship between audio channel number and slot number. The interface should be really useful because audio channel n doesn't always use slot n in all platforms. And for some devices, the relationship even can change with sound mode switch in 2.1,3.1,4.1,5.1,6.1,7.1 etc. Signed-off-by: Barry Song <21cnbao@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-09-05ASoC: Add source argument to PLL configurationMark Brown1-3/+5
More and more devices feature PLLs and FLLs with the ability to select between multiple input clocks. In order to better support these devices a new argument, source, has been added to the set_pll() configuration API. Using set_clkdiv() is often difficult due to the need to stop the PLL/FLL before any reconfiguration can be done. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-08-21ASoC: Add DAPM widget power decision debugfs filesMark Brown1-0/+8
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-06ASoC: change set_tdm_slot api to allow slot_width override.Daniel Ribeiro1-3/+6
Extend set_tdm_slot to allow the user to arbitrarily set the frame width and active TX/RX slots. Updates magician.c and wm9081.c for the new set_tdm_slot(). wm9081.c still doesn't handle the slot_width override. While being there, correct an incorrect use of SlotsPerFrm(7) use in bitmask on pxa-ssp.c (SSCR0_SlotsPerFrm(x) is (((x) - 1) << 24)) ). (this series is meant for Mark's for-2.6.32 branch) Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-07-31ASoC: Allow CODECs to flag invalid registersMark Brown1-0/+3
This helps CODECs with sparse register maps work better with the register cache display interface. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-07-23ALSA: Allow passing platform_data to devices attached to AC97 busMarek Vasut1-1/+5
This patch allows passing platform_data to devices attached to AC97 bus (like touchscreens, battery measurement chips ...). Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-07-05ASoC: Add CODEC volatile register operationMark Brown1-0/+17
Add a volatile_register() operation to the CODEC structure providing a standard operation to query if a register is volatile. This will be used to factor out the register cache I/O operations for the CODECs. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-30ASoC: Convert to dev_pm_opsMark Brown1-11/+19
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-25Merge branch 'for-2.6.31' into for-2.6.32Mark Brown1-0/+3
2009-06-23ASoC: Add a shutdown callbackMark Brown1-0/+16
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-14ASoC: Instantiate any forgotten DAPM widgetsMark Brown1-0/+3
With the recent changes to the DAPM power checks it has become important to explicitly instantiate all widgets but some drivers were forgetting to do that. Since everything needs to do it add a call to instantiate them immediately before the card registration - it does no harm when it is called repeatedly and saves work in drivers. Tested-by: pHilipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-13ASoC: Add stub suspend and resume calls for ASoC subdevicesMark Brown1-0/+39
Now that ASoC subdevices can be regular devices they can have normal suspend and resume calls from their buses. However, suspending them individually is not desirable since this can lead to problems such as pops and clicks from devices being suspended with their signals being amplified or clocks being stopped suddenly. This will be resolved by having the normal device model suspend and resume calls call into ASoC which will suspend the entire card while any of its components are suspended. At present this is not yet implemented but in order to aid the transition of drivers to the standard device model this patch adds API calls for the notifications. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-06-08ASoC: Allow 32 bit registers for DAPMDaniel Ribeiro1-14/+14
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-04ASoC: fix NULL pointer dereference in soc_suspend()Daniel Mack1-0/+6
In case the initalization of an soc_device failed, there is no codec associated with it. soc_suspend() will still dereference the pointer and cause an Ooops when entering the sleep mode. This happens on our board with a multi-target kernel image when booted on a machine without audio circuits. This patch makes the code bail out very early in this special case. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-05-18ASoC: Integrate bias management with DAPM power managementMark Brown1-51/+10
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>
2009-05-12Merge branch 'for-2.6.30' into for-2.6.31Mark Brown1-0/+3
2009-05-11ASoC: soc-core: fix crash when removing not instantiated cardMike Rapoport1-0/+3
If the card was not instantiated in snd_soc_instantiate_card, calling soc-remove will crash because some of codec, cpu_dai and card .remove methods are called twice. Fix this by returning from soc_remove immediately. Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-05-09ASoC: Fix up CODEC DAI formats for big endian CPUsMark Brown1-0/+40
ASoC uses the standard ALSA data format definitions to specify the wire format used between the CPU and CODEC. Since the ALSA data formats all include the endianess of the data but this information is not relevant by the time the data has been encoded onto the serial link to the CODEC this means that either all the CODEC drivers need to declare both big and little endian variants or the core needs to fix up the format constraints specified by CODEC drivers. For now take the latter approach - this will need to be revisited if any CODECs are endianness dependant. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-04-16ASoC: Volume controls are never of boolean typeMark Brown1-3/+3
Some limited volume controls (mostly simple attenuations) have only two settings so the ASoC info functions misreport them as booleans. Since we currently have no better information check for " Volume" in the control name and always report any controls matching as being integer. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-04-16ASoC: Check we have DAI ops when calling via accessor functionsMark Brown1-7/+7
Also make sure we're checking for the right operation while we're here. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-04-07ASoC: Provide core support for symmetric sample ratesMark Brown1-0/+38
Many devices require symmetric configurations of capture and playback data formats, often due to shared clocking but sometimes also due to other shared playback and record configuration in the device. Start providing core support for this by allowing the DAIs or the machine to specify that the sample rates used should be kept symmetric. A flag symmetric_rates is provided in the snd_soc_dai and snd_soc_dai_link structures. If this is set in either of the DAIs or in the machine then a constraint will be applied when a stream is already open preventing any changes in sample rate. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-04-02ASoC: Set parent for AC97 devices we registerMark Brown1-1/+1
Ensure that any AC97 devices that bind to the CODEC are below the ASoC device in the device tree so the suspend and resume code can figure out what order to handle them in. Reported-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-04-02ASoC: Don't defer resume work for AC97 codecsMark Brown1-4/+14
AC97 devices may have other drivers hanging off them directly so need to have resumed when the resume function returns meaning that we can't defer the resume - complete it immediately for them. Non-AC97 devices should not have other drivers hanging directly off the ASoC devices. We only really need the deferral for non-AC97 devices - it's there since some I2C buses are very slow and non-AC97 codecs often have large numbers of registers to restore and require delays to bring the codec up cleanly leading to a substantial impact on overall resume time. Reported-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-03-17ASoC: Only deregister AC97 dev if it's name was not "AC97"Atsushi Nemoto1-1/+2
The commit 14fa43f53ff3a9c3d8b9662574b7369812a31a97 ("ASoC: Only register AC97 bus if it's not done already") added a condition for calling of soc_ac97_dev_register() but not added for calling of soc_ac97_dev_unregister(). This patch adds same condition for soc_ac97_dev_unregister(). Without this fix, kernel crashes when unloading an asoc driver. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-03-04ASoC: make ops a pointer in 'struct snd_soc_dai'Eric Miao1-48/+54
Considering the fact that most cpu_dai or codec_dai are using a same 'snd_soc_dai_ops' for several similar interfaces, 'ops' would be better made a pointer instead, to make sharing easier and code a bit cleaner. The patch below is rather preliminary since the asoc tree is being actively developed, and this touches almost every piece of code, (and possibly many others in development need to be changed as well). Building of all codecs are OK, yet to every SoC, I didn't test that. Signed-off-by: Eric Miao <eric.miao@marvell.com> Acked-by: Timur Tabi <timur@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-02-13Merge branch 'for-2.6.29' into for-2.6.30Mark Brown1-1/+4
2009-02-13ASoC: Only register AC97 bus if it's not done alreadyMark Brown1-1/+4
ASoC supports both explicit codec drivers for AC97 devices and a simple driver which uses the standard ALSA AC97 framework for codec support. When used with the generic AC97 codec support that will provide the ad hoc AC97 device for drivers like touchscreens to attach to so the core shouldn't do so. Reported-by: Manuel Lauss <mano@roarinelk.homelinux.net> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-01-28Merge branch 'topic/snd_card_new-err' into topic/asocTakashi Iwai1-4/+4
Conflicts: sound/soc/soc-core.c
2009-01-27ASoC: Push the codec runtime storage into the card structureMark Brown1-20/+17
This is a further stage on the road to refactoring away the ASoC platform device. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-01-12ALSA: Convert to snd_card_create() in other sound/*Takashi Iwai1-4/+4
Convert from snd_card_new() to the new snd_card_create() function in other sound subdirectories. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-09Merge branch 'for-2.6.29' into for-2.6.30Mark Brown1-35/+2
2009-01-09ASoC: cleanup duplicated code.Ian Molton1-0/+31
Many codec drivers were implementing cookie-cutter copies of the function that adds kcontrols to the codec. This patch moves this code to a common function snd_soc_add_controls() in soc-core.c and updates all drivers using copies of this function to use the new common version. [Edited to raise priority of error log message and document parameters. -- broonie] Signed-off-by: Ian Molton <ian@mnementh.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-01-08ASoC: Merge the soc_value_enum to soc_enum structPeter Ujfalusi1-35/+2
Merge the recently introduced soc_value_enum structure to the soc_enum. The value based enums are still handled separately from the normal enum types, but with the merge some of the newly introduced functions can be removed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-01-05ASoC: New enum type: value_enumPeter Ujfalusi1-0/+107
This patch introduces a new enum type. In this enum type each enumerated items referred with a value. This new enum type can handle enums encoded in bitfield, or any other weird ways. twl4030 codec has several mux selection register, where the input/output mux is coded in a bitfield. With the normal enum type this type of mux can not be handled in a clean way. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-01-01ASoC: Clean up kerneldoc warningsMark Brown1-22/+24
Almost all parameters that have been misnamed in the comments. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2008-12-10ASoC: Add codec registration APIMark Brown1-0/+43
Another part of the backporting of Liam's ASoC v2 work. Using this is more complicated than the other registration types since currently the codec is instantiated during the probe of the ASoC device so we can't currently readily wait for the codec to register. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2008-12-10ALSA: ASoC - Fix wrong section typesTakashi Iwai1-1/+1
The module init entries should be __init instead of __devinit. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-09ASoC: Wait for non-AC97 codec DAIs before instantiatingMark Brown1-1/+26
This will allow codec drivers to be refactored to allow them to be registered out of line with the ASoC device registration. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2008-12-09ASoC: Initial framework for dynamic card instantiationMark Brown1-20/+79
Use the lists of platforms, platform DAIs and cards to check to see that everything has registered. Since relationships are still specified by direct references to the structures in the drivers and the drivers all register everything at modprobe there should be no practical effect yet. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>