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

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

Merge "ASoC: msm8952: Defer until pcm voice probe done"

parents d0f1d9b8 17074ec9
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2019, 2021, The Linux Foundation. All rights reserved.
 */

#include <linux/init.h>
@@ -29,6 +29,8 @@

static struct msm_voice voice_info[VOICE_SESSION_INDEX_MAX];

static int voice_probe_done;

static struct snd_pcm_hardware msm_pcm_hardware = {

	.info =                 (SNDRV_PCM_INFO_INTERLEAVED |
@@ -778,6 +780,7 @@ static int msm_pcm_probe(struct platform_device *pdev)
	bool destroy_cvd = false;
	const char *is_destroy_cvd = "qcom,destroy-cvd";

	voice_probe_done = 0;
	if (!is_voc_initialized()) {
		pr_debug("%s: voice module not initialized yet, deferring probe()\n",
		       __func__);
@@ -806,11 +809,31 @@ static int msm_pcm_probe(struct platform_device *pdev)
	rc = snd_soc_register_component(&pdev->dev,
				       &msm_soc_component,
					NULL, 0);
	if (!rc) {
		pr_debug("%s msm_pcm_voice probe success! \n", __func__);
		voice_probe_done = 1;
	}

done:
	return rc;
}

/**
 * msm_voice_get_probe_status - Returns the probe
 * status of msm-pcm-voice.
 *
 * Function that returns the probe status of msm-pcm-voice
 * driver.
 *
 * Returns: 1 on probe success, 0 otherwise.
 */
int msm_voice_get_probe_status(void)
{
	return voice_probe_done;
}

EXPORT_SYMBOL(msm_voice_get_probe_status);

static int msm_pcm_remove(struct platform_device *pdev)
{
	snd_soc_unregister_component(&pdev->dev);
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, 2021, The Linux Foundation. All rights reserved.
 */
#ifndef _MSM_PCM_VOICE_H
#define _MSM_PCM_VOICE_H
@@ -31,4 +31,6 @@ struct msm_voice {
	int capture_start;
};

int msm_voice_get_probe_status(void);

#endif /*_MSM_PCM_VOICE_H*/
+9 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include "msm-pcm-routing-v2.h"
#include <asoc/msm-cdc-pinctrl.h>
#include "msm8952.h"
#include "msm-pcm-voice-v2.h"

#define DRV_NAME "msm8952-asoc-wcd"

@@ -3426,6 +3427,14 @@ static int msm8952_asoc_machine_probe(struct platform_device *pdev)
		}
	}

	/* Check if voice probe done, defer otherwise */
	ret = msm_voice_get_probe_status();
	if (!ret) {
		pr_debug("%s msm-pcm-voice probe status %d \n", __func__, ret);
		ret = -EPROBE_DEFER;
		goto err;
	}

	card = msm8952_populate_sndcard_dailinks(&pdev->dev,
					pdata->snd_card_val);
	dev_dbg(&pdev->dev, "default codec configured\n");