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

Commit a03d65e2 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: Increase slimbus clock gear during device path bringup"

parents 08723c7f 023bf334
Loading
Loading
Loading
Loading
+23 −36
Original line number Diff line number Diff line
@@ -338,6 +338,7 @@ enum {
	AUDIO_NOMINAL,
	CPE_NOMINAL,
	HPH_PA_DELAY,
	SB_CLK_GEAR,
};

enum {
@@ -4764,6 +4765,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;
@@ -8013,40 +8018,6 @@ static int tasha_codec_aif4_mixer_switch_put(struct snd_kcontrol *kcontrol,
	return 1;
}

static int tasha_dapm_pre_powerup(struct snd_soc_dapm_widget *w,
				  struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = w->codec;

	dev_dbg(codec->dev, "%s: w->name %s event %d\n",
		 __func__, w->name, event);

	switch (event) {
	case SND_SOC_DAPM_PRE_PMU:
		tasha_codec_vote_max_bw(codec, true);
		break;
	}

	return 0;
}

static int tasha_dapm_post_powerup(struct snd_soc_dapm_widget *w,
				   struct snd_kcontrol *kcontrol, int event)
{
	struct snd_soc_codec *codec = w->codec;

	dev_dbg(codec->dev, "%s: w->name %s event %d\n",
		 __func__, w->name, event);

	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		tasha_codec_vote_max_bw(codec, false);
		break;
	}

	return 0;
}

static const char * const tasha_ear_pa_gain_text[] = {
	"G_6_DB", "G_4P5_DB", "G_3_DB", "G_1P5_DB",
	"G_0_DB", "G_M2P5_DB", "UNDEFINED", "G_M12_DB"
@@ -9997,8 +9968,6 @@ static const struct snd_soc_dapm_widget tasha_dapm_widgets[] = {
			&anc_lineout1_switch),
	SND_SOC_DAPM_SWITCH("ANC LINEOUT2 Enable", SND_SOC_NOPM, 0, 0,
			&anc_lineout2_switch),
	SND_SOC_DAPM_PRE("Pre powerup", tasha_dapm_pre_powerup),
	SND_SOC_DAPM_POST("Post powerup", tasha_dapm_post_powerup),
};

static int tasha_get_channel_map(struct snd_soc_dai *dai,
@@ -10343,6 +10312,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)
@@ -10456,6 +10440,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,
@@ -10646,6 +10631,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);
@@ -10658,6 +10644,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;
}