From 3a6d714aa732c5f8019ce36e1a6ae0313214da78 Mon Sep 17 00:00:00 2001 From: Akash Kollipara Date: Mon, 11 Apr 2022 13:31:40 +0530 Subject: [PATCH] nvadsp: Added new commands support to adsp console - Added suspend, reusme and stop abilities to adsp console Bug 3596981 Change-Id: I867a85130bb2abf7feb5a3a78ebb2b343272a32a Signed-off-by: Akash Kollipara Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2723711 (cherry picked from commit 046f4f8874a1fc8c7af88c44ad08114e489f3302) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2695477 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Viswanath L Reviewed-by: Ravindra Lokhande GVS: Gerrit_Virtual_Submit --- .../platform/tegra/nvadsp/adsp_console_dbfs.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/platform/tegra/nvadsp/adsp_console_dbfs.c b/drivers/platform/tegra/nvadsp/adsp_console_dbfs.c index ee3a270b..c45bd112 100644 --- a/drivers/platform/tegra/nvadsp/adsp_console_dbfs.c +++ b/drivers/platform/tegra/nvadsp/adsp_console_dbfs.c @@ -3,7 +3,7 @@ * * adsp mailbox console driver * - * Copyright (C) 2014-2020, NVIDIA Corporation. All rights reserved. + * Copyright (C) 2014-2022, NVIDIA Corporation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -161,6 +161,7 @@ adsp_consol_ioctl(struct file *f, unsigned int cmd, unsigned long arg) return -EFAULT; if ((_IOC_NR(cmd) != _IOC_NR(ADSP_CNSL_LOAD)) && + (_IOC_NR(cmd) != _IOC_NR(ADSP_CNSL_RESUME)) && (!drv_data->adsp_os_running)) { dev_info(dev, "adsp_consol: os not running."); return -EPERM; @@ -197,6 +198,23 @@ adsp_consol_ioctl(struct file *f, unsigned int cmd, unsigned long arg) pr_err("adsp_consol: Failed to init adsp_consol send mailbox"); memset(mbox, 0, sizeof(struct nvadsp_mbox)); break; + case _IOC_NR(ADSP_CNSL_SUSPEND): + ret = nvadsp_os_suspend(); + if (ret) + dev_info(dev, "adsp_consol: OS Suspend Failed."); + break; + case _IOC_NR(ADSP_CNSL_STOP): + nvadsp_os_stop(); + break; + case _IOC_NR(ADSP_CNSL_RESUME): + if (!drv_data->adsp_os_suspended) { + dev_info(dev, "adsp_consol: OS is not suspended to perform resume."); + break; + } + ret = nvadsp_os_start(); + if (ret) + dev_info(dev, "adsp_consol: OS Resume Failed."); + break; case _IOC_NR(ADSP_CNSL_RUN_APP): if (!ACCESS_OK(uarg, sizeof(struct adsp_consol_run_app_arg_t))) return -EACCES;