Ver código fonte

Revert "ipc: Remove adsp/modem up check in gpr_send_pkt"

It was found that sending GPR command before audio process
domain can lead to deadlock in ADSP. Reinstate the check to
send GPR command only when gpr-lite is informed that process
domain is up.This reverts commit
2922723c6f75b0ce32b392f1547ce2e354676e7b.

Change-Id: I8076dc053c2d7c5b84bdafa2feb35462b2309227
Patrick Lai 4 anos atrás
pai
commit
32363052e1
1 arquivos alterados com 13 adições e 1 exclusões
  1. 13 1
      ipc/gpr-lite.c

+ 13 - 1
ipc/gpr-lite.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, 2019-2020 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2017, 2019-2021 The Linux Foundation. All rights reserved.
  * Copyright (c) 2018, Linaro Limited
  *
  * This program is free software; you can redistribute it and/or modify
@@ -105,6 +105,18 @@ int gpr_send_pkt(struct gpr_device *adev, struct gpr_pkt *pkt)
 
 	gpr = dev_get_drvdata(adev->dev.parent);
 
+	if ((adev->domain_id == GPR_DOMAIN_ADSP) &&
+	    (gpr_get_q6_state() != GPR_SUBSYS_LOADED)) {
+		dev_err(gpr->dev,"%s: domain_id[%d], Still Dsp is not Up\n",
+			__func__, adev->domain_id);
+		return -ENETRESET;
+		} else if ((adev->domain_id == GPR_DOMAIN_MODEM) &&
+		   (gpr_get_modem_state() == GPR_SUBSYS_DOWN)) {
+		dev_err(gpr->dev, "%s: domain_id[%d], Still Modem is not Up\n",
+			__func__, adev->domain_id );
+		return -ENETRESET;
+	}
+
 	spin_lock_irqsave(&adev->lock, flags);
 
 	hdr = &pkt->hdr;