xref: /openbmc/linux/include/soc/qcom/cmd-db.h (revision 6197e5b7)
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 #include <linux/err.h>
8 
9 enum cmd_db_hw_type {
10 	CMD_DB_HW_INVALID = 0,
11 	CMD_DB_HW_MIN     = 3,
12 	CMD_DB_HW_ARC     = CMD_DB_HW_MIN,
13 	CMD_DB_HW_VRM     = 4,
14 	CMD_DB_HW_BCM     = 5,
15 	CMD_DB_HW_MAX     = CMD_DB_HW_BCM,
16 	CMD_DB_HW_ALL     = 0xff,
17 };
18 
19 #if IS_ENABLED(CONFIG_QCOM_COMMAND_DB)
20 u32 cmd_db_read_addr(const char *resource_id);
21 
22 const void *cmd_db_read_aux_data(const char *resource_id, size_t *len);
23 
24 enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id);
25 
26 int cmd_db_ready(void);
27 #else
28 static inline u32 cmd_db_read_addr(const char *resource_id)
29 { return 0; }
30 
31 static inline const void *cmd_db_read_aux_data(const char *resource_id, size_t *len)
32 { return ERR_PTR(-ENODEV); }
33 
34 static inline enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id)
35 { return -ENODEV; }
36 
37 static inline int cmd_db_ready(void)
38 { return -ENODEV; }
39 #endif /* CONFIG_QCOM_COMMAND_DB */
40 #endif /* __QCOM_COMMAND_DB_H__ */
41