diff options
author | Kevin Hilman <khilman@ti.com> | 2011-04-05 17:39:11 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-09-15 15:09:07 -0400 |
commit | 633ef8b7475a224b6be662d7c698cd705157064f (patch) | |
tree | 03b219463824f61398fd358e84bc6d9c80fda951 /arch/arm | |
parent | b7ea803e55769768d1eff3b32e4f99837fa6ddb5 (diff) |
OMAP3+: voltage: remove unneeded debugfs interface
Remove read-only debugfs interface to VP values. Most of the values
are init-time only and never change. Current voltage value should be
retreived from the (eventual) regulator framework interface to the
voltage domain.
Fixes to original version provided by Nishanth Menon <nm@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/smartreflex.c | 29 | ||||
-rw-r--r-- | arch/arm/mach-omap2/voltage.c | 78 | ||||
-rw-r--r-- | arch/arm/mach-omap2/voltage.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/vp.c | 63 |
4 files changed, 19 insertions, 154 deletions
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 34c01a7de810..bb606c9709b2 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list); | |||
62 | 62 | ||
63 | static struct omap_sr_class_data *sr_class; | 63 | static struct omap_sr_class_data *sr_class; |
64 | static struct omap_sr_pmic_data *sr_pmic_data; | 64 | static struct omap_sr_pmic_data *sr_pmic_data; |
65 | static struct dentry *sr_dbg_dir; | ||
65 | 66 | ||
66 | static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value) | 67 | static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value) |
67 | { | 68 | { |
@@ -826,9 +827,10 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
826 | struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); | 827 | struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); |
827 | struct omap_sr_data *pdata = pdev->dev.platform_data; | 828 | struct omap_sr_data *pdata = pdev->dev.platform_data; |
828 | struct resource *mem, *irq; | 829 | struct resource *mem, *irq; |
829 | struct dentry *vdd_dbg_dir, *nvalue_dir; | 830 | struct dentry *nvalue_dir; |
830 | struct omap_volt_data *volt_data; | 831 | struct omap_volt_data *volt_data; |
831 | int i, ret = 0; | 832 | int i, ret = 0; |
833 | char *name; | ||
832 | 834 | ||
833 | if (!sr_info) { | 835 | if (!sr_info) { |
834 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", | 836 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", |
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
899 | } | 901 | } |
900 | 902 | ||
901 | dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); | 903 | dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); |
904 | if (!sr_dbg_dir) { | ||
905 | sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); | ||
906 | if (!sr_dbg_dir) { | ||
907 | ret = PTR_ERR(sr_dbg_dir); | ||
908 | pr_err("%s:sr debugfs dir creation failed(%d)\n", | ||
909 | __func__, ret); | ||
910 | goto err_iounmap; | ||
911 | } | ||
912 | } | ||
902 | 913 | ||
903 | /* | 914 | name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name); |
904 | * If the voltage domain debugfs directory is not created, do | 915 | if (!name) { |
905 | * not try to create rest of the debugfs entries. | 916 | dev_err(&pdev->dev, "%s: Unable to alloc debugfs name\n", |
906 | */ | 917 | __func__); |
907 | vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); | 918 | ret = -ENOMEM; |
908 | if (!vdd_dbg_dir) { | ||
909 | ret = -EINVAL; | ||
910 | goto err_iounmap; | 919 | goto err_iounmap; |
911 | } | 920 | } |
912 | 921 | sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); | |
913 | sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); | 922 | kfree(name); |
914 | if (IS_ERR(sr_info->dbg_dir)) { | 923 | if (IS_ERR(sr_info->dbg_dir)) { |
915 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", | 924 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", |
916 | __func__); | 925 | __func__); |
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c index c22b53c42193..eaa5f93021ae 100644 --- a/arch/arm/mach-omap2/voltage.c +++ b/arch/arm/mach-omap2/voltage.c | |||
@@ -43,9 +43,6 @@ | |||
43 | 43 | ||
44 | static LIST_HEAD(voltdm_list); | 44 | static LIST_HEAD(voltdm_list); |
45 | 45 | ||
46 | #define VOLTAGE_DIR_SIZE 16 | ||
47 | static struct dentry *voltage_dir; | ||
48 | |||
49 | static int __init _config_common_vdd_data(struct voltagedomain *voltdm) | 46 | static int __init _config_common_vdd_data(struct voltagedomain *voltdm) |
50 | { | 47 | { |
51 | char *sys_ck_name; | 48 | char *sys_ck_name; |
@@ -102,51 +99,6 @@ static int __init _config_common_vdd_data(struct voltagedomain *voltdm) | |||
102 | return 0; | 99 | return 0; |
103 | } | 100 | } |
104 | 101 | ||
105 | static int nom_volt_debug_get(void *data, u64 *val) | ||
106 | { | ||
107 | struct voltagedomain *voltdm = (struct voltagedomain *)data; | ||
108 | |||
109 | if (!voltdm) { | ||
110 | pr_warning("Wrong paramater passed\n"); | ||
111 | return -EINVAL; | ||
112 | } | ||
113 | |||
114 | *val = omap_voltage_get_nom_volt(voltdm); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | DEFINE_SIMPLE_ATTRIBUTE(nom_volt_debug_fops, nom_volt_debug_get, NULL, | ||
120 | "%llu\n"); | ||
121 | static void __init vdd_debugfs_init(struct voltagedomain *voltdm) | ||
122 | { | ||
123 | char *name; | ||
124 | struct omap_vdd_info *vdd = voltdm->vdd; | ||
125 | |||
126 | name = kzalloc(VOLTAGE_DIR_SIZE, GFP_KERNEL); | ||
127 | if (!name) { | ||
128 | pr_warning("%s: Unable to allocate memory for debugfs" | ||
129 | " directory name for vdd_%s", | ||
130 | __func__, voltdm->name); | ||
131 | return; | ||
132 | } | ||
133 | strcpy(name, "vdd_"); | ||
134 | strcat(name, voltdm->name); | ||
135 | |||
136 | vdd->debug_dir = debugfs_create_dir(name, voltage_dir); | ||
137 | kfree(name); | ||
138 | if (IS_ERR(vdd->debug_dir)) { | ||
139 | pr_warning("%s: Unable to create debugfs directory for" | ||
140 | " vdd_%s\n", __func__, voltdm->name); | ||
141 | vdd->debug_dir = NULL; | ||
142 | return; | ||
143 | } | ||
144 | |||
145 | (void) debugfs_create_file("curr_nominal_volt", S_IRUGO, | ||
146 | vdd->debug_dir, (void *) voltdm, | ||
147 | &nom_volt_debug_fops); | ||
148 | } | ||
149 | |||
150 | static int __init omap_vdd_data_configure(struct voltagedomain *voltdm) | 102 | static int __init omap_vdd_data_configure(struct voltagedomain *voltdm) |
151 | { | 103 | { |
152 | int ret = -EINVAL; | 104 | int ret = -EINVAL; |
@@ -342,31 +294,6 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm, | |||
342 | } | 294 | } |
343 | 295 | ||
344 | /** | 296 | /** |
345 | * omap_voltage_get_dbgdir() - API to get pointer to the debugfs directory | ||
346 | * corresponding to a voltage domain. | ||
347 | * | ||
348 | * @voltdm: pointer to the VDD whose debug directory is required. | ||
349 | * | ||
350 | * This API returns pointer to the debugfs directory corresponding | ||
351 | * to the voltage domain. Should be used by drivers requiring to | ||
352 | * add any debug entry for a particular voltage domain. Returns NULL | ||
353 | * in case of error. | ||
354 | */ | ||
355 | struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm) | ||
356 | { | ||
357 | struct omap_vdd_info *vdd; | ||
358 | |||
359 | if (!voltdm || IS_ERR(voltdm)) { | ||
360 | pr_warning("%s: VDD specified does not exist!\n", __func__); | ||
361 | return NULL; | ||
362 | } | ||
363 | |||
364 | vdd = voltdm->vdd; | ||
365 | |||
366 | return vdd->debug_dir; | ||
367 | } | ||
368 | |||
369 | /** | ||
370 | * omap_change_voltscale_method() - API to change the voltage scaling method. | 297 | * omap_change_voltscale_method() - API to change the voltage scaling method. |
371 | * @voltdm: pointer to the VDD whose voltage scaling method | 298 | * @voltdm: pointer to the VDD whose voltage scaling method |
372 | * has to be changed. | 299 | * has to be changed. |
@@ -418,10 +345,6 @@ int __init omap_voltage_late_init(void) | |||
418 | return -EINVAL; | 345 | return -EINVAL; |
419 | } | 346 | } |
420 | 347 | ||
421 | voltage_dir = debugfs_create_dir("voltage", NULL); | ||
422 | if (IS_ERR(voltage_dir)) | ||
423 | pr_err("%s: Unable to create voltage debugfs main dir\n", | ||
424 | __func__); | ||
425 | list_for_each_entry(voltdm, &voltdm_list, node) { | 348 | list_for_each_entry(voltdm, &voltdm_list, node) { |
426 | if (!voltdm->scalable) | 349 | if (!voltdm->scalable) |
427 | continue; | 350 | continue; |
@@ -434,7 +357,6 @@ int __init omap_voltage_late_init(void) | |||
434 | if (voltdm->vdd) { | 357 | if (voltdm->vdd) { |
435 | if (omap_vdd_data_configure(voltdm)) | 358 | if (omap_vdd_data_configure(voltdm)) |
436 | continue; | 359 | continue; |
437 | vdd_debugfs_init(voltdm); | ||
438 | omap_vp_init(voltdm); | 360 | omap_vp_init(voltdm); |
439 | } | 361 | } |
440 | } | 362 | } |
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h index 1ea735431ee0..eafcc927e873 100644 --- a/arch/arm/mach-omap2/voltage.h +++ b/arch/arm/mach-omap2/voltage.h | |||
@@ -139,14 +139,12 @@ struct omap_voltdm_pmic { | |||
139 | * @volt_data : voltage table having the distinct voltages supported | 139 | * @volt_data : voltage table having the distinct voltages supported |
140 | * by the domain and other associated per voltage data. | 140 | * by the domain and other associated per voltage data. |
141 | * @vp_rt_data : VP data derived at runtime, not predefined | 141 | * @vp_rt_data : VP data derived at runtime, not predefined |
142 | * @debug_dir : debug directory for this voltage domain. | ||
143 | * @curr_volt : current voltage for this vdd. | 142 | * @curr_volt : current voltage for this vdd. |
144 | * @volt_scale : API to scale the voltage of the vdd. | 143 | * @volt_scale : API to scale the voltage of the vdd. |
145 | */ | 144 | */ |
146 | struct omap_vdd_info { | 145 | struct omap_vdd_info { |
147 | struct omap_volt_data *volt_data; | 146 | struct omap_volt_data *volt_data; |
148 | struct omap_vp_runtime_data vp_rt_data; | 147 | struct omap_vp_runtime_data vp_rt_data; |
149 | struct dentry *debug_dir; | ||
150 | u32 curr_volt; | 148 | u32 curr_volt; |
151 | 149 | ||
152 | int (*volt_scale) (struct voltagedomain *voltdm, | 150 | int (*volt_scale) (struct voltagedomain *voltdm, |
@@ -161,7 +159,6 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm, | |||
161 | struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, | 159 | struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, |
162 | unsigned long volt); | 160 | unsigned long volt); |
163 | unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm); | 161 | unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm); |
164 | struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm); | ||
165 | #ifdef CONFIG_PM | 162 | #ifdef CONFIG_PM |
166 | int omap_voltage_register_pmic(struct voltagedomain *voltdm, | 163 | int omap_voltage_register_pmic(struct voltagedomain *voltdm, |
167 | struct omap_voltdm_pmic *pmic); | 164 | struct omap_voltdm_pmic *pmic); |
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index 53d6018fa678..c9a315f9d3d8 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/kernel.h> | 1 | #include <linux/kernel.h> |
2 | #include <linux/init.h> | 2 | #include <linux/init.h> |
3 | #include <linux/debugfs.h> | ||
4 | 3 | ||
5 | #include <plat/common.h> | 4 | #include <plat/common.h> |
6 | 5 | ||
@@ -10,8 +9,6 @@ | |||
10 | #include "prm-regbits-44xx.h" | 9 | #include "prm-regbits-44xx.h" |
11 | #include "prm44xx.h" | 10 | #include "prm44xx.h" |
12 | 11 | ||
13 | static void __init vp_debugfs_init(struct voltagedomain *voltdm); | ||
14 | |||
15 | static void vp_latch_vsel(struct voltagedomain *voltdm) | 12 | static void vp_latch_vsel(struct voltagedomain *voltdm) |
16 | { | 13 | { |
17 | struct omap_vp_instance *vp = voltdm->vp; | 14 | struct omap_vp_instance *vp = voltdm->vp; |
@@ -87,8 +84,6 @@ void __init omap_vp_init(struct voltagedomain *voltdm) | |||
87 | (vdd->vp_rt_data.vlimitto_timeout << | 84 | (vdd->vp_rt_data.vlimitto_timeout << |
88 | vp->common->vlimitto_timeout_shift)); | 85 | vp->common->vlimitto_timeout_shift)); |
89 | voltdm->write(vp_val, vp->vlimitto); | 86 | voltdm->write(vp_val, vp->vlimitto); |
90 | |||
91 | vp_debugfs_init(voltdm); | ||
92 | } | 87 | } |
93 | 88 | ||
94 | /* VP force update method of voltage scaling */ | 89 | /* VP force update method of voltage scaling */ |
@@ -300,61 +295,3 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
300 | 295 | ||
301 | return; | 296 | return; |
302 | } | 297 | } |
303 | |||
304 | /* Voltage debugfs support */ | ||
305 | static int vp_volt_debug_get(void *data, u64 *val) | ||
306 | { | ||
307 | struct voltagedomain *voltdm = (struct voltagedomain *)data; | ||
308 | struct omap_vp_instance *vp = voltdm->vp; | ||
309 | struct omap_vdd_info *vdd = voltdm->vdd; | ||
310 | u8 vsel; | ||
311 | |||
312 | if (!vdd) { | ||
313 | pr_warning("Wrong paramater passed\n"); | ||
314 | return -EINVAL; | ||
315 | } | ||
316 | |||
317 | vsel = voltdm->read(vp->voltage); | ||
318 | |||
319 | if (!voltdm->pmic->vsel_to_uv) { | ||
320 | pr_warning("PMIC function to convert vsel to voltage" | ||
321 | "in uV not registerd\n"); | ||
322 | return -EINVAL; | ||
323 | } | ||
324 | |||
325 | *val = voltdm->pmic->vsel_to_uv(vsel); | ||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | DEFINE_SIMPLE_ATTRIBUTE(vp_volt_debug_fops, vp_volt_debug_get, NULL, "%llu\n"); | ||
330 | |||
331 | static void __init vp_debugfs_init(struct voltagedomain *voltdm) | ||
332 | { | ||
333 | struct omap_vdd_info *vdd = voltdm->vdd; | ||
334 | struct dentry *debug_dir; | ||
335 | |||
336 | debug_dir = debugfs_create_dir("vp", vdd->debug_dir); | ||
337 | if (IS_ERR(debug_dir)) | ||
338 | pr_err("%s: Unable to create VP debugfs dir dir\n", __func__); | ||
339 | |||
340 | (void) debugfs_create_x16("errorgain", S_IRUGO, debug_dir, | ||
341 | &(vdd->vp_rt_data.vpconfig_errorgain)); | ||
342 | (void) debugfs_create_x16("smpswaittimemin", S_IRUGO, | ||
343 | debug_dir, | ||
344 | &(vdd->vp_rt_data.vstepmin_smpswaittimemin)); | ||
345 | (void) debugfs_create_x8("stepmin", S_IRUGO, debug_dir, | ||
346 | &(vdd->vp_rt_data.vstepmin_stepmin)); | ||
347 | (void) debugfs_create_x16("smpswaittimemax", S_IRUGO, | ||
348 | debug_dir, | ||
349 | &(vdd->vp_rt_data.vstepmax_smpswaittimemax)); | ||
350 | (void) debugfs_create_x8("stepmax", S_IRUGO, debug_dir, | ||
351 | &(vdd->vp_rt_data.vstepmax_stepmax)); | ||
352 | (void) debugfs_create_x8("vddmax", S_IRUGO, debug_dir, | ||
353 | &(vdd->vp_rt_data.vlimitto_vddmax)); | ||
354 | (void) debugfs_create_x8("vddmin", S_IRUGO, debug_dir, | ||
355 | &(vdd->vp_rt_data.vlimitto_vddmin)); | ||
356 | (void) debugfs_create_x16("timeout", S_IRUGO, debug_dir, | ||
357 | &(vdd->vp_rt_data.vlimitto_timeout)); | ||
358 | (void) debugfs_create_file("curr_volt", S_IRUGO, debug_dir, | ||
359 | (void *) voltdm, &vp_volt_debug_fops); | ||
360 | } | ||