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

Commit a4f8e6f1 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd9335: Fix internal clock enable during SSR"

parents f711e8ab e574cc97
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -11082,18 +11082,12 @@ int tasha_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
}
EXPORT_SYMBOL(tasha_codec_info_create_codec_entry);

/*
 * tasha_codec_internal_rco_ctrl()
 * Make sure that the caller does not acquire
 * BG_CLK_LOCK.
 */
static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
				  bool enable)
static int __tasha_codec_internal_rco_ctrl(
	struct snd_soc_codec *codec, bool enable)
{
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
	int ret = 0;

	WCD9XXX_V2_BG_CLK_LOCK(tasha->resmgr);
	if (enable) {
		tasha_cdc_sido_ccl_enable(tasha, true);
		if (wcd_resmgr_get_clk_type(tasha->resmgr) ==
@@ -11118,6 +11112,23 @@ static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
			__func__, (enable ? "enabling" : "disabling"));
		ret = -EINVAL;
	}

	return ret;
}

/*
 * tasha_codec_internal_rco_ctrl()
 * Make sure that the caller does not acquire
 * BG_CLK_LOCK.
 */
static int tasha_codec_internal_rco_ctrl(struct snd_soc_codec *codec,
				  bool enable)
{
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
	int ret = 0;

	WCD9XXX_V2_BG_CLK_LOCK(tasha->resmgr);
	ret = __tasha_codec_internal_rco_ctrl(codec, enable);
	WCD9XXX_V2_BG_CLK_UNLOCK(tasha->resmgr);
	return ret;
}
@@ -12076,7 +12087,7 @@ static int tasha_cpe_initialize(struct snd_soc_codec *codec)
}

static const struct wcd_resmgr_cb tasha_resmgr_cb = {
	.cdc_rco_ctrl = tasha_codec_internal_rco_ctrl,
	.cdc_rco_ctrl = __tasha_codec_internal_rco_ctrl,
};

static int tasha_device_down(struct wcd9xxx *wcd9xxx)
+3 −4
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ static void wcd_resmgr_cdc_specific_get_clk(struct wcd9xxx_resmgr_v2 *resmgr,
						int clk_users)
{
	/* Caller of this function should have acquired BG_CLK lock */
	WCD9XXX_V2_BG_CLK_UNLOCK(resmgr);
	if (clk_users) {
		if (resmgr->resmgr_cb &&
		    resmgr->resmgr_cb->cdc_rco_ctrl) {
@@ -84,8 +83,6 @@ static void wcd_resmgr_cdc_specific_get_clk(struct wcd9xxx_resmgr_v2 *resmgr,
								true);
		}
	}
	/* Acquire BG_CLK lock before return */
	WCD9XXX_V2_BG_CLK_LOCK(resmgr);
}

void wcd_resmgr_post_ssr_v2(struct wcd9xxx_resmgr_v2 *resmgr)
@@ -324,7 +321,8 @@ static int wcd_resmgr_disable_clk_rco(struct wcd9xxx_resmgr_v2 *resmgr)
{
	if ((resmgr->clk_rco_users <= 0) ||
	    (resmgr->clk_type == WCD_CLK_OFF)) {
		pr_err("%s: No RCO Clk users, cannot disable\n", __func__);
		pr_err("%s: rco_clk_users = %d, clk_type = %d, cannot disable\n",
			__func__, resmgr->clk_rco_users, resmgr->clk_type);
		return -EINVAL;
	}

@@ -485,6 +483,7 @@ int wcd_resmgr_post_init(struct wcd9xxx_resmgr_v2 *resmgr,
	}

	resmgr->codec = codec;
	resmgr->resmgr_cb = resmgr_cb;

	return 0;
}