aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/generic
AgeCommit message (Collapse)Author
2021-05-14ASoC: simple-card: fix possible uninitialized single_cpu local variableKrzysztof Kozlowski
[ Upstream commit fa74c223b6fd78a5314b4c61b9abdbed3c2185b4 ] The 'single_cpu' local variable is assigned by asoc_simple_parse_dai() and later used in a asoc_simple_canonicalize_cpu() call, assuming the entire function did not exit on errors. However the first function returns 0 if passed device_node is NULL, thus leaving the variable uninitialized and reporting success. Addresses-Coverity: Uninitialized scalar variable Fixes: 8f7f298a3337 ("ASoC: simple-card-utils: separate asoc_simple_card_parse_dai()") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Acked-by: Sameer Pujar <spujar@nvidia.com> Link: https://lore.kernel.org/r/20210407092027.60769-1-krzysztof.kozlowski@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-24ASoC: simple-card-utils: Do not handle device clockSameer Pujar
commit 8ca88d53351cc58d535b2bfc7386835378fb0db2 upstream. This reverts commit 1e30f642cf29 ("ASoC: simple-card-utils: Fix device module clock"). The original patch ended up breaking following platform, which depends on set_sysclk() to configure internal PLL on wm8904 codec and expects simple-card-utils to not update the MCLK rate. - "arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var3-ads2.dts" It would be best if codec takes care of setting MCLK clock via DAI set_sysclk() callback. Reported-by: Michael Walle <michael@walle.cc> Suggested-by: Mark Brown <broonie@kernel.org> Suggested-by: Michael Walle <michael@walle.cc> Fixes: 1e30f642cf29 ("ASoC: simple-card-utils: Fix device module clock") Signed-off-by: Sameer Pujar <spujar@nvidia.com> Tested-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/1615829492-8972-2-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-04ASoC: simple-card-utils: Fix device module clockSameer Pujar
[ Upstream commit 1e30f642cf2939bbdac82ea0dd3071232670b5ab ] If "clocks = <&xxx>" is specified from the CPU or Codec component device node, the clock is not getting enabled. Thus audio playback or capture fails. Fix this by populating "simple_dai->clk" field when clocks property is specified from device node as well. Also tidy up by re-organising conditional statements of parsing logic. Fixes: bb6fc620c2ed ("ASoC: simple-card-utils: add asoc_simple_card_parse_clk()") Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Sameer Pujar <spujar@nvidia.com> Link: https://lore.kernel.org/r/1612939421-19900-2-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-09-09SoC: simple-card-utils: set 0Hz to sysclk when shutdownKatsuhiro Suzuki
This patch set 0Hz to sysclk when shutdown the card. Some codecs set rate constraints that derives from sysclk. This mechanism works correctly if machine drivers give fixed frequency. But simple-audio and audio-graph card set variable clock rate if 'mclk-fs' property exists. In this case, rate constraints will go bad scenario. For example a codec accepts three limited rates (mclk / 256, mclk / 384, mclk / 512). Bad scenario as follows (mclk-fs = 256): - Initialize sysclk by correct value (Ex. 12.288MHz) - Codec set constraints of PCM rate by sysclk 48kHz (1/256), 32kHz (1/384), 24kHz (1/512) - Play 48kHz sound, it's acceptable - Sysclk is not changed - Play 32kHz sound, it's acceptable - Set sysclk to 8.192MHz (= fs * mclk-fs = 32k * 256) - Codec set constraints of PCM rate by sysclk 32kHz (1/256), 21.33kHz (1/384), 16kHz (1/512) - Play 48kHz again, but it's NOT acceptable because constraints do not allow 48kHz So codecs treat 0Hz sysclk as signal of applying no constraints to avoid this problem. Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Link: https://lore.kernel.org/r/20190907174501.19833-1-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-03ASoC: audio-graph: indicate rebind issueKuninori Morimoto
ALSA SoC try to rebind Sound Card if Card/CPU/Codec/Platform were unbinded and re-binded again. But, Audio Graph Card might can't rebind again if user do for example unbind CPU or Codec driver bind CPU or Codec driver Because Audio Graph Card is still pointing old/unbinded CPU or Codec driver's DAI name at dlc->dai_name. To avoid this issue, it needs to alloc memory and keep DAI name even though if CPU or Codec driver was unbinded. Or, always do unbind/bind at Sound Card. For now, this patch indicates this issue as FIXME. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sgpdu75m.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-03ASoC: simple-card: indicate rebind issueKuninori Morimoto
ALSA SoC try to rebind Sound Card if Card/CPU/Codec/Platform were unbinded and re-binded again. But, Simple Card might can't rebind again if user do for example unbind CPU or Codec driver bind CPU or Codec driver Because Simple Card is still pointing old/unbinded CPU or Codec driver's DAI name at dlc->dai_name. To avoid this issue, it needs to alloc memory and keep DAI name even though if CPU or Codec driver was unbinded. Or, always do unbind/bind at Sound Card. For now, this patch indicates this issue as FIXME. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tv9tu75x.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-09ASoC: simple-card: use snd_soc_dai_link_component for aux_devKuninori Morimoto
We can use snd_soc_dai_link_component to specify aux_dev. Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87wofo6wc1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-26Merge branch 'asoc-5.3' into asoc-5.4Mark Brown
2019-07-11ASoC: audio-graph-card: add missing const at graph_get_dai_id()Kuninori Morimoto
commit c152f8491a8d9 ("ASoC: audio-graph-card: fix an use-after-free in graph_get_dai_id()") fixups use-after-free issue, but, it need to use "const" for reg. This patch adds it. We will have below without this patch LINUX/sound/soc/generic/audio-graph-card.c: In function 'graph_get_dai_id': LINUX/sound/soc/generic/audio-graph-card.c:87:7: warning: assignment discards\ 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] reg = of_get_property(node, "reg", NULL); Fixes: c152f8491a8d9 ("ASoC: audio-graph-card: fix an use-after-free in graph_get_dai_id()") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Wen Yang <wen.yang99@zte.com.cn> Link: https://lore.kernel.org/r/87sgrd43ja.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-10ASoC: audio-graph-card: fix an use-after-free in graph_get_dai_id()Wen Yang
After calling of_node_put() on the node variable, it is still being used, which may result in use-after-free. Fix this issue by calling of_node_put() after the last usage. Fixes: a0c426fe1433 ("ASoC: simple-card-utils: check "reg" property on asoc_simple_card_get_dai_id()") Link: https://lore.kernel.org/r/1562743509-30496-5-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-10ASoC: audio-graph-card: fix use-after-free in graph_dai_link_of_dpcm()Wen Yang
After calling of_node_put() on the ports, port, and node variables, they are still being used, which may result in use-after-free. Fix this issue by calling of_node_put() after the last usage. Fixes: dd98fbc558a0 ("ASoC: audio-graph-card: cleanup DAI link loop method - step1") Link: https://lore.kernel.org/r/1562743509-30496-4-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-10ASoC: simple-card: fix an use-after-free in simple_for_each_link()Wen Yang
The codec variable is still being used after the of_node_put() call, which may result in use-after-free. Fixes: d947cdfd4be2 ("ASoC: simple-card: cleanup DAI link loop method - step1") Link: https://lore.kernel.org/r/1562743509-30496-3-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-10ASoC: simple-card: fix an use-after-free in simple_dai_link_of_dpcm()Wen Yang
The node variable is still being used after the of_node_put() call, which may result in use-after-free. Fixes: cfc652a73331 ("ASoC: simple-card: tidyup prefix for snd_soc_codec_conf") Link: https://lore.kernel.org/r/1562743509-30496-2-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-10ASoC: simple-card-utils: care no Platform for DPCMKuninori Morimoto
commit 34614739988ad ("ASoC: soc-core: support dai_link with platforms_num != 1") supports multi Platform, and commit 9f3eb91753451 ("ASoC: simple-card-utils: consider CPU-Platform possibility") removed no Platform from simple-card. Multi Platform is now checking both Platform name/of_node are NULL case. But in normal case, DPCM be doesn't have Platform. asoc_simple_canonicalize_platform() try to use CPU of_node to Platform (This is needed for DMAEngine platform case), but it still might be NULL at DPCM be. This patch try to use no Platform after that if Platform of_node is still NULL. It can't probe without this patch. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87muhmgw2o.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-06Merge branch 'asoc-5.3' into asoc-nextMark Brown
2019-07-06Merge branch 'asoc-5.2' into asoc-linusMark Brown
2019-07-04ASoC: audio-graph-card: fix use-after-free in graph_for_each_linkWen Yang
After calling of_node_put() on the codec_ep and codec_port variables, they are still being used, which may result in use-after-free. We fix this issue by calling of_node_put() after the last usage. Fixes: fce9b90c1ab7 ("ASoC: audio-graph-card: cleanup DAI link loop method - step2") Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Link: https://lore.kernel.org/r/1562229530-8121-1-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-28ASoC: simple-card-utils: consider CPU-Platform possibilityKuninori Morimoto
commit 6f0437445735 ("ASoC: simple-card-utils: don't select unnecessary Platform") Current ALSA SoC avoid to add duplicate component to rtd, and this driver was selecting CPU component as Platform component. Thus, above patch removed Platform settings from this driver, because it assumed these are same component. But, some CPU driver is using generic DMAEngine, in such case, both CPU component and Platform component will have same of_node/name. In other words, there are some components which are different but have same of_node/name. In such case, Card driver definitely need to select Platform even though it is same as CPU. It is depends on CPU driver, but is difficult to know it from Card driver. This patch reverts above patch. Fixes: commit 6f0437445735 ("ASoC: simple-card-utils: don't select unnecessary Platform") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-26Merge tag 'v5.2-rc6' into asoc-5.3Mark Brown
Linux 5.2-rc6
2019-06-19ASoC: simple-card-utils: don't select unnecessary PlatformKuninori Morimoto
ALSA SoC is now supporting "no Platform". Sound card doesn't need to select "CPU component" as "Platform" anymore if it doesn't need special Platform. This patch removes such settings. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-06ASoC: simple-card: support snd_soc_dai_link_component style for cpuKuninori Morimoto
ASoC supports modern style dai_link (= snd_soc_dai_link_component) for CPU. legacy style dai_link (= cpu_dai_name, cpu_name, cpu_of_node) are no longer needed. This patch switches to modern style. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-30Merge branch 'asoc-5.2' into asoc-5.3Mark Brown
2019-05-24ASoC: simple-card: Restore original configuration of DAI formatJon Hunter
Revert commit 069d037aea98 ("ASoC: simple-card: Fix configuration of DAI format"). During further review, it turns out that the actual issue was caused by an incorrectly formatted device-tree node describing the soundcard. The following is incorrect because the simple-audio-card 'bitclock-master' and 'frame-master' properties should not reference the actual codec phandle ... sound { compatible = "simple-audio-card"; ... => simple-audio-card,bitclock-master = <&codec>; => simple-audio-card,frame-master = <&codec>; ... simple-audio-card,cpu { sound-dai = <&xxx>; }; simple-audio-card,codec { => sound-dai = <&codec>; }; }; Rather, these properties should reference the phandle to the 'simple-audio-card,codec' property as shown below ... sound { compatible = "simple-audio-card"; ... => simple-audio-card,bitclock-master = <&codec>; => simple-audio-card,frame-master = <&codec>; ... simple-audio-card,cpu { sound-dai = <&xxx>; }; => codec: simple-audio-card,codec { /* simple-card wants here */ sound-dai = <&xxx>; /* not here */ }; }; Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-21Merge branch 'for-5.2' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.3
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20ASoC: simple-card: Fix configuration of DAI formatJon Hunter
When configuring a codec to be both bit-clock and frame-master, it was found that the codec was always configured as bit-clock and frame-slave. Looking at the simple_dai_link_of() function there appears to be two problems with the configuration of the DAI format, which are ... 1. The function asoc_simple_parse_daifmt() is called before the function asoc_simple_parse_codec() and this means that the device-tree node for the codec has not been parsed yet, which is needed by the function asoc_simple_parse_daifmt() to determine who is the codec. 2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to the 'codec' node and not the phandle of the actual codec defined by the 'sound-dai' property under the 'codec' node. Fix the above by moving the call to asoc_simple_parse_daifmt() after the the call to asoc_simple_parse_codec() and pass the phandle for the codec to asoc_simple_parse_daifmt(). Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-20ASoC: rename functions that pollute the simple_xxx namespaceAmir Goldstein
include/linux/fs.h defines a bunch of simple fs helpers, (e.g. simple_rename) and we intend to add an fs helper named simple_remove. Rename the ASoC driver static functions, so they will not collide with the upcoming fs helper function name. Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-26ASoC: simple-card: Read pin switches conf from devicetreePaul Cercueil
When the routing path between a widget (e.g. "Speaker") and the codec goes through an external amplifier, having a pin switch for this widget allows the amplifier to be disabled when the widget is not to be used (e.g. when using headphones). Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-26ASoC: simple-card-utils: add asoc_simple_parse_pin_switches()Paul Cercueil
This function is a helper that permits to create pin switch controls for a list of widgets whose names are listed in the PREFIX "pin-switches" devicetree property. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04Merge branch 'asoc-5.1' into asoc-5.2Mark Brown
2019-04-04ASoC: simple-card: don't select DPCM via simple-audio-cardKuninori Morimoto
commit da215354eb55c ("ASoC: simple-card: merge simple-scu-card") merged simple-scu-audio-card which can handle DPCM into simple-audio-card. By this patch, the judgement to select "normal sound card" or "DPCM sound card" is based on its CPU/Codec DAI count. But, because of it, existing "simple-audio-card" user who is assuming "normal sound card" might select DPCM unintentionally. To solve this issue, this patch allows "simple-audio-card" user can select "normal sound card", and "simple-scu-audio-card" user can select both "normal sound card" and "DPCM sound card". This keeps compatibility collectry. Fixes: da215354eb55c ("ASoC: simple-card: merge simple-scu-card") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04ASoC: audio-graph-card: don't select DPCM via audio-graph-cardKuninori Morimoto
commit ae3cb5790906b ("ASoC: audio-graph-card: merge audio-graph-scu-card") merged audio-graph-scu-card which can handle DPCM into audio-graph-card. By this patch, the judgement to select "normal sound card" or "DPCM sound card" is based on its OF-graph endpoint connection. But, because of it, existing "audio-graph-card" user who is assuming "normal sound card" might select DPCM unintentionally. To solve this issue, this patch allows "audio-graph-card" user can select "normal sound card", and "audio-graph-scu-card" user can select both "normal sound card" and "DPCM sound card". This keeps compatibility collectry. Fixes: ae3cb5790906b ("ASoC: audio-graph-card: merge audio-graph-scu-card") Reported-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-01ASoC: simple-card-utils: remove set but not used variable 'dai_name'YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning: sound/soc/generic/simple-card-utils.c: In function 'asoc_simple_parse_clk': sound/soc/generic/simple-card-utils.c:164:18: warning: parameter 'dai_name' set but not used [-Wunused-but-set-parameter] It's not used since commit 0580dde59438 ("ASoC: simple-card-utils: add asoc_simple_debug_info()"), so can be removed. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: test memory allocationKuninori Morimoto
li->conf will be 0 if it was not DPCM case. Then, 1) we shouldn't call devm_kcalloc() with size 0, 2) we need NULL pointer check if li->conf was not 0. This patch fixed above issues. Special thanks to Pierre-Louis Bossart Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: rename asoc_simple_card_xxx() to asoc_simple_()Kuninori Morimoto
Current simple-card-utils is using asoc_simple_card_xxx() for each function naming, but it is very verbose. Thus it is easy to be over 80 char. This patch renames it to asoc_simple_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: separate asoc_simple_card_parse_dai()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph are using asoc_simple_card_parse_dai() which is different implementation. But, these are implemanted at simple-card-utils. It should be implemanted at each files. This patch separate these into each files. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: share asoc_simple_card_init_priv()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph are initializing each priv, but it is same operation. This patch adds new asoc_simple_card_init_priv() and initialize priv by same operation. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: share asoc_simple_be_hw_params_fixup()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph have almost same functions. This patch shares asoc_simple_be_hw_params_fixup() between in these 2 drivers. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: share asoc_simple_dai_init()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph have almost same functions. This patch shares asoc_simple_dai_init() between in these 2 drivers. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: share asoc_simple_hw_param()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph have almost same functions. This patch shares asoc_simple_hw_param() between in these 2 drivers. One note is that only simple-card supports simple_set_clk_rate() at hw_param from commit e9be4ffd4f40fcb ("ASoC: simple-card: set cpu dai clk in hw_params"). By this patch, audio-graph has same feature. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: share asoc_simple_shutdown()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph have almost same functions. This patch shares asoc_simple_shutdown() between in these 2 drivers. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: share asoc_simple_startup()Kuninori Morimoto
The difference between simple-card / audio-graph are just using OF graph style, or not. In other words, other things should be same. This means, simple-card/audio-graph common functions should be implemented at simple-card-utils, and its own functions should be implemented at each files. Current simple-card / audio-graph have almost same functions. This patch shares asoc_simple_startup() between in these 2 drivers. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple_card_utils: share common priv for simple-card/audio-graphKuninori Morimoto
Historically, simple-card/simple-scu-card/audio-graph/audio-graph-scu are similar but different generic sound card. simple-scu-card which was for DPCM was merged into simple-card, and audio-graph-scu which was for DPCM was merged into audio-graph. simple-card is for non OF graph sound card, and audio-graph is for OF graph sound card. And, small detail difference (= function parameter, naming, etc) between simple-card/audio-graph has been unified. So today, the difference between simple-card/audio-graph are just using OF graph style, or not. In other words, there should no difference other than OF graph sytle. simple-card/audio-graph are using own priv today , but we can merge it. This patch merge it at simple_card_utils. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: simple-card-utils: add asoc_simple_debug_info()Kuninori Morimoto
Current simple-card-utils has dev_dbg(), but people want to add #define DEBUG at simple-card/audio-graph, not simple-card-utils. And, people want to get all information. This patch adds new asoc_simple_debug_info() to indicates information. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-18ASoC: audio-graph: add graph_parse_mclk_fs()Kuninori Morimoto
It is parsing mclk_fs at many places, but it should be same operation. This patch adds graph_parse_mclk_fs() and parse it. This patch also renames similar function graph_get_conversion() to graph_parse_convert(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-18ASoC: audio-graph: rename graph_get_conversion() to graph_parse_convert()Kuninori Morimoto
use same naming rule, and this patch add missing of_node_put() on it Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-18ASoC: simple-card: add simple_parse_mclk_fs()Kuninori Morimoto
It is parsing mclk_fs at many places, but it should be same operation. This patch adds simple_parse_mclk_fs() and parse it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-18ASoC: simple-card: rename simple_get_conversion() to simple_parse_convert()Kuninori Morimoto
use same naming rule Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-20ASoC: simple-card: Fix of-node refcount unbalance in DAI-link parserTakashi Iwai
The function simple_for_each_link() has a few missing places that forgot unrefereing of-nodes after the use. The main do-while loop may abort when loop=0, and this leaves the node object still referenced. A similar leak is found in the error handling of NULL codec that aborts the loop as well. Last but not least, the inner for_each_child_of_node() loop may abort in the middle, and this leaks the refcount of the iterator node. This patch addresses these missing refcount issues. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-20ASoC: simple-card: Fix missing of_node_put() at simple_dai_link_of()Takashi Iwai
We forgot to unreference the platform node object obtained from of_get_child_by_name(). This leads to the unbalance of node refcount. Fixes: e0ae225b7e96 ("ASoC: simple-card: support platform in dts parse") Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>