Browse Source

ASoC: wcd934x: Avoid soundwire enable when codec is in power collapse

During SSR, when the playback on speaker gets started before codec
is out of digital core power collapse, results in soundwire
register read/write failures. Check for codec power state before
enabling the soundwire during speaker device path enablement for
playback usecase to avoid soundwire register read/write failures.

Change-Id: I3b45ef0c34ad4f97aad89afaf719989ffbda7485
Signed-off-by: Sudheer Papothi <[email protected]>
Sudheer Papothi 6 years ago
parent
commit
2498e397f4
1 changed files with 6 additions and 0 deletions
  1. 6 0
      asoc/codecs/wcd934x/wcd934x.c

+ 6 - 0
asoc/codecs/wcd934x/wcd934x.c

@@ -2974,6 +2974,11 @@ static int __tavil_codec_enable_swr(struct snd_soc_dapm_widget *w, int event)
 			tavil->swr.rx_8_count++;
 		ch_cnt = !!(tavil->swr.rx_7_count) + tavil->swr.rx_8_count;
 
+		if (wcd9xxx_get_current_power_state(tavil->wcd9xxx,
+						WCD9XXX_DIG_CORE_REGION_1)
+					!= WCD_REGION_POWER_COLLAPSE_REMOVE)
+			goto done;
+
 		swrm_wcd_notify(tavil->swr.ctrl_data[0].swr_pdev,
 				SWR_DEVICE_UP, NULL);
 		swrm_wcd_notify(tavil->swr.ctrl_data[0].swr_pdev,
@@ -2994,6 +2999,7 @@ static int __tavil_codec_enable_swr(struct snd_soc_dapm_widget *w, int event)
 
 		break;
 	}
+done:
 	dev_dbg(tavil->dev, "%s: %s: current swr ch cnt: %d\n",
 		__func__, w->name, ch_cnt);