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

Commit e7637cdd authored by Honghao Liu's avatar Honghao Liu
Browse files

ASoC: msm: defer the machine driver probing if ADSP is down



Update the machine driver probing function to check the ADSP state
at the beginning of the function and return -EPROBE_DEFER if the
ADSP state is down. This reduces the amount of time spent in each
deferred machine driver probing.

The machine driver depends on a set of other drivers which ultimately
depends on the ADSP state to be up. Currently the machine driver
detects that its dependent drivers not being ready at a late stage
of the probing.

CRs-fixed: 2001641
Change-Id: I8fdaa7261aecee48f1927acf1303a52e48753006
Signed-off-by: default avatarHonghao Liu <honghaol@codeaurora.org>
parent 1d2e9200
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/switch.h>
#include <linux/input.h>
#include <linux/qdsp6v2/apr.h>
#include <sound/core.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
@@ -3819,12 +3820,21 @@ static int apq8096_asoc_machine_probe(struct platform_device *pdev)
	struct snd_soc_card *card;
	const struct of_device_id *match;
	int ret;
	enum apr_subsys_state q6_state;

	if (!pdev->dev.of_node) {
		dev_err(&pdev->dev, "No platform supplied from device tree\n");
		return -EINVAL;
	}

	q6_state = apr_get_q6_state();
	if (q6_state == APR_SUBSYS_DOWN) {
		dev_dbg(&pdev->dev, "deferring %s, adsp_state %d\n",
			__func__, q6_state);
		ret = -EPROBE_DEFER;
		goto err;
	}

	card = populate_snd_card_dailinks(&pdev->dev);
	if (!card) {
		dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);