asoc: update snd info api

Update snd info API and userspace and get codec info.

Change-Id: Ic9cfc89365cf6263a9b1c02403d68e7740bebbeb
Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
Meng Wang
2019-10-30 17:55:20 +08:00
committed by Gerrit - the friendly Code Review server
parent 11d5299f26
commit 4a03bd5171
5 changed files with 58 additions and 7 deletions

View File

@@ -786,19 +786,26 @@ int bolero_info_create_codec_entry(struct snd_info_entry *codec_root,
return 0; return 0;
} }
card = component->card; card = component->card;
priv->entry = snd_info_create_subdir(codec_root->module, priv->entry = snd_info_create_module_entry(codec_root->module,
"bolero", codec_root); "bolero", codec_root);
if (!priv->entry) { if (!priv->entry) {
dev_dbg(component->dev, "%s: failed to create bolero entry\n", dev_dbg(component->dev, "%s: failed to create bolero entry\n",
__func__); __func__);
return -ENOMEM; return -ENOMEM;
} }
priv->entry->mode = S_IFDIR | 0555;
if (snd_info_register(priv->entry) < 0) {
snd_info_free_entry(priv->entry);
return -ENOMEM;
}
version_entry = snd_info_create_card_entry(card->snd_card, version_entry = snd_info_create_card_entry(card->snd_card,
"version", "version",
priv->entry); priv->entry);
if (!version_entry) { if (!version_entry) {
dev_err(component->dev, "%s: failed to create bolero version entry\n", dev_err(component->dev, "%s: failed to create bolero version entry\n",
__func__); __func__);
snd_info_free_entry(priv->entry);
return -ENOMEM; return -ENOMEM;
} }
@@ -809,6 +816,7 @@ int bolero_info_create_codec_entry(struct snd_info_entry *codec_root,
if (snd_info_register(version_entry) < 0) { if (snd_info_register(version_entry) < 0) {
snd_info_free_entry(version_entry); snd_info_free_entry(version_entry);
snd_info_free_entry(priv->entry);
return -ENOMEM; return -ENOMEM;
} }
priv->version_entry = version_entry; priv->version_entry = version_entry;

View File

@@ -2944,19 +2944,26 @@ int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root,
return 0; return 0;
} }
card = component->card; card = component->card;
priv->entry = snd_info_create_subdir(codec_root->module,
priv->entry = snd_info_create_module_entry(codec_root->module,
"wcd938x", codec_root); "wcd938x", codec_root);
if (!priv->entry) { if (!priv->entry) {
dev_dbg(component->dev, "%s: failed to create wcd938x entry\n", dev_dbg(component->dev, "%s: failed to create wcd938x entry\n",
__func__); __func__);
return -ENOMEM; return -ENOMEM;
} }
priv->entry->mode = S_IFDIR | 0555;
if (snd_info_register(priv->entry) < 0) {
snd_info_free_entry(priv->entry);
return -ENOMEM;
}
version_entry = snd_info_create_card_entry(card->snd_card, version_entry = snd_info_create_card_entry(card->snd_card,
"version", "version",
priv->entry); priv->entry);
if (!version_entry) { if (!version_entry) {
dev_dbg(component->dev, "%s: failed to create wcd938x version entry\n", dev_dbg(component->dev, "%s: failed to create wcd938x version entry\n",
__func__); __func__);
snd_info_free_entry(priv->entry);
return -ENOMEM; return -ENOMEM;
} }
@@ -2967,6 +2974,7 @@ int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root,
if (snd_info_register(version_entry) < 0) { if (snd_info_register(version_entry) < 0) {
snd_info_free_entry(version_entry); snd_info_free_entry(version_entry);
snd_info_free_entry(priv->entry);
return -ENOMEM; return -ENOMEM;
} }
priv->version_entry = version_entry; priv->version_entry = version_entry;
@@ -2977,6 +2985,8 @@ int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root,
if (!variant_entry) { if (!variant_entry) {
dev_dbg(component->dev, "%s: failed to create wcd938x variant entry\n", dev_dbg(component->dev, "%s: failed to create wcd938x variant entry\n",
__func__); __func__);
snd_info_free_entry(version_entry);
snd_info_free_entry(priv->entry);
return -ENOMEM; return -ENOMEM;
} }
@@ -2987,6 +2997,8 @@ int wcd938x_info_create_codec_entry(struct snd_info_entry *codec_root,
if (snd_info_register(variant_entry) < 0) { if (snd_info_register(variant_entry) < 0) {
snd_info_free_entry(variant_entry); snd_info_free_entry(variant_entry);
snd_info_free_entry(version_entry);
snd_info_free_entry(priv->entry);
return -ENOMEM; return -ENOMEM;
} }
priv->variant_entry = variant_entry; priv->variant_entry = variant_entry;

View File

@@ -343,7 +343,7 @@ int wsa881x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
snprintf(name, sizeof(name), "%s.%x", "wsa881x", snprintf(name, sizeof(name), "%s.%x", "wsa881x",
(u32)wsa881x->swr_slave->addr); (u32)wsa881x->swr_slave->addr);
wsa881x->entry = snd_info_create_subdir(codec_root->module, wsa881x->entry = snd_info_create_module_entry(codec_root->module,
(const char *)name, (const char *)name,
codec_root); codec_root);
if (!wsa881x->entry) { if (!wsa881x->entry) {
@@ -351,6 +351,11 @@ int wsa881x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
__func__); __func__);
return -ENOMEM; return -ENOMEM;
} }
wsa881x->entry->mode = S_IFDIR | 0555;
if (snd_info_register(wsa881x->entry) < 0) {
snd_info_free_entry(wsa881x->entry);
return -ENOMEM;
}
version_entry = snd_info_create_card_entry(card->snd_card, version_entry = snd_info_create_card_entry(card->snd_card,
"version", "version",
@@ -358,6 +363,7 @@ int wsa881x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
if (!version_entry) { if (!version_entry) {
dev_dbg(component->dev, "%s: failed to create wsa881x version entry\n", dev_dbg(component->dev, "%s: failed to create wsa881x version entry\n",
__func__); __func__);
snd_info_free_entry(wsa881x->entry);
return -ENOMEM; return -ENOMEM;
} }
@@ -368,6 +374,7 @@ int wsa881x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
if (snd_info_register(version_entry) < 0) { if (snd_info_register(version_entry) < 0) {
snd_info_free_entry(version_entry); snd_info_free_entry(version_entry);
snd_info_free_entry(wsa881x->entry);
return -ENOMEM; return -ENOMEM;
} }
wsa881x->version_entry = version_entry; wsa881x->version_entry = version_entry;

View File

@@ -570,7 +570,7 @@ int wsa883x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
snprintf(name, sizeof(name), "%s.%x", "wsa883x", snprintf(name, sizeof(name), "%s.%x", "wsa883x",
(u32)wsa883x->swr_slave->addr); (u32)wsa883x->swr_slave->addr);
wsa883x->entry = snd_info_create_subdir(codec_root->module, wsa883x->entry = snd_info_create_module_entry(codec_root->module,
(const char *)name, (const char *)name,
codec_root); codec_root);
if (!wsa883x->entry) { if (!wsa883x->entry) {
@@ -578,6 +578,11 @@ int wsa883x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
__func__); __func__);
return -ENOMEM; return -ENOMEM;
} }
wsa883x->entry->mode = S_IFDIR | 0555;
if (snd_info_register(wsa883x->entry) < 0) {
snd_info_free_entry(wsa883x->entry);
return -ENOMEM;
}
version_entry = snd_info_create_card_entry(card->snd_card, version_entry = snd_info_create_card_entry(card->snd_card,
"version", "version",
@@ -585,6 +590,7 @@ int wsa883x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
if (!version_entry) { if (!version_entry) {
dev_dbg(component->dev, "%s: failed to create wsa883x version entry\n", dev_dbg(component->dev, "%s: failed to create wsa883x version entry\n",
__func__); __func__);
snd_info_free_entry(wsa883x->entry);
return -ENOMEM; return -ENOMEM;
} }
@@ -595,6 +601,7 @@ int wsa883x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
if (snd_info_register(version_entry) < 0) { if (snd_info_register(version_entry) < 0) {
snd_info_free_entry(version_entry); snd_info_free_entry(version_entry);
snd_info_free_entry(wsa883x->entry);
return -ENOMEM; return -ENOMEM;
} }
wsa883x->version_entry = version_entry; wsa883x->version_entry = version_entry;

View File

@@ -5313,6 +5313,23 @@ static int msm_wcn_init_lito(struct snd_soc_pcm_runtime *rtd)
tx_ch, ARRAY_SIZE(rx_ch), rx_ch); tx_ch, ARRAY_SIZE(rx_ch), rx_ch);
} }
static struct snd_info_entry *msm_snd_info_create_subdir(struct module *mod,
const char *name,
struct snd_info_entry *parent)
{
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(mod, name, parent);
if (!entry)
return NULL;
entry->mode = S_IFDIR | 0555;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
return NULL;
}
return entry;
}
static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
{ {
int ret = -EINVAL; int ret = -EINVAL;
@@ -5407,7 +5424,7 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
} }
card = rtd->card->snd_card; card = rtd->card->snd_card;
if (!pdata->codec_root) { if (!pdata->codec_root) {
entry = snd_info_create_subdir(card->module, "codecs", entry = msm_snd_info_create_subdir(card->module, "codecs",
card->proc_root); card->proc_root);
if (!entry) { if (!entry) {
pr_debug("%s: Cannot create codecs module entry\n", pr_debug("%s: Cannot create codecs module entry\n",
@@ -7501,7 +7518,7 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
} }
pdata = snd_soc_card_get_drvdata(component->card); pdata = snd_soc_card_get_drvdata(component->card);
if (!pdata->codec_root) { if (!pdata->codec_root) {
entry = snd_info_create_subdir(card->module, "codecs", entry = msm_snd_info_create_subdir(card->module, "codecs",
card->proc_root); card->proc_root);
if (!entry) { if (!entry) {
pr_err("%s: Cannot create codecs module entry\n", pr_err("%s: Cannot create codecs module entry\n",
@@ -7539,7 +7556,7 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
pdata = snd_soc_card_get_drvdata(component->card); pdata = snd_soc_card_get_drvdata(component->card);
if (!pdata->codec_root) { if (!pdata->codec_root) {
entry = snd_info_create_subdir(card->module, "codecs", entry = msm_snd_info_create_subdir(card->module, "codecs",
card->proc_root); card->proc_root);
if (!entry) { if (!entry) {
dev_dbg(component->dev, "%s: Cannot create codecs module entry\n", dev_dbg(component->dev, "%s: Cannot create codecs module entry\n",