Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 525e5f7d authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge b2758386 on remote branch

Change-Id: I544f95234c354955f3164f6bdb73053ed0c71fe1
parents b62a6848 b2758386
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -47,9 +47,16 @@ include $(MY_LOCAL_PATH)/asoc/codecs/wcd937x/Android.mk
endif
endif

ifeq ($(call is-board-platform-in-list, bengal),true)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/rouleur/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/rouleur/Android.mk
endif

ifeq ($(call is-board-platform-in-list, kona lito),true)
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/bolero/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/bolero/Android.mk
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd938x/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/wcd938x/Android.mk
$(shell rm -rf $(PRODUCT_OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/wcd937x/Module.symvers)
include $(MY_LOCAL_PATH)/asoc/codecs/wcd937x/Android.mk
endif
+43 −2
Original line number Diff line number Diff line
@@ -31,8 +31,10 @@
#include "asoc/msm-cdc-pinctrl.h"
#include "asoc/wcd-mbhc-v2.h"
#include "codecs/wcd937x/wcd937x-mbhc.h"
#include "codecs/rouleur/rouleur-mbhc.h"
#include "codecs/wsa881x-analog.h"
#include "codecs/wcd937x/wcd937x.h"
#include "codecs/rouleur/rouleur.h"
#include "codecs/bolero/bolero-cdc.h"
#include <dt-bindings/sound/audio-codec-port-types.h>
#include "bengal-port-config.h"
@@ -5995,9 +5997,13 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
	struct snd_info_entry *entry;
	struct snd_card *card = component->card->snd_card;
	struct msm_asoc_mach_data *pdata;
	struct platform_device *pdev = NULL;
	char *data = NULL;
	int i = 0;

	snd_soc_dapm_ignore_suspend(dapm, "EAR");
	snd_soc_dapm_ignore_suspend(dapm, "AUX");
	snd_soc_dapm_ignore_suspend(dapm, "LO");
	snd_soc_dapm_ignore_suspend(dapm, "HPHL");
	snd_soc_dapm_ignore_suspend(dapm, "HPHR");
	snd_soc_dapm_ignore_suspend(dapm, "AMIC1");
@@ -6018,14 +6024,49 @@ static int msm_aux_codec_init(struct snd_soc_component *component)
		}
		pdata->codec_root = entry;
	}
	wcd937x_info_create_codec_entry(pdata->codec_root, component);

	for (i = 0; i < component->card->num_aux_devs; i++)
	{
		if (msm_aux_dev[i].name != NULL ) {
			if (strstr(msm_aux_dev[i].name, "wsa"))
				continue;
		}

		if (msm_aux_dev[i].codec_of_node) {
			pdev = of_find_device_by_node(
				msm_aux_dev[i].codec_of_node);
			if (pdev)
				data = (char*) of_device_get_match_data(
							&pdev->dev);

			if (data != NULL) {
				if (!strncmp(data, "wcd937x",
						sizeof("wcd937x"))) {
					wcd937x_info_create_codec_entry(
						pdata->codec_root, component);
					break;
				} else if (!strncmp(data, "rouleur",
						sizeof("rouleur"))) {
					rouleur_info_create_codec_entry(
						pdata->codec_root, component);
					break;
				}
			}
		}
	}

mbhc_cfg_cal:
	mbhc_calibration = def_wcd_mbhc_cal();
	if (!mbhc_calibration)
		return -ENOMEM;
	wcd_mbhc_cfg.calibration = mbhc_calibration;
        if (data != NULL) {
                if (!strncmp(data, "wcd937x", sizeof("wcd937x")))
                        ret = wcd937x_mbhc_hs_detect(component, &wcd_mbhc_cfg);
                else if (!strncmp( data, "rouleur", sizeof("rouleur")))
                        ret = rouleur_mbhc_hs_detect(component, &wcd_mbhc_cfg);
        }

	if (ret) {
		dev_err(component->dev, "%s: mbhc hs detect failed, err:%d\n",
			__func__, ret);
+1 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ ifeq ($(KERNEL_BUILD), 1)
	obj-y	+= wcd937x/
	obj-y	+= wcd938x/
	obj-y	+= bolero/
	obj-y	+= rouleur/
endif
# Module information used by KBuild framework
obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd_core_dlkm.o
+8 −2
Original line number Diff line number Diff line
@@ -101,8 +101,11 @@ static int __bolero_reg_read(struct bolero_priv *priv,
		goto ssr_err;
	}

	if (priv->macro_params[VA_MACRO].dev)
	if (priv->macro_params[VA_MACRO].dev) {
		pm_runtime_get_sync(priv->macro_params[VA_MACRO].dev);
		if (!bolero_check_core_votes(priv->macro_params[VA_MACRO].dev))
			goto ssr_err;
	}

	if (priv->version < BOLERO_VERSION_2_0) {
		/* Request Clk before register access */
@@ -149,8 +152,11 @@ static int __bolero_reg_write(struct bolero_priv *priv,
		ret = -EINVAL;
		goto ssr_err;
	}
	if (priv->macro_params[VA_MACRO].dev)
	if (priv->macro_params[VA_MACRO].dev) {
		pm_runtime_get_sync(priv->macro_params[VA_MACRO].dev);
		if (!bolero_check_core_votes(priv->macro_params[VA_MACRO].dev))
			goto ssr_err;
	}

	if (priv->version < BOLERO_VERSION_2_0) {
		/* Request Clk before register access */
+63 −0
Original line number Diff line number Diff line
@@ -793,6 +793,66 @@ static int tx_macro_set_bcs(struct snd_kcontrol *kcontrol,
	return 0;
}

static const char * const bcs_ch_sel_mux_text[] = {
	"SWR_MIC0", "SWR_MIC1", "SWR_MIC2", "SWR_MIC3",
	"SWR_MIC4", "SWR_MIC5", "SWR_MIC6", "SWR_MIC7",
	"SWR_MIC8", "SWR_MIC9", "SWR_MIC10", "SWR_MIC11",
};

static const struct soc_enum bcs_ch_sel_mux_enum =
	SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(bcs_ch_sel_mux_text),
			    bcs_ch_sel_mux_text);

static int tx_macro_get_bcs_ch_sel(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_component *component =
				snd_soc_kcontrol_component(kcontrol);
	struct tx_macro_priv *tx_priv = NULL;
	struct device *tx_dev = NULL;
	int value = 0;

	if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
		return -EINVAL;

	if (tx_priv->version == BOLERO_VERSION_2_1)
		value = (snd_soc_component_read32(component,
			BOLERO_CDC_VA_TOP_CSR_SWR_CTRL)) & 0x0F;
	else if (tx_priv->version == BOLERO_VERSION_2_0)
		value = (snd_soc_component_read32(component,
			BOLERO_CDC_TX_TOP_CSR_SWR_CTRL)) & 0x0F;

	ucontrol->value.integer.value[0] = value;
	return 0;
}

static int tx_macro_put_bcs_ch_sel(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
{
	struct snd_soc_component *component =
				snd_soc_kcontrol_component(kcontrol);
	struct tx_macro_priv *tx_priv = NULL;
	struct device *tx_dev = NULL;
	int value;

	if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
		return -EINVAL;

	if (ucontrol->value.integer.value[0] < 0 ||
	    ucontrol->value.integer.value[0] > ARRAY_SIZE(bcs_ch_sel_mux_text))
		return -EINVAL;

	value = ucontrol->value.integer.value[0];
	if (tx_priv->version == BOLERO_VERSION_2_1)
		snd_soc_component_update_bits(component,
			BOLERO_CDC_VA_TOP_CSR_SWR_CTRL, 0x0F, value);
	else if (tx_priv->version == BOLERO_VERSION_2_0)
		snd_soc_component_update_bits(component,
			BOLERO_CDC_TX_TOP_CSR_SWR_CTRL, 0x0F, value);

	return 0;
}

static int tx_macro_enable_dmic(struct snd_soc_dapm_widget *w,
		struct snd_kcontrol *kcontrol, int event)
{
@@ -2243,6 +2303,9 @@ static const struct snd_kcontrol_new tx_macro_snd_controls_common[] = {

	SOC_SINGLE_EXT("DEC0_BCS Switch", SND_SOC_NOPM, 0, 1, 0,
		       tx_macro_get_bcs, tx_macro_set_bcs),

	SOC_ENUM_EXT("BCS CH_SEL", bcs_ch_sel_mux_enum,
			tx_macro_get_bcs_ch_sel, tx_macro_put_bcs_ch_sel),
};

static const struct snd_kcontrol_new tx_macro_snd_controls_v3[] = {
Loading