Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc72b0c6 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: qcom: Report if command DB is initialized as standalone" into msm-4.8

parents 5f5fc8d2 1c5ab79a
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -27,6 +27,7 @@
#define CMD_DB_MAGIC 0x0C0330DBUL
#define SLAVE_ID_MASK 0x7
#define SLAVE_ID_SHIFT 16
#define CMD_DB_STANDALONE_MASK BIT(0)

struct entry_header {
	uint64_t res_id;
@@ -220,6 +221,14 @@ int cmd_db_ready(void)
	return cmd_db_status;
}

int cmd_db_is_standalone(void)
{
	if (cmd_db_status < 0)
		return cmd_db_status;

	return !!(cmd_db_header->reserved & CMD_DB_STANDALONE_MASK);
}

int cmd_db_get_slave_id(const char *resource_id)
{
	int ret;
@@ -259,6 +268,10 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
	}
	cmd_db_status = 0;
	of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);

	if (cmd_db_is_standalone() == 1)
		pr_info("Command DB is initialized in standalone mode.\n");

failed:
	return cmd_db_status;
}
+13 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -96,6 +96,13 @@ int cmd_db_ready(void);
 * return  cmd_db_hw_type enum  on success, errno on error
 */
int cmd_db_get_slave_id(const char *resource_id);

/**
 * cmd_db_is_standalone - Returns if the command DB is standalone
 *
 * return 1 if command DB is standalone, 0 if not, errno otherwise.
 */
int cmd_db_is_standalone(void);
#else

static inline u32 cmd_db_get_addr(const char *resource_id)
@@ -132,5 +139,10 @@ int cmd_db_get_slave_id(const char *resource_id)
{
	return -ENODEV;
}

int cmd_db_is_standalone(void)
{
	return -ENODEV;
}
#endif
#endif