blob: c30f762c86ce73adc99693129fc326bcdf0f699d [file] [log] [blame]
developer91bb08d2022-09-07 18:41:59 +08001/*
2 * Copyright (c) 2023, MediaTek Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef MT_LP_RQM_H
8#define MT_LP_RQM_H
9
10#include "mt_lp_rq.h"
11
12enum plat_mt_lpm_rq_update_type {
13 PLAT_RQ_USER_NUM,
14 PLAT_RQ_USER_VALID,
15 PLAT_RQ_USER_REQ,
16 PLAT_RQ_USER_REL,
17 PLAT_RQ_PER_USER_NAME,
18 PLAT_RQ_REQ_NUM,
19 PLAT_RQ_REQ_USAGE,
20};
21
22/* Determine the request valid */
23#define MT_LP_RQ_VALID (0x1)
24#define MT_LP_RQ_INVALID (0x0)
25
26/* Determine the request user opertions */
27#define MT_LP_RQ_USER_INVALID (-1)
28#define MT_LP_RQ_USER_MAX (32)
29#define MT_LP_RQ_USER_NAME_LEN (4)
30#define MT_LP_RQ_USER_CHAR_U (8)
31
32/* Determine the request update flag */
33#define MT_LP_RQ_FLAG_DONE (0)
34#define MT_LP_RQ_FLAG_NEED_UPDATE BIT(6)
35
36/* Determine the resource update id */
37#define MT_LP_RQ_ID_ALL_USAGE (-1)
38
39/* Determine the return status */
40#define MT_LP_RQ_STA_OK (0)
41#define MT_LP_RQ_STA_BAD (-1)
42
43struct mt_lp_res_req {
44 /* Determine the resource req public identify */
45 const unsigned int res_id;
46 /* Determine the resource bitwise internal control */
47 const unsigned int res_rq;
48 /* Determine the users per bit for current resource usage */
49 unsigned int res_usage;
50};
51
52struct mt_resource_req_manager {
53 /* Determine the set of resources */
54 struct mt_lp_res_req **res;
55};
56
57struct resource_req_status {
58 /* Determine the status id */
59 unsigned int id;
60 /* Determine the status value */
61 unsigned int val;
62};
63
64int mt_lp_resource_request_manager_register(struct mt_resource_req_manager *rqm);
65int mt_lp_rq_update_status(int type, void *p);
66int mt_lp_rq_get_status(int type, void *p);
67
68#endif /* MT_LP_RQM_H */