blob: 1e22d86c66c97fd772f619df91828ecc8e5c798d [file] [log] [blame]
Caleb Connollyceb92622023-09-26 17:12:13 +01001/* 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#include <dm/device.h>
9
10enum cmd_db_hw_type {
11 CMD_DB_HW_INVALID = 0,
12 CMD_DB_HW_MIN = 3,
13 CMD_DB_HW_ARC = CMD_DB_HW_MIN,
14 CMD_DB_HW_VRM = 4,
15 CMD_DB_HW_BCM = 5,
16 CMD_DB_HW_MAX = CMD_DB_HW_BCM,
17 CMD_DB_HW_ALL = 0xff,
18};
19
20#if IS_ENABLED(CONFIG_QCOM_COMMAND_DB)
21u32 cmd_db_read_addr(const char *resource_id);
22
23const void *cmd_db_read_aux_data(const char *resource_id, size_t *len);
24
25enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id);
26
27int cmd_db_init(ofnode node);
28
29#else
30static inline u32 cmd_db_read_addr(const char *resource_id)
31{ return 0; }
32
33static inline const void *cmd_db_read_aux_data(const char *resource_id, size_t *len)
34{ return ERR_PTR(-ENODEV); }
35
36static inline enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id)
37{ return -ENODEV; }
38
39static inline int cmd_db_ready(void)
40{ return -ENODEV; }
41#endif /* CONFIG_QCOM_COMMAND_DB */
42#endif /* __QCOM_COMMAND_DB_H__ */