ASoC: update machine driver for kernel-4.19
snd_soc_codec is removed from kernel-4.19. Update machine driver to fix compile error. Change-Id: I1bdfda07c0d150d008c434c361142b655de1e9db Signed-off-by: Meng Wang <mengw@codeaurora.org>
这个提交包含在:
194
asoc/qcs405.c
194
asoc/qcs405.c
@@ -191,7 +191,7 @@ struct msm_asoc_mach_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct msm_asoc_wcd93xx_codec {
|
struct msm_asoc_wcd93xx_codec {
|
||||||
void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
|
void* (*get_afe_config_fn)(struct snd_soc_component *component,
|
||||||
enum afe_config_type config_type);
|
enum afe_config_type config_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -610,7 +610,7 @@ static struct snd_soc_aux_dev *msm_aux_dev;
|
|||||||
static struct snd_soc_codec_conf *msm_codec_conf;
|
static struct snd_soc_codec_conf *msm_codec_conf;
|
||||||
static struct msm_asoc_wcd93xx_codec msm_codec_fn;
|
static struct msm_asoc_wcd93xx_codec msm_codec_fn;
|
||||||
|
|
||||||
static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
|
static int msm_snd_enable_codec_ext_clk(struct snd_soc_component *component,
|
||||||
int enable, bool dapm);
|
int enable, bool dapm);
|
||||||
static int msm_wsa881x_init(struct snd_soc_component *component);
|
static int msm_wsa881x_init(struct snd_soc_component *component);
|
||||||
static int msm_snd_vad_cfg_put(struct snd_kcontrol *kcontrol,
|
static int msm_snd_vad_cfg_put(struct snd_kcontrol *kcontrol,
|
||||||
@@ -3773,30 +3773,30 @@ static const struct snd_kcontrol_new msm_snd_controls[] = {
|
|||||||
msm_spdif_tx_format_get, msm_spdif_tx_format_put),
|
msm_spdif_tx_format_get, msm_spdif_tx_format_put),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
|
static int msm_snd_enable_codec_ext_clk(struct snd_soc_component *component,
|
||||||
int enable, bool dapm)
|
int enable, bool dapm)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!strcmp(dev_name(codec->dev), "tasha_codec")) {
|
if (!strcmp(component.name, "tasha_codec")) {
|
||||||
ret = tasha_cdc_mclk_enable(codec, enable, dapm);
|
ret = tasha_cdc_mclk_enable(component, enable, dapm);
|
||||||
} else {
|
} else {
|
||||||
dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
|
dev_err(component->dev, "%s: unknown codec to enable ext clk\n",
|
||||||
__func__);
|
__func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
|
static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_component *component,
|
||||||
int enable, bool dapm)
|
int enable, bool dapm)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!strcmp(dev_name(codec->dev), "tasha_codec")) {
|
if (!strcmp(component.name, "tasha_codec")) {
|
||||||
ret = tasha_cdc_mclk_tx_enable(codec, enable, dapm);
|
ret = tasha_cdc_mclk_tx_enable(component, enable, dapm);
|
||||||
} else {
|
} else {
|
||||||
dev_err(codec->dev, "%s: unknown codec to enable TX ext clk\n",
|
dev_err(component->dev, "%s: unknown codec to enable TX ext clk\n",
|
||||||
__func__);
|
__func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -3807,15 +3807,16 @@ static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
|
|||||||
static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
|
static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
pr_debug("%s: event = %d\n", __func__, event);
|
pr_debug("%s: event = %d\n", __func__, event);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
return msm_snd_enable_codec_ext_tx_clk(codec, 1, true);
|
return msm_snd_enable_codec_ext_tx_clk(component, 1, true);
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
return msm_snd_enable_codec_ext_tx_clk(codec, 0, true);
|
return msm_snd_enable_codec_ext_tx_clk(component, 0, true);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3823,15 +3824,16 @@ static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
|
|||||||
static int msm_mclk_event(struct snd_soc_dapm_widget *w,
|
static int msm_mclk_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
pr_debug("%s: event = %d\n", __func__, event);
|
pr_debug("%s: event = %d\n", __func__, event);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
return msm_snd_enable_codec_ext_clk(codec, 1, true);
|
return msm_snd_enable_codec_ext_clk(component, 1, true);
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
return msm_snd_enable_codec_ext_clk(codec, 0, true);
|
return msm_snd_enable_codec_ext_clk(component, 0, true);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3854,7 +3856,8 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct msm_asoc_mach_data *pdata = NULL;
|
struct msm_asoc_mach_data *pdata = NULL;
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint32_t dmic_idx;
|
uint32_t dmic_idx;
|
||||||
int *dmic_gpio_cnt;
|
int *dmic_gpio_cnt;
|
||||||
@@ -3863,18 +3866,18 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
|
|
||||||
wname = strpbrk(w->name, "01234567");
|
wname = strpbrk(w->name, "01234567");
|
||||||
if (!wname) {
|
if (!wname) {
|
||||||
dev_err(codec->dev, "%s: widget not found\n", __func__);
|
dev_err(component->dev, "%s: widget not found\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = kstrtouint(wname, 10, &dmic_idx);
|
ret = kstrtouint(wname, 10, &dmic_idx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n",
|
dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata = snd_soc_card_get_drvdata(codec->component.card);
|
pdata = snd_soc_card_get_drvdata(component->card);
|
||||||
|
|
||||||
switch (dmic_idx) {
|
switch (dmic_idx) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -3898,12 +3901,12 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
dmic_gpio = pdata->dmic_67_gpio_p;
|
dmic_gpio = pdata->dmic_67_gpio_p;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
|
dev_err(component->dev, "%s: Invalid DMIC Selection\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_gpio_cnt %d\n",
|
dev_dbg(component->dev, "%s: event %d DMIC%d dmic_gpio_cnt %d\n",
|
||||||
__func__, event, dmic_idx, *dmic_gpio_cnt);
|
__func__, event, dmic_idx, *dmic_gpio_cnt);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
@@ -3913,7 +3916,7 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
ret = msm_cdc_pinctrl_select_active_state(
|
ret = msm_cdc_pinctrl_select_active_state(
|
||||||
dmic_gpio);
|
dmic_gpio);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "%s: gpio set cannot be activated %sd\n",
|
dev_err(component->dev, "%s: gpio set cannot be activated %sd\n",
|
||||||
__func__, "dmic_gpio");
|
__func__, "dmic_gpio");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -3925,14 +3928,14 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
ret = msm_cdc_pinctrl_select_sleep_state(
|
ret = msm_cdc_pinctrl_select_sleep_state(
|
||||||
dmic_gpio);
|
dmic_gpio);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "%s: gpio set cannot be de-activated %sd\n",
|
dev_err(component->dev, "%s: gpio set cannot be de-activated %sd\n",
|
||||||
__func__, "dmic_gpio");
|
__func__, "dmic_gpio");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "%s: invalid DAPM event %d\n",
|
dev_err(component->dev, "%s: invalid DAPM event %d\n",
|
||||||
__func__, event);
|
__func__, event);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -4087,7 +4090,7 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
int idx;
|
int idx;
|
||||||
void *config = NULL;
|
void *config = NULL;
|
||||||
struct snd_soc_codec *codec = NULL;
|
struct snd_soc_component *component = NULL;
|
||||||
|
|
||||||
pr_debug("%s: format = %d, rate = %d\n",
|
pr_debug("%s: format = %d, rate = %d\n",
|
||||||
__func__, params_format(params), params_rate(params));
|
__func__, params_format(params), params_rate(params));
|
||||||
@@ -4137,11 +4140,16 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MSM_BACKEND_DAI_SLIMBUS_5_TX:
|
case MSM_BACKEND_DAI_SLIMBUS_5_TX:
|
||||||
codec = rtd->codec;
|
component = snd_soc_rtdcom_lookup(rtd, "tasha_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
rate->min = rate->max = SAMPLING_RATE_16KHZ;
|
rate->min = rate->max = SAMPLING_RATE_16KHZ;
|
||||||
channels->min = channels->max = 1;
|
channels->min = channels->max = 1;
|
||||||
|
|
||||||
config = msm_codec_fn.get_afe_config_fn(codec,
|
config = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_SLIMBUS_SLAVE_PORT_CONFIG);
|
AFE_SLIMBUS_SLAVE_PORT_CONFIG);
|
||||||
if (config) {
|
if (config) {
|
||||||
rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
|
rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
|
||||||
@@ -4553,46 +4561,46 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_afe_set_config(struct snd_soc_codec *codec)
|
static int msm_afe_set_config(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *config_data = NULL;
|
void *config_data = NULL;
|
||||||
|
|
||||||
if (!msm_codec_fn.get_afe_config_fn) {
|
if (!msm_codec_fn.get_afe_config_fn) {
|
||||||
dev_err(codec->dev, "%s: codec get afe config not init'ed\n",
|
dev_err(component->dev, "%s: codec get afe config not init'ed\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_CDC_REGISTERS_CONFIG);
|
AFE_CDC_REGISTERS_CONFIG);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
|
ret = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: Failed to set codec registers config %d\n",
|
"%s: Failed to set codec registers config %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_CDC_REGISTER_PAGE_CONFIG);
|
AFE_CDC_REGISTER_PAGE_CONFIG);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
|
ret = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
|
||||||
0);
|
0);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: Failed to set cdc register page config\n",
|
"%s: Failed to set cdc register page config\n",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_SLIMBUS_SLAVE_CONFIG);
|
AFE_SLIMBUS_SLAVE_CONFIG);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
|
ret = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: Failed to set slimbus slave config %d\n",
|
"%s: Failed to set slimbus slave config %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -4608,7 +4616,7 @@ static void msm_afe_clear_config(void)
|
|||||||
afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
|
afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_adsp_power_up_config(struct snd_soc_codec *codec,
|
static int msm_adsp_power_up_config(struct snd_soc_component *component,
|
||||||
struct snd_card *card)
|
struct snd_card *card)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -4650,7 +4658,7 @@ static int msm_adsp_power_up_config(struct snd_soc_codec *codec,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = msm_afe_set_config(codec);
|
ret = msm_afe_set_config(component);
|
||||||
if (ret)
|
if (ret)
|
||||||
pr_err("%s: Failed to set AFE config. err %d\n",
|
pr_err("%s: Failed to set AFE config. err %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
@@ -4668,7 +4676,8 @@ static int qcs405_notifier_service_cb(struct notifier_block *this,
|
|||||||
struct snd_soc_card *card = NULL;
|
struct snd_soc_card *card = NULL;
|
||||||
const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
|
const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
|
||||||
struct snd_soc_pcm_runtime *rtd;
|
struct snd_soc_pcm_runtime *rtd;
|
||||||
struct snd_soc_codec *codec;
|
struct snd_soc_dai *codec_dai;
|
||||||
|
struct snd_soc_component *component;
|
||||||
|
|
||||||
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
|
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
|
||||||
|
|
||||||
@@ -4701,9 +4710,11 @@ static int qcs405_notifier_service_cb(struct notifier_block *this,
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
codec = rtd->codec;
|
codec_dai = rtd->codec_dai;
|
||||||
|
if (!strcmp(dev_name(codec_dai->dev), "tasha_codec"))
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "tasha_codec");
|
||||||
|
|
||||||
ret = msm_adsp_power_up_config(codec, card->snd_card);
|
ret = msm_adsp_power_up_config(component, card->snd_card);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(card->dev,
|
dev_err(card->dev,
|
||||||
"%s: msm_adsp_power_up_config failed ret = %d!\n",
|
"%s: msm_adsp_power_up_config failed ret = %d!\n",
|
||||||
@@ -4727,8 +4738,8 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *config_data;
|
void *config_data;
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component;
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
struct snd_soc_dapm_context *dapm;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
@@ -4751,7 +4762,12 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
|
|
||||||
rtd->pmdown_time = 0;
|
rtd->pmdown_time = 0;
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_snd_sb_controls,
|
if (!strcmp(dev_name(codec_dai->dev), "tasha_codec")) {
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "tasha_codec");
|
||||||
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = snd_soc_add_component_controls(component, msm_snd_sb_controls,
|
||||||
ARRAY_SIZE(msm_snd_sb_controls));
|
ARRAY_SIZE(msm_snd_sb_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("%s: add_codec_controls failed, err %d\n",
|
pr_err("%s: add_codec_controls failed, err %d\n",
|
||||||
@@ -4777,19 +4793,19 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
|
|
||||||
msm_codec_fn.get_afe_config_fn = tasha_get_afe_config;
|
msm_codec_fn.get_afe_config_fn = tasha_get_afe_config;
|
||||||
|
|
||||||
ret = msm_adsp_power_up_config(codec, rtd->card->snd_card);
|
ret = msm_adsp_power_up_config(component, rtd->card->snd_card);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev, "%s: Failed to set AFE config %d\n",
|
dev_err(component->dev, "%s: Failed to set AFE config %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_AANC_VERSION);
|
AFE_AANC_VERSION);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
|
ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev, "%s: Failed to set aanc version %d\n",
|
dev_err(component->dev, "%s: Failed to set aanc version %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -4805,7 +4821,7 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
tasha_codec_info_create_codec_entry(pdata->codec_root, codec);
|
tasha_codec_info_create_codec_entry(pdata->codec_root, component);
|
||||||
|
|
||||||
codec_reg_done = true;
|
codec_reg_done = true;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4817,16 +4833,25 @@ err:
|
|||||||
static int msm_va_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
static int msm_va_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component;
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
struct snd_soc_dapm_context *dapm;
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(rtd->card);
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_snd_va_controls,
|
component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
|
|
||||||
|
ret = snd_soc_add_component_controls(component, msm_snd_va_controls,
|
||||||
ARRAY_SIZE(msm_snd_va_controls));
|
ARRAY_SIZE(msm_snd_va_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "%s: add_codec_controls for va failed, err %d\n",
|
dev_err(component->dev, "%s: add_component_controls for va failed, err %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -4855,7 +4880,7 @@ static int msm_va_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
bolero_info_create_codec_entry(pdata->codec_root, codec);
|
bolero_info_create_codec_entry(pdata->codec_root, component);
|
||||||
done:
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -4863,17 +4888,24 @@ done:
|
|||||||
static int msm_wsa_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
static int msm_wsa_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component = NULL;
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
struct snd_soc_dapm_context *dapm = NULL;
|
||||||
struct snd_soc_component *aux_comp;
|
struct snd_soc_component *aux_comp = NULL;
|
||||||
struct snd_card *card;
|
struct snd_card *card = NULL;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(rtd->card);
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_snd_wsa_controls,
|
component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
|
|
||||||
|
ret = snd_soc_add_component_controls(component, msm_snd_wsa_controls,
|
||||||
ARRAY_SIZE(msm_snd_wsa_controls));
|
ARRAY_SIZE(msm_snd_wsa_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "%s: add_codec_controls for wsa failed, err %d\n",
|
dev_err(component->dev, "%s: add_codec_controls for wsa failed, err %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -4891,7 +4923,7 @@ static int msm_wsa_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
* Send speaker configuration only for WSA8810.
|
* Send speaker configuration only for WSA8810.
|
||||||
* Default configuration is for WSA8815.
|
* Default configuration is for WSA8815.
|
||||||
*/
|
*/
|
||||||
dev_dbg(codec->dev, "%s: Number of aux devices: %d\n",
|
dev_dbg(component->dev, "%s: Number of aux devices: %d\n",
|
||||||
__func__, rtd->card->num_aux_devs);
|
__func__, rtd->card->num_aux_devs);
|
||||||
if (rtd->card->num_aux_devs &&
|
if (rtd->card->num_aux_devs &&
|
||||||
!list_empty(&rtd->card->component_dev_list)) {
|
!list_empty(&rtd->card->component_dev_list)) {
|
||||||
@@ -4901,9 +4933,9 @@ static int msm_wsa_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
card_aux_list);
|
card_aux_list);
|
||||||
if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
|
if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
|
||||||
!strcmp(aux_comp->name, WSA8810_NAME_2)) {
|
!strcmp(aux_comp->name, WSA8810_NAME_2)) {
|
||||||
wsa_macro_set_spkr_mode(rtd->codec,
|
wsa_macro_set_spkr_mode(component,
|
||||||
WSA_MACRO_SPKR_MODE_1);
|
WSA_MACRO_SPKR_MODE_1);
|
||||||
wsa_macro_set_spkr_gain_offset(rtd->codec,
|
wsa_macro_set_spkr_gain_offset(component,
|
||||||
WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4912,12 +4944,12 @@ static int msm_wsa_cdc_dma_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
pdata->codec_root = snd_info_create_subdir(card->module,
|
pdata->codec_root = snd_info_create_subdir(card->module,
|
||||||
"codecs", card->proc_root);
|
"codecs", card->proc_root);
|
||||||
if (!pdata->codec_root) {
|
if (!pdata->codec_root) {
|
||||||
dev_dbg(codec->dev, "%s: Cannot create codecs module entry\n",
|
dev_dbg(component->dev, "%s: Cannot create codecs module entry\n",
|
||||||
__func__);
|
__func__);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
bolero_info_create_codec_entry(pdata->codec_root, codec);
|
bolero_info_create_codec_entry(pdata->codec_root, component);
|
||||||
done:
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -7884,22 +7916,20 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
SPKR_R_BOOST, SPKR_R_VI};
|
SPKR_R_BOOST, SPKR_R_VI};
|
||||||
unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
|
unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
|
||||||
unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
||||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
|
||||||
struct msm_asoc_mach_data *pdata;
|
struct msm_asoc_mach_data *pdata;
|
||||||
struct snd_soc_dapm_context *dapm;
|
struct snd_soc_dapm_context *dapm;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!codec) {
|
if (!component) {
|
||||||
pr_err("%s codec is NULL\n", __func__);
|
pr_err("%s component is NULL\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
dapm = snd_soc_codec_get_dapm(codec);
|
|
||||||
|
|
||||||
if (!strcmp(component->name_prefix, "SpkrLeft")) {
|
if (!strcmp(component->name_prefix, "SpkrLeft")) {
|
||||||
dev_dbg(codec->dev, "%s: setting left ch map to codec %s\n",
|
dev_dbg(component->dev, "%s: setting left ch map to codec %s\n",
|
||||||
__func__, codec->component.name);
|
__func__, component->name);
|
||||||
wsa881x_set_channel_map(codec, &spkleft_ports[0],
|
wsa881x_set_channel_map(component, &spkleft_ports[0],
|
||||||
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkleft_port_types[0]);
|
&ch_rate[0], &spkleft_port_types[0]);
|
||||||
if (dapm->component) {
|
if (dapm->component) {
|
||||||
@@ -7907,9 +7937,9 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
|
snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
|
||||||
}
|
}
|
||||||
} else if (!strcmp(component->name_prefix, "SpkrRight")) {
|
} else if (!strcmp(component->name_prefix, "SpkrRight")) {
|
||||||
dev_dbg(codec->dev, "%s: setting right ch map to codec %s\n",
|
dev_dbg(component->dev, "%s: setting right ch map to codec %s\n",
|
||||||
__func__, codec->component.name);
|
__func__, component->name);
|
||||||
wsa881x_set_channel_map(codec, &spkright_ports[0],
|
wsa881x_set_channel_map(component, &spkright_ports[0],
|
||||||
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkright_port_types[0]);
|
&ch_rate[0], &spkright_port_types[0]);
|
||||||
if (dapm->component) {
|
if (dapm->component) {
|
||||||
@@ -7917,15 +7947,15 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
|
snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev_err(codec->dev, "%s: wrong codec name %s\n", __func__,
|
dev_err(component->dev, "%s: wrong codec name %s\n", __func__,
|
||||||
codec->component.name);
|
component->name);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
pdata = snd_soc_card_get_drvdata(component->card);
|
pdata = snd_soc_card_get_drvdata(component->card);
|
||||||
if (pdata && pdata->codec_root)
|
if (pdata && pdata->codec_root)
|
||||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
codec);
|
component);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
@@ -8120,10 +8150,8 @@ err:
|
|||||||
|
|
||||||
static int msm_csra66x0_init(struct snd_soc_component *component)
|
static int msm_csra66x0_init(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
if (!component) {
|
||||||
|
pr_err("%s component is NULL\n", __func__);
|
||||||
if (!codec) {
|
|
||||||
pr_err("%s codec is NULL\n", __func__);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
238
asoc/sm6150.c
238
asoc/sm6150.c
@@ -203,7 +203,7 @@ struct msm_asoc_mach_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct msm_asoc_wcd93xx_codec {
|
struct msm_asoc_wcd93xx_codec {
|
||||||
void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
|
void* (*get_afe_config_fn)(struct snd_soc_component *component,
|
||||||
enum afe_config_type config_type);
|
enum afe_config_type config_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -645,7 +645,7 @@ static int dmic_0_1_gpio_cnt;
|
|||||||
static int dmic_2_3_gpio_cnt;
|
static int dmic_2_3_gpio_cnt;
|
||||||
|
|
||||||
static void *def_wcd_mbhc_cal(void);
|
static void *def_wcd_mbhc_cal(void);
|
||||||
static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
|
static int msm_snd_enable_codec_ext_clk(struct snd_soc_component *component,
|
||||||
int enable, bool dapm);
|
int enable, bool dapm);
|
||||||
static int msm_wsa881x_init(struct snd_soc_component *component);
|
static int msm_wsa881x_init(struct snd_soc_component *component);
|
||||||
static int msm_aux_codec_init(struct snd_soc_component *component);
|
static int msm_aux_codec_init(struct snd_soc_component *component);
|
||||||
@@ -3394,18 +3394,20 @@ static int msm_aux_pcm_tx_format_put(struct snd_kcontrol *kcontrol,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_hifi_ctrl(struct snd_soc_codec *codec)
|
static int msm_hifi_ctrl(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
struct snd_soc_dapm_context *dapm =
|
||||||
struct snd_soc_card *card = codec->component.card;
|
snd_soc_component_get_dapm(component);
|
||||||
|
struct snd_soc_card *card = component->card;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(card);
|
snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s: msm_hifi_control = %d\n", __func__,
|
dev_dbg(component->dev, "%s: msm_hifi_control = %d\n", __func__,
|
||||||
msm_hifi_control);
|
msm_hifi_control);
|
||||||
|
|
||||||
if (!pdata || !pdata->hph_en1_gpio_p) {
|
if (!pdata || !pdata->hph_en1_gpio_p) {
|
||||||
dev_err(codec->dev, "%s: hph_en1_gpio is invalid\n", __func__);
|
dev_err(component->dev, "%s: hph_en1_gpio is invalid\n",
|
||||||
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (msm_hifi_control == MSM_HIFI_ON) {
|
if (msm_hifi_control == MSM_HIFI_ON) {
|
||||||
@@ -3433,13 +3435,14 @@ static int msm_hifi_get(struct snd_kcontrol *kcontrol,
|
|||||||
static int msm_hifi_put(struct snd_kcontrol *kcontrol,
|
static int msm_hifi_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_kcontrol_component(kcontrol);
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
|
dev_dbg(component->dev, "%s: ucontrol->value.integer.value[0] = %ld\n",
|
||||||
__func__, ucontrol->value.integer.value[0]);
|
__func__, ucontrol->value.integer.value[0]);
|
||||||
|
|
||||||
msm_hifi_control = ucontrol->value.integer.value[0];
|
msm_hifi_control = ucontrol->value.integer.value[0];
|
||||||
msm_hifi_ctrl(codec);
|
msm_hifi_ctrl(component);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3831,30 +3834,30 @@ static const struct snd_kcontrol_new msm_common_snd_controls[] = {
|
|||||||
msm_vi_feed_tx_ch_get, msm_vi_feed_tx_ch_put),
|
msm_vi_feed_tx_ch_get, msm_vi_feed_tx_ch_put),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec,
|
static int msm_snd_enable_codec_ext_clk(struct snd_soc_component *component,
|
||||||
int enable, bool dapm)
|
int enable, bool dapm)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!strcmp(dev_name(codec->dev), "tavil_codec")) {
|
if (!strcmp(component->name, "tavil_codec")) {
|
||||||
ret = tavil_cdc_mclk_enable(codec, enable);
|
ret = tavil_cdc_mclk_enable(component, enable);
|
||||||
} else {
|
} else {
|
||||||
dev_err(codec->dev, "%s: unknown codec to enable ext clk\n",
|
dev_err(component->dev, "%s: unknown codec to enable ext clk\n",
|
||||||
__func__);
|
__func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
|
static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_component *component,
|
||||||
int enable, bool dapm)
|
int enable, bool dapm)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!strcmp(dev_name(codec->dev), "tavil_codec")) {
|
if (!strcmp(component->name, "tavil_codec")) {
|
||||||
ret = tavil_cdc_mclk_tx_enable(codec, enable);
|
ret = tavil_cdc_mclk_tx_enable(component, enable);
|
||||||
} else {
|
} else {
|
||||||
dev_err(codec->dev, "%s: unknown codec to enable TX ext clk\n",
|
dev_err(component->dev, "%s: unknown codec to enable TX ext clk\n",
|
||||||
__func__);
|
__func__);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -3865,15 +3868,16 @@ static int msm_snd_enable_codec_ext_tx_clk(struct snd_soc_codec *codec,
|
|||||||
static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
|
static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
pr_debug("%s: event = %d\n", __func__, event);
|
pr_debug("%s: event = %d\n", __func__, event);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
return msm_snd_enable_codec_ext_tx_clk(codec, 1, true);
|
return msm_snd_enable_codec_ext_tx_clk(component, 1, true);
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
return msm_snd_enable_codec_ext_tx_clk(codec, 0, true);
|
return msm_snd_enable_codec_ext_tx_clk(component, 0, true);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3881,15 +3885,16 @@ static int msm_mclk_tx_event(struct snd_soc_dapm_widget *w,
|
|||||||
static int msm_mclk_event(struct snd_soc_dapm_widget *w,
|
static int msm_mclk_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
pr_debug("%s: event = %d\n", __func__, event);
|
pr_debug("%s: event = %d\n", __func__, event);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
return msm_snd_enable_codec_ext_clk(codec, 1, true);
|
return msm_snd_enable_codec_ext_clk(component, 1, true);
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
return msm_snd_enable_codec_ext_clk(codec, 0, true);
|
return msm_snd_enable_codec_ext_clk(component, 0, true);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3897,21 +3902,23 @@ static int msm_mclk_event(struct snd_soc_dapm_widget *w,
|
|||||||
static int msm_hifi_ctrl_event(struct snd_soc_dapm_widget *w,
|
static int msm_hifi_ctrl_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *k, int event)
|
struct snd_kcontrol *k, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
struct snd_soc_card *card = codec->component.card;
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
struct snd_soc_card *card = component->card;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(card);
|
snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s: msm_hifi_control = %d\n",
|
dev_dbg(component->dev, "%s: msm_hifi_control = %d\n",
|
||||||
__func__, msm_hifi_control);
|
__func__, msm_hifi_control);
|
||||||
|
|
||||||
if (!pdata || !pdata->hph_en0_gpio_p) {
|
if (!pdata || !pdata->hph_en0_gpio_p) {
|
||||||
dev_err(codec->dev, "%s: hph_en0_gpio is invalid\n", __func__);
|
dev_err(component->dev, "%s: hph_en0_gpio is invalid\n",
|
||||||
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msm_hifi_control != MSM_HIFI_ON) {
|
if (msm_hifi_control != MSM_HIFI_ON) {
|
||||||
dev_dbg(codec->dev, "%s: HiFi mixer control is not set\n",
|
dev_dbg(component->dev, "%s: HiFi mixer control is not set\n",
|
||||||
__func__);
|
__func__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3958,7 +3965,8 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct msm_asoc_mach_data *pdata = NULL;
|
struct msm_asoc_mach_data *pdata = NULL;
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u32 dmic_idx;
|
u32 dmic_idx;
|
||||||
int *dmic_gpio_cnt;
|
int *dmic_gpio_cnt;
|
||||||
@@ -3967,18 +3975,18 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
|
|
||||||
wname = strpbrk(w->name, "0123");
|
wname = strpbrk(w->name, "0123");
|
||||||
if (!wname) {
|
if (!wname) {
|
||||||
dev_err(codec->dev, "%s: widget not found\n", __func__);
|
dev_err(component->dev, "%s: widget not found\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = kstrtouint(wname, 10, &dmic_idx);
|
ret = kstrtouint(wname, 10, &dmic_idx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "%s: Invalid DMIC line on the codec\n",
|
dev_err(component->dev, "%s: Invalid DMIC line on the codec\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata = snd_soc_card_get_drvdata(codec->component.card);
|
pdata = snd_soc_card_get_drvdata(component->card);
|
||||||
|
|
||||||
switch (dmic_idx) {
|
switch (dmic_idx) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -3992,12 +4000,12 @@ static int msm_dmic_event(struct snd_soc_dapm_widget *w,
|
|||||||
dmic_gpio = pdata->dmic23_gpio_p;
|
dmic_gpio = pdata->dmic23_gpio_p;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(codec->dev, "%s: Invalid DMIC Selection\n",
|
dev_err(component->dev, "%s: Invalid DMIC Selection\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s: event %d DMIC%d dmic_gpio_cnt %d\n",
|
dev_dbg(component->dev, "%s: event %d DMIC%d dmic_gpio_cnt %d\n",
|
||||||
__func__, event, dmic_idx, *dmic_gpio_cnt);
|
__func__, event, dmic_idx, *dmic_gpio_cnt);
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
@@ -4184,10 +4192,12 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||||||
SNDRV_PCM_HW_PARAM_RATE);
|
SNDRV_PCM_HW_PARAM_RATE);
|
||||||
struct snd_interval *channels = hw_param_interval(params,
|
struct snd_interval *channels = hw_param_interval(params,
|
||||||
SNDRV_PCM_HW_PARAM_CHANNELS);
|
SNDRV_PCM_HW_PARAM_CHANNELS);
|
||||||
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int idx;
|
int idx;
|
||||||
void *config = NULL;
|
void *config = NULL;
|
||||||
struct snd_soc_codec *codec = NULL;
|
struct snd_soc_component *component = NULL;
|
||||||
|
|
||||||
pr_debug("%s: format = %d, rate = %d\n",
|
pr_debug("%s: format = %d, rate = %d\n",
|
||||||
__func__, params_format(params), params_rate(params));
|
__func__, params_format(params), params_rate(params));
|
||||||
@@ -4237,11 +4247,17 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MSM_BACKEND_DAI_SLIMBUS_5_TX:
|
case MSM_BACKEND_DAI_SLIMBUS_5_TX:
|
||||||
codec = rtd->codec;
|
component = snd_soc_rtdcom_lookup(rtd, "tavil_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
rc = -EINVAL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
rate->min = rate->max = SAMPLING_RATE_16KHZ;
|
rate->min = rate->max = SAMPLING_RATE_16KHZ;
|
||||||
channels->min = channels->max = 1;
|
channels->min = channels->max = 1;
|
||||||
|
|
||||||
config = msm_codec_fn.get_afe_config_fn(codec,
|
config = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_SLIMBUS_SLAVE_PORT_CONFIG);
|
AFE_SLIMBUS_SLAVE_PORT_CONFIG);
|
||||||
if (config) {
|
if (config) {
|
||||||
rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
|
rc = afe_set_config(AFE_SLIMBUS_SLAVE_PORT_CONFIG,
|
||||||
@@ -4597,9 +4613,10 @@ done:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool msm_usbc_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
|
static bool msm_usbc_swap_gnd_mic(struct snd_soc_component *component,
|
||||||
|
bool active)
|
||||||
{
|
{
|
||||||
struct snd_soc_card *card = codec->component.card;
|
struct snd_soc_card *card = component->card;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(card);
|
snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
@@ -4609,25 +4626,25 @@ static bool msm_usbc_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
|
|||||||
return fsa4480_switch_event(pdata->fsa_handle, FSA_MIC_GND_SWAP);
|
return fsa4480_switch_event(pdata->fsa_handle, FSA_MIC_GND_SWAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
|
static bool msm_swap_gnd_mic(struct snd_soc_component *component, bool active)
|
||||||
{
|
{
|
||||||
int value = 0;
|
int value = 0;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
struct snd_soc_card *card;
|
struct snd_soc_card *card;
|
||||||
struct msm_asoc_mach_data *pdata;
|
struct msm_asoc_mach_data *pdata;
|
||||||
|
|
||||||
if (!codec) {
|
if (!component) {
|
||||||
pr_err("%s codec is NULL\n", __func__);
|
pr_err("%s component is NULL\n", __func__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
card = codec->component.card;
|
card = component->card;
|
||||||
pdata = snd_soc_card_get_drvdata(card);
|
pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
if (!pdata)
|
if (!pdata)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (wcd_mbhc_cfg.enable_usbc_analog)
|
if (wcd_mbhc_cfg.enable_usbc_analog)
|
||||||
return msm_usbc_swap_gnd_mic(codec, active);
|
return msm_usbc_swap_gnd_mic(component, active);
|
||||||
|
|
||||||
/* if usbc is not defined, swap using us_euro_gpio_p */
|
/* if usbc is not defined, swap using us_euro_gpio_p */
|
||||||
if (pdata->us_euro_gpio_p) {
|
if (pdata->us_euro_gpio_p) {
|
||||||
@@ -4639,53 +4656,53 @@ static bool msm_swap_gnd_mic(struct snd_soc_codec *codec, bool active)
|
|||||||
else
|
else
|
||||||
msm_cdc_pinctrl_select_active_state(
|
msm_cdc_pinctrl_select_active_state(
|
||||||
pdata->us_euro_gpio_p);
|
pdata->us_euro_gpio_p);
|
||||||
dev_dbg(codec->dev, "%s: swap select switch %d to %d\n",
|
dev_dbg(component->dev, "%s: swap select switch %d to %d\n",
|
||||||
__func__, value, !value);
|
__func__, value, !value);
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_afe_set_config(struct snd_soc_codec *codec)
|
static int msm_afe_set_config(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *config_data = NULL;
|
void *config_data = NULL;
|
||||||
|
|
||||||
if (!msm_codec_fn.get_afe_config_fn) {
|
if (!msm_codec_fn.get_afe_config_fn) {
|
||||||
dev_err(codec->dev, "%s: codec get afe config not init'ed\n",
|
dev_err(component->dev, "%s: codec get afe config not init'ed\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_CDC_REGISTERS_CONFIG);
|
AFE_CDC_REGISTERS_CONFIG);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
|
ret = afe_set_config(AFE_CDC_REGISTERS_CONFIG, config_data, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: Failed to set codec registers config %d\n",
|
"%s: Failed to set codec registers config %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_CDC_REGISTER_PAGE_CONFIG);
|
AFE_CDC_REGISTER_PAGE_CONFIG);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
|
ret = afe_set_config(AFE_CDC_REGISTER_PAGE_CONFIG, config_data,
|
||||||
0);
|
0);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: Failed to set cdc register page config\n",
|
"%s: Failed to set cdc register page config\n",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_SLIMBUS_SLAVE_CONFIG);
|
AFE_SLIMBUS_SLAVE_CONFIG);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
|
ret = afe_set_config(AFE_SLIMBUS_SLAVE_CONFIG, config_data, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: Failed to set slimbus slave config %d\n",
|
"%s: Failed to set slimbus slave config %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -4705,12 +4722,12 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *config_data;
|
void *config_data;
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component = NULL;
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
struct snd_soc_dapm_context *dapm;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||||
struct snd_soc_component *aux_comp;
|
struct snd_soc_component *aux_comp;
|
||||||
struct snd_card *card;
|
struct snd_card *card = rtd->card->snd_card;
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(rtd->card);
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
@@ -4731,7 +4748,14 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
|
|
||||||
rtd->pmdown_time = 0;
|
rtd->pmdown_time = 0;
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_tavil_snd_controls,
|
component = snd_soc_rtdcom_lookup(rtd, "tavil_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
|
|
||||||
|
ret = snd_soc_add_component_controls(component, msm_tavil_snd_controls,
|
||||||
ARRAY_SIZE(msm_tavil_snd_controls));
|
ARRAY_SIZE(msm_tavil_snd_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("%s: add_codec_controls failed, err %d\n",
|
pr_err("%s: add_codec_controls failed, err %d\n",
|
||||||
@@ -4739,7 +4763,7 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_common_snd_controls,
|
ret = snd_soc_add_component_controls(component, msm_common_snd_controls,
|
||||||
ARRAY_SIZE(msm_common_snd_controls));
|
ARRAY_SIZE(msm_common_snd_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("%s: add_codec_controls failed, err %d\n",
|
pr_err("%s: add_codec_controls failed, err %d\n",
|
||||||
@@ -4788,14 +4812,14 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
|
|
||||||
msm_codec_fn.get_afe_config_fn = tavil_get_afe_config;
|
msm_codec_fn.get_afe_config_fn = tavil_get_afe_config;
|
||||||
|
|
||||||
ret = msm_afe_set_config(codec);
|
ret = msm_afe_set_config(component);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("%s: Failed to set AFE config %d\n", __func__, ret);
|
pr_err("%s: Failed to set AFE config %d\n", __func__, ret);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
pdata->is_afe_config_done = true;
|
pdata->is_afe_config_done = true;
|
||||||
|
|
||||||
config_data = msm_codec_fn.get_afe_config_fn(codec,
|
config_data = msm_codec_fn.get_afe_config_fn(component,
|
||||||
AFE_AANC_VERSION);
|
AFE_AANC_VERSION);
|
||||||
if (config_data) {
|
if (config_data) {
|
||||||
ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
|
ret = afe_set_config(AFE_AANC_VERSION, config_data, 0);
|
||||||
@@ -4818,8 +4842,8 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
struct snd_soc_component, card_aux_list);
|
struct snd_soc_component, card_aux_list);
|
||||||
if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
|
if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
|
||||||
!strcmp(aux_comp->name, WSA8810_NAME_2)) {
|
!strcmp(aux_comp->name, WSA8810_NAME_2)) {
|
||||||
tavil_set_spkr_mode(rtd->codec, WCD934X_SPKR_MODE_1);
|
tavil_set_spkr_mode(component, WCD934X_SPKR_MODE_1);
|
||||||
tavil_set_spkr_gain_offset(rtd->codec,
|
tavil_set_spkr_gain_offset(component,
|
||||||
WCD934X_RX_GAIN_OFFSET_M1P5_DB);
|
WCD934X_RX_GAIN_OFFSET_M1P5_DB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4834,7 +4858,7 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
pdata->codec_root = entry;
|
pdata->codec_root = entry;
|
||||||
tavil_codec_info_create_codec_entry(pdata->codec_root, codec);
|
tavil_codec_info_create_codec_entry(pdata->codec_root, component);
|
||||||
|
|
||||||
codec_reg_done = true;
|
codec_reg_done = true;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -4845,22 +4869,30 @@ err:
|
|||||||
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 = 0;
|
int ret = 0;
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component;
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
struct snd_soc_dapm_context *dapm;
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
struct snd_soc_component *aux_comp;
|
struct snd_soc_component *aux_comp;
|
||||||
struct msm_asoc_mach_data *pdata =
|
struct msm_asoc_mach_data *pdata =
|
||||||
snd_soc_card_get_drvdata(rtd->card);
|
snd_soc_card_get_drvdata(rtd->card);
|
||||||
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_int_snd_controls,
|
component = snd_soc_rtdcom_lookup(rtd, "bolero_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
|
|
||||||
|
ret = snd_soc_add_component_controls(component, msm_int_snd_controls,
|
||||||
ARRAY_SIZE(msm_int_snd_controls));
|
ARRAY_SIZE(msm_int_snd_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("%s: add_codec_controls failed: %d\n",
|
pr_err("%s: add_component_controls failed: %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_common_snd_controls,
|
ret = snd_soc_add_component_controls(component, msm_common_snd_controls,
|
||||||
ARRAY_SIZE(msm_common_snd_controls));
|
ARRAY_SIZE(msm_common_snd_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("%s: add common snd controls failed: %d\n",
|
pr_err("%s: add common snd controls failed: %d\n",
|
||||||
@@ -4892,7 +4924,7 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
* Send speaker configuration only for WSA8810.
|
* Send speaker configuration only for WSA8810.
|
||||||
* Default configuration is for WSA8815.
|
* Default configuration is for WSA8815.
|
||||||
*/
|
*/
|
||||||
dev_dbg(codec->dev, "%s: Number of aux devices: %d\n",
|
dev_dbg(component->dev, "%s: Number of aux devices: %d\n",
|
||||||
__func__, rtd->card->num_aux_devs);
|
__func__, rtd->card->num_aux_devs);
|
||||||
if (rtd->card->num_aux_devs &&
|
if (rtd->card->num_aux_devs &&
|
||||||
!list_empty(&rtd->card->component_dev_list)) {
|
!list_empty(&rtd->card->component_dev_list)) {
|
||||||
@@ -4902,9 +4934,9 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
card_aux_list);
|
card_aux_list);
|
||||||
if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
|
if (!strcmp(aux_comp->name, WSA8810_NAME_1) ||
|
||||||
!strcmp(aux_comp->name, WSA8810_NAME_2)) {
|
!strcmp(aux_comp->name, WSA8810_NAME_2)) {
|
||||||
wsa_macro_set_spkr_mode(rtd->codec,
|
wsa_macro_set_spkr_mode(component,
|
||||||
WSA_MACRO_SPKR_MODE_1);
|
WSA_MACRO_SPKR_MODE_1);
|
||||||
wsa_macro_set_spkr_gain_offset(rtd->codec,
|
wsa_macro_set_spkr_gain_offset(component,
|
||||||
WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
WSA_MACRO_GAIN_OFFSET_M1P5_DB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4930,9 +4962,9 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||||||
*/
|
*/
|
||||||
if (socinfo_get_id() == SM6150_SOC_MSM_ID &&
|
if (socinfo_get_id() == SM6150_SOC_MSM_ID &&
|
||||||
socinfo_get_version() == SM6150_SOC_VERSION_1_0)
|
socinfo_get_version() == SM6150_SOC_VERSION_1_0)
|
||||||
bolero_register_wake_irq(codec, true);
|
bolero_register_wake_irq(component, true);
|
||||||
else
|
else
|
||||||
bolero_register_wake_irq(codec, false);
|
bolero_register_wake_irq(component, false);
|
||||||
|
|
||||||
codec_reg_done = true;
|
codec_reg_done = true;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -7490,6 +7522,7 @@ static int msm_snd_card_tavil_late_probe(struct snd_soc_card *card)
|
|||||||
{
|
{
|
||||||
const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
|
const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
|
||||||
struct snd_soc_pcm_runtime *rtd;
|
struct snd_soc_pcm_runtime *rtd;
|
||||||
|
struct snd_soc_component *component;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *mbhc_calibration;
|
void *mbhc_calibration;
|
||||||
|
|
||||||
@@ -7502,13 +7535,19 @@ static int msm_snd_card_tavil_late_probe(struct snd_soc_card *card)
|
|||||||
goto err_pcm_runtime;
|
goto err_pcm_runtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component = snd_soc_rtdcom_lookup(rtd, "tavil_codec");
|
||||||
|
if (!component) {
|
||||||
|
pr_err("%s: component is NULL\n", __func__);
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto err_pcm_runtime;
|
||||||
|
}
|
||||||
mbhc_calibration = def_wcd_mbhc_cal();
|
mbhc_calibration = def_wcd_mbhc_cal();
|
||||||
if (!mbhc_calibration) {
|
if (!mbhc_calibration) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto err_mbhc_cal;
|
goto err_mbhc_cal;
|
||||||
}
|
}
|
||||||
wcd_mbhc_cfg.calibration = mbhc_calibration;
|
wcd_mbhc_cfg.calibration = mbhc_calibration;
|
||||||
ret = tavil_mbhc_hs_detect(rtd->codec, &wcd_mbhc_cfg);
|
ret = tavil_mbhc_hs_detect(component, &wcd_mbhc_cfg);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
|
dev_err(card->dev, "%s: mbhc hs detect failed, err:%d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
@@ -7613,12 +7652,13 @@ err:
|
|||||||
static int msm_audrx_stub_init(struct snd_soc_pcm_runtime *rtd)
|
static int msm_audrx_stub_init(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_codec *codec = rtd->codec;
|
struct snd_soc_component *component =
|
||||||
|
snd_soc_rtdcom_lookup(rtd, "msm-stub-codec");
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, msm_tavil_snd_controls,
|
ret = snd_soc_add_component_controls(component, msm_tavil_snd_controls,
|
||||||
ARRAY_SIZE(msm_tavil_snd_controls));
|
ARRAY_SIZE(msm_tavil_snd_controls));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev,
|
dev_err(component->dev,
|
||||||
"%s: add_codec_controls failed, err = %d\n",
|
"%s: add_codec_controls failed, err = %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -7916,24 +7956,23 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
SPKR_R_BOOST, SPKR_R_VI};
|
SPKR_R_BOOST, SPKR_R_VI};
|
||||||
unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
|
unsigned int ch_rate[WSA881X_MAX_SWR_PORTS] = {2400, 600, 300, 1200};
|
||||||
unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
unsigned int ch_mask[WSA881X_MAX_SWR_PORTS] = {0x1, 0xF, 0x3, 0x3};
|
||||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
|
||||||
struct msm_asoc_mach_data *pdata;
|
struct msm_asoc_mach_data *pdata;
|
||||||
struct snd_soc_dapm_context *dapm;
|
struct snd_soc_dapm_context *dapm;
|
||||||
struct snd_card *card = component->card->snd_card;
|
struct snd_card *card = component->card->snd_card;
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!codec) {
|
if (!component) {
|
||||||
pr_err("%s codec is NULL\n", __func__);
|
pr_err("%s codec is NULL\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dapm = snd_soc_codec_get_dapm(codec);
|
dapm = snd_soc_component_get_dapm(component);
|
||||||
|
|
||||||
if (!strcmp(component->name_prefix, "SpkrLeft")) {
|
if (!strcmp(component->name_prefix, "SpkrLeft")) {
|
||||||
dev_dbg(codec->dev, "%s: setting left ch map to codec %s\n",
|
dev_dbg(component->dev, "%s: setting left ch map to codec %s\n",
|
||||||
__func__, codec->component.name);
|
__func__, component->name);
|
||||||
wsa881x_set_channel_map(codec, &spkleft_ports[0],
|
wsa881x_set_channel_map(component, &spkleft_ports[0],
|
||||||
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkleft_port_types[0]);
|
&ch_rate[0], &spkleft_port_types[0]);
|
||||||
if (dapm->component) {
|
if (dapm->component) {
|
||||||
@@ -7941,9 +7980,9 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
|
snd_soc_dapm_ignore_suspend(dapm, "SpkrLeft SPKR");
|
||||||
}
|
}
|
||||||
} else if (!strcmp(component->name_prefix, "SpkrRight")) {
|
} else if (!strcmp(component->name_prefix, "SpkrRight")) {
|
||||||
dev_dbg(codec->dev, "%s: setting right ch map to codec %s\n",
|
dev_dbg(component->dev, "%s: setting right ch map to codec %s\n",
|
||||||
__func__, codec->component.name);
|
__func__, component->name);
|
||||||
wsa881x_set_channel_map(codec, &spkright_ports[0],
|
wsa881x_set_channel_map(component, &spkright_ports[0],
|
||||||
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
WSA881X_MAX_SWR_PORTS, &ch_mask[0],
|
||||||
&ch_rate[0], &spkright_port_types[0]);
|
&ch_rate[0], &spkright_port_types[0]);
|
||||||
if (dapm->component) {
|
if (dapm->component) {
|
||||||
@@ -7951,8 +7990,8 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
|
snd_soc_dapm_ignore_suspend(dapm, "SpkrRight SPKR");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev_err(codec->dev, "%s: wrong codec name %s\n", __func__,
|
dev_err(component->dev, "%s: wrong codec name %s\n", __func__,
|
||||||
codec->component.name);
|
component->name);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -7969,15 +8008,14 @@ static int msm_wsa881x_init(struct snd_soc_component *component)
|
|||||||
pdata->codec_root = entry;
|
pdata->codec_root = entry;
|
||||||
}
|
}
|
||||||
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
wsa881x_codec_info_create_codec_entry(pdata->codec_root,
|
||||||
codec);
|
component);
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_aux_codec_init(struct snd_soc_component *component)
|
static int msm_aux_codec_init(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *mbhc_calibration;
|
void *mbhc_calibration;
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
@@ -8006,14 +8044,14 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
|
|||||||
}
|
}
|
||||||
pdata->codec_root = entry;
|
pdata->codec_root = entry;
|
||||||
}
|
}
|
||||||
wcd937x_info_create_codec_entry(pdata->codec_root, codec);
|
wcd937x_info_create_codec_entry(pdata->codec_root, component);
|
||||||
codec_root_err:
|
codec_root_err:
|
||||||
mbhc_calibration = def_wcd_mbhc_cal();
|
mbhc_calibration = def_wcd_mbhc_cal();
|
||||||
if (!mbhc_calibration) {
|
if (!mbhc_calibration) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
wcd_mbhc_cfg.calibration = mbhc_calibration;
|
wcd_mbhc_cfg.calibration = mbhc_calibration;
|
||||||
ret = wcd937x_mbhc_hs_detect(codec, &wcd_mbhc_cfg);
|
ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -8319,7 +8357,8 @@ static int sm6150_ssr_enable(struct device *dev, void *data)
|
|||||||
{
|
{
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||||
struct msm_asoc_mach_data *pdata;
|
struct msm_asoc_mach_data *pdata = NULL;
|
||||||
|
struct snd_soc_component *component = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!card) {
|
if (!card) {
|
||||||
@@ -8342,7 +8381,14 @@ static int sm6150_ssr_enable(struct device *dev, void *data)
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ret = msm_afe_set_config(rtd->codec);
|
component = snd_soc_rtdcom_lookup(rtd, "tavil_codec");
|
||||||
|
if (!component) {
|
||||||
|
dev_err(dev, "%s: component is NULL\n",
|
||||||
|
__func__);
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
ret = msm_afe_set_config(component);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(dev, "%s: Failed to set AFE config. err %d\n",
|
dev_err(dev, "%s: Failed to set AFE config. err %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
|
670
asoc/sm8150.c
670
asoc/sm8150.c
文件差异内容过多而无法显示
加载差异
在新工单中引用
屏蔽一个用户