Browse Source

Merge 3944bb8d29f3d7ab607ea2ec4f78b43b52961aa4 on remote branch

Change-Id: Ie5b564e2bc4c75d70e7c941fdd2cde12712785bb
Linux Build Service Account 4 years ago
parent
commit
21429ed59f

+ 15 - 14
asoc/codecs/bolero/bolero-cdc.c

@@ -18,6 +18,7 @@
 #include "bolero-cdc.h"
 #include "internal.h"
 #include "bolero-clk-rsc.h"
+#include "asoc/bolero-slave-internal.h"
 
 #define DRV_NAME "bolero_codec"
 
@@ -202,37 +203,37 @@ static int bolero_cdc_update_wcd_event(void *handle, u16 event, u32 data)
 	}
 
 	switch (event) {
-	case WCD_BOLERO_EVT_RX_MUTE:
+	case SLV_BOLERO_EVT_RX_MUTE:
 		if (priv->macro_params[RX_MACRO].event_handler)
 			priv->macro_params[RX_MACRO].event_handler(
 				priv->component,
 				BOLERO_MACRO_EVT_RX_MUTE, data);
 		break;
-	case WCD_BOLERO_EVT_IMPED_TRUE:
+	case SLV_BOLERO_EVT_IMPED_TRUE:
 		if (priv->macro_params[RX_MACRO].event_handler)
 			priv->macro_params[RX_MACRO].event_handler(
 				priv->component,
 				BOLERO_MACRO_EVT_IMPED_TRUE, data);
 		break;
-	case WCD_BOLERO_EVT_IMPED_FALSE:
+	case SLV_BOLERO_EVT_IMPED_FALSE:
 		if (priv->macro_params[RX_MACRO].event_handler)
 			priv->macro_params[RX_MACRO].event_handler(
 				priv->component,
 				BOLERO_MACRO_EVT_IMPED_FALSE, data);
 		break;
-	case WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST:
+	case SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST:
 		if (priv->macro_params[RX_MACRO].event_handler)
 			priv->macro_params[RX_MACRO].event_handler(
 				priv->component,
 				BOLERO_MACRO_EVT_RX_COMPANDER_SOFT_RST, data);
 		break;
-	case WCD_BOLERO_EVT_BCS_CLK_OFF:
+	case SLV_BOLERO_EVT_BCS_CLK_OFF:
 		if (priv->macro_params[TX_MACRO].event_handler)
 			priv->macro_params[TX_MACRO].event_handler(
 				priv->component,
 				BOLERO_MACRO_EVT_BCS_CLK_OFF, data);
 		break;
-	case WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE:
+	case SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE:
 		/* Update PA Gain only for bolero version 2.1 */
 		if (priv->version == BOLERO_VERSION_2_1)
 			if (priv->macro_params[RX_MACRO].event_handler)
@@ -241,13 +242,13 @@ static int bolero_cdc_update_wcd_event(void *handle, u16 event, u32 data)
 					BOLERO_MACRO_EVT_RX_PA_GAIN_UPDATE,
 					data);
 		break;
-	case WCD_BOLERO_EVT_HPHL_HD2_ENABLE:
+	case SLV_BOLERO_EVT_HPHL_HD2_ENABLE:
 		if (priv->macro_params[RX_MACRO].event_handler)
 			priv->macro_params[RX_MACRO].event_handler(
 				priv->component,
 				BOLERO_MACRO_EVT_HPHL_HD2_ENABLE, data);
 		break;
-	case WCD_BOLERO_EVT_HPHR_HD2_ENABLE:
+	case SLV_BOLERO_EVT_HPHR_HD2_ENABLE:
 		if (priv->macro_params[RX_MACRO].event_handler)
 			priv->macro_params[RX_MACRO].event_handler(
 				priv->component,
@@ -329,7 +330,7 @@ void bolero_clear_amic_tx_hold(struct device *dev, u16 adc_n)
 		dev_err(dev, "%s: priv is null\n", __func__);
 		return;
 	}
-	event = BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR;
+	event = BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR;
 	if (adc_n == BOLERO_ADC0)
 		amic = 0x1;
 	else if (adc_n == BOLERO_ADC1)
@@ -796,10 +797,10 @@ void bolero_wsa_pa_on(struct device *dev, bool adie_lb)
 	}
 	if (adie_lb)
 		bolero_cdc_notifier_call(priv,
-			BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB);
+			BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB);
 	else
 		bolero_cdc_notifier_call(priv,
-			BOLERO_WCD_EVT_PA_ON_POST_FSCLK);
+			BOLERO_SLV_EVT_PA_ON_POST_FSCLK);
 }
 EXPORT_SYMBOL(bolero_wsa_pa_on);
 
@@ -916,7 +917,7 @@ static int bolero_ssr_enable(struct device *dev, void *data)
 			BOLERO_MACRO_EVT_SSR_UP, 0x0);
 	}
 	trace_printk("%s: SSR up events processed by all macros\n", __func__);
-	bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_UP);
+	bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_SSR_UP);
 	return 0;
 }
 
@@ -931,7 +932,7 @@ static void bolero_ssr_disable(struct device *dev, void *data)
 		return;
 	}
 
-	bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_OFF_PRE_SSR);
+	bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_PA_OFF_PRE_SSR);
 	regcache_cache_only(priv->regmap, true);
 
 	mutex_lock(&priv->clk_lock);
@@ -947,7 +948,7 @@ static void bolero_ssr_disable(struct device *dev, void *data)
 			priv->component,
 			BOLERO_MACRO_EVT_SSR_DOWN, 0x0);
 	}
-	bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_DOWN);
+	bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_SSR_DOWN);
 }
 
 static struct snd_info_entry_ops bolero_info_ops = {

+ 0 - 22
asoc/codecs/bolero/internal.h

@@ -9,16 +9,6 @@
 
 #define BOLERO_CDC_CHILD_DEVICES_MAX 6
 
-/* from bolero to WCD events */
-enum {
-	BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1,
-	BOLERO_WCD_EVT_PA_OFF_PRE_SSR,
-	BOLERO_WCD_EVT_SSR_DOWN,
-	BOLERO_WCD_EVT_SSR_UP,
-	BOLERO_WCD_EVT_PA_ON_POST_FSCLK,
-	BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB,
-};
-
 enum {
 	REG_NO_ACCESS,
 	RD_REG,
@@ -26,18 +16,6 @@ enum {
 	RD_WR_REG
 };
 
-/* from WCD to bolero events */
-enum {
-	WCD_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */
-	WCD_BOLERO_EVT_IMPED_TRUE,   /* for imped true */
-	WCD_BOLERO_EVT_IMPED_FALSE,  /* for imped false */
-	WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
-	WCD_BOLERO_EVT_BCS_CLK_OFF,
-	WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE,
-	WCD_BOLERO_EVT_HPHL_HD2_ENABLE, /* to enable hd2 config for hphl */
-	WCD_BOLERO_EVT_HPHR_HD2_ENABLE, /* to enable hd2 config for hphr */
-};
-
 struct wcd_ctrl_platform_data {
 	void *handle;
 	int (*update_wcd_event)(void *handle, u16 event, u32 data);

+ 0 - 19
asoc/codecs/rouleur/internal.h

@@ -108,7 +108,6 @@ struct rouleur_pdata {
 	int num_supplies;
 	int reset_reg;
 	int foundry_id_reg;
-	u32 soc_threshold_val;
 };
 
 struct wcd_ctrl_platform_data {
@@ -125,24 +124,6 @@ enum {
 	WCD_RX3
 };
 
-enum {
-	BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1,
-	BOLERO_WCD_EVT_PA_OFF_PRE_SSR,
-	BOLERO_WCD_EVT_SSR_DOWN,
-	BOLERO_WCD_EVT_SSR_UP,
-};
-
-enum {
-	WCD_BOLERO_EVT_RX_MUTE = 1,	/* for RX mute/unmute */
-	WCD_BOLERO_EVT_IMPED_TRUE,	/* for imped true */
-	WCD_BOLERO_EVT_IMPED_FALSE,	/* for imped false */
-	WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
-	WCD_BOLERO_EVT_BCS_CLK_OFF,
-	WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE, /* To reduce PA gain for low SoC */
-	WCD_BOLERO_EVT_HPHL_HD2_ENABLE, /* to enable hd2 config for hphl */
-	WCD_BOLERO_EVT_HPHR_HD2_ENABLE, /* to enable hd2 config for hphr */
-};
-
 enum {
 	/* INTR_CTRL_INT_MASK_0 */
 	ROULEUR_IRQ_MBHC_BUTTON_PRESS_DET = 0,

+ 31 - 40
asoc/codecs/rouleur/rouleur.c

@@ -27,6 +27,7 @@
 #include <dt-bindings/sound/audio-codec-port-types.h>
 #include <asoc/msm-cdc-supply.h>
 #include <linux/power_supply.h>
+#include "asoc/bolero-slave-internal.h"
 
 #define DRV_NAME "rouleur_codec"
 
@@ -646,7 +647,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 		/* Enable HD2 Config for HPHR if foundry id is SEC */
 		if (rouleur->foundry_id == FOUNDRY_ID_SEC)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_HPHR_HD2_ENABLE,
+						SLV_BOLERO_EVT_HPHR_HD2_ENABLE,
 						0x04);
 		snd_soc_component_update_bits(component,
 			ROULEUR_DIG_SWR_PDM_WD_CTL1,
@@ -664,7 +665,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10));
 		wcd_enable_irq(&rouleur->irq_info,
 				ROULEUR_IRQ_HPHR_PDM_WD_INT);
@@ -674,7 +675,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 				ROULEUR_IRQ_HPHR_PDM_WD_INT);
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10 | 0x1));
 		blocking_notifier_call_chain(&rouleur->mbhc->notifier,
 					     WCD_EVENT_PRE_HPHR_PA_OFF,
@@ -694,7 +695,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 
 		if (rouleur->foundry_id == FOUNDRY_ID_SEC)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_HPHR_HD2_ENABLE,
+						SLV_BOLERO_EVT_HPHR_HD2_ENABLE,
 						0x00);
 		blocking_notifier_call_chain(&rouleur->mbhc->notifier,
 					     WCD_EVENT_POST_HPHR_PA_OFF,
@@ -728,7 +729,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 		usleep_range(200, 210);
 		if (rouleur->foundry_id == FOUNDRY_ID_SEC)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_HPHL_HD2_ENABLE,
+						SLV_BOLERO_EVT_HPHL_HD2_ENABLE,
 						0x04);
 		snd_soc_component_update_bits(component,
 				ROULEUR_DIG_SWR_PDM_WD_CTL0,
@@ -746,7 +747,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 		wcd_enable_irq(&rouleur->irq_info,
 				ROULEUR_IRQ_HPHL_PDM_WD_INT);
@@ -756,7 +757,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 				ROULEUR_IRQ_HPHL_PDM_WD_INT);
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		blocking_notifier_call_chain(&rouleur->mbhc->notifier,
 					     WCD_EVENT_PRE_HPHL_PA_OFF,
@@ -775,7 +776,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 
 		if (rouleur->foundry_id == FOUNDRY_ID_SEC)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_HPHL_HD2_ENABLE,
+						SLV_BOLERO_EVT_HPHL_HD2_ENABLE,
 						0x00);
 		blocking_notifier_call_chain(&rouleur->mbhc->notifier,
 					     WCD_EVENT_POST_HPHL_PA_OFF,
@@ -819,7 +820,7 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 				0x40, 0x00);
 		if (rouleur->foundry_id == FOUNDRY_ID_SEC)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_HPHL_HD2_ENABLE,
+						SLV_BOLERO_EVT_HPHL_HD2_ENABLE,
 						0x04);
 		snd_soc_component_update_bits(component,
 				ROULEUR_DIG_SWR_PDM_WD_CTL0,
@@ -832,7 +833,7 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 				0x0F, 0x04);
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 		wcd_enable_irq(&rouleur->irq_info,
 				ROULEUR_IRQ_HPHL_PDM_WD_INT);
@@ -842,14 +843,14 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 				ROULEUR_IRQ_HPHL_PDM_WD_INT);
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		break;
 	case SND_SOC_DAPM_POST_PMD:
 		usleep_range(5000, 5100);
 		if (rouleur->foundry_id == FOUNDRY_ID_SEC)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_HPHL_HD2_ENABLE,
+						SLV_BOLERO_EVT_HPHL_HD2_ENABLE,
 						0x00);
 		snd_soc_component_update_bits(component,
 				ROULEUR_DIG_SWR_PDM_WD_CTL0,
@@ -897,7 +898,7 @@ static int rouleur_codec_enable_lo_pa(struct snd_soc_dapm_widget *w,
 				0x0F, 0x04);
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 		wcd_enable_irq(&rouleur->irq_info,
 				ROULEUR_IRQ_HPHL_PDM_WD_INT);
@@ -907,7 +908,7 @@ static int rouleur_codec_enable_lo_pa(struct snd_soc_dapm_widget *w,
 					ROULEUR_IRQ_HPHL_PDM_WD_INT);
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		break;
 	case SND_SOC_DAPM_POST_PMD:
@@ -1371,10 +1372,10 @@ void rouleur_disable_bcs_before_slow_insert(struct snd_soc_component *component,
 	if (rouleur->update_wcd_event) {
 		if (bcs_disable)
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_BCS_CLK_OFF, 0);
+						SLV_BOLERO_EVT_BCS_CLK_OFF, 0);
 		else
 			rouleur->update_wcd_event(rouleur->handle,
-						WCD_BOLERO_EVT_BCS_CLK_OFF, 1);
+						SLV_BOLERO_EVT_BCS_CLK_OFF, 1);
 	}
 }
 
@@ -1420,7 +1421,7 @@ static int rouleur_event_notify(struct notifier_block *block,
 	struct wcd_mbhc *mbhc;
 
 	switch (event) {
-	case BOLERO_WCD_EVT_PA_OFF_PRE_SSR:
+	case BOLERO_SLV_EVT_PA_OFF_PRE_SSR:
 		snd_soc_component_update_bits(component,
 					ROULEUR_ANA_HPHPA_CNP_CTL_2,
 					0xC0, 0x00);
@@ -1437,7 +1438,7 @@ static int rouleur_event_notify(struct notifier_block *block,
 				ROULEUR_ANA_COMBOPA_CTL,
 				0x80, 0x00);
 		break;
-	case BOLERO_WCD_EVT_SSR_DOWN:
+	case BOLERO_SLV_EVT_SSR_DOWN:
 		rouleur->dev_up = false;
 		rouleur->mbhc->wcd_mbhc.deinit_in_progress = true;
 		mbhc = &rouleur->mbhc->wcd_mbhc;
@@ -1446,7 +1447,7 @@ static int rouleur_event_notify(struct notifier_block *block,
 		rouleur_mbhc_ssr_down(rouleur->mbhc, component);
 		rouleur_reset(rouleur->dev, 0x01);
 		break;
-	case BOLERO_WCD_EVT_SSR_UP:
+	case BOLERO_SLV_EVT_SSR_UP:
 		rouleur_reset(rouleur->dev, 0x00);
 		/* allow reset to take effect */
 		usleep_range(10000, 10010);
@@ -2087,14 +2088,14 @@ static void rouleur_evaluate_soc(struct work_struct *work)
 		return;
 	}
 
-	if (soc_val < pdata->soc_threshold_val) {
+	if (soc_val < SOC_THRESHOLD_LEVEL) {
 		dev_dbg(rouleur->dev,
 			"%s battery SoC less than threshold soc_val = %d\n",
 			__func__, soc_val);
 		/* Reduce PA Gain by 6DB for low SoC */
 		if (rouleur->update_wcd_event)
 			rouleur->update_wcd_event(rouleur->handle,
-					WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE,
+					SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE,
 					true);
 		rouleur->low_soc = true;
 		ret = msm_cdc_set_supply_min_voltage(rouleur->dev,
@@ -2113,7 +2114,7 @@ static void rouleur_evaluate_soc(struct work_struct *work)
 			/* Reset PA Gain to default for normal SoC */
 			if (rouleur->update_wcd_event)
 				rouleur->update_wcd_event(rouleur->handle,
-					WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE,
+					SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE,
 					false);
 			ret = msm_cdc_set_supply_min_voltage(rouleur->dev,
 						rouleur->supplies,
@@ -2224,6 +2225,14 @@ static int rouleur_soc_codec_probe(struct snd_soc_component *component)
 	}
 	rouleur->low_soc = false;
 	rouleur->dev_up = true;
+	/* Register notifier to change gain based on state of charge */
+	INIT_WORK(&rouleur->soc_eval_work, rouleur_evaluate_soc);
+	rouleur->psy_nb.notifier_call = rouleur_battery_supply_cb;
+	if (power_supply_reg_notifier(&rouleur->psy_nb) < 0)
+		dev_dbg(rouleur->dev,
+			"%s: could not register pwr supply notifier\n",
+			__func__);
+	queue_work(system_freezable_wq, &rouleur->soc_eval_work);
 done:
 	return ret;
 }
@@ -2463,16 +2472,6 @@ struct rouleur_pdata *rouleur_populate_dt_data(struct device *dev)
 	else
 		pdata->foundry_id_reg = reg;
 
-	if (of_property_read_u32(dev->of_node, "qcom,soc-threshold-voltage"
-	    , &reg)) {
-		dev_dbg(dev, "%s: Looking up %s property in node %s failed\n",
-			__func__, "qcom,soc-threshold-voltage",
-			dev->of_node->full_name);
-		pdata->soc_threshold_val = SOC_THRESHOLD_LEVEL;
-	} else {
-		pdata->soc_threshold_val = reg;
-	}
-
 	/* Parse power supplies */
 	msm_cdc_get_power_supplies(dev, &pdata->regulator,
 				   &pdata->num_supplies);
@@ -2690,14 +2689,6 @@ static int rouleur_bind(struct device *dev)
 		goto err_irq;
 	}
 
-	/* Register notifier to change gain based on state of charge */
-	INIT_WORK(&rouleur->soc_eval_work, rouleur_evaluate_soc);
-	rouleur->psy_nb.notifier_call = rouleur_battery_supply_cb;
-	if (power_supply_reg_notifier(&rouleur->psy_nb) < 0)
-		dev_dbg(rouleur->dev,
-			"%s: could not register pwr supply notifier\n",
-			__func__);
-	queue_work(system_freezable_wq, &rouleur->soc_eval_work);
 	return ret;
 err_irq:
 	wcd_irq_exit(&rouleur->irq_info, rouleur->virq);

+ 0 - 15
asoc/codecs/wcd937x/internal.h

@@ -128,21 +128,6 @@ enum {
 	WCD_RX3
 };
 
-enum {
-	BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1,
-	BOLERO_WCD_EVT_PA_OFF_PRE_SSR,
-	BOLERO_WCD_EVT_SSR_DOWN,
-	BOLERO_WCD_EVT_SSR_UP,
-};
-
-enum {
-	WCD_BOLERO_EVT_RX_MUTE = 1,	/* for RX mute/unmute */
-	WCD_BOLERO_EVT_IMPED_TRUE,	/* for imped true */
-	WCD_BOLERO_EVT_IMPED_FALSE,	/* for imped false */
-	WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
-	WCD_BOLERO_EVT_BCS_CLK_OFF,
-};
-
 enum {
 	/* INTR_CTRL_INT_MASK_0 */
 	WCD937X_IRQ_MBHC_BUTTON_PRESS_DET = 0,

+ 15 - 14
asoc/codecs/wcd937x/wcd937x.c

@@ -25,6 +25,7 @@
 #include "wcd937x-registers.h"
 #include "wcd937x.h"
 #include "internal.h"
+#include "asoc/bolero-slave-internal.h"
 
 #define WCD9370_VARIANT 0
 #define WCD9375_VARIANT 5
@@ -745,7 +746,7 @@ static int wcd937x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 				0x02, 0x02);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10));
 		wcd_enable_irq(&wcd937x->irq_info,
 				WCD937X_IRQ_HPHR_PDM_WD_INT);
@@ -755,7 +756,7 @@ static int wcd937x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 				WCD937X_IRQ_HPHR_PDM_WD_INT);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10 | 0x1));
 		blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
 					     WCD_EVENT_PRE_HPHR_PA_OFF,
@@ -844,7 +845,7 @@ static int wcd937x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 				0x02, 0x02);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 		wcd_enable_irq(&wcd937x->irq_info,
 				WCD937X_IRQ_HPHL_PDM_WD_INT);
@@ -854,7 +855,7 @@ static int wcd937x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 				WCD937X_IRQ_HPHL_PDM_WD_INT);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		blocking_notifier_call_chain(&wcd937x->mbhc->notifier,
 					     WCD_EVENT_PRE_HPHL_PA_OFF,
@@ -920,7 +921,7 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
 					0x02, 0x02);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX3 << 0x10));
 		wcd_enable_irq(&wcd937x->irq_info, WCD937X_IRQ_AUX_PDM_WD_INT);
 		break;
@@ -928,7 +929,7 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
 		wcd_disable_irq(&wcd937x->irq_info, WCD937X_IRQ_AUX_PDM_WD_INT);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX3 << 0x10 | 0x1));
 		break;
 	case SND_SOC_DAPM_POST_PMD:
@@ -990,7 +991,7 @@ static int wcd937x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 					0x02, 0x02);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 		if (wcd937x->ear_rx_path & EAR_RX_PATH_AUX)
 			wcd_enable_irq(&wcd937x->irq_info,
@@ -1008,7 +1009,7 @@ static int wcd937x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 					WCD937X_IRQ_HPHL_PDM_WD_INT);
 		if (wcd937x->update_wcd_event)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		break;
 	case SND_SOC_DAPM_POST_PMD:
@@ -1589,10 +1590,10 @@ void wcd937x_disable_bcs_before_slow_insert(struct snd_soc_component *component,
 	if (wcd937x->update_wcd_event) {
 		if (bcs_disable)
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_BCS_CLK_OFF, 0);
+						SLV_BOLERO_EVT_BCS_CLK_OFF, 0);
 		else
 			wcd937x->update_wcd_event(wcd937x->handle,
-						WCD_BOLERO_EVT_BCS_CLK_OFF, 1);
+						SLV_BOLERO_EVT_BCS_CLK_OFF, 1);
 	}
 }
 
@@ -1640,7 +1641,7 @@ static int wcd937x_event_notify(struct notifier_block *block,
 	struct wcd_mbhc *mbhc;
 
 	switch (event) {
-	case BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR:
+	case BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR:
 		if (amic == 0x1 || amic == 0x2)
 			reg = WCD937X_ANA_TX_CH2;
 		else if (amic == 0x3)
@@ -1651,7 +1652,7 @@ static int wcd937x_event_notify(struct notifier_block *block,
 			mask = 0x20;
 		snd_soc_component_update_bits(component, reg, mask, 0x00);
 		break;
-	case BOLERO_WCD_EVT_PA_OFF_PRE_SSR:
+	case BOLERO_SLV_EVT_PA_OFF_PRE_SSR:
 		snd_soc_component_update_bits(component, WCD937X_ANA_HPH,
 					0xC0, 0x00);
 		snd_soc_component_update_bits(component, WCD937X_ANA_EAR,
@@ -1659,7 +1660,7 @@ static int wcd937x_event_notify(struct notifier_block *block,
 		snd_soc_component_update_bits(component, WCD937X_AUX_AUXPA,
 					0x80, 0x00);
 		break;
-	case BOLERO_WCD_EVT_SSR_DOWN:
+	case BOLERO_SLV_EVT_SSR_DOWN:
 		wcd937x->mbhc->wcd_mbhc.deinit_in_progress = true;
 		mbhc = &wcd937x->mbhc->wcd_mbhc;
 		wcd937x->usbc_hs_status = get_usbc_hs_status(component,
@@ -1667,7 +1668,7 @@ static int wcd937x_event_notify(struct notifier_block *block,
 		wcd937x_mbhc_ssr_down(wcd937x->mbhc, component);
 		wcd937x_reset_low(wcd937x->dev);
 		break;
-	case BOLERO_WCD_EVT_SSR_UP:
+	case BOLERO_SLV_EVT_SSR_UP:
 		wcd937x_reset(wcd937x->dev);
 		/* allow reset to take effect */
 		usleep_range(10000, 10010);

+ 0 - 16
asoc/codecs/wcd938x/internal.h

@@ -146,22 +146,6 @@ enum {
 	WCD_RX3
 };
 
-enum {
-	BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1,
-	BOLERO_WCD_EVT_PA_OFF_PRE_SSR,
-	BOLERO_WCD_EVT_SSR_DOWN,
-	BOLERO_WCD_EVT_SSR_UP,
-	BOLERO_WCD_EVT_CLK_NOTIFY,
-};
-
-enum {
-	WCD_BOLERO_EVT_RX_MUTE = 1,	/* for RX mute/unmute */
-	WCD_BOLERO_EVT_IMPED_TRUE,	/* for imped true */
-	WCD_BOLERO_EVT_IMPED_FALSE,	/* for imped false */
-	WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
-	WCD_BOLERO_EVT_BCS_CLK_OFF,
-};
-
 enum {
 	/* INTR_CTRL_INT_MASK_0 */
 	WCD938X_IRQ_MBHC_BUTTON_PRESS_DET = 0,

+ 22 - 21
asoc/codecs/wcd938x/wcd938x.c

@@ -24,6 +24,7 @@
 #include "wcd938x-registers.h"
 #include "wcd938x.h"
 #include "internal.h"
+#include "asoc/bolero-slave-internal.h"
 
 #define NUM_SWRS_DT_PARAMS 5
 #define WCD938X_VARIANT_ENTRY_SIZE 32
@@ -789,7 +790,7 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 						0x80, 0x80);
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10 | 0x1));
 		ret = swr_slvdev_datapath_control(wcd938x->rx_swr_dev,
 				    wcd938x->rx_swr_dev->dev_num,
@@ -840,7 +841,7 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 					WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02);
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10));
 		wcd_enable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_HPHR_PDM_WD_INT);
@@ -848,13 +849,13 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
 	case SND_SOC_DAPM_PRE_PMD:
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX2 << 0x10 | 0x1));
 		wcd_disable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_HPHR_PDM_WD_INT);
 		if (wcd938x->update_wcd_event && wcd938x->comp2_enable)
 			wcd938x->update_wcd_event(wcd938x->handle,
-					WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
+					SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
 					(WCD_RX2 << 0x10));
 		/*
 		 * 7ms sleep is required if compander is enabled as per
@@ -925,7 +926,7 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 						0x80, 0x80);
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x01));
 		ret = swr_slvdev_datapath_control(wcd938x->rx_swr_dev,
 				    wcd938x->rx_swr_dev->dev_num,
@@ -976,7 +977,7 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 					WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02);
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 		wcd_enable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_HPHL_PDM_WD_INT);
@@ -984,13 +985,13 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
 	case SND_SOC_DAPM_PRE_PMD:
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		wcd_disable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_HPHL_PDM_WD_INT);
 		if (wcd938x->update_wcd_event && wcd938x->comp1_enable)
 			wcd938x->update_wcd_event(wcd938x->handle,
-					WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
+					SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
 					(WCD_RX1 << 0x10));
 		/*
 		 * 7ms sleep is required if compander is enabled as per
@@ -1072,7 +1073,7 @@ static int wcd938x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
 					0x02, 0x02);
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX3 << 0x10));
 		wcd_enable_irq(&wcd938x->irq_info, WCD938X_IRQ_AUX_PDM_WD_INT);
 		break;
@@ -1081,7 +1082,7 @@ static int wcd938x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
 					WCD938X_IRQ_AUX_PDM_WD_INT);
 		if (wcd938x->update_wcd_event)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX3 << 0x10 | 0x1));
 		break;
 	case SND_SOC_DAPM_POST_PMD:
@@ -1152,14 +1153,14 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 		if (wcd938x->ear_rx_path & EAR_RX_PATH_AUX) {
 			if (wcd938x->update_wcd_event)
 				wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX3 << 0x10));
 			wcd_enable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_AUX_PDM_WD_INT);
 		} else {
 			if (wcd938x->update_wcd_event)
 				wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10));
 			wcd_enable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_HPHL_PDM_WD_INT);
@@ -1171,14 +1172,14 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
 					WCD938X_IRQ_AUX_PDM_WD_INT);
 			if (wcd938x->update_wcd_event)
 				wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX3 << 0x10 | 0x1));
 		} else {
 			wcd_disable_irq(&wcd938x->irq_info,
 					WCD938X_IRQ_HPHL_PDM_WD_INT);
 			if (wcd938x->update_wcd_event)
 				wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_RX_MUTE,
+						SLV_BOLERO_EVT_RX_MUTE,
 						(WCD_RX1 << 0x10 | 0x1));
 		}
 		break;
@@ -1775,10 +1776,10 @@ void wcd938x_disable_bcs_before_slow_insert(struct snd_soc_component *component,
 	if (wcd938x->update_wcd_event) {
 		if (bcs_disable)
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_BCS_CLK_OFF, 0);
+						SLV_BOLERO_EVT_BCS_CLK_OFF, 0);
 		else
 			wcd938x->update_wcd_event(wcd938x->handle,
-						WCD_BOLERO_EVT_BCS_CLK_OFF, 1);
+						SLV_BOLERO_EVT_BCS_CLK_OFF, 1);
 	}
 }
 
@@ -2114,7 +2115,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
 	struct wcd_mbhc *mbhc;
 
 	switch (event) {
-	case BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR:
+	case BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR:
 		if (test_bit(WCD_ADC1, &wcd938x->status_mask)) {
 			snd_soc_component_update_bits(component,
 					WCD938X_ANA_TX_CH2, 0x40, 0x00);
@@ -2140,7 +2141,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
 			clear_bit(WCD_ADC4, &wcd938x->status_mask);
 		}
 		break;
-	case BOLERO_WCD_EVT_PA_OFF_PRE_SSR:
+	case BOLERO_SLV_EVT_PA_OFF_PRE_SSR:
 		snd_soc_component_update_bits(component, WCD938X_ANA_HPH,
 					0xC0, 0x00);
 		snd_soc_component_update_bits(component, WCD938X_ANA_EAR,
@@ -2148,7 +2149,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
 		snd_soc_component_update_bits(component, WCD938X_AUX_AUXPA,
 					0x80, 0x00);
 		break;
-	case BOLERO_WCD_EVT_SSR_DOWN:
+	case BOLERO_SLV_EVT_SSR_DOWN:
 		wcd938x->dev_up = false;
 		if(wcd938x->notify_swr_dmic)
 			blocking_notifier_call_chain(&wcd938x->notifier,
@@ -2163,7 +2164,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
 		wcd938x_mbhc_ssr_down(wcd938x->mbhc, component);
 		wcd938x_reset_low(wcd938x->dev);
 		break;
-	case BOLERO_WCD_EVT_SSR_UP:
+	case BOLERO_SLV_EVT_SSR_UP:
 		wcd938x_reset(wcd938x->dev);
 		/* allow reset to take effect */
 		usleep_range(10000, 10010);
@@ -2192,7 +2193,7 @@ static int wcd938x_event_notify(struct notifier_block *block,
 						     WCD938X_EVT_SSR_UP,
 						     NULL);
 		break;
-	case BOLERO_WCD_EVT_CLK_NOTIFY:
+	case BOLERO_SLV_EVT_CLK_NOTIFY:
 		snd_soc_component_update_bits(component,
 				WCD938X_DIGITAL_TOP_CLK_CFG, 0x06,
 				((val >> 0x10) << 0x01));

+ 4 - 13
asoc/codecs/wsa881x.c

@@ -28,6 +28,7 @@
 #include <asoc/msm-cdc-pinctrl.h>
 #include "wsa881x.h"
 #include "wsa881x-temp-sensor.h"
+#include "asoc/bolero-slave-internal.h"
 
 #define DRV_NAME "wsa-codec"
 #define WSA881X_NUM_RETRY	5
@@ -111,16 +112,6 @@ struct wsa881x_priv {
 				 bool enable);
 };
 
-/* from bolero to WSA events */
-enum {
-	BOLERO_WSA_EVT_TX_CH_HOLD_CLEAR = 1,
-	BOLERO_WSA_EVT_PA_OFF_PRE_SSR,
-	BOLERO_WSA_EVT_SSR_DOWN,
-	BOLERO_WSA_EVT_SSR_UP,
-	BOLERO_WSA_EVT_PA_ON_POST_FSCLK,
-	BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB,
-};
-
 struct wsa_ctrl_platform_data {
 	void *handle;
 	int (*update_wsa_event)(void *handle, u16 event, u32 data);
@@ -1395,7 +1386,7 @@ static int wsa881x_event_notify(struct notifier_block *nb,
 		return -EINVAL;
 
 	switch (event) {
-	case BOLERO_WSA_EVT_PA_OFF_PRE_SSR:
+	case BOLERO_SLV_EVT_PA_OFF_PRE_SSR:
 		snd_soc_component_update_bits(wsa881x->component,
 					      WSA881X_SPKR_DRV_GAIN,
 					      0xF0, 0xC0);
@@ -1403,8 +1394,8 @@ static int wsa881x_event_notify(struct notifier_block *nb,
 					      WSA881X_SPKR_DRV_EN,
 					      0x80, 0x00);
 		break;
-	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK:
-	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB:
+	case BOLERO_SLV_EVT_PA_ON_POST_FSCLK:
+	case BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB:
 		if ((snd_soc_component_read32(wsa881x->component,
 				WSA881X_SPKR_DAC_CTL) & 0x80) == 0x80)
 			snd_soc_component_update_bits(wsa881x->component,

+ 0 - 9
asoc/codecs/wsa883x/internal.h

@@ -60,15 +60,6 @@ enum {
 	SWR_VISENSE_PORT,
 };
 
-enum {
-	BOLERO_WSA_EVT_TX_CH_HOLD_CLEAR = 1,
-	BOLERO_WSA_EVT_PA_OFF_PRE_SSR,
-	BOLERO_WSA_EVT_SSR_DOWN,
-	BOLERO_WSA_EVT_SSR_UP,
-	BOLERO_WSA_EVT_PA_ON_POST_FSCLK,
-	BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB,
-};
-
 struct wsa_ctrl_platform_data {
 	void *handle;
 	int (*update_wsa_event)(void *handle, u16 event, u32 data);

+ 5 - 4
asoc/codecs/wsa883x/wsa883x.c

@@ -29,6 +29,7 @@
 #include <asoc/msm-cdc-supply.h>
 #include "wsa883x.h"
 #include "internal.h"
+#include "asoc/bolero-slave-internal.h"
 
 #define T1_TEMP -10
 #define T2_TEMP 150
@@ -1436,7 +1437,7 @@ static int wsa883x_event_notify(struct notifier_block *nb,
 		return -EINVAL;
 
 	switch (event) {
-	case BOLERO_WSA_EVT_PA_OFF_PRE_SSR:
+	case BOLERO_SLV_EVT_PA_OFF_PRE_SSR:
 		if (test_bit(SPKR_STATUS, &wsa883x->status_mask))
 			snd_soc_component_update_bits(wsa883x->component,
 						WSA883X_PA_FSM_CTL,
@@ -1444,14 +1445,14 @@ static int wsa883x_event_notify(struct notifier_block *nb,
 		wsa883x_swr_down(wsa883x);
 		break;
 
-	case BOLERO_WSA_EVT_SSR_UP:
+	case BOLERO_SLV_EVT_SSR_UP:
 		wsa883x_swr_up(wsa883x);
 		/* Add delay to allow enumerate */
 		usleep_range(20000, 20010);
 		wsa883x_swr_reset(wsa883x);
 		break;
 
-	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK:
+	case BOLERO_SLV_EVT_PA_ON_POST_FSCLK:
 		if (test_bit(SPKR_STATUS, &wsa883x->status_mask)) {
 			snd_soc_component_update_bits(wsa883x->component,
 						WSA883X_PDM_WD_CTL,
@@ -1470,7 +1471,7 @@ static int wsa883x_event_notify(struct notifier_block *nb,
 			usleep_range(5000, 5050);
 		}
 		break;
-	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB:
+	case BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB:
 		if (test_bit(SPKR_STATUS, &wsa883x->status_mask))
 			set_bit(SPKR_ADIE_LB, &wsa883x->status_mask);
 		break;

+ 46 - 2
asoc/holi.c

@@ -14,6 +14,7 @@
 #include <linux/input.h>
 #include <linux/of_device.h>
 #include <linux/soc/qcom/fsa4480-i2c.h>
+#include <linux/nvmem-consumer.h>
 #include <sound/core.h>
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
@@ -6602,6 +6603,49 @@ static int msm_audio_ssr_register(struct device *dev)
 	return ret;
 }
 
+static int msm_asoc_parse_soundcard_name(struct platform_device *pdev,
+					 struct snd_soc_card *card)
+{
+	struct nvmem_cell *cell;
+	size_t len;
+	u32 *buf;
+	u32 adsp_var_idx = 0;
+	int ret = 0;
+
+	/* get adsp variant idx */
+	cell = nvmem_cell_get(&pdev->dev, "adsp_variant");
+	if (IS_ERR_OR_NULL(cell)) {
+		dev_dbg(&pdev->dev, "%s: FAILED to get nvmem cell \n", __func__);
+		goto parse;
+	}
+	buf = nvmem_cell_read(cell, &len);
+	nvmem_cell_put(cell);
+	if (IS_ERR_OR_NULL(buf)) {
+		dev_dbg(&pdev->dev, "%s: FAILED to read nvmem cell \n", __func__);
+		goto parse;
+	}
+	if (len <= 0 || len > sizeof(u32)) {
+		dev_dbg(&pdev->dev, "%s: nvmem cell length out of range: %d\n",
+			__func__, len);
+		kfree(buf);
+		goto parse;
+	}
+	memcpy(&adsp_var_idx, buf, len);
+	kfree(buf);
+
+parse:
+	if(adsp_var_idx == 1)
+		ret = snd_soc_of_parse_card_name(card, "qcom,sku-model");
+	else
+		ret = snd_soc_of_parse_card_name(card, "qcom,model");
+
+	if (ret)
+		dev_err(&pdev->dev, "%s: parse card name failed, err:%d\n",
+			__func__, ret);
+
+	return ret;
+}
+
 static int msm_asoc_machine_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = NULL;
@@ -6637,9 +6681,9 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, card);
 	snd_soc_card_set_drvdata(card, pdata);
 
-	ret = snd_soc_of_parse_card_name(card, "qcom,model");
+	ret = msm_asoc_parse_soundcard_name(pdev, card);
 	if (ret) {
-		dev_err(&pdev->dev, "%s: parse card name failed, err:%d\n",
+		dev_err(&pdev->dev, "%s: parse soundcard name failed, err:%d\n",
 			__func__, ret);
 		goto err;
 	}

+ 107 - 9
dsp/msm_audio_ion_vm.c

@@ -34,6 +34,7 @@
 struct msm_audio_ion_private {
 	bool smmu_enabled;
 	struct device *cb_dev;
+	struct device *cb_cma_dev;
 	u8 device_status;
 	struct list_head alloc_list;
 	struct mutex list_mutex;
@@ -88,7 +89,8 @@ static void msm_audio_ion_add_allocation(
 }
 
 static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
-				 dma_addr_t *addr, size_t *len)
+				 dma_addr_t *addr, size_t *len,
+				 bool cma_mem)
 {
 
 	struct msm_audio_alloc_data *alloc_data;
@@ -96,7 +98,10 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
 	unsigned long ionflag = 0;
 	int rc = 0;
 
-	cb_dev = msm_audio_ion_data.cb_dev;
+	if (cma_mem)
+		cb_dev = msm_audio_ion_data.cb_cma_dev;
+	else
+		cb_dev = msm_audio_ion_data.cb_dev;
 
 	/* Data required per buffer mapping */
 	alloc_data = kzalloc(sizeof(*alloc_data), GFP_KERNEL);
@@ -161,14 +166,19 @@ free_alloc_data:
 	return rc;
 }
 
-static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf)
+static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf, bool cma_mem)
 {
 	int rc = 0;
 	struct msm_audio_alloc_data *alloc_data = NULL;
 	struct list_head *ptr, *next;
-	struct device *cb_dev = msm_audio_ion_data.cb_dev;
+	struct device *cb_dev;
 	bool found = false;
 
+	if (cma_mem)
+		cb_dev = msm_audio_ion_data.cb_cma_dev;
+	else
+		cb_dev = msm_audio_ion_data.cb_dev;
+
 	/*
 	 * Though list_for_each_safe is delete safe, lock
 	 * should be explicitly acquired to avoid race condition
@@ -401,7 +411,7 @@ static int msm_audio_ion_get_phys(struct dma_buf *dma_buf,
 {
 	int rc = 0;
 
-	rc = msm_audio_dma_buf_map(dma_buf, addr, len);
+	rc = msm_audio_dma_buf_map(dma_buf, addr, len, false);
 	if (rc) {
 		pr_err("%s: failed to map DMA buf, err = %d\n",
 			__func__, rc);
@@ -509,7 +519,7 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
 	if (IS_ERR_OR_NULL(*vaddr)) {
 		pr_err("%s: ION memory mapping for AUDIO failed\n", __func__);
 		rc = -ENOMEM;
-		msm_audio_dma_buf_unmap(dma_buf);
+		msm_audio_dma_buf_unmap(dma_buf, false);
 		goto err;
 	}
 
@@ -518,7 +528,7 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
 		if (rc) {
 			pr_err("%s: failed to do smmu map, err = %d\n",
 				__func__, rc);
-			msm_audio_dma_buf_unmap(dma_buf);
+			msm_audio_dma_buf_unmap(dma_buf, false);
 			goto err;
 		}
 	}
@@ -623,7 +633,7 @@ EXPORT_SYMBOL(msm_audio_is_hypervisor_supported);
  * @bufsz: buffer size
  * @paddr: Physical address to be assigned with allocated region
  * @plen: length of allocated region to be assigned
- * vaddr: virtual address to be assigned
+ * @vaddr: virtual address to be assigned
  *
  * Returns 0 on success or error on failure
  */
@@ -679,6 +689,67 @@ err:
 }
 EXPORT_SYMBOL(msm_audio_ion_import);
 
+/**
+ * msm_audio_ion_import_cma-
+ *        Import ION buffer with given file descriptor
+ *
+ * @dma_buf: dma_buf for the ION memory
+ * @fd: file descriptor for the ION memory
+ * @ionflag: flags associated with ION buffer
+ * @bufsz: buffer size
+ * @paddr: Physical address to be assigned with allocated region
+ * @plen: length of allocated region to be assigned
+ * @vaddr: virtual address to be assigned
+ *
+ * Returns 0 on success or error on failure
+ */
+int msm_audio_ion_import_cma(struct dma_buf **dma_buf, int fd,
+			unsigned long *ionflag, size_t bufsz,
+			dma_addr_t *paddr, size_t *plen, void **vaddr)
+{
+	int rc = 0;
+
+	if (!(msm_audio_ion_data.device_status & MSM_AUDIO_ION_PROBED)) {
+		pr_debug("%s: probe is not done, deferred\n", __func__);
+		return -EPROBE_DEFER;
+	}
+
+	if (!dma_buf || !paddr || !vaddr || !plen ||
+	    !msm_audio_ion_data.cb_cma_dev) {
+		pr_err("%s: Invalid params\n", __func__);
+		return -EINVAL;
+	}
+
+	/* bufsz should be 0 and fd shouldn't be 0 as of now */
+	*dma_buf = dma_buf_get(fd);
+	pr_debug("%s: dma_buf =%pK, fd=%d\n", __func__, *dma_buf, fd);
+	if (IS_ERR_OR_NULL((void *)(*dma_buf))) {
+		pr_err("%s: dma_buf_get failed\n", __func__);
+		rc = -EINVAL;
+		goto err;
+	}
+
+	if (ionflag != NULL) {
+		rc = dma_buf_get_flags(*dma_buf, ionflag);
+		if (rc) {
+			pr_err("%s: could not get flags for the dma_buf\n",
+				__func__);
+			goto err_ion_flag;
+		}
+	}
+
+	msm_audio_dma_buf_map(*dma_buf, paddr, plen, true);
+
+	return 0;
+
+err_ion_flag:
+	dma_buf_put(*dma_buf);
+err:
+	*dma_buf = NULL;
+	return rc;
+}
+EXPORT_SYMBOL(msm_audio_ion_import_cma);
+
 /**
  * msm_audio_ion_free -
  *        fress ION memory for given client and handle
@@ -707,12 +778,33 @@ int msm_audio_ion_free(struct dma_buf *dma_buf)
 				__func__, ret);
 	}
 
-	msm_audio_dma_buf_unmap(dma_buf);
+	msm_audio_dma_buf_unmap(dma_buf, false);
 
 	return 0;
 }
 EXPORT_SYMBOL(msm_audio_ion_free);
 
+/**
+ * msm_audio_ion_free_cma -
+ *        fress ION memory for given client and handle
+ *
+ * @dma_buf: dma_buf for the ION memory
+ *
+ * Returns 0 on success or error on failure
+ */
+int msm_audio_ion_free_cma(struct dma_buf *dma_buf)
+{
+	if (!dma_buf) {
+		pr_err("%s: dma_buf invalid\n", __func__);
+		return -EINVAL;
+	}
+
+	msm_audio_dma_buf_unmap(dma_buf, true);
+
+	return 0;
+}
+EXPORT_SYMBOL(msm_audio_ion_free_cma);
+
 /**
  * msm_audio_ion_mmap -
  *       Audio ION memory map
@@ -814,6 +906,7 @@ EXPORT_SYMBOL(msm_audio_populate_upper_32_bits);
 
 static const struct of_device_id msm_audio_ion_dt_match[] = {
 	{ .compatible = "qcom,msm-audio-ion" },
+	{ .compatible = "qcom,msm-audio-ion-cma"},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, msm_audio_ion_dt_match);
@@ -833,6 +926,11 @@ static int msm_audio_ion_probe(struct platform_device *pdev)
 		return 0;
 	}
 
+	if (of_device_is_compatible(dev->of_node, "qcom,msm-audio-ion-cma")) {
+		msm_audio_ion_data.cb_cma_dev = dev;
+		return 0;
+	}
+
 	smmu_enabled = of_property_read_bool(dev->of_node,
 					     msm_audio_ion_dt);
 	msm_audio_ion_data.smmu_enabled = smmu_enabled;

+ 6 - 6
dsp/q6afe.c

@@ -2379,8 +2379,8 @@ static int afe_spk_prot_prepare(int src_port, int dst_port, int param_id,
 					       q6audio_get_port_index(src_port),
 					       param_info, (u8 *) prot_config);
 	if (ret)
-		pr_err("%s: port = 0x%x param = 0x%x failed %d\n", __func__,
-		       src_port, param_id, ret);
+		pr_err_ratelimited("%s: port = 0x%x param = 0x%x failed %d\n",
+					__func__, src_port, param_id, ret);
 
 fail_cmd:
 	pr_debug("%s: config.pdata.param_id 0x%x status %d 0x%x\n", __func__,
@@ -2994,7 +2994,7 @@ static int afe_send_hw_delay(u16 port_id, u32 rate)
 					       q6audio_get_port_index(port_id),
 					       param_info, (u8 *) &hw_delay);
 	if (ret)
-		pr_err("%s: AFE hw delay for port 0x%x failed %d\n",
+		pr_err_ratelimited("%s: AFE hw delay for port 0x%x failed %d\n",
 		       __func__, port_id, ret);
 
 fail_cmd:
@@ -3079,7 +3079,7 @@ static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id,
 	cal_block = afe_find_cal_topo_id_by_port(
 		this_afe.cal_data[cal_type_index], port_id);
 	if (cal_block == NULL) {
-		pr_err("%s: cal_type %d not initialized for this port %d\n",
+		pr_err_ratelimited("%s: cal_type %d not initialized for this port %d\n",
 			__func__, cal_type_index, port_id);
 		ret = -EINVAL;
 		goto unlock;
@@ -3596,7 +3596,7 @@ static int send_afe_cal_type(int cal_index, int port_id)
 				this_afe.cal_data[cal_index]);
 
 	if (cal_block == NULL || cal_utils_is_cal_stale(cal_block)) {
-		pr_err("%s cal_block not found!!\n", __func__);
+		pr_err_ratelimited("%s cal_block not found!!\n", __func__);
 		ret = -EINVAL;
 		goto unlock;
 	}
@@ -5860,7 +5860,7 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
 					       q6audio_get_port_index(port_id),
 					       param_hdr, (u8 *) &port_cfg);
 	if (ret) {
-		pr_err("%s: AFE enable for port 0x%x failed %d\n",
+		pr_err_ratelimited("%s: AFE enable for port 0x%x failed %d\n",
 			__func__, port_id, ret);
 		goto fail_cmd;
 	}

+ 2 - 2
dsp/q6asm.c

@@ -4463,7 +4463,7 @@ int q6asm_open_shared_io(struct audio_client *ac,
 
 	rc = apr_send_pkt(ac->apr, (uint32_t *) open);
 	if (rc < 0) {
-		pr_err("%s: Open failed op[0x%x]rc[%d]\n",
+		pr_err_ratelimited("%s: Open failed op[0x%x]rc[%d]\n",
 		       __func__, open->hdr.opcode, rc);
 		goto done;
 	}
@@ -10398,7 +10398,7 @@ static int __q6asm_cmd(struct audio_client *ac, int cmd, uint32_t stream_id)
 			hdr.opcode);
 	rc = apr_send_pkt(ac->apr, (uint32_t *) &hdr);
 	if (rc < 0) {
-		pr_err("%s: Commmand 0x%x failed %d\n",
+		pr_err_ratelimited("%s: Commmand 0x%x failed %d\n",
 				__func__, hdr.opcode, rc);
 		rc = -EINVAL;
 		goto fail_cmd;

+ 12 - 0
dsp/rtac.c

@@ -957,6 +957,12 @@ void rtac_set_asm_handle(u32 session_id, void *handle)
 {
 	pr_debug("%s\n", __func__);
 
+	if (session_id >= (ASM_ACTIVE_STREAMS_ALLOWED + 1)) {
+		pr_err_ratelimited("%s: Invalid Session = %d\n",
+				 __func__, session_id);
+		return;
+	}
+
 	mutex_lock(&rtac_asm_apr_mutex);
 	rtac_asm_apr_data[session_id].apr_handle = handle;
 	mutex_unlock(&rtac_asm_apr_mutex);
@@ -965,6 +971,12 @@ void rtac_set_asm_handle(u32 session_id, void *handle)
 bool rtac_make_asm_callback(u32 session_id, uint32_t *payload,
 	u32 payload_size)
 {
+	if (session_id >= (ASM_ACTIVE_STREAMS_ALLOWED + 1)) {
+		pr_err_ratelimited("%s: Invalid Session = %d\n",
+				 __func__, session_id);
+		return false;
+	}
+
 	if (atomic_read(&rtac_asm_apr_data[session_id].cmd_state) != 1)
 		return false;
 

+ 27 - 0
include/asoc/bolero-slave-internal.h

@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+
+/* from Slave to bolero events */
+enum {
+	SLV_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */
+	SLV_BOLERO_EVT_IMPED_TRUE,   /* for imped true */
+	SLV_BOLERO_EVT_IMPED_FALSE,  /* for imped false */
+	SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
+	SLV_BOLERO_EVT_BCS_CLK_OFF,
+	SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE,
+	SLV_BOLERO_EVT_HPHL_HD2_ENABLE, /* to enable hd2 config for hphl */
+	SLV_BOLERO_EVT_HPHR_HD2_ENABLE, /* to enable hd2 config for hphr */
+};
+
+/* from bolero to SLV events */
+enum {
+	BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR = 1,
+	BOLERO_SLV_EVT_PA_OFF_PRE_SSR,
+	BOLERO_SLV_EVT_SSR_DOWN,
+	BOLERO_SLV_EVT_SSR_UP,
+	BOLERO_SLV_EVT_PA_ON_POST_FSCLK,
+	BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB,
+	BOLERO_SLV_EVT_CLK_NOTIFY,
+};

+ 2 - 1
ipc/apr_tal_rpmsg.c

@@ -58,7 +58,8 @@ int apr_tal_write(struct apr_svc_ch_dev *apr_ch, void *data,
 	spin_unlock_irqrestore(&apr_ch->w_lock, flags);
 
 	if (rc)
-		pr_err("%s: Unable to send the packet, rc:%d\n", __func__, rc);
+		pr_err_ratelimited("%s: Unable to send the packet, rc:%d\n",
+					__func__, rc);
 	else
 		rc = len;
 

+ 1 - 1
soc/swr-mstr-ctrl.c

@@ -3250,7 +3250,7 @@ static int swrm_runtime_suspend(struct device *dev)
 		swrm->state = SWR_MSTR_DOWN;
 
 exit:
-	if (current_state != SWR_MSTR_UP) {
+	if (swrm->state != SWR_MSTR_UP) {
 		if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, false))
 			dev_dbg(dev, "%s:lpass audio hw enable failed\n",
 			__func__);