diff options
author | Thierry Reding <treding@nvidia.com> | 2015-05-18 11:35:30 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2015-07-16 03:51:47 -0400 |
commit | 30a636f984984655ad5350e73a6a3141c9ba85ae (patch) | |
tree | 8aa6f27fd9a92d1495b9f9069a6542152a981c93 | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
memory: tegra: Expose supported rates via debugfs
In order to ease testing, expose the list of supported EMC frequencies
via debugfs.
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/memory/tegra/tegra124-emc.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 8620355776fe..3dac7be39654 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c | |||
@@ -1027,7 +1027,40 @@ static int emc_debug_rate_set(void *data, u64 rate) | |||
1027 | DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get, | 1027 | DEFINE_SIMPLE_ATTRIBUTE(emc_debug_rate_fops, emc_debug_rate_get, |
1028 | emc_debug_rate_set, "%lld\n"); | 1028 | emc_debug_rate_set, "%lld\n"); |
1029 | 1029 | ||
1030 | static void emc_debugfs_init(struct device *dev) | 1030 | static int emc_debug_supported_rates_show(struct seq_file *s, void *data) |
1031 | { | ||
1032 | struct tegra_emc *emc = s->private; | ||
1033 | const char *prefix = ""; | ||
1034 | unsigned int i; | ||
1035 | |||
1036 | for (i = 0; i < emc->num_timings; i++) { | ||
1037 | struct emc_timing *timing = &emc->timings[i]; | ||
1038 | |||
1039 | seq_printf(s, "%s%lu", prefix, timing->rate); | ||
1040 | |||
1041 | prefix = " "; | ||
1042 | } | ||
1043 | |||
1044 | seq_puts(s, "\n"); | ||
1045 | |||
1046 | return 0; | ||
1047 | } | ||
1048 | |||
1049 | static int emc_debug_supported_rates_open(struct inode *inode, | ||
1050 | struct file *file) | ||
1051 | { | ||
1052 | return single_open(file, emc_debug_supported_rates_show, | ||
1053 | inode->i_private); | ||
1054 | } | ||
1055 | |||
1056 | static const struct file_operations emc_debug_supported_rates_fops = { | ||
1057 | .open = emc_debug_supported_rates_open, | ||
1058 | .read = seq_read, | ||
1059 | .llseek = seq_lseek, | ||
1060 | .release = single_release, | ||
1061 | }; | ||
1062 | |||
1063 | static void emc_debugfs_init(struct device *dev, struct tegra_emc *emc) | ||
1031 | { | 1064 | { |
1032 | struct dentry *root, *file; | 1065 | struct dentry *root, *file; |
1033 | struct clk *clk; | 1066 | struct clk *clk; |
@@ -1048,6 +1081,11 @@ static void emc_debugfs_init(struct device *dev) | |||
1048 | &emc_debug_rate_fops); | 1081 | &emc_debug_rate_fops); |
1049 | if (!file) | 1082 | if (!file) |
1050 | dev_err(dev, "failed to create debugfs entry\n"); | 1083 | dev_err(dev, "failed to create debugfs entry\n"); |
1084 | |||
1085 | file = debugfs_create_file("supported_rates", S_IRUGO, root, emc, | ||
1086 | &emc_debug_supported_rates_fops); | ||
1087 | if (!file) | ||
1088 | dev_err(dev, "failed to create debugfs entry\n"); | ||
1051 | } | 1089 | } |
1052 | 1090 | ||
1053 | static int tegra_emc_probe(struct platform_device *pdev) | 1091 | static int tegra_emc_probe(struct platform_device *pdev) |
@@ -1119,7 +1157,7 @@ static int tegra_emc_probe(struct platform_device *pdev) | |||
1119 | platform_set_drvdata(pdev, emc); | 1157 | platform_set_drvdata(pdev, emc); |
1120 | 1158 | ||
1121 | if (IS_ENABLED(CONFIG_DEBUG_FS)) | 1159 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
1122 | emc_debugfs_init(&pdev->dev); | 1160 | emc_debugfs_init(&pdev->dev, emc); |
1123 | 1161 | ||
1124 | return 0; | 1162 | return 0; |
1125 | }; | 1163 | }; |