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

Commit d8d90b4a authored by Laxminath Kasam's avatar Laxminath Kasam
Browse files

soc: wsa: Fix adie loopback test



In ADIE loopback, need PA enable to
avoid mute. Ensure PA enable post slave
path setup and FS clock.

Change-Id: I4df9d7b919325b50f237f31338859e1b5b34b2eb
Signed-off-by: default avatarLaxminath Kasam <lkasam@codeaurora.org>
parent 779e5fd0
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -735,7 +735,7 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id)
}
}
EXPORT_SYMBOL(bolero_unregister_macro);
EXPORT_SYMBOL(bolero_unregister_macro);


void bolero_wsa_pa_on(struct device *dev)
void bolero_wsa_pa_on(struct device *dev, bool adie_lb)
{
{
	struct bolero_priv *priv;
	struct bolero_priv *priv;


@@ -753,8 +753,12 @@ void bolero_wsa_pa_on(struct device *dev)
		dev_err(dev, "%s: priv is null\n", __func__);
		dev_err(dev, "%s: priv is null\n", __func__);
		return;
		return;
	}
	}

	if (adie_lb)
	bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK);
		bolero_cdc_notifier_call(priv,
			BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB);
	else
		bolero_cdc_notifier_call(priv,
			BOLERO_WCD_EVT_PA_ON_POST_FSCLK);
}
}
EXPORT_SYMBOL(bolero_wsa_pa_on);
EXPORT_SYMBOL(bolero_wsa_pa_on);


+2 −2
Original line number Original line Diff line number Diff line
@@ -105,7 +105,7 @@ int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *dat
int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src);
int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src);
int bolero_register_event_listener(struct snd_soc_component *component,
int bolero_register_event_listener(struct snd_soc_component *component,
				   bool enable);
				   bool enable);
void bolero_wsa_pa_on(struct device *dev);
void bolero_wsa_pa_on(struct device *dev, bool adie_lb);
bool bolero_check_core_votes(struct device *dev);
bool bolero_check_core_votes(struct device *dev);
int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable);
int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable);
int bolero_get_version(struct device *dev);
int bolero_get_version(struct device *dev);
@@ -183,7 +183,7 @@ static inline int bolero_register_event_listener(
	return 0;
	return 0;
}
}


static void bolero_wsa_pa_on(struct device *dev)
static void bolero_wsa_pa_on(struct device *dev, bool adie_lb)
{
{
}
}


+1 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@ enum {
	BOLERO_WCD_EVT_SSR_DOWN,
	BOLERO_WCD_EVT_SSR_DOWN,
	BOLERO_WCD_EVT_SSR_UP,
	BOLERO_WCD_EVT_SSR_UP,
	BOLERO_WCD_EVT_PA_ON_POST_FSCLK,
	BOLERO_WCD_EVT_PA_ON_POST_FSCLK,
	BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB,
};
};


enum {
enum {
+7 −4
Original line number Original line Diff line number Diff line
@@ -845,6 +845,7 @@ static int wsa_macro_digital_mute(struct snd_soc_dai *dai, int mute)
	uint16_t j = 0, reg = 0, mix_reg = 0, dsm_reg = 0;
	uint16_t j = 0, reg = 0, mix_reg = 0, dsm_reg = 0;
	u16 int_mux_cfg0 = 0, int_mux_cfg1 = 0;
	u16 int_mux_cfg0 = 0, int_mux_cfg1 = 0;
	u8 int_mux_cfg0_val = 0, int_mux_cfg1_val = 0;
	u8 int_mux_cfg0_val = 0, int_mux_cfg1_val = 0;
	bool adie_lb = false;


	if (mute)
	if (mute)
		return 0;
		return 0;
@@ -881,7 +882,7 @@ static int wsa_macro_digital_mute(struct snd_soc_dai *dai, int mute)
			}
			}
		}
		}
	}
	}
	bolero_wsa_pa_on(wsa_dev);
	bolero_wsa_pa_on(wsa_dev, adie_lb);
		break;
		break;
	default:
	default:
		break;
		break;
@@ -1472,6 +1473,7 @@ static int wsa_macro_enable_main_path(struct snd_soc_dapm_widget *w,
	u16 reg = 0;
	u16 reg = 0;
	struct device *wsa_dev = NULL;
	struct device *wsa_dev = NULL;
	struct wsa_macro_priv *wsa_priv = NULL;
	struct wsa_macro_priv *wsa_priv = NULL;
	bool adie_lb = false;


	if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
	if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
		return -EINVAL;
		return -EINVAL;
@@ -1482,9 +1484,10 @@ static int wsa_macro_enable_main_path(struct snd_soc_dapm_widget *w,
	switch (event) {
	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
	case SND_SOC_DAPM_PRE_PMU:
		if (wsa_macro_adie_lb(component, w->shift)) {
		if (wsa_macro_adie_lb(component, w->shift)) {
			adie_lb = true;
			snd_soc_component_update_bits(component,
			snd_soc_component_update_bits(component,
						reg, 0x20, 0x20);
						reg, 0x20, 0x20);
			bolero_wsa_pa_on(wsa_dev);
			bolero_wsa_pa_on(wsa_dev, adie_lb);
		}
		}
		break;
		break;
	default:
	default:
@@ -2566,10 +2569,10 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets[] = {
	SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM,
	SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM,
		0, 0, &rx1_mix_mux, wsa_macro_enable_mix_path,
		0, 0, &rx1_mix_mux, wsa_macro_enable_mix_path,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_MIXER_E("WSA_RX INT0 MIX", SND_SOC_NOPM,
	SND_SOC_DAPM_PGA_E("WSA_RX INT0 MIX", SND_SOC_NOPM,
			0, 0, NULL, 0, wsa_macro_enable_main_path,
			0, 0, NULL, 0, wsa_macro_enable_main_path,
			SND_SOC_DAPM_PRE_PMU),
			SND_SOC_DAPM_PRE_PMU),
	SND_SOC_DAPM_MIXER_E("WSA_RX INT1 MIX", SND_SOC_NOPM,
	SND_SOC_DAPM_PGA_E("WSA_RX INT1 MIX", SND_SOC_NOPM,
			1, 0, NULL, 0, wsa_macro_enable_main_path,
			1, 0, NULL, 0, wsa_macro_enable_main_path,
			SND_SOC_DAPM_PRE_PMU),
			SND_SOC_DAPM_PRE_PMU),
	SND_SOC_DAPM_MIXER("WSA_RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
	SND_SOC_DAPM_MIXER("WSA_RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
+2 −0
Original line number Original line Diff line number Diff line
@@ -118,6 +118,7 @@ enum {
	BOLERO_WSA_EVT_SSR_DOWN,
	BOLERO_WSA_EVT_SSR_DOWN,
	BOLERO_WSA_EVT_SSR_UP,
	BOLERO_WSA_EVT_SSR_UP,
	BOLERO_WSA_EVT_PA_ON_POST_FSCLK,
	BOLERO_WSA_EVT_PA_ON_POST_FSCLK,
	BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB,
};
};


struct wsa_ctrl_platform_data {
struct wsa_ctrl_platform_data {
@@ -1400,6 +1401,7 @@ static int wsa881x_event_notify(struct notifier_block *nb,
					      0x80, 0x00);
					      0x80, 0x00);
		break;
		break;
	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK:
	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK:
	case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB:
		if ((snd_soc_component_read32(wsa881x->component,
		if ((snd_soc_component_read32(wsa881x->component,
				WSA881X_SPKR_DAC_CTL) & 0x80) == 0x80)
				WSA881X_SPKR_DAC_CTL) & 0x80) == 0x80)
			snd_soc_component_update_bits(wsa881x->component,
			snd_soc_component_update_bits(wsa881x->component,
Loading