summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
AgeCommit message (Collapse)AuthorFilesLines
2017-07-03Merge remote-tracking branch 'asoc/topic/rcar' into asoc-nextMark Brown1-3/+44
2017-07-03Merge remote-tracking branch 'asoc/topic/intel' into asoc-nextMark Brown1-4/+35
2017-06-30ASoC: fix semicolon.cocci warningsWu Fengguang1-1/+1
sound/soc/soc-core.c:1961:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Fixes: 98faf436ee05 ("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-28ASoC: Drop invalid DMI fields when setting card long name from DMI infoMengdong Lin1-4/+35
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-05-24Merge branch 'topic/dai-id' of ↵Mark Brown1-0/+37
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-of-graph
2017-05-24ASoC: add snd_soc_get_dai_id() functionKuninori Morimoto1-0/+37
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-24ASoC: Fix use-after-free at card unregistrationTakashi Iwai1-2/+3
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-17ASoC: soc-core: enable "dai-format" on snd_soc_of_parse_daifmt()Kuninori Morimoto1-3/+7
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-08scripts/spelling.txt: add regsiter -> register spelling mistakeStephen Boyd1-1/+1
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-04-30Merge remote-tracking branches 'asoc/topic/uda1380', ↵Mark Brown1-0/+5
'asoc/topic/unregister', 'asoc/topic/ux500', 'asoc/topic/wm5100' and 'asoc/topic/wm8903' into asoc-next
2017-04-30Merge remote-tracking branch 'asoc/topic/intel' into asoc-nextMark Brown1-0/+5
2017-04-30Merge remote-tracking branch 'asoc/topic/core' into asoc-nextMark Brown1-11/+6
2017-04-24ASoC: Call snd_soc_set_dmi_name() unconditionallyTakashi Iwai1-0/+3
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-24ASoC: Provide a dummy wrapper of snd_soc_set_dmi_name()Takashi Iwai1-0/+2
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-05ASoC: soc-core: verify Sound Card normalityKuninori Morimoto1-0/+5
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-03-24ASoC: core: remove pointless auxiliary from snd_soc_componentKuninori Morimoto1-10/+5
commit 1a653aa44725 ("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 d2e3a1358c37 ("ASoC: Fix binding and probing of auxiliary..."). One of main purpose of commit 1a653aa44725 ("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 1a653aa44725 ("ASoC: core: replace aux_comp_list to ...") and commit d2e3a1358c37 ("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-09ASoC: don't dereference NULL pcm_{new,free}Brian Norris1-2/+6
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: 99b04f4c4051 ("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-07ASoC: Add space around '='Adrian Dinu1-1/+1
This was reported by checkpatch.pl Signed-off-by: Adrian Dinu <adrian.dinu95@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-02-27lib/vsprintf.c: remove %Z supportAlexey Dobriyan1-1/+1
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-19Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8328', ↵Mark Brown1-24/+14
'asoc/topic/fsl', 'asoc/topic/fsl-sai' and 'asoc/topic/graph' into asoc-next
2017-02-19Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/debugfs' ↵Mark Brown1-3/+1
and 'asoc/topic/doc' into asoc-next
2017-02-19Merge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/chmap', ↵Mark Brown1-0/+28
'asoc/topic/cq93vc' and 'asoc/topic/da7218' into asoc-next
2017-02-19Merge remote-tracking branch 'asoc/topic/intel' into asoc-nextMark Brown1-0/+134
2017-02-19Merge remote-tracking branch 'asoc/topic/component' into asoc-nextMark Brown1-0/+21
2017-02-04ASoC: Drop unnecessary debugfs ifdefDaniel Baluta1-2/+0
This is a relict of 6553bf06a369 ("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-01-27ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_card_nameKuninori Morimoto1-6/+5
Because prototype of OF-graph sound card support didn't have Sound Card node, commit 8f5ebb1bee15b5720741a98414767bb86f6c2b23 ("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 8f5ebb1bee15b5720741a98414767bb86f6c2b23. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_prefixKuninori Morimoto1-6/+3
Because prototype of OF-graph sound card support didn't have Sound Card node, commit b6defcca0a604129155ae472b116a2e1688d8995 ("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 b6defcca0a604129155ae472b116a2e1688d8995. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_simple_widgetsKuninori Morimoto1-6/+3
Because prototype of OF-graph sound card support didn't have Sound Card node, commit 1ef5bcd57be5c8b31286b7b47828064be25f266b ("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 1ef5bcd57be5c8b31286b7b47828064be25f266b. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-27ASoC: soc-core: remove OF adjusting for snd_soc_of_parse_audio_routingKuninori Morimoto1-6/+3
Because prototype of OF-graph sound card support didn't have Sound Card node, commit 7364c8dc255232db33bcd1c5b19eb8f34cf6108a ("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 7364c8dc255232db33bcd1c5b19eb8f34cf6108a. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-20ASoC: core: add optional pcm_new callback for DAI driverArnaud Pouliquen1-0/+28
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-17ASoC: core: Add API to use DMI name in sound card long nameLiam Girdwood1-0/+134
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-12ASoC: Fixup some small kernel-doc typosCharles Keepax1-1/+1
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-31ASoC: Fix binding and probing of auxiliary componentsSylwester Nawrocki1-5/+5
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: 1a653aa44725 "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-15ASoC: add Component level pcm_new/pcm_freeKuninori Morimoto1-0/+21
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-12Merge remote-tracking branches 'asoc/topic/tlv320aic31xx', ↵Mark Brown1-0/+42
'asoc/topic/topology', 'asoc/topic/uda1380', 'asoc/topic/wm2200' and 'asoc/topic/wm8523' into asoc-next
2016-12-12Merge remote-tracking branches 'asoc/topic/of-graph', 'asoc/topic/pxa', ↵Mark Brown1-15/+26
'asoc/topic/qcom' and 'asoc/topic/rk808' into asoc-next
2016-12-12Merge remote-tracking branch 'asoc/topic/core' into asoc-nextMark Brown1-2/+6
2016-12-01ASoC: add Component level suspend/resumeKuninori Morimoto1-26/+37
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-01ASoC: core: replace aux_comp_list to component_dev_listKuninori Morimoto1-5/+12
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-01ASoC: core: replace codec_dev_list to component_dev_list on CardKuninori Morimoto1-12/+16
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-11-11ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgetsKuninori Morimoto1-3/+6
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-11ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_nameKuninori Morimoto1-5/+6
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-11ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefixKuninori Morimoto1-3/+6
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-11ASoC: soc-core: snd_soc_get_dai_name() become non staticKuninori Morimoto1-1/+2
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-11ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routingKuninori Morimoto1-3/+6
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-09ASoC: core: If a platform doesn't have an of_node use parent's nodeCharles Keepax1-2/+6
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 3e0aa8d83bf8 ("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-04ASoC: Define API to find a dai linkMengdong Lin1-0/+42
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-09-29Merge remote-tracking branches 'asoc/topic/nau8810', 'asoc/topic/of-bool', ↵Mark Brown1-1/+1
'asoc/topic/omap' and 'asoc/topic/platform-drvdata' into asoc-next
2016-09-29Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ak4104', ↵Mark Brown1-13/+0
'asoc/topic/arizona', 'asoc/topic/atmel' and 'asoc/topic/codec-component' into asoc-next
2016-08-24Merge remote-tracking branches 'asoc/fix/atmel', 'asoc/fix/compress', ↵Mark Brown1-2/+1
'asoc/fix/da7213' and 'asoc/fix/debugfs' into asoc-linus