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

Commit b27eed5d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dsp: q6core: retry till adsp is up to send custom topologies"

parents ddd29e8b a6d9099c
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -1762,13 +1762,34 @@ static int q6core_send_custom_topologies(void)
{
	int ret = 0;
	int ret2 = 0;
	int32_t adsp_ready = 0;
	unsigned long timeout;
	struct cal_block_data *cal_block = NULL;
	struct avcs_cmd_register_topologies reg_top;

	/*  If ADSP is down, retry till ADSP is up */
	if (!q6core_is_adsp_ready()) {
		pr_err("%s: ADSP is not ready!\n", __func__);
		pr_err("%s: ADSP is not ready.proceed with retry!\n",
				 __func__);

		timeout = jiffies +
			msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);

		do {
			adsp_ready = q6core_is_adsp_ready();
			pr_debug("%s: ADSP Audio is %s\n", __func__,
				adsp_ready ? "ready" : "not ready");
			if (adsp_ready)
				break;
			msleep(50);
		} while (time_after(timeout, jiffies));

		if (!adsp_ready) {
			pr_err_ratelimited("%s: Timeout. ADSP Audio is not ready\n",
					__func__);
			return -ENODEV;
		}
	}

	memset(&reg_top, 0, sizeof(reg_top));
	mutex_lock(&q6core_lcl.cal_data[CUST_TOP_CAL]->lock);