/* SPDX-License-Identifier: MIT */ /* * SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #ifndef TEGRA_DCE_CLIENT_IPC_H #define TEGRA_DCE_CLIENT_IPC_H #define DCE_CLIENT_IPC_TYPE_CPU_RM 0U #define DCE_CLIENT_IPC_TYPE_HDCP_KMD 1U #define DCE_CLIENT_IPC_TYPE_RM_EVENT 2U #define DCE_CLIENT_IPC_TYPE_MAX 3U #define DCE_CLIENT_MAX_IPC_MSG_SIZE 4096 /** * struct dce_ipc_message - Contains necessary info for an ipc msg. * * @tx : transmit message info * @rx : receive message info */ struct dce_ipc_message { struct { void *data; size_t size; } tx; struct { void *data; size_t size; } rx; }; /* * tegra_dce_client_ipc_callback_t - callback function to notify the * client when the CPU Driver receives an IPC from DCE for the client. * * @client_id: id that represents the corresponding client. * @interface_type: Interface on which the IPC was received. * @msg_length: Length of the message. * @msg_data: Message data. * @usr_ctx: Any user context if present. */ typedef void (*tegra_dce_client_ipc_callback_t)(u32 handle, u32 interface_type, u32 msg_length, void *msg_data, void *usr_ctx); /* * tegra_dce_register_ipc_client() - used by clients to register with dce driver * @interface_type: Interface for which this client is expected to send rpcs and * receive callbacks. * @callback_fn: callback function to be called by DCE driver on receiving IPCs * from DCE on this interface. * @usr_ctx: Any user context if present. * * Return: valid client_id if no errors else corresponding error value. */ int tegra_dce_register_ipc_client(u32 interface_type, tegra_dce_client_ipc_callback_t callback_fn, void *usr_ctx, u32 *handlep); /* * tegra_dce_unregister_client() - used by clients to unregister to dce driver * @client_id : ointer to client's data * * Return: 0 if no errors else corresponding error value. */ int tegra_dce_unregister_ipc_client(u32 handle); /* * tegra_dce_client_ipc_send_recv() - used by clients to send rpcs to dce * @client_id : client_id registered with dce driver * @msg : message to be sent and received * * Return: 0 if no errors else corresponding error value. */ int tegra_dce_client_ipc_send_recv(u32 handle, struct dce_ipc_message *msg); #endif