xref: /openbmc/linux/include/soc/qcom/cmd-db.h (revision b9b77222)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. */
3 
4 #ifndef __QCOM_COMMAND_DB_H__
5 #define __QCOM_COMMAND_DB_H__
6 
7 
8 enum cmd_db_hw_type {
9 	CMD_DB_HW_INVALID = 0,
10 	CMD_DB_HW_MIN     = 3,
11 	CMD_DB_HW_ARC     = CMD_DB_HW_MIN,
12 	CMD_DB_HW_VRM     = 4,
13 	CMD_DB_HW_BCM     = 5,
14 	CMD_DB_HW_MAX     = CMD_DB_HW_BCM,
15 	CMD_DB_HW_ALL     = 0xff,
16 };
17 
18 #if IS_ENABLED(CONFIG_QCOM_COMMAND_DB)
19 u32 cmd_db_read_addr(const char *resource_id);
20 
21 int cmd_db_read_aux_data(const char *resource_id, u8 *data, size_t len);
22 
23 size_t cmd_db_read_aux_data_len(const char *resource_id);
24 
25 enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id);
26 
27 int cmd_db_ready(void);
28 #else
29 static inline u32 cmd_db_read_addr(const char *resource_id)
30 { return 0; }
31 
32 static inline int cmd_db_read_aux_data(const char *resource_id, u8 *data,
33 				       size_t len)
34 { return -ENODEV; }
35 
36 static inline size_t cmd_db_read_aux_data_len(const char *resource_id)
37 { return -ENODEV; }
38 
39 static inline enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id)
40 { return -ENODEV; }
41 
42 static inline int cmd_db_ready(void)
43 { return -ENODEV; }
44 #endif /* CONFIG_QCOM_COMMAND_DB */
45 #endif /* __QCOM_COMMAND_DB_H__ */
46