Merge "asoc: Add codec entry node for wcd937x to support ADIE RTAC"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
b764c33cef
@@ -72,6 +72,11 @@ struct wcd937x_priv {
|
||||
struct codec_port_info
|
||||
rx_port_mapping[MAX_PORT][MAX_CH_PER_PORT];
|
||||
struct regulator_bulk_data *supplies;
|
||||
|
||||
u32 version;
|
||||
/* Entry for version info */
|
||||
struct snd_info_entry *entry;
|
||||
struct snd_info_entry *version_entry;
|
||||
};
|
||||
|
||||
struct wcd937x_micbias_setting {
|
||||
@@ -128,4 +133,6 @@ extern int wcd937x_mbhc_micb_adjust_voltage(struct snd_soc_codec *codec,
|
||||
extern int wcd937x_get_micb_vout_ctl_val(u32 micb_mv);
|
||||
extern int wcd937x_micbias_control(struct snd_soc_codec *codec, int micb_num,
|
||||
int req, bool is_dapm);
|
||||
extern int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root,
|
||||
struct snd_soc_codec *codec);
|
||||
#endif
|
||||
|
@@ -36,6 +36,9 @@
|
||||
|
||||
#define NUM_SWRS_DT_PARAMS 5
|
||||
|
||||
#define WCD937X_VERSION_1_0 1
|
||||
#define WCD937X_VERSION_ENTRY_SIZE 32
|
||||
|
||||
enum {
|
||||
CODEC_TX = 0,
|
||||
CODEC_RX,
|
||||
@@ -1564,6 +1567,95 @@ static const struct snd_soc_dapm_route wcd9375_audio_map[] = {
|
||||
|
||||
};
|
||||
|
||||
static ssize_t wcd937x_version_read(struct snd_info_entry *entry,
|
||||
void *file_private_data,
|
||||
struct file *file,
|
||||
char __user *buf, size_t count,
|
||||
loff_t pos)
|
||||
{
|
||||
struct wcd937x_priv *priv;
|
||||
char buffer[WCD937X_VERSION_ENTRY_SIZE];
|
||||
int len = 0;
|
||||
|
||||
priv = (struct wcd937x_priv *) entry->private_data;
|
||||
if (!priv) {
|
||||
pr_err("%s: wcd937x priv is null\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (priv->version) {
|
||||
case WCD937X_VERSION_1_0:
|
||||
len = snprintf(buffer, sizeof(buffer), "WCD937X_1_0\n");
|
||||
break;
|
||||
default:
|
||||
len = snprintf(buffer, sizeof(buffer), "VER_UNDEFINED\n");
|
||||
}
|
||||
|
||||
return simple_read_from_buffer(buf, count, &pos, buffer, len);
|
||||
}
|
||||
|
||||
static struct snd_info_entry_ops wcd937x_info_ops = {
|
||||
.read = wcd937x_version_read,
|
||||
};
|
||||
|
||||
/*
|
||||
* wcd937x_info_create_codec_entry - creates wcd937x module
|
||||
* @codec_root: The parent directory
|
||||
* @codec: Codec instance
|
||||
*
|
||||
* Creates wcd937x module and version entry under the given
|
||||
* parent directory.
|
||||
*
|
||||
* Return: 0 on success or negative error code on failure.
|
||||
*/
|
||||
int wcd937x_info_create_codec_entry(struct snd_info_entry *codec_root,
|
||||
struct snd_soc_codec *codec)
|
||||
{
|
||||
struct snd_info_entry *version_entry;
|
||||
struct wcd937x_priv *priv;
|
||||
struct snd_soc_card *card;
|
||||
|
||||
if (!codec_root || !codec)
|
||||
return -EINVAL;
|
||||
|
||||
priv = snd_soc_codec_get_drvdata(codec);
|
||||
if (priv->entry) {
|
||||
dev_dbg(priv->dev,
|
||||
"%s:wcd937x module already created\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
card = codec->component.card;
|
||||
priv->entry = snd_info_create_subdir(codec_root->module,
|
||||
"wcd937x", codec_root);
|
||||
if (!priv->entry) {
|
||||
dev_dbg(codec->dev, "%s: failed to create wcd937x entry\n",
|
||||
__func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
version_entry = snd_info_create_card_entry(card->snd_card,
|
||||
"version",
|
||||
priv->entry);
|
||||
if (!version_entry) {
|
||||
dev_dbg(codec->dev, "%s: failed to create wcd937x version entry\n",
|
||||
__func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
version_entry->private_data = priv;
|
||||
version_entry->size = WCD937X_VERSION_ENTRY_SIZE;
|
||||
version_entry->content = SNDRV_INFO_CONTENT_DATA;
|
||||
version_entry->c.ops = &wcd937x_info_ops;
|
||||
|
||||
if (snd_info_register(version_entry) < 0) {
|
||||
snd_info_free_entry(version_entry);
|
||||
return -ENOMEM;
|
||||
}
|
||||
priv->version_entry = version_entry;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(wcd937x_info_create_codec_entry);
|
||||
|
||||
static int wcd937x_soc_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct wcd937x_priv *wcd937x = snd_soc_codec_get_drvdata(codec);
|
||||
@@ -1630,6 +1722,7 @@ static int wcd937x_soc_codec_probe(struct snd_soc_codec *codec)
|
||||
goto err_hwdep;
|
||||
}
|
||||
}
|
||||
wcd937x->version = WCD937X_VERSION_1_0;
|
||||
return ret;
|
||||
|
||||
err_hwdep:
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include "codecs/bolero/bolero-cdc.h"
|
||||
#include <dt-bindings/sound/audio-codec-port-types.h>
|
||||
#include "codecs/bolero/wsa-macro.h"
|
||||
#include "codecs/wcd937x/internal.h"
|
||||
|
||||
#define DRV_NAME "sm6150-asoc-snd"
|
||||
|
||||
@@ -4915,15 +4916,17 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
||||
}
|
||||
}
|
||||
card = rtd->card->snd_card;
|
||||
entry = snd_info_create_subdir(card->module, "codecs",
|
||||
card->proc_root);
|
||||
if (!entry) {
|
||||
pr_debug("%s: Cannot create codecs module entry\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
goto err;
|
||||
if (!pdata->codec_root) {
|
||||
entry = snd_info_create_subdir(card->module, "codecs",
|
||||
card->proc_root);
|
||||
if (!entry) {
|
||||
pr_debug("%s: Cannot create codecs module entry\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
goto err;
|
||||
}
|
||||
pdata->codec_root = entry;
|
||||
}
|
||||
pdata->codec_root = entry;
|
||||
bolero_info_create_codec_entry(pdata->codec_root, codec);
|
||||
codec_reg_done = true;
|
||||
return 0;
|
||||
@@ -7878,6 +7881,8 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct msm_asoc_mach_data *pdata;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
struct snd_card *card = component->card->snd_card;
|
||||
struct snd_info_entry *entry;
|
||||
int ret = 0;
|
||||
|
||||
if (!codec) {
|
||||
@@ -7914,10 +7919,19 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
||||
goto err;
|
||||
}
|
||||
pdata = snd_soc_card_get_drvdata(component->card);
|
||||
if (pdata && pdata->codec_root)
|
||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
codec);
|
||||
|
||||
if (!pdata->codec_root) {
|
||||
entry = snd_info_create_subdir(card->module, "codecs",
|
||||
card->proc_root);
|
||||
if (!entry) {
|
||||
pr_err("%s: Cannot create codecs module entry\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
goto err;
|
||||
}
|
||||
pdata->codec_root = entry;
|
||||
}
|
||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||
codec);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
@@ -7928,6 +7942,9 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
int ret = 0;
|
||||
void *mbhc_calibration;
|
||||
struct snd_info_entry *entry;
|
||||
struct snd_card *card = component->card->snd_card;
|
||||
struct msm_asoc_mach_data *pdata;
|
||||
|
||||
snd_soc_dapm_ignore_suspend(dapm, "EAR");
|
||||
snd_soc_dapm_ignore_suspend(dapm, "AUX");
|
||||
@@ -7939,6 +7956,20 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
|
||||
snd_soc_dapm_ignore_suspend(dapm, "AMIC4");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
|
||||
pdata = snd_soc_card_get_drvdata(component->card);
|
||||
if (!pdata->codec_root) {
|
||||
entry = snd_info_create_subdir(card->module, "codecs",
|
||||
card->proc_root);
|
||||
if (!entry) {
|
||||
pr_err("%s: Cannot create codecs module entry\n",
|
||||
__func__);
|
||||
ret = 0;
|
||||
goto codec_root_err;
|
||||
}
|
||||
pdata->codec_root = entry;
|
||||
}
|
||||
wcd937x_info_create_codec_entry(pdata->codec_root, codec);
|
||||
codec_root_err:
|
||||
mbhc_calibration = def_wcd_mbhc_cal();
|
||||
if (!mbhc_calibration) {
|
||||
return -ENOMEM;
|
||||
|
Reference in New Issue
Block a user