Prechádzať zdrojové kódy

dsp: add early down support for PDR

When early down happens ADSP is down and APPS is trying to render audio
to ADSP continuously in impression that DSP is Up until APPS get down
notification. In some scenarios the time taken b/w early down to down
taking more time than expected. This longer times may cause block in
printk and other system hogging. So add support to listen early down
to do avoid such issues.

Change-Id: I798265d682e2d93ae889a514eb3a2022afa73196
Signed-off-by: Prasad Kumpatla <[email protected]>
Prasad Kumpatla 3 rokov pred
rodič
commit
7d084b4b16
1 zmenil súbory, kde vykonal 15 pridanie a 1 odobranie
  1. 15 1
      dsp/audio_notifier.c

+ 15 - 1
dsp/audio_notifier.c

@@ -25,6 +25,7 @@
 #define NO_SERVICE -2
 #define UNINIT_SERVICE -1
 
+static bool service_early_down;
 static struct platform_device *adsp_private;
 
 struct adsp_notify_private {
@@ -429,13 +430,26 @@ static int audio_notifier_convert_opcode(unsigned long opcode,
 
 	switch (opcode) {
 	case QCOM_SSR_BEFORE_SHUTDOWN:
-	case SERVREG_SERVICE_STATE_DOWN:
+	case SERVREG_SERVICE_STATE_EARLY_DOWN:
 		*notifier_opcode = AUDIO_NOTIFIER_SERVICE_DOWN;
+		if (opcode == SERVREG_SERVICE_STATE_EARLY_DOWN)
+			service_early_down = true;
 		break;
 	case QCOM_SSR_AFTER_POWERUP:
 	case SERVREG_SERVICE_STATE_UP:
 		*notifier_opcode = AUDIO_NOTIFIER_SERVICE_UP;
 		break;
+	case SERVREG_SERVICE_STATE_DOWN:
+		if (!service_early_down)
+			*notifier_opcode = AUDIO_NOTIFIER_SERVICE_DOWN;
+		else {
+			/* Reset service_early_down and nothing to do*/
+			service_early_down = false;
+			ret = -EINVAL;
+			pr_info("%s: Early down aleady handled %d\n", __func__,
+						service_early_down);
+		}
+		break;
 	default:
 		pr_debug("%s: Unused opcode 0x%lx\n", __func__, opcode);
 		ret = -EINVAL;