summaryrefslogtreecommitdiffstats
path: root/sound/soc/generic
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: simple-card-utils: fix sysclk shutdownOlivier Moysan2022-04-201-1/+1
| | | | | | | | | | | | 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>
* ASoC: simple-card-utils: Avoid NULL deref in asoc_simple_set_tdm()Richard Fitzgerald2022-04-061-2/+4
| | | | | | | | | | | 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>
* ASoC: simple-card-utils: Don't reset clock of active DAISameer Pujar2022-03-111-4/+8
| | | | | | | | | | | | | | | | 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>
* ASoC: audio_graph_card2: Add support for variable slot widthsRichard Fitzgerald2022-03-072-0/+101
| | | | | | | | | | | | | | | | | | | | | | | 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>
* ASoC: simple-card-utils: Add new system-clock-fixed flagRobert Hancock2022-01-241-11/+60
| | | | | | | | | | | | | | | 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>
* ASoC: simple-card-utils: Set sysclk on all componentsRobert Hancock2022-01-241-0/+15
| | | | | | | | | | | | | | | | | | | | | 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>
* ASoC: simple-card: fix probe failure on platform componentRobert Hancock2022-01-111-1/+25
| | | | | | | | | | | | | | | | A previous change to simple-card resulted in asoc_simple_parse_dai attempting to retrieve the dai_name for platform components, which are unlikely to have a valid DAI name. This caused simple-card to fail to probe when using the xlnx_formatter_pcm as the platform component, since it does not register any DAI components. Since the dai_name is not used for platform components, just skip trying to retrieve it for those. Fixes: f107294c6422 ("ASoC: simple-card: support snd_soc_dai_link_component style for cpu") Signed-off-by: Robert Hancock <robert.hancock@calian.com> Link: https://lore.kernel.org/r/20220107214711.1100162-6-robert.hancock@calian.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: core: Add snd_soc_of_parse_pin_switches() from simple-card-utilsStephan Gerhold2021-12-231-44/+1
| | | | | | | | | | | | | 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>
* ASoC: generic: Use dev_err_probe() helperKuninori Morimoto2021-12-203-8/+4
| | | | | | | | | Use the dev_err_probe() helper, instead of open-coding the same operation. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20211214020843.2225831-15-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: test-component: fix null pointer dereference.Ameer Hamza2021-12-091-6/+2
| | | | | | | | | | Dereferncing of_id pointer will result in exception in current implementation since of_match_device() will assign it to NULL. Adding NULL check for protection. Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com> Link: https://lore.kernel.org/r/20211207142309.222820-1-amhamza.mgc@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: test-component: fix null pointer dereference.Ameer Hamza2021-12-061-1/+4
| | | | | | | | | | Dereferncing of_id pointer will result in exception in current implementation since of_match_device() will assign it to NULL. Adding NULL check for protection. Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com> Link: https://lore.kernel.org/r/20211205204200.7852-1-amhamza.mgc@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-component: add snd_soc_component_is_codec()Kuninori Morimoto2021-10-181-2/+2
| | | | | | | | | 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>
* ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Multi)Kuninori Morimoto2021-10-151-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds Codec2Codec-Multi sample to audio-graph-card2-custom-sample.dtsi. Because it can use very basic connection only for now, it can use only - 2channels - S32_LE format Test-Component driver has "IN" and "OUT" widget. Thus the route is +--+ +-+ | | | |- Codec8 <- IN | | <- | |- Codec9 <- IN | | +-+ | | | | +-+ | | -> | |- Codec10 -> OUT | | | |- Codec11 -> OUT +--+ +-+ One note here is that it will start works when it boot. In other words we can't stop it so far. We need to update driver for it in the future. ... asoc-audio-graph-card2-custom-sample: multicodec <-> multicpu mapping ok test-component test_codec: test_dai_startup() : test_codec.9 test-component test_codec: test_dai_startup() : test_codec.8 test-component test_codec: test_dai_startup() : test_codec.11 test-component test_codec: test_dai_startup() : test_codec.10 ... Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87mtnelu2k.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Single)Kuninori Morimoto2021-10-151-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds Codec2Codec-Single sample to audio-graph-card2-custom-sample.dtsi. Because it can use very basic connection only for now, it can use only - 2channels - S32_LE format Test-Component driver has "IN" and "OUT" widget. Thus the route is +--+ | | <-- Codec6 <-- IN | | --> Codec7 --> OUT +--+ One note here is that it will start works when it boot. In other words we can't stop it so far. We need to update driver for it in the future. ... asoc-audio-graph-card2-custom-sample: test_codec.7 <-> test_codec.6 mapping ok test-component test_codec: test_dai_startup() : test_codec.6 test-component test_codec: test_dai_startup() : test_codec.7 ... Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87o87ulu2o.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Multi)Kuninori Morimoto2021-10-151-1/+35
| | | | | | | | | | | | | | | | | This patch adds DPCM link Multi-CPU/Codec sample to audio-graph-card2-custom-sample.dtsi. This sample is assuming MIXer connection. One note is that Multi-FE is not supported on ASoC FE BE **** +-+ CPU5 -- * * -- | | -- Codec4 CPU6 -- * * | | -- Codec5 **** +-+ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pmsalu2s.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Single)Kuninori Morimoto2021-10-151-0/+36
| | | | | | | | | | | | | | | | This patch adds DPCM link Single-CPU/Codec sample to audio-graph-card2-custom-sample.dtsi. This sample is assuming MIXer connection. FE BE **** CPU3 -- * * -- Codec3 CPU4 -- * * **** Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87r1cqlu2w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Nulti)Kuninori Morimoto2021-10-151-0/+24
| | | | | | | | | | | | | | This patch adds Normal link Multi-CPU/Codec sample to audio-graph-card2-custom-sample.dtsi. +-+ +-+ CPU1 --| | <---> | | -- Codec1 CPU2 --| | | | -- Codec2 +-+ +-+ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sfx6lu30.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Single)Kuninori Morimoto2021-10-151-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Audio Graph Card2 settings is a little bit difficult for beginner, and Customizing it also difficult/confusable too. So, this patch adds sample for it. You can easily use it by adding below line on your DT file, and select CONFIGs to your .config. #include "../../../../../sound/soc/generic/audio-graph-card2-custom-sample.dtsi" CONFIG_SND_AUDIO_GRAPH_CARD2 CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE CONFIG_SND_TEST_COMPONENT This patch uses audio-graph-card2 base custom sample driver. You can directly use audio-graph-card2 instead of custom sample driver by modifing compatible. - compatible = "audio-graph-card2-custom-sample"; + compatible = "audio-graph-card2"; Sample custom driver will indicate customized print. It is using Test-Component driver for CPU/Codec. It can indicate more detail print of each behavior if user want to. In such case, you need to update compatible to "xxx-nv" or "xxx-vv". - compatible = "test-cpu"; + compatible = "test-cpu-verbose"; Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tuhmlu35.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: add Audio Graph Card2 Custom SampleKuninori Morimoto2021-10-153-0/+191
| | | | | | | | | | | | | | | audio-graph-card2 has customizing support. This means user can re-use audio-graph-card2 DT parsing, and possible to expand to own special handling. This patch adds Audio Graph Card2 Customize Sample Driver. It can re-use audio-graph-card2 parsing by calling audio_graph2_parse_of(...), and user can expand each functions by using hooks. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v922lu3c.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2: add Codec2Codec supportKuninori Morimoto2021-10-151-0/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds Codec2Codec support to audio-graph-card2. It can use Codec2Codec but very simple case only for now. It doesn't have "SWITCH" control yet, thus it start automatically when it was probed, and can't stop, so far. Thus it needs to be updated around widgets/routing handling, and you need to understand that it is under experimental. Codec has SND_SOC_DAPM_INPUT() (= IN) / SND_SOC_DAPM_OUTPUT(= OUT) widgets in below case. It is assuming 2channel, S32_LE format for now. It needs to be updated, too. It needs "codec2codec" node (= B), needs to have routing (= A), need to indicate CPU side at links (= X). ports@0 is for CPU side (= X), port@1 is Codec side (= Y). It needs to have "rate" (= C) +--+ | |<-- Codec0 <-- IN | |--> Codec1 --> OUT +--+ sound { compatible = "audio-graph-card2"; (A) routing = "OUT" ,"DAI1 Playback", "DAI0 Capture", "IN"; (X) links = <&c2c>; (B) codec2codec { ports { (C) rate = <48000>; (X) c2c: port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec0_ep>; }; }; (Y) port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; }; }; Codec { ports { port@0 { bitclock-master; frame-master; codec0_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; }; port@1 { codec1_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; }; }; }; Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87y26ylu4a.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2: add DPCM supportKuninori Morimoto2021-10-151-0/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds DPCM support to audio-graph-card2. It uses "dpcm" node (= D), needs to have routing (= A), need to indicate both FE/BE at links (= B, C). dpcm ports@0 is for FE (= B), port@1 is for BE (= C). remote-endpoint can use both Single/Multi connection. DSP ************ PCM0 <--> * fe0 be0 * <--> DAI0: Codec Headset PCM1 <--> * fe1 be1 * <--> DAI1: Codec Speakers PCM2 <--> * fe2 be2 * <--> DAI2: MODEM PCM3 <--> * fe3 be3 * <--> DAI3: BT * be4 * <--> DAI4: DMIC * be5 * <--> DAI5: FM ************ sound { compatible = "audio-graph-card2"; // indicate routing (A) routing = "xxx Playback", "xxx Playback", "xxx Playback", "xxx Playback", "xxx Playback", "xxx Playback"; // indicate all Front-End, Back-End in DPCM case (B) links = <&fe0, &fe1, ... (C) &be0, &be1, ... (D) dpcm { // Front-End ports@0 { (B) fe0: port@0 { fe0_ep: endpoint { remote-endpoint = <&pcm0_ep>; }; }; (B) fe1: port@1 { fe1_ep: endpoint { remote-endpoint = <&pcm1_ep>; }; }; ... }; // Back-End ports@1 { (C) be0: port@0 { be0_ep: endpoint { remote-endpoint = <&dai0_ep>; }; }; (C) be1: port@1 { be1_ep: endpoint { remote-endpoint = <&dai1_ep>; }; }; ... }; }; }; CPU { ports { bitclock-master; frame-master; port@0 { pcm0_ep: endpoint { remote-endpoint = <&fe0_ep>; }; }; port@1 { pcm1_ep: endpoint { remote-endpoint = <&fe1_ep>; }; }; ... }; }; Codec { ports { port@0 { dai0_ep: endpoint { remote-endpoint = <&be0_ep>; }; }; port@1 { dai1_ep: endpoint { remote-endpoint = <&be1_ep>; }; }; ... }; }; Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87zgrelu4v.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph-card2: add Multi CPU/Codec supportKuninori Morimoto2021-10-151-10/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds Multi CPU/Codec support to audio-graph-card2. Multi CPU/Codec will have connection part (= X) and CPU/Codec list part (= Y). links indicates connection part of CPU side (= A). +-+ (A) +-+ CPU1 --(Y) | | <-(X)--(X)-> | | (Y)-- Codec1 CPU2 --(Y) | | | | (Y)-- Codec2 +-+ +-+ sound { compatible = "audio-graph-card2"; (A) links = <&mcpu>; multi { ports@0 { (X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; (Y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; (Y) port@1 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; }; ports@1 { (X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; (Y) port@0 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; (Y) port@1 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; }; }; }; CPU { ports { bitclock-master; frame-master; port@0 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; }; port@1 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; }; }; }; Codec { ports { port@0 { codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; }; port@1 { codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; }; }; }; Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/20210804171748.GC26252@sirena.org.uk Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/871r4qn8pk.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: add Audio Graph Card2 driverKuninori Morimoto2021-10-153-0/+680
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have audio-graph-card which is Of-graph base of general sound card driver. It is supporting DPCM connection, but was forcibly expanded. Thus, it is very difficult to add new features on it, for example Multi CPU/Codec support, Codec2Codec support, etc. This patch adds more flexible new Audio Graph Card2 driver for it. audio-graph-card and audio-graph-card2 are similar, but don't have full compatibility. Audio Graph Card2 supports very generic connection, but some users want to have its own settings, for example PLL settings, etc. For such case, it has customizing support. In users own driver, it can use Audio Graph Card2 parsing by using audio_graph2_parse_of(), and doing its own customizing. Because Audio Graph Card2 is still under experimental stage, it will indicate such warning when probing, and the DT syntax might be changed. Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/871r8u4s6q.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87a6mhwyqn.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87tuitusy4.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87a6jn56x0.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/8735p6n8q1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card-utils: add codec2codec supportKuninori Morimoto2021-10-151-1/+17
| | | | | | | | | 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>
* ASoC: simple-card-utils: add asoc_graph_is_ports0()Kuninori Morimoto2021-10-151-0/+28
| | | | | | | | | | | | 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>
* ASoC: test-component: add Test Component for Sound debug/testKuninori Morimoto2021-10-153-0/+667
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have dummy-codec, dummy-platform. But its issues are 1) we don't have dummy-cpu, 2) we can't select it via DeviceTree 3) It do nothing Sometimes we want to have Dummy Sound Component for debugging, for testing, for learning Framework behavior, etc, etc... This patch adds Test-Component driver for it. User can select CPU Component by using "test-cpu" compatible, and can select Codec Component by using "test-codec" compatible. It doesn't support Platform so far, but is easy to add. We can verbose print to know its progress if user selected xxx-verbose compatible driver. for example, test-cpu : silent Component, silent DAI test-cpu-verbose-component : verbose Component, silent DAI test-cpu-verbose-dai : silent Component, verbose DAI test-cpu-verbose : verbose Component, verbose DAI Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/877dein8rx.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: Fixup CPU endpoint hw_params in a BE<->BE linkSameer Pujar2021-09-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | When multiple components are connected back to back in an audio path, hw_param fixup may be required for CPU or Codec endpoint of BE<->BE DAI links. Currently fixup support is available for Codec and this commit adds similar feature for CPU endpoint of a BE<->BE link. For example a resampler component can be plugged into an audio path. [ FE -> BE1 -> ... -> resampler -> ... BEn ] The resampler DAI links can be: BEx (CPU) -> resampler input (Codec) resampler output (CPU) -> BEy (Codec) Thus input and output sample rate parameters for resampler can be fixed up as per the resample requirement. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/1631551342-25469-4-git-send-email-spujar@nvidia.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: respawn Platform SupportKuninori Morimoto2021-09-011-0/+6
| | | | | | | | | | | | | | | | | | | commit 63f2f9cceb09f8 ("ASoC: audio-graph: remove Platform support") removed Platform support from audio-graph, because it doesn't have "plat" support on DT (simple-card has). But, Platform support is needed if user is using snd_dmaengine_pcm_register() which adds generic DMA as Platform. And this Platform dev is using CPU dev. Without this patch, at least STM32MP15 audio sound card is no more functional (v5.13 or later). This patch respawn Platform Support on audio-graph again. Reported-by: Olivier MOYSAN <olivier.moysan@foss.st.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Olivier MOYSAN <olivier.moysan@foss.st.com> Link: https://lore.kernel.org/r/878s0jzrpf.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card-utils: Avoid over-allocating DLCsSamuel Holland2021-08-051-2/+2
| | | | | | | | | | | | | | 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>
* ASoC: simple-card: Fill in driver nameGuido Günther2021-06-221-0/+1
| | | | | | | | | | | | | | | | | | | | | alsa-ucm groups by driver name so fill that in as well. Otherwise the presented information is redundant and doesn't reflect the used driver. We can't just use 'asoc-simple-card' since the driver name is restricted to 15 characters. Before: # cat /proc/asound/cards 0 [Devkit ]: Librem_5_Devkit - Librem 5 Devkit Librem 5 Devkit After: 0 [Devkit ]: simple-card - Librem 5 Devkit Librem 5 Devkit Signed-off-by: Guido Günther <agx@sigxcpu.org> Link: https://lore.kernel.org/r/YNGe3akAntQi8qJD@qwark.sigxcpu.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card-utils: switch to use ↵Kuninori Morimoto2021-06-211-11/+5
| | | | | | | | | | | 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>
* ASoC: audio-graph: tidyup graph_parse_node()Kuninori Morimoto2021-05-111-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | audio-graph is using cpus->dai_name / codecs->dai_name for dailink->name. In graph_parse_node(), xxx->dai_name is got by snd_soc_get_dai_name(), but it might be removed soon by asoc_simple_canonicalize_cpu(). The order should be *1) call snd_soc_get_dai_name() 2) create dailink name *3) call asoc_simple_canonicalize_cpu() * are implemented in graph_parse_node(). This patch remove 3) from graph_parse_node() Reported-by: "kernelci.org bot" <bot@kernelci.org> Fixes: 8859f809c7d5813 ("ASoC: audio-graph: add graph_parse_node()") Fixes: e51237b8d305225 ("ASoC: audio-graph: add graph_link_init()") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/87cztyawzr.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()Kuninori Morimoto2021-05-111-16/+14
| | | | | | | | | Use local variable at local area only. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/87eeeeax16.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card: add simple_link_init()Kuninori Morimoto2021-05-111-31/+30
| | | | | | | | | | | | | | | Original commit 434392271afcff350fe ("ASoC: simple-card: add simple_link_init()") are rejected, and this is remake version of it. This patch adds simple_link_init() and share dai_link setting code. Reported-by: "kernelci.org bot" <bot@kernelci.org> Fixes: 25c4a9b614f101bb9f3 ("ASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2") Fixes: 434392271afcff350fe ("ASoC: simple-card: add simple_link_init()") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/87fsyuax1g.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card: add simple_parse_node()Kuninori Morimoto2021-05-111-54/+53
| | | | | | | | | | | | | | | | Original commit 59c35c44a9cf89a83a9 ("ASoC: simple-card: add simple_parse_node()") was reverted, and this is remake version. Parse dai/tdm/clk are common for both CPU/Codec node. This patch creates simple_parse_node() for it and share the code. Reported-by: "kernelci.org bot" <bot@kernelci.org> Fixes: 25c4a9b614f101bb9f3 ("ASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2") Fixes: 59c35c44a9cf89a83a9 ("ASoC: simple-card: add simple_parse_node()") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/87h7jaax2k.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2Mark Brown2021-04-232-102/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | A KernelCI bisection identified 59c35c44a9cf89 "ASoC: simple-card: add simple_parse_node()" as causing simple-card to fail to instantiate on kontron-sl28-var3-ads2 systems. Since the merge window is expected to open over the weekend drop that commit and subsequent ones which depend on it for now in case other systems are affected too. The boot log showed the error as: <4>[ 9.948821] sysfs: cannot create duplicate filename '/devices/platform/sound/(null)-wm8904-hifi' (backtrace) <3>[ 10.191982] kobject_add_internal failed for (null)-wm8904-hifi with -EEXIST, don't try to register things with the same name in the same directory. The dropped commits are: 73371bacf0475a20ab6 "ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()" 434392271afcff350fe "ASoC: simple-card: add simple_link_init()" 59c35c44a9cf89a83a9 "ASoC: simple-card: add simple_parse_node()" Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com> Reported-by: "kernelci.org bot" <bot@kernelci.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()Kuninori Morimoto2021-04-211-16/+14
| | | | | | | | Use local variable at local area only. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a6psi417.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card: add simple_link_init()Kuninori Morimoto2021-04-211-29/+30
| | | | | | | | This patch adds simple_link_init() and share dai_link setting code. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87bla8i41b.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card: add simple_parse_node()Kuninori Morimoto2021-04-211-61/+58
| | | | | | | | | Parse dai/tdm/clk are common for both CPU/Codec node. This patch creates simple_parse_node() for it and share the code. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87czuoi41f.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: add graph_link_init()Kuninori Morimoto2021-04-211-37/+33
| | | | | | | | This patch adds graph_link_init() and share dai_link setting code. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87eef4i41k.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: add graph_parse_node()Kuninori Morimoto2021-04-211-59/+49
| | | | | | | | | Parse mclk_fs/dai/tdm/clk are common for both CPU/Codec node. This patch creates graph_parse_node() for it and share the code. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87fszki426.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: remove Platform supportKuninori Morimoto2021-04-201-6/+0
| | | | | | | | | | | | | | | | | | | | | Platform was one of mandatory component on ASoC before, and audio-graph-card was assuming that CPU and Platform were same driver. But it is no longer mandatory on ASoC. Current ASoC will just ignore if Platform and CPU were same or doplicated component. Of course ASoC is supporting Platform, but current audio-graph-card doesn't support detecting it from DT. This means current audio-graph-card operation for Platform so far is 100% useless. This patch removes it. We can respawn it when we need it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sg3n3ubg.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()Kuninori Morimoto2021-04-201-2/+0
| | | | | | | | | graph_parse_mclk_fs() has "node", but is not used. This patch removes unused "node" Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tuo33ubl.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: remove "audio-graph-card, " preix supportKuninori Morimoto2021-04-201-5/+0
| | | | | | | | | | No upstream code is using "audio-graph-card," preix, and Yaml base Document doesn't indicate it. Let's remove it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v98j3ubp.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: check ports if existsKuninori Morimoto2021-04-201-4/+6
| | | | | | | | | | | | "endpoint" and "port" are always exists, but there is no guarantee for "ports". This patch checks "ports" if exists, otherwise, it might set un-expected settings. This patch also do align to 100 char in 1 line. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87wnsz3ubu.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.cKuninori Morimoto2021-04-203-16/+9
| | | | | | | | | 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>
* ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.cKuninori Morimoto2021-04-202-18/+18
| | | | | | | | | 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>
* ASoC: simple-card-utils: Allocate link info structure on heapThierry Reding2021-04-202-17/+24
| | | | | | | | | | | | | | | | | struct link_info can grow fairly large and may cause the stack frame size to be exceeded when allocated on the stack. Some architectures such as 32-bit ARM, RISC-V or PowerPC have small stack frames where this causes a compiler warning, so allocate these structures on the heap instead of the stack. Fixes: 343e55e71877 ("ASoC: simple-card-utils: Increase maximum number of links to 128") Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20210419164117.1422242-1-thierry.reding@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card-utils: Increase maximum number of links to 128Thierry Reding2021-04-162-4/+4
| | | | | | | | | | | | On Tegra186 and later, the number of links can go up to 72, so bump the maximum number of links to the next power of two (128). Fixes: f2138aed231c ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform") Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20210416071147.2149109-2-thierry.reding@gmail.com Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: simple-card-utils: Propagate errors on too many linksThierry Reding2021-04-162-15/+21
| | | | | | | | | | | | | | | | | | The DAI counting code doesn't propagate errors when the number of maximum links is exceeded, which causes subsequent initialization code to continue to run and that eventually leads to memory corruption with the code trying to access memory that is out of bounds. Fix this by propagating errors when the maximum number of links is reached, which ensures that the driver fails to load and prevents the memory corruption. Fixes: f2138aed231c ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform") Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20210416071147.2149109-1-thierry.reding@gmail.com Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>