summaryrefslogtreecommitdiffstats
path: root/drivers/platform/tegra/tegra18_cpu_debugfs.c
blob: 7f79634fc4df200b7dcad7820df6fd4ff4b51faf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (c) 2015-2016, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#include <linux/smp.h>
#include <asm/smp_plat.h>
#include <asm/traps.h>
#include <linux/debugfs.h>
#include <linux/cpu.h>
#include <linux/module.h>
#include <linux/platform/tegra/tegra18_cpu_map.h>
#include <linux/of_platform.h>
#include <linux/tegra-cpu.h>


static struct dentry *debugfs_dir;

static int __init tegra18_cpu_debugfs_init(void)
{
	struct dentry *denver_dir;
	struct dentry *a57_dir;
	char dest[128];
	char name[8];
	int cpu;

	debugfs_dir = debugfs_create_dir("cpu_topology", NULL);
	/* Save off the debugfs dir so that it can be removed */

	denver_dir = debugfs_create_dir("denver", debugfs_dir);
	a57_dir = debugfs_create_dir("a57", debugfs_dir);

	/* Create symlinks to the logical CPUs based on the cluster type and
	   the physical CPU number. */
	for_each_possible_cpu(cpu) {
		snprintf(dest, sizeof(dest),
			 "/sys/devices/system/cpu/cpu%d", cpu);
		snprintf(name, sizeof(name),
			 "cpu%d", tegra18_logical_to_cpu(cpu));
		if (tegra18_is_cpu_denver(cpu))
			debugfs_create_symlink(name, denver_dir, dest);
		else
			debugfs_create_symlink(name, a57_dir, dest);
	}
	return 0;
}
module_init(tegra18_cpu_debugfs_init);

static void tegra18_cpu_debugfs_exit(void)
{
	debugfs_remove_recursive(debugfs_dir);
}
module_exit(tegra18_cpu_debugfs_exit);

MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Tegra T18x CPU Topology debugfs");