1
0
Fork 0
Commit Graph

67 Commits (b53ce3e7d407aa4196877a48b8601181162ab158)

Author SHA1 Message Date
Mengdong Lin 68003e6cf2 ASoC: Support registering a DAI dynamically
Define API snd_soc_register_dai() to add a DAI dynamically and
create the DAI widgets. Topology can use this API to register DAIs
when probing a component with topology info. These DAIs's playback
& capture widgets will be freed when the sound card is unregistered
and the DAIs will be freed when cleaning up the component.

And a dobj is embedded into the struct snd_soc_dai_driver. Topology
can use the dobj to find the DAI drivers created by it and free them
when the topology component is removed.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10 12:06:19 +00:00
Mark Brown b27aafedfd Merge remote-tracking branch 'asoc/topic/doc' into asoc-next 2015-10-26 11:15:57 +09:00
Anatol Pomozov 1d387a3fd8 ASoC: Document DAI signal polarity
Currently there is no clear definition of what FSYNC polarity is.
Different drivers use its own definition of what is "normal" and what is
"inverted" fsync. This leads to compatibility problems between drivers.

For example TegraX1 driver assumes that DSP-A format with frames
starting at rising FSYNC edge has "inverted" polarity,
while RT5677 assumes it is "normal" polarity.

Explicitly specify meaning of BCLK/FSYNC polarity to avoid future
compatibility problems.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23 01:21:14 +09:00
Jie Yang 6f0c42269f ASoC: compress: add config item for soc-compress to make it compiled only when needed
We don't always need soc-compress in soc, here add a config item
SND_SOC_COMPRESS, when nobody select it, the soc-compress will
not be compiled.

Here also change Kconfig to 'select SND_SOC_COMPRESS' for drivers
that needed soc-compress.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-22 13:52:16 +01:00
Mark Brown 0a7e4ca1aa Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ad193x', 'asoc/topic/adau1373' and 'asoc/topic/adau17x1' into asoc-next 2014-12-08 13:11:45 +00:00
Lars-Peter Clausen bc26321404 ASoC: Rename snd_soc_dai_driver struct ac97_control field to bus_control
Setting the ac97_control field on a CPU DAI tells the ASoC core that this
DAI in addition to audio data also transports control data to the CODEC.
This causes the core to suspend the DAI after the CODEC and resume it before
the CODEC so communication to the CODEC is still possible. This is not
necessarily something that is specific to AC'97 and can be used by other
buses with the same requirement. This patch renames the flag from
ac97_control to bus_control to make this explicit.

While we are at it also change the type from int to bool.

The following semantich patch was used for automatic conversion of the
drivers:
// <smpl>
@@
identifier drv;
@@
struct snd_soc_dai_driver drv = {
-	.ac97_control
+	.bus_control
	=
-	1
+	true
};
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:38:03 +00:00
Lars-Peter Clausen ca005f324e ASoC: ac97: Drop support for setting platform data via the CPU DAI
This has no users since commit f0fba2ad1b ("ASoC: multi-component - ASoC
Multi-Component Support") which was almost 5 years ago. Given that this runs
after CODEC probe functions have been run it also doesn't seem to be that
useful.

So drop it altogether to make the code simpler.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:37:58 +00:00
Lars-Peter Clausen 313665b983 ASoC: Remove card field from snd_soc_dai struct
The card field of the snd_soc_dai field is very rarely used. We can use
dai->component->card instead and remove the card field from the snd_soc_dai
struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-04 11:53:53 +00:00
Lars-Peter Clausen 2a374b78f5 ASoC: Remove platform field from snd_soc_dai
Typically a DAI does not need direct access to the platform. Currently the
only user of this field is in a platform driver where we have a more direct
way of getting a pointer to the platform. This patch updates the driver to
use the more direct way and then removes the platform field from the
snd_soc_dai struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03 12:17:07 +00:00
Benoit Cousson 88bd870f02 ASoC: core: Add initial support for DAI multicodec
DAI link assumes a one to one mapping between CPU DAI and CODEC. In
some cases, the same CPU DAI can be connected to several codecs.
This is the case for example, if you connect two mono codecs to the
same I2S link in order to have a stereo card.
The current ASoC implementation does not allow such setup.

Add support for DAI links composed of a single CPU DAI and multiple
CODECs. Sound cards have to pass the CODECs array in the corresponding
DAI link through a new 'snd_soc_dai_link_component' struct. Each CODEC in
this array is described in the same manner single CODEC DAIs are
(either DT/OF node or codec_name).

Multi-codec links are not supported in the case of CODEC to CODEC links.
Just print a warning if it happens.

Based on an original code done by Misael.

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16 22:58:49 +01:00
Lars-Peter Clausen 9420d97b3f ASoC: dapm: Remove DAI DAPM context
The DAI DAPM context was added in commit be09ad90 ("ASoC: core: Add platform DAI
widget mapping") and the only user was removed again in commit ae10e7e8f ("ASoC:
core: Only add platform DAI widgets once."). Now that we have a per component
DAPM context it is unlikely that we'll need the DAI DAPM context again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:36:08 +01:00
Lars-Peter Clausen 797f283b61 ASoC: Remove runtime field from DAI
This was initially removed in commit 6423c1875 ("ASoC: Remove runtime field from
DAI"), but was, presumably by accident, brought back in commit f0fba2ad1 ("ASoC:
multi-component - ASoC Multi-Component Support"). But has never been
initialized to anything but NULL ever since. This commit removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-12 22:08:36 +01:00
Lars-Peter Clausen 24faf76568 ASoC: Remove card's DAI list
Commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support") added
a per card list that keeps track of all the DAIs that have been registered with
the card, but the list has never been used. This patch removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 10:21:25 +01:00
Xiubo Li e5c2151483 ASoC: core: remove the 'of_' prefix of of_xlate_tdm_slot_mask.
The 'of_' is not appropriate here for there hasn't any DT parsing.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-25 13:06:43 +00:00
Mark Brown a4b12990b6 Merge remote-tracking branches 'asoc/topic/ml26124', 'asoc/topic/of', 'asoc/topic/omap', 'asoc/topic/pxa' and 'asoc/topic/rcar' into asoc-next 2014-03-12 23:04:35 +00:00
Lars-Peter Clausen 6106d12947 ASoC: Add component pointer to the DAI struct
Keep track of which component registered a DAI. We'll need this as
componentization progresses.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:04:55 +08:00
Xiubo Li 89c6785715 ASoC: core: add TDM slot parsing from DT supports
For some CPU/CODEC DAI devices the TDM slot infomation maybe needed. This
patch adds the slot parsing from DT supports.

TDM slot properties:
    dai-tdm-slot-num : Number of slots in use.
    dai-tdm-slot-width :  Width in bits for each slot.

For instance:
    dai-tdm-slot-num = <2>;
    dai-tdm-slot-width = <8>;

And for each spcified driver, there could be one .of_xlate_tdm_slot_mask()
to specify a explicit mapping of the channels and the slots. If it's absent
the default snd_soc_of_xlate_tdm_slot_mask() will be used to generating the
tx and rx masks.

For snd_soc_of_xlate_tdm_slot_mask(), the tx and rx masks will use a 1 bit
for an active slot as default, and the default active bits are at the LSB of
the masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-23 14:15:30 +09:00
Mark Brown 99896f714a Merge remote-tracking branch 'asoc/topic/dapm' into for-tiwai 2014-01-16 12:42:53 +00:00
Liam Girdwood bece9e957c ASoC: utils: Add internal call to determine if DAI is dummy.
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>
2014-01-08 12:07:13 +00:00
Nicolin Chen 3635bf09a8 ASoC: soc-pcm: add symmetry for channels and sample bits
Some SoCs can only work in mono or stereo mode at one time. So if
we let them capture a mono stream while playing a stereo stream,
there might be a problem occur to one of these two streams: double
paced or slowed down.

In soc-pcm.c, we have soc_pcm_apply_symmetry() to apply the rate
symmetry. But we don't have one for channels.

Likewise, we can treat symmetric_rate as a solution for those SoCs
or CODECs which can not handle asymmetrical LRCLK. But it's also
impossible for them to handle asymmetrical BCLK. And accodring to
BCLK = LRCLK * channel number * slot size(fixed or sample bits),
sample bits might also be a problem if they are not using a fixed
slot size.

Thus, this patch applys symmetry for channels and sample bits.

Meanwhile, there might be a race between two substreams if starting
simultaneously. Previously, we only added warning to compalin but
still using conservative way to let it carry on. However, this patch
rejects the second stream with any unmatched parameter to make sure
the first existing stream won't be broken.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 13:32:50 +00:00
Mark Brown 10abe843d5 Merge remote-tracking branch 'asoc/topic/mxs' into asoc-next 2013-10-24 11:24:09 +01:00
Mark Brown 70e0db2f74 Merge remote-tracking branch 'asoc/topic/dma' into asoc-next 2013-10-24 11:24:05 +01:00
Mark Brown ecfc0c04f2 ASoC: dai: Provide interface for setting DMA data at probe time
Allow DMA data to be set at probe time for devices that can do that,
avoiding the need to do it every time we start a stream and supporting
non-DT dmaengine users using the helpers.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-20 17:26:34 +01:00
Markus Pargmann 9f1614aae5 ASoC: snd_soc_dai_ops trigger function description
Add a comment to the trigger function in snd_soc_dai_ops struct about
possible command sequences.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-14 18:01:50 +01:00
Liam Girdwood e54cf76ba2 ASoC: core: Add API for configuration of DAI BCLK ratio
Some codec drivers when running in slave mode require that BCLK to sample rate ratio
is explicitly set by the machine driver as it may not be exactly rate * frame size.

Extend the DAI API by adding :-

int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:57:37 +01:00
Kuninori Morimoto f53179c026 ASoC: snd_soc_[un]register_dai[s]() become non global function
All drivers are using snd_soc_register_component()
instead of snd_soc_register_dai[s]()
snd_soc_[un]register_dai[s]() are no longer needed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 21:57:54 +00:00
Mark Brown 556d8b55d0 Merge remote-tracking branch 'asoc/topic/of' into asoc-next 2013-02-11 11:06:38 +00:00
Mark Brown d289323286 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2013-02-11 11:06:30 +00:00
Mark Brown da18396f94 ASoC: core: Allow digital mute for capture
Help avoid noise from the power up of the capture path propagating through
into the start of the recording (especially noise caused by the ramp of
microphone biases) by keeping the capture muted until after we've finished
powering things up with DAPM in the same manner we do for playback. This
allows us to take advantage of soft mute support in the hardware more
effectively and is more consistent.

The core code using the existing digital mute operation is updated to take
advantage of this. Some additional cases in the soc-pcm code and suspend
will need separate handling but these are less practically relevant than
the main runtime stream start/stop case.

Rather than refactor the digital mute function in every single driver a
new operation is added for drivers taking advantage of this functionality,
the old operation should be phased out over time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by Vinod Koul <vinod.koul@intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2013-02-08 11:08:44 +00:00
Kuninori Morimoto eef28e1082 ASoC: SND_SOC_DAIFMT_GATED become 0 as default settings
Current soc-dai.h defines SND_SOC_DAIFMT_GATED as (2 << 4),
but gated clock should be default settings (= 0).
This patch fixup SND_SOC_DAIFMT_GATED as (0 << 4).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-30 16:42:24 +08:00
Kuninori Morimoto 5d163336a7 ASoC: SND_SOC_DAIFMT_NB_NF become 0 as default settings
Current soc-dai.h defines SND_SOC_DAIFMT_NB_NF as (1 << 8),
but normal bit clock / normal frame should be
default settings (= 0).
This patch fixup SND_SOC_DAIFMT_NB_NF as (0 << 8).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-16 20:28:24 +09:00
Misael Lopez Cruz 9bffb1fb7c ASoC: Prevent pop_wait overwrite
pop_wait is used to determine if a deferred playback close
needs to be cancelled when the a PCM is open or if after
the power-down delay expires it needs to run. pop_wait is
associated with the CODEC DAI, so the CODEC DAI must be
unique. This holds true for most CODECs, except for the
dummy CODEC and its DAI.

In DAI links with non-unique dummy CODECs (e.g. front-ends),
pop_wait can be overwritten by another DAI link using also a
dummy CODEC. Failure to cancel a deferred close can cause
mute due to the DAPM STOP event sent in the deferred work.

One scenario where pop_wait is overwritten and causing mute
is below (where hw:0,0 and hw:0,1 are two front-ends with
default pmdown_time = 5 secs):

aplay /dev/urandom -D hw:0,0 -c 2 -r 48000 -f S16_LE -d 1
sleep 1
aplay /dev/urandom -D hw:0,1 -c 2 -r 48000 -f S16_LE -d 3 &
aplay /dev/urandom -D hw:0,0 -c 2 -r 48000 -f S16_LE

Since CODECs may not be unique, pop_wait is moved to the PCM
runtime structure. Creating separate dummy CODECs for each
DAI link can also solve the problem, but at this point it's
only pop_wait variable in the CODEC DAI that has negative
effects by not being unique.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-15 23:45:09 +09:00
Vinod Koul 4968107786 ASoC: add definations for compressed operations
Here we update the asoc structures to add compress stream definations
First the struct snd_soc_dai_driver adds a new member to indicate if the dai is
compressed or pcm. Next we add a new structre the struct snd_soc_compr_ops in
the struct snd_soc_dai_link. This is to be used for machine driver to perform
any opertaions required for setting up compressed audio streams

next is the compressed data operations, they are added using struct
snd_compr_ops in the struct snd_soc_platform_driver.

Signed-off-by: Namarta Kohli <namartax.kohli@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-20 20:50:37 +01:00
Mark Brown 623682941a ASoC: core: Allow DAIs to specify a base address
Devices with many DAIs are becoming more and more common, and generally
the more modern devices have consistent register layouts between DAIs.
Rather than have drivers open code lookups based on the DAI ID or cause
uglification in UI by having register addresses for IDs provide a base
address field they can use.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-05-02 15:42:27 +01:00
Liam Girdwood 07bf84aaf7 ASoC: dpcm: Add bespoke trigger()
Some on SoC DSP HW is very tightly coupled with DMA and DAI drivers. It's
necessary to allow some flexability wrt to PCM operations here so that we
can define a bespoke DPCM trigger() PCM operation for such HW.

A bespoke DPCM trigger() allows exact ordering and timing of component
triggering by allowing a component driver to manage the final enable
and disable configurations without adding extra complexity to other
component drivers. e.g. The McPDM DAI and ABE are tightly coupled on
OMAP4 so we have a bespoke trigger to manage the trigger to improve
performance and reduce complexity when triggering new McPDM BEs.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-26 17:48:42 +01:00
Liam Girdwood be09ad90e1 ASoC: core: Add platform DAI widget mapping
Add platform driver support for CPU DAI DAPM widgets.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:28:21 +01:00
Mark Brown 2466ab9709 ASoC: core: Split the union for CODEC/platform in the DAI
There's now core code which falls back to global CODEC operations for
DAI calls that needs to be able to tell if it's dealing with a CPU or
CODEC DAI and given the small number of DAIs in a typical system and
overall memory usage pattern saving a pointer per DAI is really not
worth the effort.

Reported-by: Ian Lartey <ian@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-03-04 13:44:01 +00:00
Mark Brown 888df395eb ASoC: dapm: Implement and instantiate DAI widgets
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-17 08:10:10 -08:00
Mark Brown 75d9ac46b9 ASoC: Allow DAI formats to be specified in the dai_link
For almost all machines the DAI format is a constant, always set to the
same thing. This means that not only should we normally set it on init
rather than in hw_params() (where it has been for historical reasons) we
should also allow users to configure this by setting a variable in the
dai_link structure. The combination of these two will make many machine
drivers even more data driven.

Implement a new dai_fmt field in the dai_link doing just that. Since 0 is
a valid value for many format flags and we need to be able to tell if the
field is actually set also add one to all the values used to configure
formats.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-28 13:22:28 +01:00
Dong Aisheng 17841020e9 ASoC: soc-core: symmetry checking for each DAIs separately
The orginal code does not cover the case that one DAI such as codec
may be shared between other two DAIs(CPU).
When do symmetry checking, altough the codec DAI requires symmetry,
the two CPU DAIs may still be configured to run on different rates.

We change to check each DAI's state separately instead of only checking
the dai link to prevent this issue.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-21 15:59:46 +01:00
Liam Girdwood 0168bf0d13 ASoC: core - Allow components to probe/remove in sequence.
Some ASoC components depend on other ASoC components to provide clocks and
power resources in order to probe() and vice versa for remove().

Allow components to be ordered so that components can be probed() and removed()
in sequences that conform to their dependencies.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-06-07 18:38:27 +01:00
Mark Brown 1ee46ebd04 ASoC: Make the DAI ops constant in the DAI structure
Neither drivers nor the core should be fiddling with the actual ops
structure at runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-12-03 12:17:43 +00:00
Jarkko Nikula 851cad5aa1 ASoC: Remove cyclic dependency between soc.h and soc-dapm.h/soc-dai.h
There is no need anymore to include soc.h in soc-dapm.h and soc-dai.h as
drivers are converted to include only soc.h.

Thanks to Lars-Peter Clausen <lars@metafoo.de> for pointing out the issue.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-11-22 14:05:05 +00:00
Liam Girdwood f0fba2ad1b ASoC: multi-component - ASoC Multi-Component Support
This patch extends the ASoC API to allow sound cards to have more than one
CODEC and more than one platform DMA controller. This is achieved by dividing
some current ASoC structures that contain both driver data and device data into
structures that only either contain device data or driver data. i.e.

 struct snd_soc_codec    --->  struct snd_soc_codec (device data)
                          +->  struct snd_soc_codec_driver (driver data)

 struct snd_soc_platform --->  struct snd_soc_platform (device data)
                          +->  struct snd_soc_platform_driver (driver data)

 struct snd_soc_dai      --->  struct snd_soc_dai (device data)
                          +->  struct snd_soc_dai_driver (driver data)

 struct snd_soc_device   --->  deleted

This now allows ASoC to be more tightly aligned with the Linux driver model and
also means that every ASoC codec, platform and (platform) DAI is a kernel
device. ASoC component private data is now stored as device private data.

The ASoC sound card struct snd_soc_card has also been updated to store lists
of it's components rather than a pointer to a codec and platform. The PCM
runtime struct soc_pcm_runtime now has pointers to all its components.

This patch adds DAPM support for ASoC multi-component and removes struct
snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec
or runtime PCM level basis rather than using snd_soc_socdev.

Other notable multi-component changes:-

 * Stream operations now de-reference less structures.
 * close_delayed work() now runs on a DAI basis rather than looping all DAIs
   in a card.
 * PM suspend()/resume() operations can now handle N CODECs and Platforms
   per sound card.
 * Added soc_bind_dai_link() to bind the component devices to the sound card.
 * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove
   DAI link components.
 * sysfs entries can now be registered per component per card.
 * snd_soc_new_pcms() functionailty rolled into dai_link_probe().
 * snd_soc_register_codec() now does all the codec list and mutex init.

This patch changes the probe() and remove() of the CODEC drivers as follows:-

 o Make CODEC driver a platform driver
 o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core.
 o Removed all static codec pointers (drivers now support > 1 codec dev)
 o snd_soc_register_pcms() now done by core.
 o snd_soc_register_dai() folded into snd_soc_register_codec().

CS4270 portions:
Acked-by: Timur Tabi <timur@freescale.com>

Some TLV320aic23 and Cirrus platform fixes.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>

TI CODEC and OMAP fixes
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Samsung platform and misc fixes :-
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>

MPC8610 and PPC fixes.
Signed-off-by: Timur Tabi <timur@freescale.com>

i.MX fixes and some core fixes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

J4740 platform fixes:-
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

CC: Tony Lindgren <tony@atomide.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC: Kuninori Morimoto <morimoto.kuninori@renesas.com>
CC: Daniel Gloeckner <dg@emlix.com>
CC: Manuel Lauss <mano@roarinelk.homelinux.net>
CC: Mike Frysinger <vapier.adi@gmail.com>
CC: Arnaud Patard <apatard@mandriva.com>
CC: Wan ZongShun <mcuos.com@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-12 14:00:00 +01:00
Daniel Mack fd23b7dee5 ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream
This fixes a memory corruption when ASoC devices are used in
full-duplex mode. Specifically for pxa-ssp code, where this pointer
is dynamically allocated for each direction and destroyed upon each
stream start.

All other platforms are fixed blindly, I couldn't even compile-test
them. Sorry for any breakage I may have caused.

Reported-by: Sven Neumann <s.neumann@raumfeld.com>
Reported-by: Michael Hirsch <m.hirsch@raumfeld.com>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-03-19 19:37:29 +00:00
Peter Ujfalusi 258020d088 ASoC: core: Add delay operation to snd_soc_dai_ops
The delay callback can be used by the core to query the delay
on the dai caused by FIFO or delay in the platform side.
In case if both CPU and CODEC dai has FIFO the delay reported
by each will be added to form the full delay on the chain.
If none of the dai has FIFO, than the delay will be kept as
zero.

Signed-off-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-03 17:08:41 +00:00
jassi brar 6423c1875c ASoC: Remove runtime field from DAI
In order for having snd_soc_dais shared among two or more dai_links,
remove the relatively global runtime field from the struct snd_soc_dai

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-02-22 14:15:30 +00:00
Guennadi Liakhovetski 84740ac19a ASoC: fix compile breakage - add a missing header include
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-01-19 12:36:40 +00:00
Lopez Cruz, Misael be2500b835 ASoC: Add PDM DAI format definition
Add DAI format definition for PDM interfaces.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-09-28 14:43:27 +01:00
Barry Song 472df3cbae ASoC: Provide API for reordering channels
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-13 12:37:53 +01:00