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

Commit a9c0df8a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "clk: msm: clock-cpu: Add panic handler to dump cpu frequency"

parents 69255ecb 76de3eb7
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -700,6 +700,45 @@ static struct notifier_block clock_8939_pm_notifier_single_cluster = {
	.notifier_call = clock_8939_pm_event_single_cluster,
};

/**
 * clock_panic_callback() - panic notification callback function.
 *		This function is invoked when a kernel panic occurs.
 * @nfb:	Notifier block pointer
 * @event:	Value passed unmodified to notifier function
 * @data:	Pointer passed unmodified to notifier function
 *
 * Return: NOTIFY_OK
 */
static int clock_panic_callback(struct notifier_block *nfb,
					unsigned long event, void *data)
{
	bool single_cluster = 0;
	unsigned long rate;
	struct device_node *ofnode = of_find_compatible_node(NULL, NULL,
							"qcom,cpu-clock-8939");
	if (!ofnode)
		ofnode = of_find_compatible_node(NULL, NULL,
						"qcom,cpu-clock-8917");
	if (ofnode)
		single_cluster = of_property_read_bool(ofnode,
							"qcom,num-cluster");

	rate  = (a53_bc_clk.c.count) ? a53_bc_clk.c.rate : 0;
	pr_err("%s frequency: %10lu Hz\n", a53_bc_clk.c.dbg_name, rate);

	if (!single_cluster) {
		rate  = (a53_lc_clk.c.count) ? a53_lc_clk.c.rate : 0;
		pr_err("%s frequency: %10lu Hz\n", a53_lc_clk.c.dbg_name, rate);
	}

	return NOTIFY_OK;
}

static struct notifier_block clock_panic_notifier = {
	.notifier_call = clock_panic_callback,
	.priority = 1,
};

static int clock_a53_probe(struct platform_device *pdev)
{
	int speed_bin, version, rc, cpu, mux_id, rate;
@@ -798,6 +837,9 @@ static int clock_a53_probe(struct platform_device *pdev)

	populate_opp_table(pdev, single_cluster);

	atomic_notifier_chain_register(&panic_notifier_list,
						&clock_panic_notifier);

	return 0;
}

+31 −0
Original line number Diff line number Diff line
@@ -753,6 +753,34 @@ static int cpu_parse_devicetree(struct platform_device *pdev)
	return 0;
}

/**
 * clock_panic_callback() - panic notification callback function.
 *              This function is invoked when a kernel panic occurs.
 * @nfb:        Notifier block pointer
 * @event:      Value passed unmodified to notifier function
 * @data:       Pointer passed unmodified to notifier function
 *
 * Return: NOTIFY_OK
 */
static int clock_panic_callback(struct notifier_block *nfb,
					unsigned long event, void *data)
{
	unsigned long rate;

	rate  = (a53_perf_clk.c.count) ? a53_perf_clk.c.rate : 0;
	pr_err("%s frequency: %10lu Hz\n", a53_perf_clk.c.dbg_name, rate);

	rate  = (a53_pwr_clk.c.count) ? a53_pwr_clk.c.rate : 0;
	pr_err("%s frequency: %10lu Hz\n", a53_pwr_clk.c.dbg_name, rate);

	return NOTIFY_OK;
}

static struct notifier_block clock_panic_notifier = {
	.notifier_call = clock_panic_callback,
	.priority = 1,
};

static int clock_cpu_probe(struct platform_device *pdev)
{
	int speed_bin, version, rc, cpu, mux_id;
@@ -875,6 +903,9 @@ static int clock_cpu_probe(struct platform_device *pdev)
		a53_perf_clk.hw_low_power_ctrl = true;
	}

	atomic_notifier_chain_register(&panic_notifier_list,
						&clock_panic_notifier);

	return 0;
}