tegra-fsicom: send state notificatication to fsi

tegra-fsicom driver updated to send
suspend and shutdown notification to fsi

Jira SS-4834
Bug 4053113

Change-Id: I0df978783894b1a2ddc64ff8255a796366e79daa
Signed-off-by: Praveen James <pjames@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2880270
Reviewed-by: Rahul Bedarkar <rabedarkar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Praveen James
2023-03-31 03:08:42 +00:00
committed by mobile promotions
parent 6937db210f
commit 3d2b7e4ff8

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#include <linux/module.h>
#include <linux/fs.h>
@@ -19,7 +19,13 @@
/* Timeout in milliseconds */
#define TIMEOUT 5U
#define IOVA_UNI_CODE 0xFE0D
/* Unique signature for HSP Data */
#define IOVA_UNI_CODE 0xFE0D
#define PM_STATE_UNI_CODE 0xFDED
/* State Management */
#define PM_SUSPEND 6U
#define PM_SHUTDOWN PM_SUSPEND
/*Data type for mailbox client and channel details*/
struct fsi_hsp_sm {
@@ -47,6 +53,22 @@ static struct task_struct *task;
static struct fsi_hsp *fsi_hsp_v;
static int fsicom_fsi_pm_notify(u32 state)
{
uint32_t pdata[4] = {0};
int ret = 0;
pdata[0] = state;
pdata[1] = state;
pdata[2] = state;
pdata[3] = PM_STATE_UNI_CODE;
/* send pm state to fsi */
ret = mbox_send_message(fsi_hsp_v->tx.chan,
(void *)pdata);
return ret < 0 ? ret : 0;
}
static void fsicom_send_signal(int sig, int32_t data)
{
struct siginfo info;
@@ -270,6 +292,14 @@ static int fsicom_client_probe(struct platform_device *pdev)
return ret;
}
static void fsicom_client_shutdown(struct platform_device *pdev)
{
if (fsicom_fsi_pm_notify(PM_SHUTDOWN) < 0)
pr_err("Unable to send notification to fsi\n");
fsicom_unregister_device();
}
static int fsicom_client_remove(struct platform_device *pdev)
{
fsicom_unregister_device();
@@ -279,7 +309,7 @@ static int fsicom_client_remove(struct platform_device *pdev)
static int __maybe_unused fsicom_client_suspend(struct device *dev)
{
dev_dbg(dev, "suspend called\n");
return 0;
return fsicom_fsi_pm_notify(PM_SUSPEND);
}
static int __maybe_unused fsicom_client_resume(struct device *dev)
@@ -299,8 +329,9 @@ static struct platform_driver fsicom_client = {
.of_match_table = of_match_ptr(fsicom_client_dt_match),
.pm = pm_ptr(&fsicom_client_pm),
},
.probe = fsicom_client_probe,
.remove = fsicom_client_remove,
.probe = fsicom_client_probe,
.shutdown = fsicom_client_shutdown,
.remove = fsicom_client_remove,
};
module_platform_driver(fsicom_client);