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

Commit eba2e296 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "asoc: bolero: Register for AFE event for all SVA usecases"

parents 95f25a91 b06236e6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1078,7 +1078,7 @@ EXPORT_SYMBOL(bolero_tx_mclk_enable);
 * Returns 0 on success or -EINVAL on error.
 */
int bolero_register_event_listener(struct snd_soc_component *component,
				   bool enable)
				   bool enable, bool is_dmic_sva)
{
	struct bolero_priv *priv = NULL;
	int ret = 0;
@@ -1097,7 +1097,8 @@ int bolero_register_event_listener(struct snd_soc_component *component,

	if (priv->macro_params[TX_MACRO].reg_evt_listener)
		ret = priv->macro_params[TX_MACRO].reg_evt_listener(component,
								    enable);
								    enable,
								    is_dmic_sva);

	return ret;
}
+4 −3
Original line number Diff line number Diff line
@@ -88,7 +88,8 @@ struct macro_ops {
			    u32 size, void *data);
	int (*clk_div_get)(struct snd_soc_component *component);
	int (*clk_switch)(struct snd_soc_component *component, int clk_src);
	int (*reg_evt_listener)(struct snd_soc_component *component, bool en);
	int (*reg_evt_listener)(struct snd_soc_component *component,
			bool en, bool is_dmic_sva);
	int (*clk_enable)(struct snd_soc_component *c, bool en);
	char __iomem *io_base;
	u16 clk_id_req;
@@ -115,7 +116,7 @@ int bolero_runtime_suspend(struct device *dev);
int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *data);
int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src);
int bolero_register_event_listener(struct snd_soc_component *component,
				   bool enable);
				   bool enable, bool is_dmic_sva);
void bolero_wsa_pa_on(struct device *dev);
bool bolero_check_core_votes(struct device *dev);
int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable);
@@ -189,7 +190,7 @@ static inline int bolero_tx_clk_switch(struct snd_soc_component *component,

static inline int bolero_register_event_listener(
					struct snd_soc_component *component,
					bool enable)
					bool enable, bool is_dmic_sva)
{
	return 0;
}
+5 −3
Original line number Diff line number Diff line
@@ -2385,7 +2385,7 @@ static const struct snd_kcontrol_new tx_macro_snd_controls[] = {
};

static int tx_macro_register_event_listener(struct snd_soc_component *component,
					    bool enable)
					    bool enable, bool is_dmic_sva)
{
	struct device *tx_dev = NULL;
	struct tx_macro_priv *tx_priv = NULL;
@@ -2412,9 +2412,11 @@ static int tx_macro_register_event_listener(struct snd_soc_component *component,
			ret = swrm_wcd_notify(
				tx_priv->swr_ctrl_data[0].tx_swr_pdev,
				SWR_REGISTER_WAKEUP, NULL);
			if (!is_dmic_sva)
				msm_cdc_pinctrl_set_wakeup_capable(
					tx_priv->tx_swr_gpio_p, false);
		} else {
			if (!is_dmic_sva)
				msm_cdc_pinctrl_set_wakeup_capable(
					tx_priv->tx_swr_gpio_p, true);
			ret = swrm_wcd_notify(
+67 −2
Original line number Diff line number Diff line
@@ -457,14 +457,14 @@ static int va_macro_swr_pwr_event(struct snd_soc_dapm_widget *w,
				dev_dbg(va_dev, "%s: clock switch failed\n",
					__func__);
		if (va_priv->lpi_enable) {
			bolero_register_event_listener(component, true);
			bolero_register_event_listener(component, true, false);
			va_priv->register_event_listener = true;
		}
		break;
	case SND_SOC_DAPM_POST_PMD:
		if (va_priv->register_event_listener) {
			va_priv->register_event_listener = false;
			bolero_register_event_listener(component, false);
			bolero_register_event_listener(component, false, false);
		}
		if (bolero_tx_clk_switch(component, CLK_SRC_TX_RCG))
			dev_dbg(va_dev, "%s: clock switch failed\n",__func__);
@@ -480,6 +480,45 @@ static int va_macro_swr_pwr_event(struct snd_soc_dapm_widget *w,
	return ret;
}

static int va_macro_swr_intr_event(struct snd_soc_dapm_widget *w,
			       struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_component *component =
			snd_soc_dapm_to_component(w->dapm);
	int ret = 0;
	struct device *va_dev = NULL;
	struct va_macro_priv *va_priv = NULL;

	if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
		return -EINVAL;

	dev_dbg(va_dev, "%s: event = %d, lpi_enable = %d\n",
		__func__, event, va_priv->lpi_enable);

	if (!va_priv->lpi_enable)
		return ret;

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		if (va_priv->lpi_enable) {
			bolero_register_event_listener(component, true, true);
			va_priv->register_event_listener = true;
		}
		break;
	case SND_SOC_DAPM_POST_PMD:
		if (va_priv->register_event_listener) {
			va_priv->register_event_listener = false;
			bolero_register_event_listener(component, false, true);
		}
		break;
	default:
		dev_err(va_priv->dev,
			"%s: invalid DAPM event %d\n", __func__, event);
		ret = -EINVAL;
	}
	return ret;
}

static int va_macro_tx_swr_clk_event_v2(struct snd_soc_dapm_widget *w,
			       struct snd_kcontrol *kcontrol, int event)
{
@@ -1962,6 +2001,10 @@ static const struct snd_soc_dapm_widget va_macro_dapm_widgets_v3[] = {
	SND_SOC_DAPM_SUPPLY_S("VA_SWR_PWR", -1, SND_SOC_NOPM, 0, 0,
			      va_macro_swr_pwr_event,
			      SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),

	SND_SOC_DAPM_SUPPLY_S("VA_SWR_INTR", 0, SND_SOC_NOPM, 0, 0,
			      va_macro_swr_intr_event,
			      SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
};

static const struct snd_soc_dapm_widget va_macro_dapm_widgets[] = {
@@ -2106,6 +2149,10 @@ static const struct snd_soc_dapm_widget va_macro_dapm_widgets[] = {
	SND_SOC_DAPM_SUPPLY_S("VA_MCLK", -1, SND_SOC_NOPM, 0, 0,
			      va_macro_mclk_event,
			      SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),

	SND_SOC_DAPM_SUPPLY_S("VA_SWR_INTR", 0, SND_SOC_NOPM, 0, 0,
			      va_macro_swr_intr_event,
			      SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
};

static const struct snd_soc_dapm_widget va_macro_wod_dapm_widgets[] = {
@@ -2252,6 +2299,15 @@ static const struct snd_soc_dapm_route va_audio_map_v3[] = {
	{"VA SMIC MUX3", "SWR_MIC9", "VA SWR_MIC9"},
	{"VA SMIC MUX3", "SWR_MIC10", "VA SWR_MIC10"},
	{"VA SMIC MUX3", "SWR_MIC11", "VA SWR_MIC11"},

	{"VA DMIC0", NULL, "VA_SWR_INTR"},
	{"VA DMIC1", NULL, "VA_SWR_INTR"},
	{"VA DMIC2", NULL, "VA_SWR_INTR"},
	{"VA DMIC3", NULL, "VA_SWR_INTR"},
	{"VA DMIC4", NULL, "VA_SWR_INTR"},
	{"VA DMIC5", NULL, "VA_SWR_INTR"},
	{"VA DMIC6", NULL, "VA_SWR_INTR"},
	{"VA DMIC7", NULL, "VA_SWR_INTR"},
};

static const struct snd_soc_dapm_route va_audio_map_v2[] = {
@@ -2488,6 +2544,15 @@ static const struct snd_soc_dapm_route va_audio_map[] = {
	{"VA SMIC MUX7", "SWR_DMIC6", "VA SWR_MIC6"},
	{"VA SMIC MUX7", "SWR_DMIC7", "VA SWR_MIC7"},

	{"VA DMIC0", NULL, "VA_SWR_INTR"},
	{"VA DMIC1", NULL, "VA_SWR_INTR"},
	{"VA DMIC2", NULL, "VA_SWR_INTR"},
	{"VA DMIC3", NULL, "VA_SWR_INTR"},
	{"VA DMIC4", NULL, "VA_SWR_INTR"},
	{"VA DMIC5", NULL, "VA_SWR_INTR"},
	{"VA DMIC6", NULL, "VA_SWR_INTR"},
	{"VA DMIC7", NULL, "VA_SWR_INTR"},

	{"VA SWR_ADC0", NULL, "VA_SWR_PWR"},
	{"VA SWR_ADC1", NULL, "VA_SWR_PWR"},
	{"VA SWR_ADC2", NULL, "VA_SWR_PWR"},