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

Commit 06975992 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: bg: Register codec only once ADSP is up"

parents aec29d6f 04200bc9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2016, 2018 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
@@ -25,6 +25,7 @@ enum apr_subsys_state apr_get_subsys_state(void)
{
	return apr_get_q6_state();
}
EXPORT_SYMBOL(apr_get_subsys_state);

void apr_set_subsys_state(void)
{
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2016, 2018 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
@@ -25,6 +25,7 @@ enum apr_subsys_state apr_get_subsys_state(void)
{
	return apr_get_modem_state();
}
EXPORT_SYMBOL(apr_get_subsys_state);

void apr_set_subsys_state(void)
{
+9 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
#include <linux/qdsp6v2/apr.h>
#include <sound/info.h>
#include <soc/qcom/bg_glink.h>
#include "bg_codec.h"
@@ -864,6 +865,14 @@ static int bg_cdc_probe(struct platform_device *pdev)
{
	struct bg_cdc_priv *bg_cdc;
	int ret = 0;
	int adsp_state;

	adsp_state = apr_get_subsys_state();
	if (adsp_state != APR_SUBSYS_LOADED) {
		pr_err("%s:Adsp is not loaded yet %d\n",
			__func__, adsp_state);
		return -EPROBE_DEFER;
	}

	bg_cdc = kzalloc(sizeof(struct bg_cdc_priv),
			    GFP_KERNEL);
+6 −6
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ struct pktzr_priv {
	struct platform_device *pdev;
	pktzr_data_cmd_cb_fn data_cmd_cb;
	int num_channels;
	bool pktzr_init_complete;
};

static struct pktzr_priv *ppriv;
@@ -103,8 +104,8 @@ static int pktzr_send_pkt(void *payload, uint32_t size, void *rsp,
	int rc = 0;

	pr_debug("%s: cmd=%d sync=%d size=%d\n", __func__, cmd, sync_cmd, size);
	if (!ppriv) {
		pr_err("packetizer not initialized");
	if (!ppriv || !ppriv->pktzr_init_complete) {
		pr_err_ratelimited("packetizer not initialized\n");
		return -EINVAL;
	}
	mutex_lock(&ppriv->pktzr_lock);
@@ -242,22 +243,21 @@ int pktzr_init(void *pdev, struct bg_glink_ch_cfg *ch_info, int num_channels,
			pr_err("%s: Failed to open channel\n", __func__);
			goto err;
		}
		ppriv->token = i;
	}
	ppriv->num_channels = num_channels;
	ppriv->data_cmd_cb = func;
	ppriv->token = 0;
	ppriv->pdev = pdev;
	init_completion(&ppriv->thread_complete);
	mutex_init(&ppriv->pktzr_lock);
	INIT_LIST_HEAD(&ppriv->ch_list);
	ppriv->pktzr_init_complete = true;

done:
	return 0;
err:
	for (i = 0; i < ppriv->token; i++)
		bg_cdc_channel_close(ppriv->pdev, ppriv->ch_info[i]);
	ppriv->token = 0;
		bg_cdc_channel_close(pdev, ppriv->ch_info[i]);

	if (ppriv)
		kzfree(ppriv);
	ppriv = NULL;