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

Commit 32c95b94 authored by Maulik Shah's avatar Maulik Shah Committed by Gerrit - the friendly Code Review server
Browse files

rpmh_master_stat: Add support to use alternate profiling unit



Alternate profiling unit can be used to capture certain time
stamp when designated unit is not functional.

Add support to use alternate profiling unit.

Change-Id: Ib4e7a789d2cd073a7eab7dd9ba6cad7c34bc6fc2
Signed-off-by: default avatarMaulik Shah <mkshah@codeaurora.org>
parent 6a9c8210
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -23,9 +23,16 @@ The required properties for rpmh-master-stats are:
	Value type: <prop-encoded-array>
	Definition: Specifies physical address of start of profiling unit.

- qcom,use-alt-unit:
	Usage: Optional
	Value type: <u32>
	Definition: Specifies designated unit no. for which alternate unit
		is configured to capture time stamp.

Example:

qcom,rpmh-master-stats {
	compatible = "qcom,rpmh-master-stats";
	reg = <0xb221200 0x60>;
	qcom,use-alt-unit = <3>;
};
+20 −1
Original line number Diff line number Diff line
@@ -58,7 +58,8 @@ enum profile_data {
	POWER_UP_END,
	POWER_DOWN_END,
	POWER_UP_START,
	NUM_UNIT,
	ALT_UNIT,
	NUM_UNIT = ALT_UNIT,
};

struct msm_rpmh_master_data {
@@ -96,6 +97,7 @@ struct rpmh_master_stats_prv_data {

static struct msm_rpmh_master_stats apss_master_stats;
static void __iomem *rpmh_unit_base;
static uint32_t use_alt_unit;

static DEFINE_MUTEX(rpmh_stats_mutex);

@@ -178,6 +180,17 @@ void msm_rpmh_master_stats_update(void)
		return;

	for (i = POWER_DOWN_END; i < NUM_UNIT; i++) {
		if (i == use_alt_unit) {
			profile_unit[i].value = readl_relaxed(
						rpmh_unit_base + GET_ADDR(
						REG_DATA_LO, ALT_UNIT));
			profile_unit[i].value |= ((uint64_t)
						readl_relaxed(
						rpmh_unit_base + GET_ADDR(
						REG_DATA_HI, ALT_UNIT)) << 32);
			continue;
		}

		profile_unit[i].valid = readl_relaxed(rpmh_unit_base +
						GET_ADDR(REG_VALID, i));

@@ -233,6 +246,12 @@ static int msm_rpmh_master_stats_probe(struct platform_device *pdev)
		goto fail_sysfs;
	}

	ret = of_property_read_u32(pdev->dev.of_node,
					"qcom,use-alt-unit",
					&use_alt_unit);
	if (ret)
		use_alt_unit = -1;

	rpmh_unit_base = of_iomap(pdev->dev.of_node, 0);
	if (!rpmh_unit_base) {
		pr_err("Failed to get rpmh_unit_base\n");