adsp: add support for ivc based adsp reset control

For virtualized configurations, ADSP reset will be owned
only by Audio server.

- Moving tegra-virt-alt-ivc to drivers/.../nvaudio_ivc/
to enable Audio IVC to be built as part of Image

- Adding support in nvadsp driver to communicate with
Audio server for asserting or deasserting ADSP.

Jira EMA-1208

Change-Id: I6773c35edf2c646aa9fd7ec0aa5eceb992dffa35
Signed-off-by: Hariharan Sivaraman <hariharans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113661
Reviewed-by: Uday Gupta <udayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Nitin Pai <npai@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Hariharan Sivaraman
2019-05-07 15:31:33 +05:30
committed by Laxman Dewangan
parent 767700e13d
commit dfc3347d28
2 changed files with 74 additions and 1 deletions

View File

@@ -36,3 +36,7 @@ endif
ifeq ($(CONFIG_TEGRA_ADSP_LPTHREAD),y) ifeq ($(CONFIG_TEGRA_ADSP_LPTHREAD),y)
nvadsp-objs += adsp_lpthread.o nvadsp-objs += adsp_lpthread.o
endif endif
ifeq ($(CONFIG_TEGRA_VIRT_AUDIO_IVC),y)
ccflags-y += -I$(srctree.nvidia)/drivers/platform/tegra/nvaudio_ivc/
endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2018, NVIDIA Corporation. All rights reserved. * Copyright (c) 2015-2019, NVIDIA Corporation. All rights reserved.
* *
* This software is licensed under the terms of the GNU General Public * This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and * License version 2, as published by the Free Software Foundation, and
@@ -18,6 +18,12 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/tegra_nvadsp.h>
#ifdef CONFIG_TEGRA_VIRT_AUDIO_IVC
#include "tegra_virt_alt_ivc_common.h"
#include "tegra_virt_alt_ivc.h"
#endif
#include "dev.h" #include "dev.h"
#include "dev-t18x.h" #include "dev-t18x.h"
@@ -199,12 +205,75 @@ static int __deassert_t18x_adsp(struct nvadsp_drv_data *d)
return ret; return ret;
} }
#ifdef CONFIG_TEGRA_VIRT_AUDIO_IVC
static int __virt_assert_t18x_adsp(struct nvadsp_drv_data *d)
{
int err;
struct nvaudio_ivc_msg msg;
struct nvaudio_ivc_ctxt *hivc_client = nvaudio_get_ivc_alloc_ctxt();
if (!hivc_client) {
pr_err("%s: Failed to allocate IVC context\n", __func__);
return -ENODEV;
}
memset(&msg, 0, sizeof(struct nvaudio_ivc_msg));
msg.cmd = NVAUDIO_ADSP_RESET;
msg.params.adsp_reset_info.reset_req = ASSERT;
msg.ack_required = true;
err = nvaudio_ivc_send_receive(hivc_client,
&msg,
sizeof(struct nvaudio_ivc_msg));
if (err < 0)
pr_err("%s: error on ivc_send_receive\n", __func__);
return 0;
}
static int __virt_deassert_t18x_adsp(struct nvadsp_drv_data *d)
{
int err;
struct nvaudio_ivc_msg msg;
struct nvaudio_ivc_ctxt *hivc_client = nvaudio_get_ivc_alloc_ctxt();
if (!hivc_client) {
pr_err("%s: Failed to allocate IVC context\n", __func__);
return -ENODEV;
}
memset(&msg, 0, sizeof(struct nvaudio_ivc_msg));
msg.cmd = NVAUDIO_ADSP_RESET;
msg.params.adsp_reset_info.reset_req = DEASSERT;
msg.ack_required = true;
err = nvaudio_ivc_send_receive(hivc_client,
&msg,
sizeof(struct nvaudio_ivc_msg));
if (err < 0)
pr_err("%s: error on ivc_send_receive\n", __func__);
return 0;
}
#endif
int nvadsp_reset_t18x_init(struct platform_device *pdev) int nvadsp_reset_t18x_init(struct platform_device *pdev)
{ {
struct nvadsp_drv_data *d = platform_get_drvdata(pdev); struct nvadsp_drv_data *d = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret = 0; int ret = 0;
#ifdef CONFIG_TEGRA_VIRT_AUDIO_IVC
struct device_node *node = dev->of_node;
if (of_device_is_compatible(node, "nvidia,tegra18x-adsp-hv")) {
d->assert_adsp = __virt_assert_t18x_adsp;
d->deassert_adsp = __virt_deassert_t18x_adsp;
d->adspall_rst = NULL;
return 0;
}
#endif
d->assert_adsp = __assert_t18x_adsp; d->assert_adsp = __assert_t18x_adsp;
d->deassert_adsp = __deassert_t18x_adsp; d->deassert_adsp = __deassert_t18x_adsp;
d->adspall_rst = devm_reset_control_get(dev, "adspall"); d->adspall_rst = devm_reset_control_get(dev, "adspall");