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

Commit 023bf334 authored by Sudheer Papothi's avatar Sudheer Papothi
Browse files

ASoC: wcd9335: Increase slimbus clock gear during device path bringup



Increase slimbus clock gear during device path bringup for faster
execution of register read and writes. This will improve the
latency during device path bringup.

Change-Id: I3118eecde7dd8e90fff05a6e0c6efa4052013a44
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent 51c4bdd7
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -336,6 +336,7 @@ enum {
	AUDIO_NOMINAL,
	CPE_NOMINAL,
	HPH_PA_DELAY,
	SB_CLK_GEAR,
};

enum {
@@ -762,6 +763,9 @@ struct tasha_priv {
	int hph_r_gain;
};

static int tasha_codec_vote_max_bw(struct snd_soc_codec *codec,
				   bool vote);

static const struct tasha_reg_mask_val tasha_spkr_default[] = {
	{WCD9335_CDC_COMPANDER7_CTL3, 0x80, 0x80},
	{WCD9335_CDC_COMPANDER8_CTL3, 0x80, 0x80},
@@ -4750,6 +4754,10 @@ static int tasha_codec_enable_interpolator(struct snd_soc_dapm_widget *w,

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		if (!test_bit(SB_CLK_GEAR, &tasha->status_mask)) {
			tasha_codec_vote_max_bw(codec, true);
			set_bit(SB_CLK_GEAR, &tasha->status_mask);
		}
		/* Reset if needed */
		tasha_codec_enable_prim_interpolator(codec, reg, event);
		break;
@@ -10293,6 +10301,21 @@ prim_rate:
	return ret;
}

static int tasha_prepare(struct snd_pcm_substream *substream,
			 struct snd_soc_dai *dai)
{
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(dai->codec);

	pr_debug("%s(): substream = %s  stream = %d\n" , __func__,
		 substream->name, substream->stream);
	if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
	    test_bit(SB_CLK_GEAR, &tasha->status_mask)) {
		tasha_codec_vote_max_bw(dai->codec, false);
		clear_bit(SB_CLK_GEAR, &tasha->status_mask);
	}
	return 0;
}

static int tasha_hw_params(struct snd_pcm_substream *substream,
			   struct snd_pcm_hw_params *params,
			   struct snd_soc_dai *dai)
@@ -10406,6 +10429,7 @@ static struct snd_soc_dai_ops tasha_dai_ops = {
	.startup = tasha_startup,
	.shutdown = tasha_shutdown,
	.hw_params = tasha_hw_params,
	.prepare = tasha_prepare,
	.set_sysclk = tasha_set_dai_sysclk,
	.set_fmt = tasha_set_dai_fmt,
	.set_channel_map = tasha_set_channel_map,
@@ -10596,6 +10620,7 @@ static int tasha_dig_core_remove_power_collapse(struct snd_soc_codec *codec)
{
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);

	tasha_codec_vote_max_bw(codec, true);
	snd_soc_write(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x5);
	snd_soc_write(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x7);
	snd_soc_write(codec, WCD9335_CODEC_RPM_PWR_CDC_DIG_HM_CTL, 0x3);
@@ -10608,6 +10633,7 @@ static int tasha_dig_core_remove_power_collapse(struct snd_soc_codec *codec)
	regcache_mark_dirty(codec->component.regmap);
	regcache_sync_region(codec->component.regmap,
			     TASHA_DIG_CORE_REG_MIN, TASHA_DIG_CORE_REG_MAX);
	tasha_codec_vote_max_bw(codec, false);

	return 0;
}