Lines Matching +full:opp +full:- +full:0

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Generic OPP debugfs interface
5 * Copyright (C) 2015-2016 Viresh Kumar <viresh.kumar@linaro.org>
18 #include "opp.h"
24 if (dev->parent) in opp_set_dev_name()
25 snprintf(name, NAME_MAX, "%s-%s", dev_name(dev->parent), in opp_set_dev_name()
31 void opp_debug_remove_one(struct dev_pm_opp *opp) in opp_debug_remove_one() argument
33 debugfs_remove_recursive(opp->dentry); in opp_debug_remove_one()
39 struct icc_path *path = fp->private_data; in bw_name_read()
42 int i = 0; in bw_name_read()
56 static void opp_debug_create_bw(struct dev_pm_opp *opp, in opp_debug_create_bw() argument
61 char name[] = "icc-path-XXXXXXXXXXX"; /* Integers can take 11 chars max */ in opp_debug_create_bw()
64 for (i = 0; i < opp_table->path_count; i++) { in opp_debug_create_bw()
65 snprintf(name, sizeof(name), "icc-path-%d", i); in opp_debug_create_bw()
67 /* Create per-path directory */ in opp_debug_create_bw()
70 debugfs_create_file("name", S_IRUGO, d, opp_table->paths[i], in opp_debug_create_bw()
73 &opp->bandwidth[i].peak); in opp_debug_create_bw()
75 &opp->bandwidth[i].avg); in opp_debug_create_bw()
79 static void opp_debug_create_clks(struct dev_pm_opp *opp, in opp_debug_create_clks() argument
86 if (opp_table->clk_count == 1) { in opp_debug_create_clks()
87 debugfs_create_ulong("rate_hz", S_IRUGO, pdentry, &opp->rates[0]); in opp_debug_create_clks()
91 for (i = 0; i < opp_table->clk_count; i++) { in opp_debug_create_clks()
93 debugfs_create_ulong(name, S_IRUGO, pdentry, &opp->rates[i]); in opp_debug_create_clks()
97 static void opp_debug_create_supplies(struct dev_pm_opp *opp, in opp_debug_create_supplies() argument
104 for (i = 0; i < opp_table->regulator_count; i++) { in opp_debug_create_supplies()
105 char name[] = "supply-XXXXXXXXXXX"; /* Integers can take 11 chars max */ in opp_debug_create_supplies()
107 snprintf(name, sizeof(name), "supply-%d", i); in opp_debug_create_supplies()
109 /* Create per-opp directory */ in opp_debug_create_supplies()
113 &opp->supplies[i].u_volt); in opp_debug_create_supplies()
116 &opp->supplies[i].u_volt_min); in opp_debug_create_supplies()
119 &opp->supplies[i].u_volt_max); in opp_debug_create_supplies()
122 &opp->supplies[i].u_amp); in opp_debug_create_supplies()
125 &opp->supplies[i].u_watt); in opp_debug_create_supplies()
129 void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table) in opp_debug_create_one() argument
131 struct dentry *pdentry = opp_table->dentry; in opp_debug_create_one()
134 char name[25]; /* 20 chars for 64 bit value + 5 (opp:\0) */ in opp_debug_create_one()
137 * Get directory name for OPP. in opp_debug_create_one()
139 * - Normally rate is unique to each OPP, use it to get unique opp-name. in opp_debug_create_one()
140 * - For some devices rate isn't available or there are multiple, use in opp_debug_create_one()
143 if (likely(opp_table->clk_count == 1 && opp->rates[0])) in opp_debug_create_one()
144 id = opp->rates[0]; in opp_debug_create_one()
148 snprintf(name, sizeof(name), "opp:%lu", id); in opp_debug_create_one()
150 /* Create per-opp directory */ in opp_debug_create_one()
153 debugfs_create_bool("available", S_IRUGO, d, &opp->available); in opp_debug_create_one()
154 debugfs_create_bool("dynamic", S_IRUGO, d, &opp->dynamic); in opp_debug_create_one()
155 debugfs_create_bool("turbo", S_IRUGO, d, &opp->turbo); in opp_debug_create_one()
156 debugfs_create_bool("suspend", S_IRUGO, d, &opp->suspend); in opp_debug_create_one()
157 debugfs_create_u32("level", S_IRUGO, d, &opp->level); in opp_debug_create_one()
159 &opp->clock_latency_ns); in opp_debug_create_one()
161 opp->of_name = of_node_full_name(opp->np); in opp_debug_create_one()
162 debugfs_create_str("of_name", S_IRUGO, d, (char **)&opp->of_name); in opp_debug_create_one()
164 opp_debug_create_clks(opp, opp_table, d); in opp_debug_create_one()
165 opp_debug_create_supplies(opp, opp_table, d); in opp_debug_create_one()
166 opp_debug_create_bw(opp, opp_table, d); in opp_debug_create_one()
168 opp->dentry = d; in opp_debug_create_one()
174 const struct device *dev = opp_dev->dev; in opp_list_debug_create_dir()
177 opp_set_dev_name(dev, opp_table->dentry_name); in opp_list_debug_create_dir()
180 d = debugfs_create_dir(opp_table->dentry_name, rootdir); in opp_list_debug_create_dir()
182 opp_dev->dentry = d; in opp_list_debug_create_dir()
183 opp_table->dentry = d; in opp_list_debug_create_dir()
191 opp_set_dev_name(opp_dev->dev, name); in opp_list_debug_create_link()
194 opp_dev->dentry = debugfs_create_symlink(name, rootdir, in opp_list_debug_create_link()
195 opp_table->dentry_name); in opp_list_debug_create_link()
199 * opp_debug_register - add a device opp node to the debugfs 'opp' directory
200 * @opp_dev: opp-dev pointer for device
201 * @opp_table: the device-opp being added
203 * Dynamically adds device specific directory in debugfs 'opp' directory. If the
204 * device-opp is shared with other devices, then links will be created for all
209 if (opp_table->dentry) in opp_debug_register()
222 /* Look for next opp-dev */ in opp_migrate_dentry()
223 list_for_each_entry(iter, &opp_table->dev_list, node) in opp_migrate_dentry()
232 dev = new_dev->dev; in opp_migrate_dentry()
233 debugfs_remove_recursive(new_dev->dentry); in opp_migrate_dentry()
235 opp_set_dev_name(dev, opp_table->dentry_name); in opp_migrate_dentry()
237 dentry = debugfs_rename(rootdir, opp_dev->dentry, rootdir, in opp_migrate_dentry()
238 opp_table->dentry_name); in opp_migrate_dentry()
241 __func__, dev_name(opp_dev->dev), dev_name(dev)); in opp_migrate_dentry()
245 new_dev->dentry = dentry; in opp_migrate_dentry()
246 opp_table->dentry = dentry; in opp_migrate_dentry()
250 * opp_debug_unregister - remove a device opp node from debugfs opp directory
251 * @opp_dev: opp-dev pointer for device
252 * @opp_table: the device-opp being removed
254 * Dynamically removes device specific directory from debugfs 'opp' directory.
259 if (opp_dev->dentry == opp_table->dentry) { in opp_debug_unregister()
261 if (!list_is_singular(&opp_table->dev_list)) { in opp_debug_unregister()
265 opp_table->dentry = NULL; in opp_debug_unregister()
268 debugfs_remove_recursive(opp_dev->dentry); in opp_debug_unregister()
271 opp_dev->dentry = NULL; in opp_debug_unregister()
276 /* Create /sys/kernel/debug/opp directory */ in opp_debug_init()
277 rootdir = debugfs_create_dir("opp", NULL); in opp_debug_init()
279 return 0; in opp_debug_init()