Commit 9a61277a authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: Add Audio Graph Card2 support" from Kuninori Morimoto...

Merge series "ASoC: Add Audio Graph Card2 support" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

We already have Audio-Graph-Card which is Of-Graph base general sound
card driver. Basically it supports basic CPU-Codec connection, and is
also supporting DPCM connection. Because it was forcibly expanded to
DPCM, DT parsing is very limited and 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.
The reason why I need Audio-Graph-Card2 instead of updating Audio-Graph-Card
is that it is very difficult to keep compatibility.

Audio-Graph-Card2 supports Normal/DPCM/Codec2Codec Connection wich
Single/Multi DAIs. And it is possible to Customizing.

This patch-set adds Audio-Graph-Card2 driver and its custom driver
sample, and DT settings sample which can be used for testing.

To enable testing/debuging, this patch-set also adds Test-Component
driver. We already have Dummy Component and/or Dummy DAI on soc-utils,
but 1) we can't use it from DT, 2) it do nothing.
Added new Test-Component can be used from DT, and it can indicate called
function name. We can use it to trace callback order, understanding
ALSA SoC behavior, etc, etc...
Sample DT settings of Audio Graph Card2 is using Test-Component as CPU/Codec DAI.

You can easily try to use/test it if you added below line to your DT file.
Your .config needs to have below CONFIGs to use/test it.
It will probe sample Sound Card which has Normal/DPCM/Multi/Codec2Codec
connections.

	#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

Because Audio Graph Card2 is still under experimental stage, it will
indicate such warning when probing, and the DT might be updated/exchanged.

It can use Codec2Codec, but it will start automatically when probed,
and can't stop it so far. It should be updated.

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

v1 -> v2
	- don't use "port" base for_each loop

v2 -> v3
	- Rename audio-graph-card2 to rich-graph-card
	- Rename DSP to DPCM not to confuse
	- Normal/DPCM/Codec2Codec can use Single/Multi DAIs.
	- use dpcm/multi/codec2codec node instead of using extra compatible
	- Sample DTSI patch is separated to Single/Multi.

v3 -> v4
	- Rename rich-graph-card to audio-graph-card2
	- fixup custom sample driver's connection bug
	- test-component compatible uses "verbose" instead of "vv"

v4 -> v5
	- tidyup git-log comment at
	- tidyup Custom Sample comment

Kuninori Morimoto (16):
  ASoC: test-component: add Test Component YAML bindings
  ASoC: test-component: add Test Component for Sound debug/test
  ASoC: simple-card-utils: add asoc_graph_is_ports0()
  ASoC: simple-card-utils: add codec2codec support
  ASoC: add Audio Graph Card2 driver
  ASoC: audio-graph-card2: add Multi CPU/Codec support
  ASoC: audio-graph-card2: add DPCM support
  ASoC: audio-graph-card2: add Codec2Codec support
  ASoC: add Audio Graph Card2 Yaml Document
  ASoC: add Audio Graph Card2 Custom Sample
  ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Single)
  ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Nulti)
  ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Single)
  ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Multi)
  ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Single)
  ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Multi)

 .../bindings/sound/audio-graph-card2.yaml     |   57 +
 .../bindings/sound/test-component.yaml        |   33 +
 include/sound/graph_card.h                    |   21 +
 include/sound/simple_card_utils.h             |    4 +
 sound/soc/generic/Kconfig                     |   20 +
 sound/soc/generic/Makefile                    |    6 +
 .../generic/audio-graph-card2-custom-sample.c |  183 +++
 .../audio-graph-card2-custom-sample.dtsi      |  227 +++
 sound/soc/generic/audio-graph-card2.c         | 1281 +++++++++++++++++
 sound/soc/generic/simple-card-utils.c         |   46 +-
 sound/soc/generic/test-component.c            |  659 +++++++++
 11 files changed, 2536 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/test-component.yaml
 create mode 100644 sound/soc/generic/audio-graph-card2-custom-sample.c
 create mode 100644 sound/soc/generic/audio-graph-card2-custom-sample.dtsi
 create mode 100644 sound/soc/generic/audio-graph-card2.c
 create mode 100644 sound/soc/generic/test-component.c

--
2.25.1
parents b296997c baa274db
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/audio-graph-card2.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Audio Graph Card2 Device Tree Bindings
maintainers:
- Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
properties:
compatible:
enum:
- audio-graph-card2
links:
$ref: /schemas/types.yaml#/definitions/phandle-array
label:
maxItems: 1
routing:
description: |
A list of the connections between audio components.
Each entry is a pair of strings, the first being the
connection's sink, the second being the connection's source.
$ref: /schemas/types.yaml#/definitions/non-unique-string-array
multi:
description: Multi-CPU/Codec node
dpcm:
description: DPCM node
codec2codec:
description: Codec to Codec node
required:
- compatible
- links
additionalProperties: false
examples:
- |
sound {
compatible = "audio-graph-card2";
links = <&cpu_port>;
};
cpu {
compatible = "cpu-driver";
cpu_port: port { cpu_ep: endpoint { remote-endpoint = <&codec_ep>; }; };
};
codec {
compatible = "codec-driver";
port { codec_ep: endpoint { remote-endpoint = <&cpu_ep>; }; };
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/test-component.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Test Component Device Tree Bindings
maintainers:
- Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
properties:
compatible:
enum:
- test-cpu
- test-cpu-verbose
- test-cpu-verbose-dai
- test-cpu-verbose-component
- test-codec
- test-codec-verbose
- test-codec-verbose-dai
- test-codec-verbose-component
required:
- compatible
additionalProperties: true
examples:
- |
test_cpu {
compatible = "test-cpu";
};
......@@ -9,6 +9,27 @@
#include <sound/simple_card_utils.h>
typedef int (*GRAPH2_CUSTOM)(struct asoc_simple_priv *priv,
struct device_node *lnk,
struct link_info *li);
struct graph2_custom_hooks {
int (*hook_pre)(struct asoc_simple_priv *priv);
int (*hook_post)(struct asoc_simple_priv *priv);
GRAPH2_CUSTOM custom_normal;
GRAPH2_CUSTOM custom_dpcm;
GRAPH2_CUSTOM custom_c2c;
};
int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev);
int audio_graph2_parse_of(struct asoc_simple_priv *priv, struct device *dev,
struct graph2_custom_hooks *hooks);
int audio_graph2_link_normal(struct asoc_simple_priv *priv,
struct device_node *lnk, struct link_info *li);
int audio_graph2_link_dpcm(struct asoc_simple_priv *priv,
struct device_node *lnk, struct link_info *li);
int audio_graph2_link_c2c(struct asoc_simple_priv *priv,
struct device_node *lnk, struct link_info *li);
#endif /* __GRAPH_CARD_H */
......@@ -42,6 +42,7 @@ struct prop_nums {
int cpus;
int codecs;
int platforms;
int c2c;
};
struct asoc_simple_priv {
......@@ -54,6 +55,7 @@ struct asoc_simple_priv {
struct snd_soc_dai_link_component *platforms;
struct asoc_simple_data adata;
struct snd_soc_codec_conf *codec_conf;
struct snd_soc_pcm_stream *c2c_conf;
struct prop_nums num;
unsigned int mclk_fs;
} *dai_props;
......@@ -64,6 +66,7 @@ struct asoc_simple_priv {
struct snd_soc_dai_link_component *dlcs;
struct snd_soc_dai_link_component dummy;
struct snd_soc_codec_conf *codec_conf;
struct snd_soc_pcm_stream *c2c_conf;
struct gpio_desc *pa_gpio;
const struct snd_soc_ops *ops;
unsigned int dpcm_selectable:1;
......@@ -180,6 +183,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
int asoc_simple_remove(struct platform_device *pdev);
int asoc_graph_card_probe(struct snd_soc_card *card);
int asoc_graph_is_ports0(struct device_node *port);
#ifdef DEBUG
static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
......
......@@ -17,3 +17,23 @@ config SND_AUDIO_GRAPH_CARD
This option enables generic simple sound card support
with OF-graph DT bindings.
It also support DPCM of multi CPU single Codec ststem.
config SND_AUDIO_GRAPH_CARD2
tristate "ASoC Audio Graph sound card2 support"
depends on OF
select SND_SIMPLE_CARD_UTILS
help
This option enables generic simple sound card2 support
with OF-graph DT bindings.
config SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE
tristate "ASoC Audio Graph Card2 base custom sample support"
depends on SND_AUDIO_GRAPH_CARD2
help
This option enables Audio Graph Card2 base custom sample
config SND_TEST_COMPONENT
tristate "ASoC Test component sound support"
depends on OF
help
This option enables test component sound driver support.
......@@ -2,7 +2,13 @@
snd-soc-simple-card-utils-objs := simple-card-utils.o
snd-soc-simple-card-objs := simple-card.o
snd-soc-audio-graph-card-objs := audio-graph-card.o
snd-soc-audio-graph-card2-objs := audio-graph-card2.o
snd-soc-audio-graph-card2-custom-sample-objs := audio-graph-card2-custom-sample.o
snd-soc-test-component-objs := test-component.o
obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) += snd-soc-simple-card-utils.o
obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o
obj-$(CONFIG_SND_AUDIO_GRAPH_CARD) += snd-soc-audio-graph-card.o
obj-$(CONFIG_SND_AUDIO_GRAPH_CARD2) += snd-soc-audio-graph-card2.o
obj-$(CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE) += snd-soc-audio-graph-card2-custom-sample.o
obj-$(CONFIG_SND_TEST_COMPONENT) += snd-soc-test-component.o
// SPDX-License-Identifier: GPL-2.0
//
// audio-graph-card2-custom-sample.c
//
// Copyright (C) 2020 Renesas Electronics Corp.
// Copyright (C) 2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
//
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <sound/graph_card.h>
/*
* Custom driver can have own priv
* which includes asoc_simple_priv.
*/
struct custom_priv {
struct asoc_simple_priv simple_priv;
/* custom driver's own params */
int custom_params;
};
/* You can get custom_priv from simple_priv */
#define simple_to_custom(simple) container_of((simple), struct custom_priv, simple_priv)
static int custom_card_probe(struct snd_soc_card *card)
{
struct asoc_simple_priv *simple_priv = snd_soc_card_get_drvdata(card);
struct custom_priv *custom_priv = simple_to_custom(simple_priv);
struct device *dev = simple_priv_to_dev(simple_priv);
dev_info(dev, "custom probe\n");
custom_priv->custom_params = 1;
/* you can use generic probe function */
return asoc_graph_card_probe(card);
}
static int custom_hook_pre(struct asoc_simple_priv *priv)
{
struct device *dev = simple_priv_to_dev(priv);
/* You can custom before parsing */
dev_info(dev, "hook : %s\n", __func__);
return 0;
}
static int custom_hook_post(struct asoc_simple_priv *priv)
{
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_card *card;
/* You can custom after parsing */
dev_info(dev, "hook : %s\n", __func__);
/* overwrite .probe sample */
card = simple_priv_to_card(priv);
card->probe = custom_card_probe;
return 0;
}
static int custom_normal(struct asoc_simple_priv *priv,
struct device_node *lnk,
struct link_info *li)
{
struct device *dev = simple_priv_to_dev(priv);
/*
* You can custom Normal parsing
* before/affter audio_graph2_link_normal()
*/
dev_info(dev, "hook : %s\n", __func__);
return audio_graph2_link_normal(priv, lnk, li);
}
static int custom_dpcm(struct asoc_simple_priv *priv,
struct device_node *lnk,
struct link_info *li)
{
struct device *dev = simple_priv_to_dev(priv);
/*
* You can custom DPCM parsing
* before/affter audio_graph2_link_dpcm()
*/
dev_info(dev, "hook : %s\n", __func__);
return audio_graph2_link_dpcm(priv, lnk, li);
}
static int custom_c2c(struct asoc_simple_priv *priv,
struct device_node *lnk,
struct link_info *li)
{
struct device *dev = simple_priv_to_dev(priv);
/*
* You can custom Codec2Codec parsing
* before/affter audio_graph2_link_c2c()
*/
dev_info(dev, "hook : %s\n", __func__);
return audio_graph2_link_c2c(priv, lnk, li);
}
/*
* audio-graph-card2 has many hooks for your customizing.
*/
static struct graph2_custom_hooks custom_hooks = {
.hook_pre = custom_hook_pre,
.hook_post = custom_hook_post,
.custom_normal = custom_normal,
.custom_dpcm = custom_dpcm,
.custom_c2c = custom_c2c,
};
static int custom_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
struct device *dev = simple_priv_to_dev(priv);
dev_info(dev, "custom startup\n");
return asoc_simple_startup(substream);
}
/* You can use custom ops */
static const struct snd_soc_ops custom_ops = {
.startup = custom_startup,
.shutdown = asoc_simple_shutdown,
.hw_params = asoc_simple_hw_params,
};
static int custom_probe(struct platform_device *pdev)
{
struct custom_priv *custom_priv;
struct asoc_simple_priv *simple_priv;
struct device *dev = &pdev->dev;
int ret;
custom_priv = devm_kzalloc(dev, sizeof(*custom_priv), GFP_KERNEL);
if (!custom_priv)
return -ENOMEM;
simple_priv = &custom_priv->simple_priv;
simple_priv->ops = &custom_ops; /* customize dai_link ops */
/* use audio-graph-card2 parsing with own custom hooks */
ret = audio_graph2_parse_of(simple_priv, dev, &custom_hooks);
if (ret < 0)
return ret;
/* customize more if needed */
return 0;
}
static const struct of_device_id custom_of_match[] = {
{ .compatible = "audio-graph-card2-custom-sample", },
{},
};
MODULE_DEVICE_TABLE(of, custom_of_match);
static struct platform_driver custom_card = {
.driver = {
.name = "audio-graph-card2-custom-sample",
.of_match_table = custom_of_match,
},
.probe = custom_probe,
.remove = asoc_simple_remove,
};
module_platform_driver(custom_card);
MODULE_ALIAS("platform:asoc-audio-graph-card2-custom-sample");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("ASoC Audio Graph Card2 Custom Sample");
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
// SPDX-License-Identifier: GPL-2.0
/*
* audio-graph-card2-custom-sample.dtsi
*
* Copyright (C) 2020 Renesas Electronics Corp.
* Copyright (C) 2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
*
* This sample indicates how to use audio-graph-card2 and its
* custom driver. "audio-graph-card2-custom-sample" is the custome driver
* which is using audio-graph-card2.
*
* You can easily use this sample by adding below line on your DT file,
* and add new CONFIG 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
*/
/ {
/*
* @ : used at links
*
* [Normal]
* cpu0 <-@-----------------> codec0
*
* [Multi-CPU/Codec]
* +-+ +-+
* cpu1 <--| |<-@--------->| |-> codec1
* cpu2 <--| | | |-> codec2
* +-+ +-+
*
* [DPCM]
* FE BE
* ****
* cpu3 <-@--* *--@-> codec3
* cpu4 <-@--* *
* ****
*
* [DPCM-Multi]
*
* --NOTE--
* Multi-FE is not supported by ASoC.
*
* FE BE
* **** +-+
* cpu5 <-@--* *--@-> | | -> codec4
* cpu6 <-@--* * | | -> codec5
* **** +-+
*
* [Codec2Codec]
* +-@-> codec6
* |
* +---> codec7
*
* [Codec2Codec-Multi]
*
* --NOTE--
* Multi connect N:M is not supported by ASoC.
*
* +-+
* +-@->| |-> codec8
* | | |-> codec9
* | +-+
* | +-+
* +--->| |-> codec10
* | |-> codec11
* +-+
*/
audio-graph-card2-custom-sample {
/*
* You can use audio-graph-card2 directly by using
*
* compatible = "audio-graph-card2";
*/
compatible = "audio-graph-card2-custom-sample";
/* for [DPCM] */
/* BE FE */
routing = "TC DAI3 Playback", "DAI3 Playback",
"TC DAI3 Playback", "DAI4 Playback",
"DAI3 Capture", "TC DAI3 Capture",
"DAI4 Capture", "TC DAI3 Capture",
/* for [DPCM-Multi] */
/* BE FE */
"TC DAI4 Playback", "DAI5 Playback",
"TC DAI5 Playback", "DAI5 Playback",
"TC DAI4 Playback", "DAI6 Playback",
"TC DAI5 Playback", "DAI6 Playback",
"DAI5 Capture", "TC DAI4 Capture",
"DAI5 Capture", "TC DAI5 Capture",
"DAI6 Capture", "TC DAI4 Capture",
"DAI6 Capture", "TC DAI5 Capture",
/* for [Codec2Codec] */
"TC OUT", "TC DAI7 Playback",
"TC DAI6 Capture", "TC IN",
/* for [Codec2Codec-Multi] */
"TC OUT", "TC DAI10 Playback",
"TC DAI8 Capture", "TC IN",
"TC OUT", "TC DAI11 Playback",
"TC DAI9 Capture", "TC IN";
links = <&cpu0 /* normal: cpu side only */
&mcpu0 /* multi: cpu side only */
&fe00 &fe01 &be0 /* dpcm: both FE / BE */
&fe10 &fe11 &be1 /* dpcm-m: both FE / BE */
&c2c /* c2c: cpu side only */
&c2c_m /* c2c: cpu side only */
>;
multi {
ports@0 {
mcpu0: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
};
ports@1 {
port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; };
port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
};
ports@2 {
port@0 { mbe_ep: endpoint { remote-endpoint = <&be10_ep>; }; };
port@1 { mbe1_ep: endpoint { remote-endpoint = <&codec4_ep>; }; };
port@2 { mbe2_ep: endpoint { remote-endpoint = <&codec5_ep>; }; };
};
ports@3 {
port@0 { mc2c0_ep: endpoint { remote-endpoint = <&c2cmf_ep>; }; };
port@1 { mc2c00_ep: endpoint { remote-endpoint = <&codec8_ep>; }; };
port@2 { mc2c01_ep: endpoint { remote-endpoint = <&codec9_ep>; }; };
};
ports@4 {
port@0 { mc2c1_ep: endpoint { remote-endpoint = <&c2cmb_ep>; }; };
port@1 { mc2c10_ep: endpoint { remote-endpoint = <&codec10_ep>; }; };
port@2 { mc2c11_ep: endpoint { remote-endpoint = <&codec11_ep>; }; };
};
};
dpcm {
/* FE */
ports@0 {
fe00: port@0 { fe00_ep: endpoint { remote-endpoint = <&cpu3_ep>; }; };
fe01: port@1 { fe01_ep: endpoint { remote-endpoint = <&cpu4_ep>; }; };
fe10: port@2 { fe10_ep: endpoint { remote-endpoint = <&cpu5_ep>; }; };
fe11: port@3 { fe11_ep: endpoint { remote-endpoint = <&cpu6_ep>; }; };
};
/* BE */
ports@1 {
be0: port@0 { be00_ep: endpoint { remote-endpoint = <&codec3_ep>; }; };
be1: port@1 { be10_ep: endpoint { remote-endpoint = <&mbe_ep>; }; };
};
};
codec2codec {
ports@0 {
rate = <48000>;
c2c: port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec6_ep>; }; };
port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec7_ep>; }; };
};
ports@1 {
rate = <48000>;
c2c_m: port@0 { c2cmf_ep: endpoint { remote-endpoint = <&mc2c0_ep>; }; };
port@1 { c2cmb_ep: endpoint { remote-endpoint = <&mc2c1_ep>; }; };
};
};
};
test_cpu {
/*
* update compatible to indicate more detail behaviour
* if you want. see test-compatible for more detail.
*
* ex)
* - compatible = "test-cpu";
* + compatible = "test-cpu-verbose";
*/
compatible = "test-cpu";
ports {
bitclock-master;
frame-master;
cpu0: port@0 { cpu0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
port@1 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; };
port@2 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; };
port@3 { cpu3_ep: endpoint { remote-endpoint = <&fe00_ep>; }; };
port@4 { cpu4_ep: endpoint { remote-endpoint = <&fe01_ep>; }; };
port@5 { cpu5_ep: endpoint { remote-endpoint = <&fe10_ep>; }; };
port@6 { cpu6_ep: endpoint { remote-endpoint = <&fe11_ep>; }; };
};
};
test_codec {
/*
* update compatible to indicate more detail behaviour
* if you want. see test-compatible for more detail.
*
* ex)
* - compatible = "test-codec";
* + compatible = "test-codec-verbose";
*/
compatible = "test-codec";
ports {
/*
* prefix can be added to *component*,
* see audio-graph-card2::routing
*/
prefix = "TC";
port@0 { codec0_ep: endpoint { remote-endpoint = <&cpu0_ep>; }; };
port@1 { codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; };
port@2 { codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; };
port@3 { codec3_ep: endpoint { remote-endpoint = <&be00_ep>; }; };
port@4 { codec4_ep: endpoint { remote-endpoint = <&mbe1_ep>; }; };
port@5 { codec5_ep: endpoint { remote-endpoint = <&mbe2_ep>; }; };
port@6 { bitclock-master;
frame-master;
codec6_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; };
port@7 { codec7_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; };
port@8 { bitclock-master;
frame-master;
codec8_ep: endpoint { remote-endpoint = <&mc2c00_ep>; }; };
port@9 { codec9_ep: endpoint { remote-endpoint = <&mc2c01_ep>; }; };
port@10 { codec10_ep: endpoint { remote-endpoint = <&mc2c10_ep>; }; };
port@11 { codec11_ep: endpoint { remote-endpoint = <&mc2c11_ep>; }; };
};
};
};
This diff is collapsed.
......@@ -619,7 +619,8 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
struct asoc_simple_dai *dais;
struct snd_soc_dai_link_component *dlcs;
struct snd_soc_codec_conf *cconf = NULL;
int i, dai_num = 0, dlc_num = 0, cnf_num = 0;
struct snd_soc_pcm_stream *c2c_conf = NULL;
int i, dai_num = 0, dlc_num = 0, cnf_num = 0, c2c_num = 0;
dai_props = devm_kcalloc(dev, li->link, sizeof(*dai_props), GFP_KERNEL);
dai_link = devm_kcalloc(dev, li->link, sizeof(*dai_link), GFP_KERNEL);
......@@ -638,6 +639,8 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
if (!li->num[i].cpus)
cnf_num += li->num[i].codecs;
c2c_num += li->num[i].c2c;
}
dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL);
......@@ -651,6 +654,12 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
return -ENOMEM;
}
if (c2c_num) {
c2c_conf = devm_kcalloc(dev, c2c_num, sizeof(*c2c_conf), GFP_KERNEL);
if (!c2c_conf)
return -ENOMEM;
}
dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
li->link, dai_num, cnf_num);
......@@ -664,6 +673,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
priv->dais = dais;
priv->dlcs = dlcs;
priv->codec_conf = cconf;
priv->c2c_conf = c2c_conf;
card->dai_link = priv->dai_link;
card->num_links = li->link;
......@@ -681,6 +691,12 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
dlcs += li->num[i].cpus;
dais += li->num[i].cpus;
if (li->num[i].c2c) {
/* Codec2Codec */
dai_props[i].c2c_conf = c2c_conf;
c2c_conf += li->num[i].c2c;
}
} else {
/* DPCM Be's CPU = dummy */
dai_props[i].cpus =
......@@ -759,6 +775,34 @@ int asoc_graph_card_probe(struct snd_soc_card *card)
}
EXPORT_SYMBOL_GPL(asoc_graph_card_probe);
int asoc_graph_is_ports0(struct device_node *np)
{
struct device_node *port, *ports, *ports0, *top;
int ret;
/* np is "endpoint" or "port" */
if (of_node_name_eq(np, "endpoint")) {
port = of_get_parent(np);
} else {
port = np;
of_node_get(port);
}
ports = of_get_parent(port);
top = of_get_parent(ports);
ports0 = of_get_child_by_name(top, "ports");
ret = ports0 == ports;
of_node_put(port);
of_node_put(ports);
of_node_put(ports0);
of_node_put(top);
return ret;
}
EXPORT_SYMBOL_GPL(asoc_graph_is_ports0);
/* Module information */
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment