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

Commit fc001140 authored by Fred Oh's avatar Fred Oh
Browse files

ASoC: msm8x10-wcd: update sound card state before/after ssr



Codec state need to be updated when codec is down and up. This will
trigger a event to clients who poll on the sound card state.

Change-Id: Icc9709d6471191886d38e033c99e5310b4fd09f4
Signed-off-by: default avatarFred Oh <fred@codeaurora.org>
parent 72447d3f
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -2996,10 +2996,21 @@ static struct regulator *wcd8x10_wcd_codec_find_regulator(

	return NULL;
}
static int msm8x10_wcd_device_down(struct snd_soc_codec *codec)
{
	dev_dbg(codec->dev, "%s: device down!\n", __func__);

	snd_soc_card_change_online_state(codec->card, 0);
	return 0;
}

static int msm8x10_wcd_device_up(struct snd_soc_codec *codec)
{
	pr_debug("%s: device up!\n", __func__);
	dev_dbg(codec->dev, "%s: device up!\n", __func__);

	snd_soc_card_change_online_state(codec->card, 1);
	/* delay is required to make sure sound card state updated */
	usleep_range(5000, 5100);

	mutex_lock(&codec->mutex);

@@ -3019,7 +3030,9 @@ static int adsp_state_callback(struct notifier_block *nb, unsigned long value,
	unsigned long timeout;
	static bool booted_once;

	if (value == SUBSYS_AFTER_POWERUP) {
	if (value == SUBSYS_BEFORE_SHUTDOWN)
		msm8x10_wcd_device_down(registered_codec);
	else if (value == SUBSYS_AFTER_POWERUP) {

		if (!booted_once) {
			booted_once = true;