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

Commit a598d293 authored by Bhalchandra Gajare's avatar Bhalchandra Gajare
Browse files

ASoC: wcd9330: Perform QFUSE sensing post device_up



QFUSE sensing is required to enable blocks of codec that could be
disabled by default. After the codec is powered down and up again, it is
required to perform QFUSE sensing to enable all codec features. Add fix
to perform QFUSE sensing during device_up so codec features are enabled
in scenarios like SSR.

CRs-fixed: 667678
Change-Id: I58897e5269c9a03a1add2e5c4c09114c89fc0469
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 3b6f77d2
Loading
Loading
Loading
Loading
+20 −14
Original line number Diff line number Diff line
@@ -660,6 +660,20 @@ static unsigned short tx_digital_gain_reg[] = {
	TOMTOM_A_CDC_TX10_VOL_CTL_GAIN,
};

int tomtom_enable_qfuse_sensing(struct snd_soc_codec *codec)
{
	snd_soc_write(codec, TOMTOM_A_QFUSE_CTL, 0x03);
	/*
	 * 5ms sleep required after enabling qfuse control
	 * before checking the status.
	 */
	usleep_range(5000, 5500);
	if ((snd_soc_read(codec, TOMTOM_A_QFUSE_STATUS) & (0x03)) != 0x03)
		WARN(1, "%s: Qfuse sense is not complete\n", __func__);
	return 0;
}
EXPORT_SYMBOL(tomtom_enable_qfuse_sensing);

static int tomtom_get_sample_rate(struct snd_soc_codec *codec, int path)
{
	if (path == RX8_PATH)
@@ -8296,6 +8310,12 @@ static int tomtom_post_reset_cb(struct wcd9xxx *wcd9xxx)
	for (count = 0; count < NUM_CODEC_DAIS; count++)
		tomtom->dai[count].bus_down_in_recovery = true;

	/*
	 * After SSR, the qfuse sensing is lost.
	 * Perform qfuse sensing again after SSR
	 * handling is finished.
	 */
	tomtom_enable_qfuse_sensing(codec);
	mutex_unlock(&codec->mutex);
	return ret;
}
@@ -8480,20 +8500,6 @@ static int tomtom_cpe_initialize(struct snd_soc_codec *codec)
	return 0;
}

int tomtom_enable_qfuse_sensing(struct snd_soc_codec *codec)
{
	snd_soc_write(codec, TOMTOM_A_QFUSE_CTL, 0x03);
	/*
	 * 5ms sleep required after enabling qfuse control
	 * before checking the status.
	 */
	usleep_range(5000, 5500);
	if ((snd_soc_read(codec, TOMTOM_A_QFUSE_STATUS) & (0x03)) != 0x03)
		WARN(1, "%s: Qfuse sense is not complete\n", __func__);
	return 0;
}
EXPORT_SYMBOL(tomtom_enable_qfuse_sensing);

static int tomtom_codec_probe(struct snd_soc_codec *codec)
{
	struct wcd9xxx *control;