diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index dd872017f345..4855394001b0 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (c) 2016-2018, 2020, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2016-2018, 2020-2021, The Linux Foundation. All rights reserved. */ #include #include @@ -17,6 +17,7 @@ #define MAX_SLV_ID 8 #define SLAVE_ID_MASK 0x7 #define SLAVE_ID_SHIFT 16 +#define CMD_DB_STANDALONE_MASK BIT(0) /** * struct entry_header: header for each entry in cmddb @@ -309,6 +310,16 @@ static const struct file_operations cmd_db_debugfs_ops = { .release = single_release, }; +bool cmd_db_is_standalone(void) +{ + int ret = cmd_db_ready(); + u32 standalone = le32_to_cpu(cmd_db_header->reserved) & + CMD_DB_STANDALONE_MASK; + + return !ret && standalone; +} +EXPORT_SYMBOL(cmd_db_is_standalone); + static int cmd_db_dev_probe(struct platform_device *pdev) { struct reserved_mem *rmem; @@ -334,6 +345,9 @@ static int cmd_db_dev_probe(struct platform_device *pdev) debugfs_create_file("cmd-db", 0400, NULL, NULL, &cmd_db_debugfs_ops); + if (cmd_db_is_standalone()) + pr_info("Command DB is initialized in standalone mode\n"); + return 0; } diff --git a/include/soc/qcom/cmd-db.h b/include/soc/qcom/cmd-db.h index c8bb56e6852a..4cc3e158a843 100644 --- a/include/soc/qcom/cmd-db.h +++ b/include/soc/qcom/cmd-db.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ -/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2016-2018, 2021, The Linux Foundation. All rights reserved. */ #ifndef __QCOM_COMMAND_DB_H__ #define __QCOM_COMMAND_DB_H__ @@ -24,6 +24,8 @@ const void *cmd_db_read_aux_data(const char *resource_id, size_t *len); enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id); int cmd_db_ready(void); + +bool cmd_db_is_standalone(void); #else static inline u32 cmd_db_read_addr(const char *resource_id) { return 0; } @@ -36,5 +38,8 @@ static inline enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id) static inline int cmd_db_ready(void) { return -ENODEV; } + +static inline bool cmd_db_is_standalone(void) +{ return true; } #endif /* CONFIG_QCOM_COMMAND_DB */ #endif /* __QCOM_COMMAND_DB_H__ */