Commit 0580dde5 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card-utils: add asoc_simple_debug_info()

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 88314902
......@@ -129,4 +129,76 @@ int asoc_simple_card_init_jack(struct snd_soc_card *card,
struct asoc_simple_jack *sjack,
int is_hp, char *prefix);
#ifdef DEBUG
inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
char *name,
struct asoc_simple_dai *dai)
{
struct device *dev = simple_priv_to_dev(priv);
if (dai->name)
dev_dbg(dev, "%s dai name = %s\n",
name, dai->name);
if (dai->sysclk)
dev_dbg(dev, "%s sysclk = %d\n",
name, dai->sysclk);
dev_dbg(dev, "%s direction = %s\n",
name, dai->clk_direction ? "OUT" : "IN");
if (dai->slots)
dev_dbg(dev, "%s slots = %d\n", name, dai->slots);
if (dai->slot_width)
dev_dbg(dev, "%s slot width = %d\n", name, dai->slot_width);
if (dai->tx_slot_mask)
dev_dbg(dev, "%s tx slot mask = %d\n", name, dai->tx_slot_mask);
if (dai->rx_slot_mask)
dev_dbg(dev, "%s rx slot mask = %d\n", name, dai->rx_slot_mask);
if (dai->clk)
dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));
}
inline void asoc_simple_debug_info(struct asoc_simple_priv *priv)
{
struct snd_soc_card *card = simple_priv_to_card(priv);
struct device *dev = simple_priv_to_dev(priv);
int i;
if (card->name)
dev_dbg(dev, "Card Name: %s\n", card->name);
for (i = 0; i < card->num_links; i++) {
struct simple_dai_props *props = simple_priv_to_props(priv, i);
struct snd_soc_dai_link *link = simple_priv_to_link(priv, i);
dev_dbg(dev, "DAI%d\n", i);
asoc_simple_debug_dai(priv, "cpu", props->cpu_dai);
asoc_simple_debug_dai(priv, "codec", props->codec_dai);
if (link->name)
dev_dbg(dev, "dai name = %s\n", link->name);
dev_dbg(dev, "dai format = %04x\n", link->dai_fmt);
if (props->adata.convert_rate)
dev_dbg(dev, "convert_rate = %d\n",
props->adata.convert_rate);
if (props->adata.convert_channels)
dev_dbg(dev, "convert_channels = %d\n",
props->adata.convert_channels);
if (props->codec_conf && props->codec_conf->name_prefix)
dev_dbg(dev, "name prefix = %s\n",
props->codec_conf->name_prefix);
if (props->mclk_fs)
dev_dbg(dev, "mclk-fs = %d\n",
props->mclk_fs);
}
}
#else
#define asoc_simple_debug_info(priv)
#endif /* DEBUG */
#endif /* __SIMPLE_CARD_UTILS_H */
......@@ -712,6 +712,8 @@ static int graph_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, priv);
asoc_simple_debug_info(priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0)
goto err;
......
......@@ -49,9 +49,6 @@ void asoc_simple_card_parse_convert(struct device *dev,
/* channels transfer */
snprintf(prop, sizeof(prop), "%s%s", prefix, "convert-channels");
of_property_read_u32(np, prop, &data->convert_channels);
dev_dbg(dev, "convert_rate %d\n", data->convert_rate);
dev_dbg(dev, "convert_channels %d\n", data->convert_channels);
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_convert);
......@@ -93,8 +90,6 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
*retfmt = daifmt;
dev_dbg(dev, "format : %04x\n", daifmt);
return 0;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
......@@ -116,8 +111,6 @@ int asoc_simple_card_set_dailink_name(struct device *dev,
dai_link->name = name;
dai_link->stream_name = name;
dev_dbg(dev, "name : %s\n", name);
}
return ret;
......@@ -146,8 +139,6 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
if (!card->name && card->dai_link)
card->name = card->dai_link->name;
dev_dbg(card->dev, "Card Name: %s\n", card->name ? card->name : "");
return 0;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
......@@ -211,9 +202,6 @@ int asoc_simple_card_parse_clk(struct device *dev,
if (of_property_read_bool(node, "system-clock-direction-out"))
simple_dai->clk_direction = SND_SOC_CLOCK_OUT;
dev_dbg(dev, "%s : sysclk = %d, direction %d\n", dai_name,
simple_dai->sysclk, simple_dai->clk_direction);
return 0;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
......
......@@ -813,6 +813,8 @@ static int simple_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, priv);
asoc_simple_debug_info(priv);
ret = devm_snd_soc_register_card(dev, card);
if (ret < 0)
goto err;
......
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