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

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

Merge "asoc: codecs: Check for core votes count before accessing registers"

parents e59a8a66 d577af90
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1180,6 +1180,21 @@ int bolero_runtime_suspend(struct device *dev)
}
EXPORT_SYMBOL(bolero_runtime_suspend);

bool bolero_check_core_votes(struct device *dev)
{
	struct bolero_priv *priv = dev_get_drvdata(dev->parent);
	bool ret = true;

	mutex_lock(&priv->vote_lock);
	if ((priv->lpass_core_hw_vote && !priv->core_hw_vote_count) ||
		(priv->lpass_audio_hw_vote && !priv->core_audio_vote_count))
		ret = false;
	mutex_unlock(&priv->vote_lock);

	return ret;
}
EXPORT_SYMBOL(bolero_check_core_votes);

static const struct of_device_id bolero_dt_match[] = {
	{.compatible = "qcom,bolero-codec"},
	{}
+6 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ int bolero_tx_clk_switch(struct snd_soc_component *component);
int bolero_register_event_listener(struct snd_soc_component *component,
				   bool enable);
void bolero_wsa_pa_on(struct device *dev);
bool bolero_check_core_votes(struct device *dev);
#else
static inline int bolero_register_res_clk(struct device *dev, rsc_clk_cb_t cb)
{
@@ -158,5 +159,10 @@ static inline int bolero_register_event_listener(
static void bolero_wsa_pa_on(struct device *dev)
{
}

static inline bool bolero_check_core_votes(struct device *dev)
{
	return false;
}
#endif /* CONFIG_SND_SOC_BOLERO */
#endif /* BOLERO_CDC_H */
+4 −1
Original line number Diff line number Diff line
@@ -3572,7 +3572,10 @@ static int rx_macro_core_vote(void *handle, bool enable)
		pm_runtime_mark_last_busy(rx_priv->dev);
	}

	if (bolero_check_core_votes(rx_priv->dev))
		return 0;
	else
		return -EINVAL;
}

static int rx_swrm_clock(void *handle, bool enable)
+4 −2
Original line number Diff line number Diff line
@@ -1952,7 +1952,6 @@ static int tx_macro_clk_switch(struct snd_soc_component *component)
static int tx_macro_core_vote(void *handle, bool enable)
{
	struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle;
	int ret = 0;

	if (tx_priv == NULL) {
		pr_err("%s: tx priv data is NULL\n", __func__);
@@ -1964,7 +1963,10 @@ static int tx_macro_core_vote(void *handle, bool enable)
		pm_runtime_mark_last_busy(tx_priv->dev);
	}

	return ret;
	if (bolero_check_core_votes(tx_priv->dev))
		return 0;
	else
		return -EINVAL;
}

static int tx_macro_swrm_clock(void *handle, bool enable)
+4 −2
Original line number Diff line number Diff line
@@ -2802,7 +2802,6 @@ static void wsa_macro_init_reg(struct snd_soc_component *component)
static int wsa_macro_core_vote(void *handle, bool enable)
{
	struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle;
	int ret = 0;

	if (wsa_priv == NULL) {
		pr_err("%s: wsa priv data is NULL\n", __func__);
@@ -2814,7 +2813,10 @@ static int wsa_macro_core_vote(void *handle, bool enable)
		pm_runtime_mark_last_busy(wsa_priv->dev);
	}

	return ret;
	if (bolero_check_core_votes(wsa_priv->dev))
		return 0;
	else
		return -EINVAL;
}

static int wsa_swrm_clock(void *handle, bool enable)