1
0
Fork 0
Commit Graph

959 Commits (a860fac420971c5a90d4f78959b44ead793aee4f)

Author SHA1 Message Date
Wu Fengguang 46b5a4d249 ASoC: fix semicolon.cocci warnings
sound/soc/soc-core.c:1961:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes: 98faf436ee ("ASoC: Drop invalid DMI fields when setting card long name from DMI info")
CC: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-30 12:57:19 +01:00
Mengdong Lin 98faf436ee ASoC: Drop invalid DMI fields when setting card long name from DMI info
Sometimes DMI fields may be invalid and so can't give useful vendor,
product or board info, such as "Type2 - Board Manufacturer" or
"Type1 - TBD by OEM". Including such invalid DMI fileds may create silly
card long name. So this patch creates a black list of invalid strings.
And if a DMI field contains any string in this list, it will be excluded
from the card long name.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-28 18:46:30 +01:00
Mark Brown 7932787f03 Merge branch 'topic/dai-id' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-of-graph 2017-05-24 18:44:06 +01:00
Kuninori Morimoto a180e8b988 ASoC: add snd_soc_get_dai_id() function
ALSA SoC needs to know connected DAI ID for detecting.
It is not a big problem if device/driver was only for sound,
but getting DAI ID will be difficult if device includes both
Video/Sound, like HDMI.
To solve this issue, this patch adds new snd_soc_get_dai_id() and
its related .of_xlate_dai_id callback on component driver.
In below case, we can handle Sound port (= port@2) as ID = 0
if .of_xlate_dai_id has its support.

	hdmi {
		port@0 { /* VIDEO */ };
		port@1 { /* VIDEO */ };
		port@2 { /* SOUND */ };
	};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-05-24 18:37:47 +01:00
Takashi Iwai 4efda5f213 ASoC: Fix use-after-free at card unregistration
soc_cleanup_card_resources() call snd_card_free() at the last of its
procedure.  This turned out to lead to a use-after-free.
PCM runtimes have been already removed via soc_remove_pcm_runtimes(),
while it's dereferenced later in soc_pcm_free() called via
snd_card_free().

The fix is simple: just move the snd_card_free() call to the beginning
of the whole procedure.  This also gives another benefit: it
guarantees that all operations have been shut down before actually
releasing the resources, which was racy until now.

Reported-and-tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
2017-05-24 18:11:08 +01:00
Kuninori Morimoto 5711c97920 ASoC: soc-core: enable "dai-format" on snd_soc_of_parse_daifmt()
Current snd_soc_of_parse_daifmt() detects [prefix]format, but
"format" was unclear in some case. This patch checks "dai-format"
first, and try to check "[prefix]format" if "dai-format" was not
exist.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-05-17 10:21:19 +01:00
Stephen Boyd ad61dd303a scripts/spelling.txt: add regsiter -> register spelling mistake
This typo is quite common.  Fix it and add it to the spelling file so
that checkpatch catches it earlier.

Link: http://lkml.kernel.org/r/20170317011131.6881-2-sboyd@codeaurora.org
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-05-08 17:15:13 -07:00
Mark Brown 258ced9d08 Merge remote-tracking branches 'asoc/topic/uda1380', 'asoc/topic/unregister', 'asoc/topic/ux500', 'asoc/topic/wm5100' and 'asoc/topic/wm8903' into asoc-next 2017-04-30 22:16:41 +09:00
Mark Brown 0c2964cb38 Merge remote-tracking branch 'asoc/topic/intel' into asoc-next 2017-04-30 22:15:41 +09:00
Mark Brown d872f04606 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2017-04-30 22:15:40 +09:00
Takashi Iwai 861886d338 ASoC: Call snd_soc_set_dmi_name() unconditionally
Since recently UCM can pick up a configuration specific to the board
via card longname field, and we introduced a helper function
snd_soc_set_dmi_name() for that.  So far, it was used only in one
place (sound/soc/intel/boards/broadwell.c), but it should be more
widely applied.

This patch puts a big hammer for that: it lets snd_soc_register_card()
calling snd_soc_set_dmi_name() unconditionally, so that all x86
devices get the better longname string.  This would have no impact for
other systems without DMI support, as snd_soc_set_dmi_name() is no-op
on them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-24 18:47:17 +01:00
Takashi Iwai 1f5a4535db ASoC: Provide a dummy wrapper of snd_soc_set_dmi_name()
For systems without DMI, it makes no sense to have the code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-24 18:47:10 +01:00
Kuninori Morimoto c12c1aad98 ASoC: soc-core: verify Sound Card normality
Current ALSA SoC Sound Card basically consists of CPU/Codec/Platform
components. If system uses Kernel modules, we can disable these drivers
by using rmmod command. In such case, we can't disable
CPU/Codec/Platform driver without disabling Sound Card driver.

But on the other hand, we can disable these drivers by using unbind
command. In such case, we can disable these drivers randomly.
In this case, we can create dirty Sound Card which is missing necessary
components.

(1) If user disabled Sound Card first, but did nothing to other drivers,
user can't use Sound because Sound Card is no longer exists.
(2) If user disabled CPU/Codec/Platform driver randomly, but did nothing
to Sound Card, user still be able to use Sound Card, because dirty Sound
Card still exists. In this case, Sound system will be crashed if user
started sound playback/capture. But we can't block such random unbind
now.

To avoid Sound Card crash in (2) case, we need to unregister Sound Card
whenever CPU/Codec/Platform component were unregistered.
This patch solves this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-05 18:24:07 +01:00
Kuninori Morimoto 991454e170 ASoC: core: remove pointless auxiliary from snd_soc_component
commit 1a653aa447 ("ASoC: core: replace aux_comp_list to ...")
tried to replace aux_comp_list to component_dev_list,
but it failed because of binding timing. Thus, Sylwester fixuped it by
commit d2e3a1358c ("ASoC: Fix binding and probing of auxiliary...").

One of main purpose of commit 1a653aa447 ("ASoC: core: replace...")
was remove replaceable list (= list_aux) from snd_soc_component by using
new "auxiliary" flags (but it failed).
Because of this background, current code has reborned card_aux_list
(= same as original list_aux), and almost pointless "auxiliary" flags.

Let's remove pointless "auxiliary" flags by this patch
This means, it is same as revert both
commit 1a653aa447 ("ASoC: core: replace aux_comp_list to ...") and
commit d2e3a1358c ("ASoC: Fix binding and probing of auxiliary...").

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-24 18:41:26 +00:00
Brian Norris d6c098a1db ASoC: don't dereference NULL pcm_{new,free}
Not all platform drivers have pcm_{new,free} callbacks. Seen with a
"snd-soc-dummy" codec from sound/soc/rockchip/rk3399_gru_sound.c.

Fixes: 99b04f4c40 ("ASoC: add Component level pcm_new/pcm_free")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-09 12:34:17 +01:00
Adrian Dinu ec5a82d6c0 ASoC: Add space around '='
This was reported by checkpatch.pl

Signed-off-by: Adrian Dinu <adrian.dinu95@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-07 13:51:07 +01:00
Alexey Dobriyan 5b5e0928f7 lib/vsprintf.c: remove %Z support
Now that %z is standartised in C99 there is no reason to support %Z.
Unlike %L it doesn't even make format strings smaller.

Use BUILD_BUG_ON in a couple ATM drivers.

In case anyone didn't notice lib/vsprintf.o is about half of SLUB which
is in my opinion is quite an achievement.  Hopefully this patch inspires
someone else to trim vsprintf.c more.

Link: http://lkml.kernel.org/r/20170103230126.GA30170@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-27 18:43:47 -08:00
Mark Brown 96f0e8a5b0 Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8328', 'asoc/topic/fsl', 'asoc/topic/fsl-sai' and 'asoc/topic/graph' into asoc-next 2017-02-19 16:36:23 +00:00
Mark Brown 59acd5dfcc Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/debugfs' and 'asoc/topic/doc' into asoc-next 2017-02-19 16:36:18 +00:00
Mark Brown b7707a8be6 Merge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/chmap', 'asoc/topic/cq93vc' and 'asoc/topic/da7218' into asoc-next 2017-02-19 16:36:13 +00:00
Mark Brown 16b5711485 Merge remote-tracking branch 'asoc/topic/intel' into asoc-next 2017-02-19 16:35:45 +00:00
Mark Brown 4ae8be8ea9 Merge remote-tracking branch 'asoc/topic/component' into asoc-next 2017-02-19 16:35:41 +00:00
Daniel Baluta d6075c2601 ASoC: Drop unnecessary debugfs ifdef
This is a relict of 6553bf06a3 ("ASoC: Don't try to register debugfs
entries if the parent does not exist").

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-02-04 11:56:45 +01:00
Kuninori Morimoto b07609ceca ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_card_name
Because prototype of OF-graph sound card support didn't have Sound Card
node, commit 8f5ebb1bee
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_name")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit 8f5ebb1bee.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27 11:59:36 +00:00
Kuninori Morimoto 440a3006f1 ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_prefix
Because prototype of OF-graph sound card support didn't have Sound Card
node, commit b6defcca0a
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit b6defcca0a.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27 11:59:36 +00:00
Kuninori Morimoto 21efde50ca ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_simple_widgets
Because prototype of OF-graph sound card support didn't have Sound Card
node, commit 1ef5bcd57b
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgets")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit 1ef5bcd57b.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27 11:59:36 +00:00
Kuninori Morimoto 2bc644af61 ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_routing
Because prototype of OF-graph sound card support didn't have Sound Card
node, commit 7364c8dc25
("ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing")
adjusted to it on each functions.

But final discussion result of ALSA SoC / OF-graph ML, OF-graph sound
card has node. Thus, this commit became no longer needed.

This reverts commit 7364c8dc25.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27 11:59:35 +00:00
Arnaud Pouliquen 25f7b701c2 ASoC: core: add optional pcm_new callback for DAI driver
During probe, DAIs can need to perform some actions that requests
the knowledge of the pcm runtime handle.
The callback is called during DAIs linking, after PCM device creation.
For instance this can be used to add relationship between a DAI pcm
control and the pcm device.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-20 15:16:23 +00:00
Liam Girdwood 345233d7c6 ASoC: core: Add API to use DMI name in sound card long name
Intel DSP platform drivers are used by many different devices but are
difficult for userspace to differentiate. This patch adds an API to allow
the DMI name to be used in the sound card long name, thereby helping
userspace load the correct UCM configuration. Usually machine drivers
uses their own name as the sound card name (short name), and leave the
long name and driver name blank. This API will use the DMI info like
vendor, product and board to make up the card long name. If the machine
driver has already explicitly set the long name, this API will do nothing.

This patch also allows for further differentiation as many devices that
share the same DMI name i.e. Minnowboards, UP boards may be configured
with different codecs or firmwares. The API supports flavoring the DMI
name into the card longname to provide the extra differentiation required
for these devices.

For Use Case Manager (UCM) in the user space, changing card long name by
this API is backward compatible, since the card name does not change. For
a given sound card, even if there is no device-specific UCM configuration
file that uses the card long name, UCM will fall back to load the default
configuration file that uses the card name.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-17 17:57:14 +00:00
Charles Keepax 8abab35f9a ASoC: Fixup some small kernel-doc typos
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-12 17:23:01 +00:00
Sylwester Nawrocki d2e3a1358c ASoC: Fix binding and probing of auxiliary components
Currently binding of auxiliary devices doesn't work as in
soc_bind_aux_dev() function a bound component is not being added
to any list and in soc_probe_aux_devices() we are trying to walk
the component_dev_list list to probe auxiliary components but
at that time this list doesn't contain any auxiliary components
since they are being added to the card only in soc_probe_component().

This patch adds a list to the card where are stored bound but not
probed auxiliary devices, so that all aux devices can be probed.

Fixes: 1a653aa447 "ASoC: core: replace aux_comp_list to component_dev_list"
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-31 18:28:36 +00:00
Kuninori Morimoto 99b04f4c40 ASoC: add Component level pcm_new/pcm_free
In current ALSA SoC, Platform only has pcm_new/pcm_free feature,
but it should be supported on Component level. This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-15 16:54:23 +00:00
Mark Brown dc42c6cb30 Merge remote-tracking branches 'asoc/topic/tlv320aic31xx', 'asoc/topic/topology', 'asoc/topic/uda1380', 'asoc/topic/wm2200' and 'asoc/topic/wm8523' into asoc-next 2016-12-12 15:53:25 +00:00
Mark Brown 2f028b15a2 Merge remote-tracking branches 'asoc/topic/of-graph', 'asoc/topic/pxa', 'asoc/topic/qcom' and 'asoc/topic/rk808' into asoc-next 2016-12-12 15:53:07 +00:00
Mark Brown 3f1b86139e Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2016-12-12 15:52:43 +00:00
Kuninori Morimoto 9178feb453 ASoC: add Component level suspend/resume
In current ALSA SoC, Codec only has suspend/resume feature,
but it should be supported on Component level. This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:58 +00:00
Kuninori Morimoto 1a653aa447 ASoC: core: replace aux_comp_list to component_dev_list
Now, Card has component_dev_list, we can replace aux_comp_list
to component_dev_list with new auxiliary flags

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:50 +00:00
Kuninori Morimoto d9fc40639d ASoC: core: replace codec_dev_list to component_dev_list on Card
Current Card has Codec list (= codec_dev_list), but Codec will be
removed in the future. Because of this reason, this patch adds
new Component list in Card, and replace Codec list.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:34 +00:00
Kuninori Morimoto 1ef5bcd57b ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgets
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:22:02 +00:00
Kuninori Morimoto 8f5ebb1bee ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_name
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:22:01 +00:00
Kuninori Morimoto b6defcca0a ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:19:35 +00:00
Kuninori Morimoto 1ad8ec535b ASoC: soc-core: snd_soc_get_dai_name() become non static
snd_soc_get_dai_name() is used from snd_soc_of_get_dai_name(),
and it is assuming that DT is using "sound-dai" / "#sound-dai-cells".
But graph base DT is using "remote-endpoint". This patch makes
snd_soc_get_dai_name() non static for graph support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:19:34 +00:00
Kuninori Morimoto 7364c8dc25 ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:19:34 +00:00
Charles Keepax 06859fca43 ASoC: core: If a platform doesn't have an of_node use parent's node
Support was added to allow location of both CPU and CODEC components
of a DAI link from their parent's of_node if they did not have an
of_node themselves in this commit:

commit 3e0aa8d83b ("ASoC: core: If component doesn't have of_node
                      use parent's node instead")

However this leaves platforms as something of a special case as the
major DAI component that doesn't do this. Since this is useful for MFD
devices which often utilise a single device tree entry for the whole
device, add support for looking up platforms from the parent's of_node
as well.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09 14:01:54 +00:00
Mengdong Lin 17fb175520 ASoC: Define API to find a dai link
Define the API to find an existing DAI link of the soc card by matching
the ID, name and stream name.

Some cards may use unique ID for each DAI link, so matching ID is enough,
and name or stream name are not necessary. But user need to specify name
or stream name as well if not sure whether link ID is unique since most
cards use 0 as the default link ID.

Topology can use this API to find an existing BE link and configure it.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-04 11:16:51 -06:00
Mark Brown 971dec826c Merge remote-tracking branches 'asoc/topic/nau8810', 'asoc/topic/of-bool', 'asoc/topic/omap' and 'asoc/topic/platform-drvdata' into asoc-next 2016-09-29 12:44:31 -07:00
Mark Brown 7c90fc73bf Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ak4104', 'asoc/topic/arizona', 'asoc/topic/atmel' and 'asoc/topic/codec-component' into asoc-next 2016-09-29 12:44:07 -07:00
Mark Brown e8f0f8aa4e Merge remote-tracking branches 'asoc/fix/atmel', 'asoc/fix/compress', 'asoc/fix/da7213' and 'asoc/fix/debugfs' into asoc-linus 2016-08-24 19:05:22 +01:00
Mark Brown d1e8142882 ASoC: core: Clean up DAPM before the card debugfs
Both the card and DAPM cleanups recursively delete their debugfs
directories.  Since the DAPM debugfs subdirectory for the card is
located within the card debugfs this means we end up trying to double
free the DAPM subdirectory.  Reorder the cleanup to free the card
debugfs after we've cleaned up DAPM and it has deleted its own
subdirectory.

Reported-by: Russell King - ARM Linux <linux@armlinux.org.uk>
Tested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-19 10:17:26 +01:00
Charles Keepax 70fcad495b ASoC: Fix leak of rtd in soc_bind_dai_link
If we fail to find a platform we simply return EPROBE_DEFER,
but we have allocated the rtd pointer. All error paths before
soc_add_pcm_runtime need to call soc_free_pcm_runtime first to
avoid leaking the rtd pointer. A suitable error path already
exists and is used else where in the function so simply use that
here as well.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-11 15:00:44 +01:00
Kuninori Morimoto 8073aefa60 ASoC: remove codec duplicated callback function
codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch removes codec side duplicated callback function.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:57:57 +01:00
Julia Lawall 519302954b ASoC: use of_property_read_bool
Use of_property_read_bool to check for the existence of a property.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2;
statement S2,S1;
@@
-       if (of_get_property(e1,e2,NULL))
+       if (of_property_read_bool(e1,e2))
        S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:55:05 +01:00
Mengdong Lin fbb88b5ca1 ASoC: Add kerneldoc comments for snd_soc_find_dai
snd_soc_find_dai() has been exported and so add the kerneldoc comments
for it.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-22 10:42:03 +01:00
Mengdong Lin 305e9020f0 ASoC: Export snd_soc_find_dai()
This API can be used by topology to find an existing BE dai by name
and further configure it.

Topology will also check DAI ID to avoid wrong match.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-20 17:19:24 +01:00
Sudip Mukherjee 513cb31120 ASoC: fix memory leak
If dai_link is already bound then we just returned and leaked rtd and
rtd->codec_dais which were allocated by soc_new_pcm_runtime(). We do not
need this newly allocated rtd to check if dai_link is already binded. Lets
check first if it is already binded before allocating this memory.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-22 19:40:06 +09:00
Mark Brown a1916ff350 Merge remote-tracking branch 'asoc/topic/pcm-list' into asoc-next 2016-01-11 13:54:31 +00:00
Mengdong Lin f2ed6b0764 ASoC: Make aux_dev more like a generic component
aux_dev is mainly used by the machine driver to specify analog devices,
which are registered as codecs. Making it more like a generic component
can help the machine driver to use it to specify any component with
topology info by name.

Details:
- Remove the stub 'rtd_aux' array from the soc card.
- Add a list 'aux_comp_list' to store the components of aux_devs.
  And add a list head 'list_aux' to struct snd_soc_component, for adding
  such components to the above list.
- Add a 'init' ops to a component for machine specific init.
  soc_bind_aux_dev() will set it to be aux_dev's init. And it will be
  called when probing the component.
- soc_bind_aux_dev() will also search components by name of an aux_dev,
  since it may not be a codec.
- Move probing of aux_devs before checking new DAI links brought by
  topology.
- Move removal of aux_devs later than removal of links. Because topology
  of aux components may register DAIs and the DAI drivers will go with
  removal of the aux components, we want soc_remove_link_dais() to remove
  the DAIs at first.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10 12:46:55 +00:00
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
Mengdong Lin 5e4fb37211 ASoC: Define soc_add_dai() to add a DAI to a component
Define soc_add_dai() as a wrapper to add a single DAI to a component.
It can be reused to register a DAI dynamically by topology.

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 64dc98d374 Merge remote-tracking branches 'asoc/topic/da7219', 'asoc/topic/dai-link' and 'asoc/topic/doc' into asoc-next 2015-12-23 00:23:39 +00:00
Mark Brown a93202fa7b Merge remote-tracking branch 'asoc/topic/pcm-list' into asoc-next 2015-12-23 00:23:32 +00:00
Mengdong Lin 61b0088b6a ASoC: Bind new DAI links after probing components
Probing components can bring new DAI or DAI links based on the topology
info. This patch finds the unbound DAI links and bind them.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 18:05:09 +00:00
Mengdong Lin 49a5ba1cd9 ASoC: soc_bind_dai_link() directly returns success for a bound DAI link
This function will return success immediately for a bound DAI link.
No need to look for the cpu/codec DAIs again.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 18:05:09 +00:00
Mengdong Lin d6f220ea13 ASoC: Define add/remove_dai_link ops for a soc card
A machine driver can register the two ops.

When a DAI link is added or removed by a component's topology, the
ASoC core can call the ops to notify the machine driver for extra
intialization or destruction.

E.g. topology can create FE DAI links from a cpu DAI component, and
the machine driver may define an add_dai_link ops to set machine-specific
.init ops for the DAI link.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 18:05:09 +00:00
Mengdong Lin f8f80361d0 ASoC: Implement DAI links in a list & define API to add/remove a link
Implement a dai link list for the soc card.

Add APIs to add/remove a DAI links dynamically, e.g. by topology.

And a dobj is embedded into the struct snd_soc_dai_link. Topology can
use the dobj to find the links created by it and remove them when the
topology component is unloaded.

The predefined DAI links are reserved to keep backward compatibility.
And they will also be added to the list.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 18:05:09 +00:00
Mengdong Lin 6f2f1ff0de ASoC: Change 2nd argument of soc_bind_dai_link() to DAI link pointer
Just code refactoring, to reuse it if new DAI Links are added later
based on topology in component probing phase.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-25 17:57:04 +00:00
Mengdong Lin 923c5e61ec ASoC: Define soc_init_dai_link() to wrap link intialization.
Define soc_init_dai_link() to wrap link initialization, to reuse it later
by snd_soc_instantiate_card() when adding new DAI links from topology in
component probing phase.

Move static func snd_soc_init_multicodec(), so that it can be reused by
soc_init_dai_link(). This saves adding a function declaration for
snd_soc_init_multicodec().

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-25 17:56:39 +00:00
Jeeja KP 1a7aaa58ec ASoC: core: Change power state before rechecking endpoint
For DAPM resume, we should first change the power state of the
card and then recheck the endpoints. This ensures the dapm is
resumed first and then userspace can resume the streams.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-25 12:52:29 +00:00
Mengdong Lin 1a497983a5 ASoC: Change the PCM runtime array to a list
Currently the number of DAI links is statically defined by the machine
driver at build time using an array. This makes it difficult to shrink/
grow the number of DAI links at runtime in order to reflect any changes
in topology.

We can change the DAI link array in the core to a list so that PCMs and
FE DAI links can be added and deleted at runtime to reflect changes in
use case and DSP topology. The machine driver can still register DAI links
as an array.

As the 1st step, this patch change the PCM runtime array to a list. A new
PCM runtime is added to the list when a DAI link is bound successfully.

Later patches will further implement the DAI link list.

More:
- define snd_soc_new/free_pcm_runtime() to create/free a runtime.
- define soc_add_pcm_runtime() to add a runtime to the rtd list.
- define soc_remove_pcm_runtimes() to clean up the runtime list.

- traverse the rtd list to probe the link components and dais.

- Add a field "num" to PCM runtime struct, used to specify the device
  number when creating the pcm device, and for a soc card to access
  its dai_props array.

- The following 3rd party machine/platform drivers iterate the rtd list
  to check the runtimes:
  sound/soc/intel/atom/sst-mfld-platform-pcm.c
  sound/soc/intel/boards/cht_bsw_rt5645.c
  sound/soc/intel/boards/cht_bsw_rt5672.c
  sound/soc/intel/boards/cht_bsw_max98090_ti.c

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18 18:32:24 +00:00
Vinod Koul 3de7c420a2 ASoC: core: refactor soc_link_dai_widgets()
In soc_link_dai_widgets() we refer to local widget variables as
playback/capture_widget, but they are really sink/source widgets,
so change the names accordingly

Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18 12:56:51 +00:00
Mark Brown 6439e5c2a7 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2015-10-26 11:15:55 +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
Jyri Sarha 6c84e5917f ASoC: soc-core: Fix sparse warning in be32_to_cpup() call
Store return value of of_get_property() to a pointer of __be32 type as
device tree has big endian type. This fixes a sparse warning couple of
lines later when be32_to_cpup() is used to convert from big endian to
cpu endian.

The whole conversion is not really necessary, as we are only checking
if the value is zero or not, but I wanted to add it to remind in the
future that the data has to be converted before use. Compiler should
optimize the unnecessary operations away.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-17 11:36:05 +01:00
Jyri Sarha 6131084a0b ASoC: simple-card: Add tdm slot mask support to simple-card
Adds DT binding for explicitly choosing a tdm mask for DAI and uses it
in simple-card. The API for snd_soc_of_parse_tdm_slot() has also been
changed.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16 18:00:30 +01:00
Mark Brown acb47ad502 Merge remote-tracking branches 'asoc/topic/mediatek', 'asoc/topic/mtk', 'asoc/topic/nuc900', 'asoc/topic/of-name' and 'asoc/topic/omap' into asoc-next 2015-08-30 15:55:21 +01:00
Mark Brown 7c0031360b Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/davinci-vcif', 'asoc/topic/doc' and 'asoc/topic/dpcm' into asoc-next 2015-08-30 15:53:39 +01:00
Mark Brown cb42e0f709 Merge remote-tracking branch 'asoc/topic/rt5645' into asoc-next 2015-08-30 15:52:12 +01:00
Mark Brown 24ecc23cf6 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2015-08-30 15:51:52 +01:00
Jonathan Corbet 628536ea06 ASoC: Clean up docbook warnings
A number of functions and structures in the sound subsystem had incomplete
and/or obsolete DocBook comments, leading to warnings when the docs were
built.  Correct those comments so that we can enjoy our audio in the
absence of warning noise.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-28 19:07:16 +01:00
Kuninori Morimoto 5e3cdaa208 ASoC: core: add snd_soc_of_parse_audio_prefix()
Current ASoC can add name_prefix for DAPM, and it is necessary for
route settings. This patch adds snd_soc_of_parse_audio_prefix() for
this purpose. It will be used with snd_soc_of_parse_audio_routing().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:59:41 +01:00
Masanari Iida 7d1442b4c4 ASoC: Fix warning caused by a typo in comments of snd_soc_add_platform()
This patch fix following warnings.
Warning(.//sound/soc/soc-core.c:2855): No description found
for parameter 'platform_drv'
Warning(.//sound/soc/soc-core.c:2855): Excess function parameter
'platform_driver' description in 'snd_soc_add_platform'

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-15 17:56:51 +01:00
Masanari Iida 231b86b1d8 ASoC: Fix warning while make xmldocs caused by soc-core.c
This patch fix following warning while make xmldocs.
Warning(.//sound/soc/soc-core.c:2148): No description found
for parameter 'ratio'

Add missing ":"

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-15 17:56:51 +01:00
Lars-Peter Clausen 2210438b6a ASoC: Free card DAPM context on snd_soc_instantiate_card() error path
Make sure the to free the card DAPM context if snd_soc_instantiate_card()
fails, otherwise the memory allocated for the DAPM widgets is leaked.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-08 22:16:51 +01:00
Lars-Peter Clausen abd31b32dd ASoC: Use card field to indicate whether a component is bound
Use the card field of a component to indicate whether it is bound or not.
This makes a certain sense given that the field contains the card the
component is bound to and a component can only be bound to one card at a
time. And it also requires to unset the card field when the component is
unbound from the card.

This makes the probded flag redundant and it can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-08 20:05:04 +01:00
Lars-Peter Clausen 1b7c123169 ASoC: Prevent components from being bound to multiple cards
A component can only be bound to a single card at a time. Binding it to
card while it is already bound to another will result in undefined
behavior.

As the undefined behavior might only manifest itself later on it is not
necessarily always straight forward to find the cause. To prevent this add
a check that refuses to bind a component to multiple cards as well as
prints a error describing the problem.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-08 20:05:04 +01:00
Shengjiu Wang 6e78108bda ASoC: core: Don't probe the component which is dummy
Dummy dai can be used by multiple sound card. But it only belong to one
card's dapm list. If another card use it, there will be dapm_assert_locked
warning.

[   20.015782] WARNING: CPU: 1 PID: 661 at sound/soc/soc-dapm.c:124 dapm_assert_locked.isra.36+0x4c/0x58()
[   20.025249] Modules linked in:
[   20.028349] CPU: 1 PID: 661 Comm: aplay Not tainted 4.1.0-rc6-next-20150605-00004-gaee05d8-dirty #92
[   20.037528] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[   20.044110] Backtrace:
[   20.046614] [<80012e00>] (dump_backtrace) from [<80012fa0>] (show_stack+0x18/0x1c)
[   20.054229]  r6:809e8060 r5:00000000 r4:00000000 r3:00000000
[   20.060002] [<80012f88>] (show_stack) from [<807a0f74>] (dump_stack+0x80/0x9c)
[   20.067293] [<807a0ef4>] (dump_stack) from [<8002b144>] (warn_slowpath_common+0x7c/0xb4)
[   20.075427]  r5:0000007c r4:00000000
[   20.079065] [<8002b0c8>] (warn_slowpath_common) from [<8002b1a0>] (warn_slowpath_null+0x24/0x2c)
[   20.087898]  r8:00000001 r7:88007c28 r6:ed94a680 r5:809e83e4 r4:ed83d6c0
[   20.094747] [<8002b17c>] (warn_slowpath_null) from [<8058403c>] (dapm_assert_locked.isra.36+0x4c/0x58)
[   20.104101] [<80583ff0>] (dapm_assert_locked.isra.36) from [<805842ec>] (dapm_mark_dirty+0x64/0xa4)
[   20.113165] [<80584288>] (dapm_mark_dirty) from [<805853a8>] (soc_dapm_dai_stream_event.isra.42+0x30/0xc8)
[   20.122863]  r8:ed9b5dbc r7:00000000 r6:00000001 r5:00000001 r4:ed83d6c0
[   20.129706] [<80585378>] (soc_dapm_dai_stream_event.isra.42) from [<80587e28>] (snd_soc_dapm_stream_event+0x78/0xa0)
[   20.140264]  r5:ee2ee62c r4:00000001
[   20.143918] [<80587db0>] (snd_soc_dapm_stream_event) from [<8058957c>] (soc_pcm_prepare+0x138/0x21c)
[   20.153058]  r8:ed8d9480 r7:00000000 r6:ed9b0e00 r5:00000001 r4:ee2ee62c r3:00000000
...

This patch is to not probe the dummy component in soc_probe_component. Then
there is no widget created for dummy DAI, and also don't need to check the
dummy dai in dapm_connect_dai_link_widgets().

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 19:30:34 +01:00
Lars-Peter Clausen 4890140f38 ASoC: Remove snd_soc_codec dapm field
There are no more direct users of the snd_soc_codec DAPM field left. So we
can finally remove it and switch over to directly using the component DAPM
context and remove the dapm_ptr indirection.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 14:54:32 +01:00
Mark Brown 28bedc5946 Merge remote-tracking branches 'asoc/topic/topology', 'asoc/topic/twl6040', 'asoc/topic/wm5100', 'asoc/topic/wm8741' and 'asoc/topic/wm8960' into asoc-next 2015-06-05 18:55:05 +01:00
Mark Brown 4b57895522 Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2015-06-05 18:54:45 +01:00
Liam Girdwood 8a9782346d ASoC: topology: Add topology core
The topology core parses the FW topology file for known block types and
instanciates any common ALSA/ASoC objects that it discovers. The core
also passes any block that is does not understand to client component
drivers for enumeration.

The core exports some APIs to client drivers in order to load and unload
firmware topology data as use case require.

Currently the core deals with the following object types :-

 o kcontrols. This includes TLV, enumerated and bytes controls.
 o DAPM widgets. All types with any associated kcontrol.
 o DAPM graph.
 o FE PCM. FE PCM capabilities and configuration can be defined.
 o BE DAI Link. BE DAI link capabilities and configuration can be defined.
 o Codec <-> codec style links capabilities and configuration.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04 09:40:03 +01:00
Jyri Sarha 3e0aa8d83b ASoC: core: If component doesn't have of_node use parent's node instead
If an ASoC component device does not have a device tree node, use its
parent's node instead, when looking for a matching DAI based on a
device tree reference.

This allows video device drivers to register a separate child device
for their ASoC side audio functionality.  [And MFDs in general --
broonie]

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-02 21:09:11 +01:00
Takashi Iwai d6b6c2ca6a ASoC: Simplify format_register_str() without stack usages
Instead of allocating two string buffers on stack and copying them
back, manipulate directly the target string buffer.  This simplifies
the code well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-26 16:21:57 +01:00
Srinivas Kandagatla 9e4980896c ASoC: skip legacy dai naming if dai driver has all the information
Original issue is that the id field in the dai is not same as the id
in dai_driver when dai driver count == 1. This is due to the legacy
dai naming check, which could possibly cause issues if the audio drivers
written in assumption that dai->id would be always equal to dai_driver->id.
This assumption is true only if the dai driver count is greater than 1,
and false if dai driver count is 1. On Qcom Lpass driver we hit such
issue while adding support to apq8016.

The code path which falls back to legacy naming for cases where num_dai
== 1 does not check if there is any valid information in the dai_driver.
This patch fixes that by checking if the dai_driver has valid id and
name before falling back to legacy dai naming
Although the drivers can work around this issue by only using
dai->driver->id, but this patch attempts to fix the actual issue.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-21 22:22:30 +01:00
Lars-Peter Clausen b8faaba4a6 ASoC: Drop unnecessary bias level check on resume
The suspended flag will only be set if the CODEC bias level was either
STANDBY or OFF. This means we don't need to check for that on resume since
the condition will always be true.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-15 16:49:39 +01:00
Linus Torvalds d0a3997c0c sound updates for 4.1-rc1
There have been major modernization with the standard bus: in ALSA
 sequencer core and HD-audio.  Also, HD-audio receives the regmap
 support replacing the in-house cache register cache code.  These
 changes shouldn't impact the existing behavior, but rather
 refactoring.
 
 In addition, HD-audio got the code split to a core library part and
 the "legacy" driver parts.  This is a preliminary work for adapting
 the upcoming ASoC HD-audio driver, and the whole transition is still
 work in progress, likely finished in 4.1.
 
 Along with them, there are many updates in ASoC area as usual, too:
 lots of cleanups, Intel code shuffling, etc.
 
 Here are some highlights:
 
 ALSA core:
 - PCM: the audio timestamp / wallclock enhancement
 - PCM: fixes in DPCM management
 - Fixes / cleanups of user-space control element management
 - Sequencer: modernization using the standard bus
 
 HD-audio:
 - Modernization using the standard bus
 - Regmap support
 - Use standard runtime PM for codec power saving
 - Widget-path based power-saving for IDT, VIA and Realtek codecs
 - Reorganized sysfs entries for each codec object
 - More Dell headset support
 
 ASoC:
 - Move of jack registration to the card level
 - Lots of ASoC cleanups, mainly moving things from the CODEC level
   to the card level
 - Support for DAPM routes specified by both the machine driver and DT
 - Continuing improvements to rcar
 - pcm512x enhacements
 - Intel platforms updates
 - rt5670 updates / fixes
 - New platforms / devices: some non-DSP Qualcomm platforms, Google's
   Storm platform, Maxmim MAX98925 CODECs and the Ingenic JZ4780 SoC
 
 Misc:
 - ice1724: Improved ESI W192M support
 - emu10k1: Emu 1010 fixes/enhancement
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVLnwvAAoJEGwxgFQ9KSmks3QP/31ObznJTUHLakrUNTk5X09Q
 WJfXjbmQxzhzZ4KmPcc5iQz6sN1eId6lJLFRtX3djGqXHPCv0O8R4i9LaXqHgQHd
 XZaH5KSbpnWUi1n7UD21GuXC+IwnvaUzYDsMBN1CYA3FWX3DjQ/t2fZh+M1ljwr0
 P29ZDNb3zcj1fGuewcWmFk0nDhPoXrtwR+cVf2Z7XxDMlaqn/bWSKcM5Ke5dndjL
 WV8xlmac/HSb+cofgNco21vgJNPGEGuP5X25ESqpzWbtQan+VnAw2kRV7XSULM6j
 MJfJPQvKUb4DxlXDld//VrpBK1vlvdJJNjEQco5V8woA8vHm0AnvmerHnOzv6ISn
 dPQV0FvyH7C2DpIDI+VnvxPWr/d+RulNnWJO2t2HYwcS8BWee3RdeEQ9gzrmMwA2
 NWVSebpqzmn2dX6DyspgrFvpRTQsDlFHKCqzc3dbgELuWN8otIrDQFL2B67MYyjS
 89oOTZOywIH74joNFuh9CflQ1gIXbwjKeXZW/B/NifWckds5rbR9cW2xL/Y0zcoZ
 NZwn/IK/YP/NaOMct4emYDNCTlZ2Q/wFXcOflIvX8yYe5KoNHcahWsb4OiT5bMLc
 9T7APCSSBwy30fDRL22SaLeh9WCGVgJZI8AiqMPYWAXzaDVwbhkeGg9utTb6g+42
 BnDSB1GOtYodtuRLVEG3
 =4z5j
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "There have been major modernization with the standard bus: in ALSA
  sequencer core and HD-audio.  Also, HD-audio receives the regmap
  support replacing the in-house cache register cache code.  These
  changes shouldn't impact the existing behavior, but rather
  refactoring.

  In addition, HD-audio got the code split to a core library part and
  the "legacy" driver parts.  This is a preliminary work for adapting
  the upcoming ASoC HD-audio driver, and the whole transition is still
  work in progress, likely finished in 4.1.

  Along with them, there are many updates in ASoC area as usual, too:
  lots of cleanups, Intel code shuffling, etc.

  Here are some highlights:

  ALSA core:
   - PCM: the audio timestamp / wallclock enhancement
   - PCM: fixes in DPCM management
   - Fixes / cleanups of user-space control element management
   - Sequencer: modernization using the standard bus

  HD-audio:
   - Modernization using the standard bus
   - Regmap support
   - Use standard runtime PM for codec power saving
   - Widget-path based power-saving for IDT, VIA and Realtek codecs
   - Reorganized sysfs entries for each codec object
   - More Dell headset support

  ASoC:
   - Move of jack registration to the card level
   - Lots of ASoC cleanups, mainly moving things from the CODEC level to
     the card level
   - Support for DAPM routes specified by both the machine driver and DT
   - Continuing improvements to rcar
   - pcm512x enhacements
   - Intel platforms updates
   - rt5670 updates / fixes
   - New platforms / devices: some non-DSP Qualcomm platforms, Google's
     Storm platform, Maxmim MAX98925 CODECs and the Ingenic JZ4780 SoC

  Misc:
   - ice1724: Improved ESI W192M support
   - emu10k1: Emu 1010 fixes/enhancement"

* tag 'sound-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (411 commits)
  ALSA: hda - set GET bit when adding a vendor verb to the codec regmap
  ALSA: hda/realtek - Enable the ALC292 dock fixup on the Thinkpad T450
  ALSA: hda - Fix another race in runtime PM refcounting
  ALSA: hda - Expose codec type sysfs
  ALSA: ctl: fix to handle several elements added by one operation for userspace element
  ASoC: Intel: fix array_size.cocci warnings
  ASoC: n810: Automatically disconnect non-connected pins
  ASoC: n810: Consistently pass the card DAPM context to n810_ext_control()
  ASoC: davinci-evm: Use card DAPM context to access widgets
  ASoC: mop500_ab8500: Use card DAPM context to access widgets
  ASoC: wm1133-ev1: Use card DAPM context to access widgets
  ASoC: atmel: Improve machine driver compile test coverage
  ASoC: atmel: Add dependency to SND_SOC_I2C_AND_SPI where necessary
  ALSA: control: Fix a typo of SNDRV_CTL_ELEM_ACCESS_TLV_* with SNDRV_CTL_TLV_OP_*
  ALSA: usb-audio: Don't attempt to get Microsoft Lifecam Cinema sample rate
  ASoC: rnsd: fix build regression without CONFIG_OF
  ALSA: emu10k1: add toggles for E-mu 1010 optical ports
  ALSA: ctl: fill identical information to return value when adding userspace elements
  ALSA: ctl: fix a bug to return no identical information in info operation for userspace controls
  ALSA: ctl: confirm to return all identical information in 'activate' event
  ...
2015-04-15 15:41:41 -07:00
Linus Torvalds d0bbe0dd35 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree from Jiri Kosina:
 "Usual trivial tree updates.  Nothing outstanding -- mostly printk()
  and comment fixes and unused identifier removals"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  goldfish: goldfish_tty_probe() is not using 'i' any more
  powerpc: Fix comment in smu.h
  qla2xxx: Fix printks in ql_log message
  lib: correct link to the original source for div64_u64
  si2168, tda10071, m88ds3103: Fix firmware wording
  usb: storage: Fix printk in isd200_log_config()
  qla2xxx: Fix printk in qla25xx_setup_mode
  init/main: fix reset_device comment
  ipwireless: missing assignment
  goldfish: remove unreachable line of code
  coredump: Fix do_coredump() comment
  stacktrace.h: remove duplicate declaration task_struct
  smpboot.h: Remove unused function prototype
  treewide: Fix typo in printk messages
  treewide: Fix typo in printk messages
  mod_devicetable: fix comment for match_flags
2015-04-14 09:50:27 -07:00
Mark Brown e1f059937a Merge remote-tracking branches 'asoc/topic/link-param', 'asoc/topic/max98090', 'asoc/topic/max98925' and 'asoc/topic/nuc900' into asoc-next 2015-04-12 19:49:06 +01:00
Kuninori Morimoto a5053a8e20 ASoC: core: call snd_soc_runtime_set_dai_fmt() before soc_new_pcm()
Current snd_soc_runtime_set_dai_fmt() is called after
soc_probe_link_dais(). this means snd_soc_dai_set_fmt() will be
called after soc_new_pcm().

Before appling 1efb53a220
(ASoC: simple-card: Remove support for setting differing DAI formats)
simple-card user had (1) snd_soc_dai_set_fmt() -> soc_new_pcm(),
but, after that it is (2) soc_new_pcm() -> snd_soc_dai_set_fmt().
At least rsnd driver is assuming (1) pattern.

This patch move snd_soc_dai_set_fmt() into soc_probe_link_dais()
after the dai_link->init section to solve this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-10 16:11:12 +01:00
Mark Brown 1ddca24c53 Merge branch 'topic/dapm-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core 2015-04-10 16:09:21 +01:00
Mark Brown 5f97a4bd2c Merge branch 'topic/delay' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core 2015-04-10 16:04:46 +01:00
Lars-Peter Clausen 6553bf06a3 ASoC: Don't try to register debugfs entries if the parent does not exist
If the registration of a debugfs directory fails this is treated as a
non-fatal error in ASoC and operation continues as normal. This means we
need to be careful and check if the parent debugfs directory exists if we
try to register a debugfs file or sub-directory. Otherwise we might end up
passing NULL for the parent and the file or directory will be registered in
the top-level debugfs directory.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-09 12:23:14 +01:00
Lars-Peter Clausen 2e55b90a5e ASoC: Make soc_dpcm_debugfs_add() non-fatal
Failing to register the debugfs entries is not fatal and will not affect
normal operation of the sound card. Don't abort the card registration if
soc_dpcm_debugfs_add() fails.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-09 11:32:29 +01:00
Lars-Peter Clausen 0757d834eb ASoC: Create card debugfs directory earlier
Create the card debugfs directory at the begining of the initilization
rather then the end as various steps in the initilization sequence will try
to register files and sub-directories in the card directory.

Fixes: 4e2576bd36 ("ASoC: soc-core: initialize debugfs in snd_soc_instantiate_card()")
Reported-by: Fabio Estevam <festevam@gmail.com>
Reported-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-09 11:24:03 +01:00
Mark Brown 95a9ca7476 Linux 4.0-rc7
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVIws/AAoJEHm+PkMAQRiGwEcH/1GCBqrBzXaKwDdCPMRcYVUb
 MYkXmGkCGRYWe5MXI8QNAaa/CdG6mAFMHWN6CaMMpLTxnM1m87uBg01fQMsh73BO
 mRVLKE/soiJDnR1gYzBBDBYV/AUvytN5PhgeNaA95YIJvU3T1f3iTnV8vs30Dp0L
 YpxSqwr3C0k7C9IE0VcgfzvWJPCnQ9IWHuX3jn5s1XjGKVNbBYHMt6FusHdyXMfT
 dp8ksuGHwm30mTFI5xJpKOrRzfi+P5EsEUrsnFRPRM/iFTVrM5R7eaUhsRZb2+Wo
 YApnbYhUYz7om1AuQ+UZ/+S6y7ZLlGWegI1lWI754GIsczG5vPHEYhhgkzMhTsc=
 =kR1V
 -----END PGP SIGNATURE-----

Merge tag 'v4.0-rc7' into asoc-core

Linux 4.0-rc7
2015-04-09 11:23:57 +01:00
Lars-Peter Clausen 37660b6daf ASoC: Remove suspend_bias_level from DAPM context struct
The only two users of the suspend_bias_level field were two rather old
drivers which weren't exactly doing things by the book. Those drivers have
been updated and field is now unused and can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-01 21:28:04 +01:00
Kuninori Morimoto 4e2576bd36 ASoC: soc-core: initialize debugfs in snd_soc_instantiate_card()
Current soc_init_card_debugfs() is called from snd_soc_register_card()
but, soc_cleanup_card_debugfs() is called from soc_cleanup_card_resources(),
not from paired function.

This differences don't matter for now. But if anyone wants to implement
a proper hotplug/unplug, this difference would become clearer.

Now, we can assume that snd_soc_instantiate_card() and
soc_cleanup_card_resources() are paired function.
soc_init_card_debugfs() / soc_cleanup_card_debugfs() paired function
should be called from these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-24 10:48:56 -07:00
Nikesh Oswal c66150824b ASoC: dapm: add code to configure dai link parameters
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-17 22:54:54 +00:00
Lars-Peter Clausen 778952598e ASoC: Remove unnecessary device_remove_file()
Since commit d29697dc3b ("ASoC: Add sysfs entries via static attribute
groups") the sysfs attributes of the rtd are manged by the device core and
there is no need to manually call device_remove_file() anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-08 19:46:26 +00:00
Lars-Peter Clausen 34e81ab455 ASoC: Fix component lists locking
Any access to the component_list, codec_list and platform_list needs to be
properly locked by the client_mutex. Otherwise undefined behavior can occur
if the list is modified in one thread and concurrently accessed from another
thread.

This patch adds the missing locking to the debugfs file handlers that
display the registered components, as well as the various components
unregister functions.

Furthermore the client_lock is now held for the whole
snd_soc_instantiate_card() sequence to make sure that component removal does
not race against the card registration.

Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-08 19:45:55 +00:00
Masanari Iida f42cf8d6a3 treewide: Fix typo in printk messages
This patch fix spelling typo in printk messages.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-03-06 23:04:40 +01:00
Nicolin Chen f23e860edb ASoC: core: Add extra dapm properties for Device Tree
The current helper functions, snd_soc_of_parse_audio_simple_widgets()
and snd_soc_of_parse_audio_routing(), set dapm_widgets and dapm_routes
without caring if they are already set by using build-in widgets and
routes in the card driver. So there could be one of them, build-in one
or Device Tree one, overrided by the other depending on which one was
assigned later.

This patch adds an extra pair of dapm_widgets and dapm_routes for DT
use only so as to prevent unexpected overriding.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24 23:46:13 +09:00
Mark Brown 1bf9f29a05 Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/sta32x', 'asoc/topic/tdm-slot', 'asoc/topic/tegra' and 'asoc/topic/tlv320aic3x' into asoc-next 2015-02-09 15:10:29 +08:00
Mark Brown 3f1cf65757 Merge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/dai' and 'asoc/topic/davinci' into asoc-next 2015-02-09 15:10:14 +08:00
Mark Brown afcfe4359e Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2015-02-09 15:10:00 +08:00
Kuninori Morimoto 8f6f9b2982 ASoC: core: indicate unregister debug message once
Current snd_soc_unregister_card() indicates unregistered debug
message when it was called. But, it should be called only when
it was really unregistered.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-08 11:11:51 +08:00
Takashi Iwai d29697dc3b ASoC: Add sysfs entries via static attribute groups
Instead of calling device_create_file() manually, assign the static
attribute group entries at the device registration.  This simplifies
the error handling and avoids the possible races.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-02 20:02:42 +00:00
Lars-Peter Clausen e46c936693 ASoC: Update snd_soc_dai_set_tdm_slot() documentation
There have been some conflicting interpretations of how
snd_soc_dai_set_tdm_slot() is supposed to work. This patch updates the
documentation to be more specific on the exact semantics to avoid such
problems in the future.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-14 19:04:57 +00:00
Lars-Peter Clausen ddaca25aa4 ASoC: Export snd_soc_runtime_set_dai_fmt()
Export snd_soc_runtime_set_dai_fmt() so it can be used in modules.

Fixes: ce64c8b9cf ("ASoC: Add helper function for changing the DAI link format")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-08 17:55:06 +00:00
Lars-Peter Clausen ce64c8b9cf ASoC: Add helper function for changing the DAI link format
For some setups it is necessary to change the DAI link format at runtime.
This patch factors out the code that does the initial static DAI link format
configuration into a separate helper function which can be used board
drivers as well.

This allows board drivers that have to change the DAI link format at runtime
to reuse it instead of having to manually change the format on all DAIs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-07 18:01:57 +00:00
Mark Brown cf82602c41 Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2014-12-24 12:56:40 +00:00
Mark Brown c533b8e60a Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus 2014-12-24 12:56:32 +00:00
Lars-Peter Clausen 86d7500326 ASoC: dapm: Simplify fully route card handling
For legacy reasons the ASoC framework assumes that a CODEC INPUT or OUTPUT
widget that is not explicitly connected to a external source or sink is
potentially connected to a source or a sink and hence the framework treats
the widget itself as source (for INPUT) or sink (for OUTPUT). For this
reason a INPUT or OUTPUT widget that is really not connected needs to be
explicitly marked as so.

Setting the card's fully_routed flag will cause the ASoC core, once that all
widgets and routes have been registered, to go through the list of all
widgets and mark all INPUT and OUTPUT that are not externally connected as
non-connected. This essentially negates the default behaviour of treating
INPUT or OUTPUT widgets without external routes as sources or sinks.

This patch takes a different approach while getting the same result. Instead
of first marking INPUT and OUTPUT widgets as sinks/sources and then later
marking them as non-connected, just never mark them as a sink or a source if
the fully_routed flag is set on a card.

This requires a lot less code and also results in a slightly faster card
initialization since there is no need to iterate over all widgets and check
whether the INPUT and OUTPUT widgets are connected or not.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-22 12:44:59 +00:00
Mark Brown e3b1e6a19e ASoC: dapm: Remove snd_soc_of_parse_audio_routing() due to deferred probe
This reverts commit f8781db8ae (ASoC: dapm: Augment existing card
DAPM routes in snd_soc_of_parse_audio_routing) since it is broken for
deferred probing as it ends up storing data allocated with devm_ over
multiple instantiations of the device.

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-19 11:19:40 +00:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
Mark Brown c9098c6120 Merge remote-tracking branches 'asoc/topic/multi-codec', 'asoc/topic/mxs-saif', 'asoc/topic/mxs-sgtl5000', 'asoc/topic/omap' and 'asoc/topic/pxa' into asoc-next 2014-12-08 13:12:05 +00:00
Mark Brown cfdf59b4a1 Merge remote-tracking branches 'asoc/topic/codec-mutex', 'asoc/topic/compress' and 'asoc/topic/cq93vc' into asoc-next 2014-12-08 13:11:52 +00: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
Mark Brown dbb55ce8af Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2014-12-08 13:11:45 +00:00
Mark Brown 941725f5fa Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-12-08 13:11:44 +00:00
Mark Brown 3ee3f45463 Merge remote-tracking branch 'asoc/topic/cache' into asoc-next 2014-12-08 13:11:44 +00:00
Peter Rosin f8781db8ae ASoC: Augment existing card DAPM routes in snd_soc_of_parse_audio_routing
If a snd_soc_card has any DAPM routes when it calls
snd_soc_of_parse_audio_routing, those are clobbered without this change.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-04 22:40:13 +00:00
Lars-Peter Clausen e874bf5f76 ASoC: Disable regmap helpers if regmap is disabled
If regmap is disabled there will be no users of the ASoC regmap helpers.
Furthermore regmap_exit() will no be defined causing the following compile
error:
	sound/soc/soc-core.c: In function 'snd_soc_component_exit_regmap':
	sound/soc/soc-core.c:2645:2: error: implicit declaration of function
		'regmap_exit' [-Werror=implicit-function-declaration]

So disable the helpers if regmap is disabled.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 20feb88198 ASoC: Add helper functions for deferred regmap setup")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 21:15:31 +00:00
Jean-Francois Moine 93b0f3eeeb ASoC: core: add multi-codec support in DT
This patch exports a core function which handles the DT description
of multi-codec links (as: "sound-dai = <&hdmi 0>, <&spdif_codec>;")
and creates a CODEC component array in the DAI link.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 13:21:14 +00:00
Mark Brown e975cec295 Merge branch 'topic/regmap' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-ac97 2014-11-19 10:48:20 +00:00
Lars-Peter Clausen 20feb88198 ASoC: Add helper functions for deferred regmap setup
Some drivers (most notably the AC'97 drivers) do not have access to their
regmap struct when the component/codec is registered. For those drivers the
automatic regmap setup will not work and needs to be done manually,
typically from the component/CODEC drivers probe callback.

This patch adds a set of helper function to handle deferred regmap
initialization as well as early regmap tear-down.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-19 10:46:03 +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 6794f709b7 ASoC: ac97: Drop delayed device registration
We have all the information and dependencies we need to initialize and
register the device available in snd_soc_new_ac97_codec(). So there is no
need to delay the device registration until after the card itself as been
registered.

This makes the code significantly simpler and also makes it possible to use
the AC'97 device in the CODECs probe function. The later will be required to
be able to convert the AC'97 CODEC drivers to regmap.

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 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 336b8423e2 ASoC: Move AC'97 support to its own file
Currently the AC'97 support is splattered all throughout soc-core.c. Some
parts are #ifdef'd some parts are not. This patch moves the AC'97 support to
its own file, this should make the code a bit more clearer and also makes it
possible to easily not compile it into the kernel when not needed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:26:06 +00:00
Lars-Peter Clausen 70f3af3ca1 ASoC: Properly handle AC'97 device lifetime management
The memory that a struct device is contained in must not be freed except
from within the device's release callback. The ASoC code currently does not
adhere to this rule for the AC'97 device. This patch fixes it by moving the
freeing of the AC'97 to the release callback and splitting up the
registration and unregistration of the device into separate steps for
getting/putting the reference to the device and adding/removing it to the
device hierarchy.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:26:05 +00:00
Lars-Peter Clausen bd6b87c104 ASoC: Remove CODEC mutex
The CODEC mutex is now unused and can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-10 19:08:31 +00:00
Lars-Peter Clausen 427d204c86 ASoC: Remove snd_soc_cache_sync() implementation
This function has no more non regmap user, which means we can remove the
implementation of the function and associated functions and structure
fields.

For convenience we keep a static inline version of the function that
forwards calls to regcache_sync() unconditionally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-09 09:06:30 +00:00
Lars-Peter Clausen 8e2be56273 ASoC: Consolidate CPU and CODEC DAI probe
CPU and CODEC DAI probe are performed in exactly the same way. Which means
we can reuse the snd_soc_codec_dai_probe() for probing CPU DAIs as well.

While we are at it also drop the unused card parameter form the function.

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 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
Mark Brown ff1b1c3fef Merge branch 'topic/dapm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core 2014-11-04 11:53:49 +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
Lars-Peter Clausen dd63a9c295 ASoC: Remove snd_soc_platform_driver suspend/resume callbacks
Those are unused and new drivers should use device driver suspend/resume.

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
Lars-Peter Clausen 1ffae3612f ASoC: Fix snd_soc_find_dai() matching component by name
Commit 14621c7e5e ("ASoC: Consolidate CPU and CODEC DAI lookup")
consolidated the lookup of CPU DAIs and CODEC DAIs into a single function.
When matching a component by name for CODEC DAIs the code previous to the
patch compared the name in the DAI link table with component->name. For CPU
DAIs the code compared to dev_name(component->dev). The newly introduced
function ended up using the later as well.

For most components dev_name(component->dev) and component->name are the
same. The main notable exception are I2C devices where the driver name and
the device name are concatenated to form the component name. By using
dev_name(component->dev) instead of component->name the patch broke the
matching of I2C CODECs by name.

This patch restores the original behavior by using component->name instead
of dev_name(component->dev). This will be safe even for CPU DAIs since for
CPU DAIs both are the same.

Fixes: 14621c7e5e ("ASoC: Consolidate CPU and CODEC DAI lookup")
Reported-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-29 20:51:30 +00:00
Mark Brown 7077148fb5 ASoC: core: Split ops out of soc-core.c
The main ASoC source file is getting quite large and the standard ops don't
really have anything to do with the rest of the file so split them out into
a separate file.

Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-29 11:15:10 +00:00
Lars-Peter Clausen c1b4d1c777 ASoC: Use generic control handlers for S8 control
Commit f227b88f0f ("ASoC: core: Add signed register volume control logic")
added support for signed control to the generic volsw control handler.
This makes it possible to use them for the S8 control as well, rather than
having to use a custom control handler implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28 00:20:51 +00:00
Lars-Peter Clausen 8be4da29cf ASoC: dapm: Mark endpoints instead of IO widgets dirty during suspend/resume
The state of endpoint widgets is affected by that card's power state.
Endpoint widgets that do no have the ignore_suspend flag set will be
considered inactive during suspend. So they have to be re-checked and marked
dirty after the card's power state changes. Currently the input and output
widgets are marked dirty instead, this works most of the time since
typically a path from one endpoint to another will go via a input or output
widget. But marking the endpoints dirty is technically more correct and will
also work for odd corner cases.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28 00:19:59 +00:00
Takashi Iwai 78cb4d995b ASoC: core: Use snd_ctl_enum_info()
... and reduce the open codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-22 11:04:55 +01:00
Wolfram Sang ab31135e6e ASoC: : drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:22:02 +02:00
Mark Brown b9fb729949 Merge remote-tracking branch 'asoc/fix/core' into asoc-linus 2014-10-08 16:44:49 +01:00
Daniel Mack decc27b01d ASoC: core: fix use after free in snd_soc_remove_platform()
Coverity spotted an use-after-free condition in snd_soc_remove_platform().
Fix this by moving snd_soc_component_cleanup() after the debug print
statement which uses the component's string.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2014-10-07 13:12:28 +01:00
Mark Brown 565fefdf31 Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/dmic', 'asoc/topic/drivers', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next 2014-10-06 12:48:57 +01:00
Mark Brown 97c53e26f0 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-10-06 12:48:52 +01:00
Mark Brown 5bcaca4b5b Merge remote-tracking branch 'asoc/topic/component' into asoc-next 2014-10-06 12:48:51 +01:00
Lars-Peter Clausen 0bd2ac3dae ASoC: Remove CODEC pointer from snd_soc_dapm_context
The only remaining user of the CODEC pointer in the DAPM struct is to
initialize the CODEC pointer in the widget struct. The later is scheduled
for removal, but has still a few users left. For now use
dapm->component->codec to initialize it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-29 18:25:52 +01:00
Mark Brown 82b925c405 Merge remote-tracking branches 'asoc/fix/atmel', 'asoc/fix/compress', 'asoc/fix/core', 'asoc/fix/fsl-ssi' and 'asoc/fix/rt286' into asoc-linus 2014-09-28 12:25:12 +01:00
Xiubo Li 6596aa047b ASoC: core: fix possible ZERO_SIZE_PTR pointer dereferencing error.
Since we cannot make sure the 'params->num_regs' will always be none
zero here, and then if it equals to zero, the kmemdup() will return
ZERO_SIZE_PTR, which equals to ((void *)16).

So this patch fix this with just doing the zero check before calling
kmemdup().

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2014-09-28 11:49:42 +01:00
Howard Mitchell 5c7c343a11 ASoC: core: Fix volsw_range funcs so SOC_DOUBLE_R_RANGE_TLV works.
This fixes a bug when using the SOC_DOUBLE_R_RANGE_TLV macro in
the invert mode. In the non-invert case, e.g.

SOC_DOUBLE_R_RANGE_TLV("<name>", <reg_l>, <reg_r>,
					0, 40, 255, 0, <tlv>)

the range sent to the hardware is 40..255, but in the invert case:

SOC_DOUBLE_R_RANGE_TLV("<name>", <reg_l>, <reg_r>,
					0, 40, 255, 1, <tlv>)

the range 215..0 was being sent to the hardware. This commit
corrects this to 255..40 so it is consistent with the non-invert
case.

Signed-off-by: Howard Mitchell <hm@hmbedded.co.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-24 09:37:03 +01:00
Lars-Peter Clausen 8c8f2f6fc1 ASoC: Fix snd_soc_{new,free}_ac97_codec() locking removal
Commit e3f205a72c ("ASoC: Remove locking in
snd_soc_{new,free}_ac97_codec()") overlooked a unlock on one of the error
paths.

Fixes: e3f205a72c ("ASoC: Remove locking in snd_soc_{new,free}_ac97_codec()")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-23 14:45:06 +01:00
Lars-Peter Clausen e3f205a72c ASoC: Remove locking in snd_soc_{new,free}_ac97_codec()
snd_soc_new_ac97_codec() and snd_soc_free_ac97_codec() are called from
within a CODEC's probe() and remove() callbacks. Those will not run
concurrently against each other for the same CODEC instance, hence it is not
necessary to protect the two functions with a mutex.

This removes the last user in the ASoC core of the snd_soc_codec mutex field
and will allow us to eventually remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-22 18:19:56 -07:00
Lars-Peter Clausen 0634814fe0 ASoC: Remove table based DAPM/control setup support from snd_soc_platform_driver
There are no users left and new users should rather use the component_driver
struct embedded in the snd_soc_platform_driver struct to do this. E.g.:

static const struct snd_soc_platform_driver foobar_driver = {
	.component_driver = {
		.dapm_widgets = ...,
		.num_dapm_widgets = ...,
		...,
	},
	...
};

instead of

static const struct snd_soc_platform_driver foobar_driver = {
	.dapm_widgets = ...,
	.num_dapm_widgets = ...,
	...
};

This also allows us to remove the steal_sibling_dai_widgets hack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-09-06 14:46:30 +01:00
Lars-Peter Clausen a80932979a ASoC: Always run default suspend/resume code
We do a bit more than just running the callbacks during suspend and resume
these days (e.g. call regcache_mark_dirty() during suspend). But this is
only when suspend and resume callbacks are specified for the driver,
otherwise nothing is done. This means that drivers which don't want to do
anything special during suspend and resume, but still want the standard
operations to run, need to provide empty suspend and resume callback
functions (rather than no callbacks). This patch updates the suspend and
resume code to always run standard sequence regardless of whether suspend
and resume handlers are provided.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-04 20:10:25 +01:00
Lars-Peter Clausen 86dbf2ac6f ASoC: Add support for automatically going to BIAS_OFF on suspend
There is a substantial amount of drivers that in go to SND_SOC_BIAS_OFF on
suspend and go back to SND_SOC_BIAS_SUSPEND on resume (Often this is even
the only thing done in the suspend and resume handlers). This patch
introduces a new suspend_bias_off flag, which when set by a driver will let
the ASoC core automatically put the device's DAPM context at the
SND_SOC_BIAS_OFF level during suspend. Once the device is resumed the DAPM
context will go back to SND_SOC_BIAS_STANDBY (if the context is idle,
otherwise to SND_SOC_BIAS_ON).

This will allow us to remove a fair bit of duplicated code from the drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-04 20:10:25 +01:00
Lars-Peter Clausen 1c325f771a ASoC: Shutdown DAPM contexts when removing a card
Currently when a ASoC sound card is unregistered we leave the individual
components in their current state, just call the remove() callback and leave
it to the drivers to do the proper shutdown/cleanup.

This patch introduces a call to snd_soc_dapm_shutdown() when removing the
card.  This will make sure that all DAPM widgets are properly powered down
and all DAPM contexts are put at the SND_SOC_BIAS_OFF level. This will
ensure that all components are properly powered down when the card is
removed.

Since a lot of drivers manually go to SND_SOC_BIAS_OFF in their remove
callback this will also allow us to remove a bit of duplicated code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-04 20:10:25 +01:00
Lars-Peter Clausen 01e0df6647 ASoC: Set card->instantiated to false when removing the card
Set card->instantiated to false when the card is removed to make sure that
operations that expect the card to be fully instantiated do not run anymore
during card removal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-04 20:10:25 +01:00
Jarkko Nikula b792346fa8 ASoC: Remove unused cache_only from struct snd_soc_codec
There are no real users for cache_only in "struct snd_soc_codec" so remove
it and needless debugfs node.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-28 19:05:57 +01:00
Lars-Peter Clausen 5819c2fa55 ASoC: Restore idle_bias_off initialization
This was accidentally lost in commit f1d45cc3ae ("ASoC: Consolidate
platform and CODEC probe/remove").

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-26 09:15:15 +01:00
Lars-Peter Clausen c5599b87a8 ASoC: Replace list_empty(&card->codec_dev_list) with !card->instantiated
With componentization we no longer necessarily need a snd_soc_codec struct for a
card. Instead of checking if the card's CODEC list is empty just use
card->instantiated to check if the card has been instantiated yet.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:48 -05:00
Lars-Peter Clausen 75af7c0819 ASoC: Remove support for legacy snd_soc_platform IO
There were never any actual users of this in upstream and by we have with
regmap a replacement in place, which should be used by new drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:47 -05:00
Lars-Peter Clausen 886f569225 ASoC: Automatically initialize regmap for all components
So far regmap is only automatically initialized for CODECs. Now that we have the
infrastructure in place to let components have DAPM widgets and controls that
want to use the generic regmap based IO also make sure to automatically
initialize regmap for all components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:47 -05:00
Lars-Peter Clausen 14621c7e5e ASoC: Consolidate CPU and CODEC DAI lookup
The lookup of CPU and CODEC DAIs is fairly similar and can easily be
consolidated into a single helper function.

There are two main differences in the current implementation of the CPU and
CODEC DAI lookup:
 1) CPU DAIs can be looked up by the DAI name alone and do not necessarily
   require a component name/of_node.
 2) The CODEC DAI search only considers DAIs from CODEC components.

For 1) the new helper function will allow to lookup DAIs without providing a
component name or of_node, but since snd_soc_register_card() already rejects
CODEC DAI link components without neither a of_node or a name we'll never get
into the situation where we try to lookup a CODEC DAI without a name/of_node.
For 2) the new helper function just always considers all components.
Componentization is now at a point where it is possible to register a CODEC as a
snd_soc_component rather than a snd_soc_codec, by considering DAIs from all
components it is possible to use such a CODEC in a DAI link.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:47 -05:00
Lars-Peter Clausen e60cd14f0b ASoC: Consolidate CPU and CODEC DAI removal
CPU and CODEC DAI works exactly the same way. There is already a helper function
for CODEC DAI removal, use that one as well for CPU DAI removal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:47 -05:00
Lars-Peter Clausen ffbd7dd72b ASoC: Cleanup DAI module reference counting
Currently when a DAI has no CODEC associated to it the reference on the module
containing the DAI driver is increased when the DAI is probed and decrease when
the DAI is removed. For DAIs with CODECs the module reference count was already
incremented when the CODEC is probed. Now that all components have their module
reference count incremented when they are probed and all DAIs do have a
component it is possible to remove the module reference counting on DAI probe
and removal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:46 -05:00
Lars-Peter Clausen 70090bbb8b ASoC: Move component->probed check into soc_{remove,probe}_component()
Having the check in a centralized place makes the code a bit cleaner and
shorter.

Note: There is a slight semantic change in this patch. soc_probe_aux_dev() will
no longer return -EBUSY if the AUX dev has already been probed before. This is
fine though since it will simply do nothing in that case and return success.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:46 -05:00
Lars-Peter Clausen 57bf772687 ASoC: Pass component instead of DAPM context to AUX dev init callback
Given that the component is the containing structure it makes more sense to pass
the component rather than the DAPM context to the AUX dev init callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:46 -05:00
Lars-Peter Clausen 65d9361f0c ASoC: Move AUX dev support to the component level
This patch makes it possible to register arbitrary components as a AUX dev
for a card. This was previously only possible for CODEC components. With
componentization having made it possible for components to have DAPM contexts
and controls there is no reason why AUX devs should be artificially limited to
snd_soc_codec devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen 61aca5646b ASoC: Add component level probe/remove support
Now that we have a unified probe and remove path make sure to call them for all
components. soc_{probe,remove}_component are responsible for setting up the DAPM
context for the component, initialize the component prefix, manage the debugfs
entries as well as do the registration of table based controls and DAPM
elements. They also call the component drivers probe and remove callbacks. This
patch makes these things available for generic snd_soc_component drivers rather
than only having them for snd_soc_codec and snd_soc_platform drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen 93c3ce76cc ASoC: Make rtd->codec optional
There are some place in the ASoC core that expect rtd->codec to be non NULL
(mainly CODEC specific sysfs files). With componentization going forward
rtd->codec might be NULL in some cases. This patch prepares the core for this by
not registering CODEC specific sysfs files if rtd->codec is NULL. sysfs file
removal does not need to be conditionalized as it handles the removal of
non-existing files just fine.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen f1d45cc3ae ASoC: Consolidate platform and CODEC probe/remove
The platform and CODEC probe and remove code is now largely identical. This
patch consolidates it at the component level.

The resulting code is slightly larger due to all the boiler plate code setting
up the indirection for the table based control and DAPM registration.  Once all
drivers have been update to no longer use the snd_soc_codec_driver and
snd_soc_platform_driver specific fields for this the indirection can be removed
again.

This patch contains two noteworthy hacks that are only meant to be temporary to
be able to update drivers and the core in separate incremental patches.

The first hack is related to that some DPCM platforms expect that the DAPM
widgets for the DAIs of a snd_soc_component are created in the DAPM context of
the snd_soc_platform that has the same parent device. For handling this the
steal_sibling_dai_widgets attribute is introduced. It gets set for
snd_soc_platforms that register DAPM elements. When creating the DAI widgets for
a component this flag is checked and if it is found on one of the siblings the
component will not create any DAI widgets in its own DAPM context. If the
attribute is set on a platform it will look for siblings components and create
DAI widgets for them in its own context. The fix for this will be to update
the offending drivers to only register a single component rather than two.

The second hack deals with the fact that the ASoC card suspend and resume code
still needs a list of CODECs that have been registered for the card. To handle
this the generic probe and remove path have a check to see if the component is
CODEC and if yes add/remove it to the card's CODEC list. While it is possible to
clean up the suspend/resume code to not need the CODEC list anymore this is a
bit of a chicken and egg problem since it will become easier to clean up the
suspend/resume code once there is a unified component layer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen 81c7cfd1b2 ASoC: Move debugfs registration to the component level
The debugfs registration is mostly identical between platforms and CODECs. This
patches consolidates the two implementations at the component level.

Unfortunately there are still a couple of CODEC specific debugfs files that are
related to legacy ASoC IO that need to be registered. For this a new callback is
added to the component struct that will be initialized when a CODEC is
registered and will be used to register the CODEC specific files. Once there are
no drivers left using legacy IO this can be removed again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen f294afed03 ASoC: Use dev_set_name() instead of init_name
init_name is basically a hack and should only be used for statically allocated
device structs. For dynamically allocated devices dev_set_name() should be used.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-17 08:22:18 -05:00
Mark Brown c5e64c7636 Merge remote-tracking branches 'asoc/topic/tlv', 'asoc/topic/tlv320aic23', 'asoc/topic/tlv320aic31xx' and 'asoc/topic/tlv320aic32x4' into asoc-next 2014-08-04 16:32:12 +01:00
Mark Brown 7196be58ca Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-08-04 16:31:17 +01:00
Lars-Peter Clausen 0f2780ad4c ASoC: Add function to register component controls
We have now everything in place to actual let a component register controls. Add
a function which allows to do so.

Also update snd_soc_add_codec_controls() and snd_soc_platform_controls() to use
this new function internally. And while we are at it also change the
num_controls parameter of those two functions from int to unsigned int.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-22 23:15:57 +01:00
Lars-Peter Clausen 00200107a2 ASoC: Move card field form platform/codec to component
Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the
parent card and both handle this pointer in mostly the same way. This patch
moves the card field to the component level which will allow further code
consolidation between platforms and CODECS.

Since there are only a handful of users of the snd_soc_codec struct's card field
(and none of the snd_soc_platform's) these are update in this patch as well,
which allows it to be removed from the snd_soc_codec struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-22 23:15:57 +01:00
Lars-Peter Clausen 9898e1ccf5 ASoC: Remove per card platform list
The platform_dev_list was added in commit f0fba2ad1b ("ASoC: multi-component -
ASoC Multi-Component Support") and while platforms are added and remove from
that list it is otherwise unused. This patch removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-22 23:15:57 +01: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
Mark Brown f7acb3694a Merge remote-tracking branch 'asoc/topic/component' into asoc-multi 2014-07-16 22:58:45 +01:00
Omair Mohammed Abdullah 7523a27168 ASoC: core: add a helper for extended byte controls using TLV
ALSA supports arbitrary length TLVs for each kcontrol that can be used
to pass metadata about the control (e.g. volumes, enum information). The
same transport mechanism is now used for arbitrary length data by
defining a new helper.

Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16 22:43:59 +01:00
Tushar Behera 7e07e7c085 ASoC: core: Fix possible NULL pointer dereference
snd_soc_of_parse_card_name() may be called before card->dev has been
set, which results in a kernel panic.

Unable to handle kernel NULL pointer dereference at virtual address 00000210
PC is at snd_soc_of_parse_card_name+0x18/0x54
LR is at snow_probe+0x5c/0xd4

Add an error check in snd_soc_of_parse_card_name() to take care of this
case and print out a message in case of error.

Signed-off-by: Tushar Behera <tushar.b@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-09 10:06:46 +02:00
Lars-Peter Clausen 5f3484ac87 ASoC: core: Move non-shared code paths out of snd_soc_post_component_init()
There are two call sites for snd_soc_post_component_init(), one passes 0 and the
other 1 for the 'dailess' parameter of snd_soc_post_component_init(). Depending
on whether 'dailess' is 0 or 1 snd_soc_post_component_init() runs different code
at the beginning and the end of the function. The patch moves this conditional
code out of snd_soc_post_component_init() and into the call sites. This removes
the need for snd_soc_post_component_init() to know whether it is called for a
DAI link or a aux dev.

Also do the initialization of rtd->card when the rtd struct is allocated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-02 21:24:13 +01:00
Lars-Peter Clausen 44c69bb139 ASoC: core: Bind aux devs early
Currently in snd_soc_instantiate_card() we only check if the aux dev exists, but
do not yet assign it to its rtd. This means that we need to lookup the aux dev
again in soc_probe_aux_dev(). This patch changes the behavior to assign the aux
dev to the rtd in soc_check_aux_dev() (and renames it to soc_bind_aux_dev()).
This simplifies the implementation a bit and also removes the need for
soc_post_component_init() to know about the specific CODEC that was assigned to
the rtd. The later is necessary for componentization as the code should work for
all types of components not just CODECs. This new behavior is also more in sync
with how soc_bind_dai_link()/soc_probe_link_dais() works.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-02 21:24:10 +01:00
Lars-Peter Clausen 48f466d112 ASoC: core: Replace soc_find_matching_codec() with soc_find_codec()
soc_find_matching_codec() works in the same way as soc_find_codec() except that
it only works for auxdevs. It can easily be replaced by the generic
soc_find_codec().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-02 21:24:07 +01:00
Lars-Peter Clausen b8257be5ff ASoC: core: Remove duplicated rtd->codec initialization
rtd->codec is already initialized in soc_bind_dai_link(), so there is no need to
do it again in soc_dai_link_init(). Removing the rtd->codec initialization from
soc_dai_link_init() also removes the need for soc_dai_link_init() to know about
the CODEC at all.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-02 21:24:04 +01:00
Benoit Cousson 3f901a028f ASoC: core: Change soc_link_dai_widgets signature for multiple codecs
Since multiple codecs DAI will be usable in the future, remove
explicit unique codec_dai and cpu_dai parameters.
Replace them with snd_soc_pcm_runtime pointer that will contain
every instances.

No functionale change.

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-01 18:17:22 +01:00
Mark Brown 211bcc6c3a Merge remote-tracking branch 'asoc/fix/debugfs' into asoc-component
Conflicts:
	sound/soc/soc-core.c
2014-06-28 14:47:12 +01:00
Russell King e73f3de5c5 ASoC: fix debugfs directory creation bug
Avoid creating duplicate directories by prefixing codecs and platforms
with their separate identifiers.  This avoids snd-soc-dummy (which can
appear both as a dummy platform and a dummy codec on the same card)
from clashing.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-28 13:45:39 +01:00
Lars-Peter Clausen 88a8fe3df6 ASoC: dapm: Remove platform field from widget and dapm context struct
The platform field in the snd_soc_dapm_widget and snd_soc_dapm_context structs
is now unused can be removed. New code that wants to get the platform for a
widget or dapm context should use snd_soc_dapm_to_platform(w->dapm) or
snd_soc_dapm_to_platform(dapm).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:36:09 +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 14e8bdebfb ASoC: Add component level stream_event() and seq_notifier() support
This patch adds stream_event() and seq_notifier() callbacks similar to those
found in the snd_soc_codec_driver and snd_soc_platform driver struct to the
snd_soc_component_driver struct. This is meant to unify the handling of these
callbacks across different types of components and will eventually allow their
removal from the CODEC and platfrom driver structs.

The new callbacks are slightly different from the old ones in that they take a
snd_soc_component as a parameter rather than a snd_soc_dapm_context. This was
done since otherwise casting from the DAPM context to the component would
typically be the first thing to do in the callback. And the interface becomes
slightly cleaner by passing a snd_soc_component to all callbacks in the
snd_soc_component_driver struct.

The patch also already removes the stream_event() callback from the
snd_soc_codec_driver and snd_soc_platform_driver structs as it is currently
unused.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen bc9af9fa9b ASoC: Use component DAPM context for platforms
The snd_soc_platform dapm field is not accessed outside of the ASoC core. Switch
it over to using the snd_soc_component DAPM context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen ce0fc93ae5 ASoC: Add DAPM support at the component level
This patch adds full DAPM support at the component level. Previously there was
only full DAPM support for CODECs and partial DAPM support (e.g. no Mixers nor
MUXs) for platforms. Having DAPM support at the component level will allow all
types of components to use DAPM and also help in consolidating the DAPM support
between CODECs and platforms.

Since the DAPM context is directly embedded into the snd_soc_codec and
snd_soc_platform struct and the 'dapm' field is directly referenced in a lot of
drivers moving the field just right now is not possible without causing code
churn. The approach this patch takes is to add two new fields to the component
struct. One field which is the pointer to the actual DAPM context used by the
component and one DAPM context that will be used as the default if no other
context was specified. For CODECs and platforms the pointer is initialized to
point to the CODEC or platform DAPM context. All generic code when referencing
a component's DAPM struct will go via the pointer. This will make it possible to
eventually seamlessly move the DAPM context from snd_soc_codec and
snd_soc_platform struct over once all direct references have been eliminated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen 68f831c272 ASoC: Add a set_bias_level() callback to the DAPM context struct
Currently the DAPM code directly looks at the CODEC driver struct to get a
handle to the set_bias_level() callback. This patch adds a new set_bias_level()
callback to the DAPM context struct. The DAPM code will use this new callback
instead of the CODEC callback. For CODECs the new callback is set up to call the
CODEC specific set_bias_level callback(). Not looking directly at the CODEC
driver struct will allow non CODEC DAPM contexts to implement a set_bias_level()
callback.

This is also similar to how the seq_notifier() and stream_event() callbacks are
currently handled.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen 7df3788410 ASoC: Auto disconnect pins from all DAPM contexts
Currently only pins in CODEC DAPM contexts are automatically marked as
non-connected if the card has the fully_routed flag set. This makes sense since
widgets which qualify for auto-disconnection are only found in CODEC DAPM
contexts. But with componentisation this is going to change, so consider all
widgets for auto-disconnection.

Also it is probably faster to walk the widgets list only once rather than once
for each CODEC.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:06:56 +01:00
Lars-Peter Clausen bb13109d85 ASoC: Split component registration into two steps
Split snd_soc_component_register() into snd_soc_component_initialize() and
snd_soc_component_add(). Using a 2-stage registration approach has the advantage
that it is possible to modify the component after it has been initialized, but
before it is made visible to the system. This e.g. allows CODECs or platforms to
overwrite some of the default settings made in snd_soc_component_initialize().

Similar snd_soc_component_unregister() is split into two steps as well,
snd_soc_component_delete(), which removes the component from the system, and
snd_soc_component_cleanup(), which frees all the resources allocated by the
component.

Furthermore this patch makes sure that if a component is visible on two list
(e.g. the component list and the CODEC list) it is added or removed to both
lists atomically.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:05:13 +01:00
Lars-Peter Clausen f4333203ec ASoC: Move name and id from CODEC/platform to component
The component struct already has a name and id field which are initialized to
the same values as the same fields in the CODEC and platform structs. So remove
them from the CODEC and platform structs and used the ones from the component
struct instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:04:24 +01:00
Lars-Peter Clausen 94f99c875c ASoC: Move name_prefix from CODEC to component
Move the name_prefix from the CODEC struct to the component struct. This will
eventually allow to specify prefixes for all types of components. It is also
necessary to make the DAPM code component type independent (i.e. a DAPM context
does not need to know whether it belongs to a CODEC or a platform or something
else).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:03:22 +01:00
Mark Brown 04f87446c2 Merge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf', 'asoc/topic/sta350' and 'asoc/topic/tlv320dac33' into asoc-next 2014-05-22 00:24:00 +01:00
Mark Brown 6630f30ed5 Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
Mark Brown 566d4eeff8 Merge remote-tracking branch 'asoc/topic/dt' into asoc-next 2014-05-22 00:23:43 +01:00
Lars-Peter Clausen db88a8e3ca ASoC: Remove unused num_dai field from CODEC
Commit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the
last user of the num_dai field. Also remove the field itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 10:21:26 +01:00
Lars-Peter Clausen af0881ffbd ASoC: Remove unused 'list' field form card
The global card list was removed in commit b19e6e7b7 ("ASoC: core: Use driver
core probe deferral"). The 'list' field of the snd_soc_card struct has been
unused since then. This patch removes the field.

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
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
Mark Brown 387f837b3d Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core 2014-05-07 10:21:22 +01:00
Lars-Peter Clausen 6b0a0b3b4e ASoC: Make soc_find_matching_codec() static
The function is only used locally, make it static.

Fixes the following warning from sparse:
	sound/soc/soc-core.c:1644:22: warning: symbol 'soc_find_matching_codec' was not declared. Should it be static?

Fixes: 3ca041ed ("ASoC: dt: Allow Aux Codecs to be specified using DT")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-05 12:29:25 -07:00
Vinod Koul d98812082c ASoC: add SND_SOC_BYTES_EXT
we need _EXT version for SND_SOC_BYTES so that DSPs can use this to pass data
for DSP modules

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-02 13:44:24 -07:00
Sebastian Reichel 3ca041ed04 ASoC: dt: Allow Aux Codecs to be specified using DT
This patch adds support for specifying auxiliary codecs and
codec configuration via device tree phandles.

This change adds new fields to snd_soc_aux_dev and snd_soc_codec_conf
and adds support for the changes to SoC core methods.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-01 10:56:45 -07:00
Jarkko Nikula 4da533932d ASoC: core: Fix component_list corruption when unloading modules
This fixes module unload regressions introduced by commits 98e639fb8a
("ASoC: Track which components have been registered with
snd_soc_register_component()") and b37f1d123c ("ASoC: Let snd_soc_platform
subclass snd_soc_component").

First commit causes component_list to be corrupted when removing codec and
second when removing platform. Reason for both is that components associated
with platform or codec are never removed from the list because for them
registered_as_component field in struct snd_soc_component is always false.

Now list becomes corrupted when snd_soc_unregister_platform() or
snd_soc_unregister_codec() frees the platform or codec structure and where
the associated struct snd_soc_component is embedded.

Fix these by moving component unregistration and cleanup to a new local
function __snd_soc_unregister_component() that takes component as its
argument.

Since component is known for platforms and codecs the
__snd_soc_unregister_component() can be called directly and
snd_soc_unregister_component() takes care to find and unregister only
components that were registered using snd_soc_register_component().

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-29 10:09:11 -07:00
Lars-Peter Clausen 7b4a469e58 ASoC: Remove name_prefix unset during DAI link init hack again
This was initially removed in commit 6479f15ad ("ASoC: Remove name_prefix unset
during DAI link init hack"), but was brought back in commit 503ae5e0 ("ASoC:
core: Add helpers for dai link and aux dev init") by accident. This patch
removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-26 17:55:33 +01:00
Misael Lopez Cruz 503ae5e036 ASoC: core: Add helpers for dai link and aux dev init
Separate DAI link and aux dev initialization in preparation for
DAI multicodec support.
Since aux dev will remain using single codecs but DAI links
will be able to support multiple codecs.

No functional change.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
[fparent@baylibre.com: Adapt to 3.14+]
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-24 13:24:03 +01:00
Nicolin Chen 3dcba280f7 ASoC: core: Don't break component searching if both id and num_dai are 0
The commit e41975ed (ASoC: core: Fix the DAI name getting) added a break
within the "if (id < 0 || id >= pos->num_dai)" while the original design
of the search didn't break the loop if that condition contented but only
mark the ret error and let it go on to search the next component.

In a case like dmaengine which's not a dai but as a component sharing an
identical name with a dai, both the id and pos->num_dai here could be 0.
If we break the search, we may never find the dai we want as it might be
placed behind its dmaengine in the component list.

So this patch fixes the issue above by following the original design to
let the search carry on.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23 13:49:15 +01:00
Jyri Sarha 389cb8348c ASoC: core: Update snd_soc_of_parse_daifmt() interface
Adds struct device_node **bitclkmaster and struct device_node **framemaster
function parameters. With the new syntax bitclock-master and frame-master
properties can explicitly indicate the dai-link bit-clock and frame masters
with a phandle. This patch also makes the minimal changes to simple-card
for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears
to be the only user of snd_soc_of_parse_daifmt() for now.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23 13:14:27 +01:00
Lars-Peter Clausen 907fe36a2c ASoC: Move standard kcontrol helpers to the component level
After moving the IO layer inside ASoC to the component level we can now easily
move the standard control helpers also to the component level. This allows to
reuse the same standard helper control implementations for other components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22 13:38:21 +01:00
Mark Brown 9f68730dc8 Merge branch 'topic/multicodec' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-component 2014-04-22 13:38:14 +01:00
Lars-Peter Clausen e2c330b9b5 ASoC: Move IO abstraction to the component level
We currently have two very similar IO abstractions in ASoC, one for CODECs, the
other for platforms. Moving this to the component level will allow us to unify
those two. It will also enable us to move the standard kcontrol helpers as well
as DAPM support to the component level.

The new component level abstraction layer is primarily build around regmap.
There is a per component pointer for the regmap instance for the underlying
device. There are four new function snd_soc_component_read(),
snd_soc_component_write(), snd_soc_component_update_bits() and
snd_soc_component_update_bits_async(). They have the same signature as their
regmap counter-part and will internally forward the call one-to-one to regmap.
If the component it not using regmap it will fallback to using the custom IO
callbacks. This is done to be able to support drivers that haven't been
converted to regmap yet, but it is expected that this will eventually be removed
in the future once all component drivers have been converted to regmap.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22 13:23:35 +01:00
Mark Brown 2b17ef4071 Merge branches 'topic/sta350', 'topic/core', 'topic/dapm' and 'topic/cache' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-component 2014-04-22 13:22:52 +01:00
Christoph Jaeger b7580cde70 ASoC: core: use PTR_ERR instead of PTR_RET
PTR_RET is deprecated. PTR_ERR_OR_ZERO should be used instead. However,
we already know that IS_ERR is true, and thus PTR_ERR_OR_ZERO would
never yield zero, so we can use PTR_ERR here.

Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 17:12:35 +01:00
Misael Lopez Cruz 02c9c7b91c ASoC: core: Add function for ac97 codec registration
Add codec registration specific function in preparation
for DAI-multicodec support.

No functional change.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
[fparent@baylibre.com: Adapt to 3.14+]
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 20:37:25 +01:00
Misael Lopez Cruz 2436a723f3 ASoC: core: Add helper for DAI widgets linking
Add a helper for DAI widgets linking in preparation for
DAI-multicodec support.

No functional change.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
[fparent@baylibre.com: Adapt to 3.14+]
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 20:37:25 +01:00
Misael Lopez Cruz b0aa88af23 ASoC: core: Add helpers for codec DAI probe & remove
Add helper functions for codec DAI probe and remove in
preparation for DAI-multicodec support.

No functional change.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
[fparent@baylibre.com: Adapt to 3.14+]
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 20:37:25 +01:00
Misael Lopez Cruz 12023a9af8 ASoC: core: Add helpers for codec and codec_dai search
Add dedicated helpers for codec and codec_dai search in preparation
for DAI-multicodec. It will help reducing the extra indentation
that will be introduced by the iteration over multiple codecs.

Previous implementation unnecessarily kept searching for a matching
codec in the remaining register codecs even if it was already found.

Fix that by returning in case of matching.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
[fparent@baylibre.com: Adapt to 3.14+]
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 20:37:25 +01:00
Mark Brown aa0258adf6 Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core
Conflicts:
	sound/soc/soc-core.c
2014-04-14 17:42:28 +01:00
Bard Liao 1a39019e93 ASoC: core: Allow snd_soc_update_bits use 32 bits register
Change reg's type from unsigned short to unsigned int. So that we can use
32 bits reg value in snd_soc_update_bits.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:23:39 +01:00
Nariman Poushin b318ad5036 ASoC: core: Fail codec probe if we fail to add controls
Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:23:38 +01:00
Nariman Poushin 261edc7013 ASoC: core: Fail probe if we fail to add dai widgets
Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:23:38 +01:00
Lars-Peter Clausen b37f1d123c ASoC: Let snd_soc_platform subclass snd_soc_component
There is an increasing amount of code that is very similar between platforms,
CODECS and other components. Making platforms a component will allow us to
share this code. For now the patch just adds component and component_driver
fields to the platform and platform_driver structs and registers the platform as
a component. Followup patches will be used to consolidate code between the
different types of components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:44 +01:00
Lars-Peter Clausen 98e639fb8a ASoC: Track which components have been registered with snd_soc_register_component()
snd_soc_unregister_component() takes the parent device of the component as a
parameter and then looks up the component based on this. This is a problem if
multiple components are registered for the same parent device. Currently drivers
do not do this, but some drivers register a CPU DAI component and a platform for
the same parent device. This will become a problem once platforms are also made
components. To make sure that snd_soc_unregister_component() will not
accidentally unregister the platform in such a case only consider components
that were registered with snd_soc_register_component(). This is only meant as
short term stopgap solution to be able to continue componentisation. Long term
we'll need something different.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Lars-Peter Clausen 20a0ec27ea ASoC: Remove IO register modifier callbacks
There are no ASoC drivers left that use them and new drivers are supposed to use
regmap for this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Lars-Peter Clausen 96241c8329 ASoC: Move IO functions to soc-io.c
soc-core.c is getting quite crowded. Move all IO related functions that are
still in soc-core.c to soc-io.c

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Lars-Peter Clausen 6137a5ca32 ASoC: Prepare SOC_SINGLE_XR_SX controls for regmap
SOC_SINGLE_XR_SX controls currently only work with CODECs that set the
'reg_word_size' field in their snd_soc_codec_driver struct. Going forward
support for ASoC level IO will eventually be removed and all drivers will be
converted to regmap. Preparing for the transition this patch adds support for
CODECs using regmap for IO to the SOC_SINGLE_XR_SX control. We already have the
val_bytes field in the CODEC struct which holds the number of bytes per word,
but it is only initialized when regmap is used. Also initialize it for drivers
still using legacy IO and update the SOC_SINGLE_XR_SX handlers to use it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Xiubo Li a39f75f790 ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec()
Add the default regmap I/O setting to snd_soc_register_codec() while
the CODEC is initialising, which will be called by CODEC driver device
probe(), and then we can make XXX_set_cache_io() go away entirely from each
CODEC ASoC probe.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:18 +01:00
Takashi Iwai 69dd89fd2b ASoC: Final updates for v3.15 merge window
A few more updates from last week - use of the tdm_slot mapping from
 Xiubo plus a few smaller fixes and cleanups.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTOTo2AAoJELSic+t+oim9uGoP/js3MEs3IbvwLECnkUaEoyzs
 f80BAPlSoU/TmoBeYN8ICSZZ9a8PYOHTAQeZ5x1Wc7hCPHFzeaSjrM/KwgZJlgbg
 dQkVHDVmooNFjXiJvaqmQb/3megOIaPzPffBdSJlfE4dDhJxjlMBQtibhsoNHUzS
 33yWWxmdo1QKqD/BU0M/e0MQKvjPM9gKO9sdLaSV5fWxHug2MzqBSR4nqv0iJwX/
 i38bkj46N40VyoOwZphUiEEtXt9cldRDqAbGTi52K8tDmJYRKZpiD8LcSBLHwwAo
 VMVJCtLEZkE2B++v95s1/MoJXsc14zh5/ydYH9O8GFE5Dtu03qHxSdhTBPGFh6lb
 TUgExe+TachgQdEvEFF1/CqqxgdO7y3Q4/ns8ARAFqBzADdGaBUGVXz7TzhVrb9e
 mIf0r3IJFizK0wIjwO2hwnhygLObCBsRYNDCDTbr55zuJMN4YzQeSaTix5DINruq
 sWSSK1WfiQL49KmBJrjHqezzTYT2+Lqod82Ik5lytJl0uKFuPP8lHo5fG3C/18Kg
 OdiSBoi8SotfsOoOLJohHMg0OXhyoAm4NHs8Ts/oPUrz32u+d8mrWos5zInLMdY2
 wqqHoLMyA+ycYruW8B87BryOHf2fy7L0icDBQ+nU1YU02BhIi+CXR9tH6G6N9G+n
 G1c06a5hGSp08b3V79Zu
 =2++i
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v3.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Final updates for v3.15 merge window

A few more updates from last week - use of the tdm_slot mapping from
Xiubo plus a few smaller fixes and cleanups.
2014-03-31 12:33:09 +02:00
Mark Brown c159a85013 Merge remote-tracking branches 'asoc/topic/tdm' and 'asoc/topic/tegra' into asoc-next 2014-03-25 21:22:15 +00: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
Lars-Peter Clausen 6479f15ad7 ASoC: Remove name_prefix unset during DAI link init hack
Before we had card level support for DAPM and controls machine drivers would
register their controls and DAPM elements with the CODEC. This required us to
temporarily unset the name_prefix of a CODEC during the rtd init callback to
avoid the machine level controls getting the CODEC's prefix. Now that all
machine drivers properly register their machine level controls and DAPM elements
with the card rather than with the CODEC we can drop the hack that sets the
CODEC's name_prefix to NULL while calling the DAI link or AUX dev init callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-25 12:52:42 +00:00
Takashi Iwai c320106230 ASoC: Updates for v3.15
This is mostly a few additional fixes from Lars-Peter, a new driver and
 cleaning up a git failure with merging the Intel branch (combined with
 an xargs failure to pay attention to error codes).  The history lists a
 bunch of additional commits for the branch but the content of those
 commits is actually present already but not recorded in history due to
 git failing.  Unfortunately xargs is used in the merge script and it
 doesn't do a good job of noticing errors from the commands it invokes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTIb/oAAoJELSic+t+oim9w5gP/AnPxNltiReYgAWgkT9KfG+y
 eAD4QbAxc66FAMRicsyArM0Y+jilgFIhh9Ved6cy70oDgUuMQHU3Ma5/W4dCYdBh
 WLLz5YaCqgaHFxLKWsp2vYG4pZik0Yp7hMCC0j391/6LQyVMSTsulHy70zAbhDGK
 NpP+Z1BfB/mwDAftECGuTAmS5lJOkZ5vSkAr20n3/Omg9P/3dJ0ZixMSyVSPLyjJ
 +1lpQ0FYGwaPmfxivXBS7y5XaBQQ8yggLMlZJcNC13Ye2zB0yaBrXC8/cVyE+S3z
 5MIpwilbRsWyam2/aOa3Q5gTsTKwvWWoikIHPFTUc0qFGVr5DVea2eipuAaElPQ3
 hB7UxjhgHUEaMmpZMZp15NYieOrixS5U/es+rrugJOMp8yxazIatSipYD+P3LYeN
 I2esMnLRWr+9FGudFvwdHlmx8UQ4CDPTp1V87kibKt6SRe9GluaGnJx+YZFzH3dq
 1VZ5lA4t5Q53wTtwwsY1A7bNQxcLKwMHDr56xQMOoRZTuiBNxd5GuVQem/Obz5tg
 x+8iniasCc24pP3z95Ilx5EpW1FFyOsqXZHugup81O7SdtGuOWcrYaFVkfURVnaQ
 g04agU1ObK8bvQR2CFkux6F96nktBix9Y9PQFZrzEhKK+4qGjBSJVJBcNCKfd+NB
 btf2vWOw5jt2XodkguiZ
 =nG53
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v3.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v3.15

This is mostly a few additional fixes from Lars-Peter, a new driver and
cleaning up a git failure with merging the Intel branch (combined with
an xargs failure to pay attention to error codes).  The history lists a
bunch of additional commits for the branch but the content of those
commits is actually present already but not recorded in history due to
git failing.  Unfortunately xargs is used in the merge script and it
doesn't do a good job of noticing errors from the commands it invokes.
2014-03-13 19:03:48 +01:00