summaryrefslogtreecommitdiff
path: root/sound/soc/generic/simple-card-utils.c
AgeCommit message (Collapse)Author
2023-12-18ASoC: simple-card-utils: Drop GPIO includeLinus Walleij
The generic card utilities are including the legacy GPIO header <linux/gpio.h> but not using any symbols from it. Drop the include from all files. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://msgid.link/r/20231214-gpio-descriptors-sound-misc-v1-3-e3004176bd8b@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-14ASoC: audio-graph-card2: Introduce playback-only/capture-only DAI link flagsDaniel Baluta
We need this to support MICFIL PDM found on i.MX8MP where the DAI link supports only capture direction. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://msgid.link/r/20231128081119.106360-2-daniel.baluta@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-23ASoC: simple-card-utils: Make simple_util_remove() return voidUwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. simple_util_remove() returned zero unconditionally. Make it return void instead and convert all users to struct platform_device::remove_new(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Herve Codina <herve.codina@bootlin.com> Link: https://lore.kernel.org/r/20231013221945.1489203-13-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26ASoC: Merge up fixesMark Brown
For the benefit of CI.
2023-09-25ASoC: generic: convert not to use asoc_xxx()Kuninori Morimoto
ASoC is now unified asoc_xxx() into snd_soc_xxx(). This patch convert asoc_xxx() to snd_soc_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87h6o0qnho.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25ASoC: simple_card_utils.h: convert not to use asoc_xxx()Kuninori Morimoto
ASoC is using 2 type of prefix (asoc_xxx() vs snd_soc_xxx()), but these are unified into snd_soc_xxx(). simple_card / audio_graph drivers are historically using asoc_xxx() prefix too. simple_card / audio_graph are not ASoC framework, so let's use simple_card_xxx_() / audio_graph_xxx() for global function prefix. This patch has asoc_xxx() as define to keep compatible. It will be removed if all drivers were switched to new style. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87edj4s26a.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-19ASoC: simple-card-utils: fixup simple_util_startup() error handlingKuninori Morimoto
It should use "goto" instead of "return" Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/all/202309141205.ITZeDJxV-lkp@intel.com/ Closes: https://lore.kernel.org/all/202309151840.au9Aa2W4-lkp@intel.com/ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v8c76jnz.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-17ASoC: simple-card-utils.c: enable multi Component supportKuninori Morimoto
If CPU/Codec driver keeps its DAI node, we can directly identify actual DAI by using snd_soc_get_dai_via_args(). This means we can use multi Component. This patch enables multi Component support on Audio Graph Card/Card2. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a5w4o949.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-17ASoC: soc-core.c: add snd_soc_dlc_use_cpu_as_platform()Kuninori Morimoto
Current snd_soc_is_matching_component() checks "of_node" or "dai_args". Thus coping "of_node" only is not enough to use CPU as Platform. This patch adds snd_soc_dlc_use_cpu_as_platform() and help it. This is helper function for multi Component support. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87cz10o94k.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-20ASoC: simple-card.c: use snd_soc_{of_}get_dlc()Kuninori Morimoto
Current ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component). But we now can use snd_soc_{of_}get_dlc() for it. Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87fs6mdgmc.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-16ASoC: Merge fixes due to dependenciesMark Brown
So we can apply the tlv320aic3xxx DT conversion.
2023-06-15ASoC: simple_card_utils: remove unused cpus/codecs/platforms from propsKuninori Morimoto
simple_dai_props has cpus/codecs/platforms. These pointer were used for dai_link before, but are allocated today since commit 050c7950fd70 ("ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform"). We don't need to keep it anymore. This patch removes these. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87bkhhxpc6.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-14ASoC: simple-card-utils.c: share asoc_graph_parse_dai()Kuninori Morimoto
Current Audio Graph Card/Card2 implements asoc_simple_parse_dai() on each driver, but these are same function. This patch share it as asoc_graph_parse_dai(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87o7lihpvy.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-02ASoC: simple-card-utils: fix PCM constraint error checkRobert Hancock
The code in asoc_simple_startup was treating any non-zero return from snd_pcm_hw_constraint_minmax as an error, when this can return 1 in some normal cases and only negative values indicate an error. When this happened, it caused asoc_simple_startup to disable the clocks it just enabled and return 1, which was not treated as an error by the calling code which only checks for negative return values. Then when the PCM is eventually shut down, it causes the clock framework to complain about disabling clocks that were not enabled. Fix the check for snd_pcm_hw_constraint_minmax return value to only treat negative values as an error. Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag") Signed-off-by: Robert Hancock <robert.hancock@calian.com> Link: https://lore.kernel.org/r/20230602011936.231931-1-robert.hancock@calian.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-08ASoC: simple_card_utils.c: use asoc_dummy_dlcKuninori Morimoto
Now we can share asoc_dummy_dlc. This patch use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87ttx6ypi3.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org
2023-04-05ASoC: audio-graph-card2: switch to use c2c_params instead of paramsKuninori Morimoto
ASoC is now using c2c_params instead of params. This patch replace it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87mt3pc2la.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-22ASoC: simple-card: add comment to indicate don't remove platformsKuninori Morimoto
Basically CPU and Platform are different Component, but if CPU is using soc-generic-dmaengine-pcm, same dev will be shared between CPU and Platform, and Simple Card had been supporting it. When we focus to clean up Simple Card driver, we tend to remove platforms if no Platform was selected, but it is wrong because of above reasons. This patch adds comment why we shouldn't remove platforms. In case of CPU is not using soc-generic-dmaengine-pcm, CPU and Platform will be duplicated, but it will be ignored by snd_soc_rtd_add_component(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/875yattwqv.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-27ASoC: simple-card-utils: create jack inputs for aux_devsAstrid Rost
Add a generic way to create jack inputs for auxiliary jack detection drivers (e.g. via i2c, spi), which are not part of any real codec. The simple-card can be used as combining card driver to add the jacks, no new one is required. Create a jack (for input-events) for jack devices in the auxiliary device list (aux_devs). A device which returns a valid value on get_jack_type counts as jack device; set_jack is required to add the jack to the device. Signed-off-by: Astrid Rost <astrid.rost@axis.com> Link: https://lore.kernel.org/r/20230123135913.2720991-3-astrid.rost@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-07ASoC: simple-card-utils: remove asoc_simple_convert_fixup()Kuninori Morimoto
No one is using asoc_simple_convert_fixup(), we don't need to export its symbol. This patch removes it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/874jvj8ftp.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-10-19ASoC: simple-card: Fix up checks for HW param fixupsAidan MacDonald
The "convert-xxx" properties only have an effect for DPCM DAI links. A DAI link is only created as DPCM if the device tree requires it; part of this involves checking for the use of "convert-xxx" properties. When the convert-sample-format property was added, the checks got out of sync. A DAI link that specified only convert-sample-format but did not pass any of the other DPCM checks would not go into DPCM mode and the convert-sample-format property would be silently ignored. Fix this by adding a function to do the "convert-xxx" property checks, instead of open-coding it in simple-card and audio-graph-card. And add "convert-sample-format" to the check function so that DAI links using it will be initialized correctly. Fixes: 047a05366f4b ("ASoC: simple-card-utils: Fixup DAI sample format") Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> Acked-by: Sameer Pujar <spujar@nvidia.com> Link: https://lore.kernel.org/r/20221019012302.633830-1-aidanmacdonald.0x0@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07ASoC: simple-card-utils: switch to using gpiod APIDmitry Torokhov
This patch switches the driver away from legacy gpio/of_gpio API to gpiod API, and removes use of of_get_named_gpio_flags() which I want to make private to gpiolib. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/YxeaITtlJexygQo9@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-15ASoC: simple-card-utils: Fixup DAI sample formatSameer Pujar
Parse "convert-sample-format" DT binding and fixup the sample format as applicable. This is similar to the existing "convert-channels" and "convert-rate" properties for channels and rate fixup respectively. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/1659936452-2254-4-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-08ASoC: simple-card-utils.c: care Codec2Codec vs DPCM:BEKuninori Morimoto
Current asoc_simple_init_for_codec2codec() adds default Codec2Codec settings if rtd was Codec only. But DPCM:BE also judged as Codec only, because dummy-DAI doesn't have "endianness" (which is key parameter to judge as Codec). This patch ignores setup Codec2Codec settings if it was DPCM:BE case. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a69ts950.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-08ASoC: simple-card-utils.c: ignore Codec2Codec setting if it already haveKuninori Morimoto
Audio Graph Card2 setups own Codec2Codec settings, but current simple-card-utils.c will try to setup Codec2Codec default settings if needed, it will overwirtes the settings. This patch ignores default Codec2Codec settings if it already have. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87bku9s95b.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-08ASoC: audio-graph-card2.c: remove pre-alloced Codec2Codec spaceKuninori Morimoto
Because Codec2Codec settings becomes optional, we don't need to keep its parameter space when init time. This patch removes its default memory allocation from simple-card-utils.c, and allocate it at audio-graph-card2 ondemand. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87edz5s95o.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-09Specify clock provider directly to CPU DAIsMark Brown
Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>: Currently the set_fmt callback always passes clock provider/consumer with respect to the CODEC. This made sense when the framework was directly broken down into platforms and CODECs. However, as things are now broken down into components which can be connected as either the CPU or CODEC side of a DAI link it simplifies things if each side of the link is just told if it is provider or consumer of the clocks. Making this change allows us to remove one of the last parts of the ASoC core that needs to know if a driver is a CODEC driver, where it flips the clock format specifier if a CODEC driver is used on the CPU side of a DAI link, as well as just being conceptually more consistent with componentisation. The basic idea of this patch chain is to change the set_fmt callback from specifying if the CODEC is provider/consumer into directly specifying if the component is provider/consumer. To do this we add some new defines, and then to preserve bisectability, the migration is done by adding a new callback, converting over all existing CPU side drivers, converting the core, and then finally reverting back to the old callback. Converting the platform drivers makes sense as the existing defines are from the perspective of the CODEC and there are more CODEC drivers than platform drivers. Obviously a fair amount of this patch chain I was only able to build test, so any testing that can be done would be greatly appreciated.
2022-06-07ASoC: simple-card-utils: Make asoc_simple_clean_reference() return voidUwe Kleine-König
asoc_simple_clean_reference() returns zero unconditionally. Letting it return void instead makes it easier to see in the caller that there is no error to handle. This is a preparation for making platform remove callbacks return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220605153537.26591-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06ASoC: simple-card-utils: rename asoc_simple_init_dai_link_params() to ↵Kuninori Morimoto
asoc_simple_init_for_codec2codec() commit 95cfc0a0aaf5752071 ("ASoC: simple-card: Add support for codec2codec DAI links") added the function asoc_simple_init_dai_link_params() to initialize dai_link "params". It is very straight naming, but difficult to noticed that it is for Codec2Codec support. Handling Codec2Codec is one of very tricky part on ALSA SoC, thus it is very important to clarify it. This patch renames the function name. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87o7zflk3n.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06ASoC: simple-card-utils: Move snd_soc_component_is_codec to be localCharles Keepax
The helper function snd_soc_component_is_codec is based off the presence of the non_legacy_dai_naming flag. This isn't super robust as CPU side components may also specify this flag, and indeed the kernel already contains a couple that do. After componentisation there isn't really a totally robust solution to identifying what is a CODEC driver, without introducing a flag specifically for that purpose, and really the desirable direction to move in is that the distinction doesn't matter. This patch does two things to try to mitigate these problems. Firstly, now that all the other users of the helper function have been removed, it makes the helper function local to the driver rather, than being part of the core. This should help to discourage any new code from being created that depends on the CODEC driver distinction. Secondly, it updates the helper function itself to use the endianness flag rather than the non_legacy_dai_naming flag. The endianness flag is definitely invalid on a CPU side component, so it a more reliable indicator that the device is definitely a CODEC. The vast majority of buses require the CODEC to set the endianness flag, so the number of corner cases should be fairly minimal. It is worth noting that CODECs sending audio over SPI, or built into the CPU CODECs are potential corner cases, however the hope is that in most cases those types of devices do not consitute a simple audio card. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-57-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-04ASoC: Pull in fixesMark Brown
Cleanups for the dmaengine code build on top of current fixes.
2022-04-20ASoC: simple-card-utils: fix sysclk shutdownOlivier Moysan
In asoc_simple_shutdown() the snd_soc_dai_set_sysclk() function is called twice with input direction SND_SOC_CLOCK_IN. Restore one call with output direction SND_SOC_CLOCK_OUT. Fixes: 5ca2ab459817 ("ASoC: simple-card-utils: Add new system-clock-fixed flag") Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/20220412111658.11015-1-olivier.moysan@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-14ASoC: soc-card: Create jack kcontrol without pinsAkihiko Odaki
snd_soc_card_jack_new() allowed to create jack kcontrol without pins, but did not create kcontrols. The jack would not have kcontrols if pins were not going to be added. This renames the old snd_soc_card_jack_new() to snd_soc_card_jack_new_pins() for use when pins are provided or will be added later. The new snd_soc_card_jack_new() appropriately creates a jack for use without pins and adds a kcontrol. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-06ASoC: simple-card-utils: Avoid NULL deref in asoc_simple_set_tdm()Richard Fitzgerald
Don't dereference simple_dai before it has been checked for NULL. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 1e974e5b82b3 ("ASoC: audio_graph_card2: Add support for variable slot widths") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20220404113252.1152659-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-11ASoC: simple-card-utils: Don't reset clock of active DAISameer Pujar
Playback or capture errors are seen when clock is reset during an active stage of DAI. Presently this scenario happens when DAI has both playback and capture sessions running and one of these finishes first which will be followed by clock rate reset. The remaining active session will be affected in such case. Address this problem by allowing clock rate reset to happen only when the DAI is no more active. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/1646910999-2501-1-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07ASoC: audio_graph_card2: Add support for variable slot widthsRichard Fitzgerald
Some audio hardware cannot support the same slot width for all sample widths, or a slot width equal to the sample width for all sample widths. This is usually due either to limitations of the audio serial port or system clocking restrictions. A typical example would be: - 16-bit samples in 16-bit slots - 24-bit samples in 32-bit slots The new dai-tdm-slot-width-map property allows setting a mapping of sample widths and the corresponding tdm slot widths and slot counts. Although the slot count is usually the same for all cases this does allow for adding padding slots to maintain the same bitclk frequency. The property is added to each endpoint node that needs the component DAI to be told the TDM slot width and count. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220228172754.453783-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-24ASoC: simple-card-utils: Add new system-clock-fixed flagRobert Hancock
Add a new system-clock-fixed flag, which can be used to specify that the driver cannot or should not allow the clock frequency of the mapped clock to be modified. This behavior is also implied if the system-clock-frequency parameter is set explicitly - the flag is meant for cases where a clock is mapped to the DAI but which is, or should be treated as, fixed. When mclk-fs is also specified, this causes a PCM constraint to be added which enforces that only the corresponding valid sample rate can be used. Signed-off-by: Robert Hancock <robert.hancock@calian.com> Link: https://lore.kernel.org/r/20220120195832.1742271-7-robert.hancock@calian.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-24ASoC: simple-card-utils: Set sysclk on all componentsRobert Hancock
If an mclk-fs value was provided in the device tree configuration, the calculated MCLK was fed into the downstream codec DAI and CPU DAI, however set_sysclk was not being called on the platform device. Some platform devices such as the Xilinx Audio Formatter need to know the MCLK as well. Call snd_soc_component_set_sysclk on each component in the stream to set the proper sysclk value in addition to the existing call of snd_soc_dai_set_sysclk on the codec DAI and CPU DAI. This may end up resulting in redundant calls if one of the snd_soc_dai_set_sysclk calls ends up calling snd_soc_component_set_sysclk itself, but that isn't expected to cause any significant harm. Fixes: f48dcbb6d47d ("ASoC: simple-card-utils: share asoc_simple_hw_param()") Signed-off-by: Robert Hancock <robert.hancock@calian.com> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20220120195832.1742271-5-robert.hancock@calian.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23ASoC: core: Add snd_soc_of_parse_pin_switches() from simple-card-utilsStephan Gerhold
The ASoC core already has several helpers to parse card properties from the device tree. Move the parsing code for "pin-switches" from simple-card-utils to a shared snd_soc_of_parse_pin_switches() function so other drivers can also use it to set up pin switches configured in the device tree. Cc: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20211214142049.20422-2-stephan@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18ASoC: soc-component: add snd_soc_component_is_codec()Kuninori Morimoto
Checking .non_legacy_dai_naming is not readable. Let's add new snd_soc_component_is_codec(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87h7dft7dn.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15ASoC: simple-card-utils: add codec2codec supportKuninori Morimoto
codec2codec needs snd_soc_pcm_stream settings. This patch adds it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/874k9mn8qy.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15ASoC: simple-card-utils: add asoc_graph_is_ports0()Kuninori Morimoto
audio-graph-card2 will support DPCM/Multi/Codec2Codec, and these will use almost same DT settings which uses ports0 and ports1. This patch adds asoc_graph_is_ports0() which checks port is under port0 or not. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/875yu2n8ra.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-05ASoC: simple-card-utils: Avoid over-allocating DLCsSamuel Holland
The allocation of the DAI link components (DLCs) passed the wrong pointer to sizeof. Since simple_dai_props is much larger than snd_soc_dai_link_component, there was no out of bounds access, only wasted memory. Fixes: f2138aed231c8 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform") Fixes: 050c7950fd706 ("ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform") Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Link: https://lore.kernel.org/r/20210805050706.46833-1-samuel@sholland.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-21ASoC: simple-card-utils: switch to use ↵Kuninori Morimoto
snd_soc_daifmt_parse_format/clock_provider() This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from snd_soc_of_parse_daifmt(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/871r95w9ch.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.cKuninori Morimoto
audio-graph-card2 can reuse audio_graph_remove() / asoc_simple_remove(). This patch moves it to simple-card-utils.c. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87y2df3uby.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.cKuninori Morimoto
audio-graph-card2 can reuse audio_graph_card_probe(). This patch moves it to simple-card-utils.c. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87zgxv3uc4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13ASoC: simple-card-utils: tidyup asoc_simple_parse_convert()Kuninori Morimoto
dev is not used. This patch removes it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87eefgwf8j.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13ASoC: simple-card-utils: multi support at ↵Kuninori Morimoto
asoc_simple_canonicalize_cpu/platform() Current asoc_simple_canonicalize_cpu/platform() is assuming single CPU, single Platform, but we want to support Multi support. This patch is prepare for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87im4swf8y.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13ASoC: simple-card-utils: care multi DAI at asoc_simple_clean_reference()Kuninori Morimoto
ASoC is now supporting multi DAI, but, current simple-card / audio-graph are assuming fixed single DAI. This patch cares multi DAI at asoc_simple_clean_reference() for of_node_put(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87o8ekwf9p.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13ASoC: simple-card-utils: use for_each_prop_xxx()Kuninori Morimoto
ASoC is now supporting multi DAI, but, current simple-card / audio-graph are assuming fixed single DAI. This patch uses for_each_prop_xxx() to support multi DAI. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87r1jgwf9y.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-13ASoC: simple-card-utils: remove li->dais/li->confKuninori Morimoto
li->dais is same as number of CPU + Codec, li->conf is same as number of Codec when dummy-Codec. li->dais/li->conf are no longer needed. This patch removes these. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sg3wwfa3.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>