aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorSteve Muckle <smuckle@quicinc.com>2008-12-12 19:33:55 -0500
committerDaniel Walker <dwalker@codeaurora.org>2010-05-12 12:14:36 -0400
commit4783de9bba3dd607e6aa4d0a7dd598d9094c044c (patch)
treea4b3b18d2715181940349682598f835b0e299fbb /arch/arm
parent0c50b444b69f49e38d16b974993a626ad74c59a7 (diff)
arm: msm: status for vreg
Keep track of the success/failure of the last vreg proc comm command, and return that on debugfs reads. Signed-off-by: Steve Muckle <smuckle@quicinc.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-msm/include/mach/vreg.h2
-rw-r--r--arch/arm/mach-msm/vreg.c90
2 files changed, 54 insertions, 38 deletions
diff --git a/arch/arm/mach-msm/include/mach/vreg.h b/arch/arm/mach-msm/include/mach/vreg.h
index 9f9e25cb718..6626e7864e2 100644
--- a/arch/arm/mach-msm/include/mach/vreg.h
+++ b/arch/arm/mach-msm/include/mach/vreg.h
@@ -23,7 +23,7 @@ struct vreg *vreg_get(struct device *dev, const char *id);
23void vreg_put(struct vreg *vreg); 23void vreg_put(struct vreg *vreg);
24 24
25int vreg_enable(struct vreg *vreg); 25int vreg_enable(struct vreg *vreg);
26void vreg_disable(struct vreg *vreg); 26int vreg_disable(struct vreg *vreg);
27int vreg_set_level(struct vreg *vreg, unsigned mv); 27int vreg_set_level(struct vreg *vreg, unsigned mv);
28 28
29#endif 29#endif
diff --git a/arch/arm/mach-msm/vreg.c b/arch/arm/mach-msm/vreg.c
index a839e1913c5..8b0f7b2fd8f 100644
--- a/arch/arm/mach-msm/vreg.c
+++ b/arch/arm/mach-msm/vreg.c
@@ -1,6 +1,7 @@
1/* arch/arm/mach-msm/vreg.c 1/* arch/arm/mach-msm/vreg.c
2 * 2 *
3 * Copyright (C) 2008 Google, Inc. 3 * Copyright (C) 2008 Google, Inc.
4 * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
4 * Author: Brian Swetland <swetland@google.com> 5 * Author: Brian Swetland <swetland@google.com>
5 * 6 *
6 * This software is licensed under the terms of the GNU General Public 7 * This software is licensed under the terms of the GNU General Public
@@ -25,42 +26,44 @@
25struct vreg { 26struct vreg {
26 const char *name; 27 const char *name;
27 unsigned id; 28 unsigned id;
29 int status;
28}; 30};
29 31
30#define VREG(_name, _id) { .name = _name, .id = _id, } 32#define VREG(_name, _id, _status) \
33 { .name = _name, .id = _id, .status = _status }
31 34
32static struct vreg vregs[] = { 35static struct vreg vregs[] = {
33 VREG("msma", 0), 36 VREG("msma", 0, 0),
34 VREG("msmp", 1), 37 VREG("msmp", 1, 0),
35 VREG("msme1", 2), 38 VREG("msme1", 2, 0),
36 VREG("msmc1", 3), 39 VREG("msmc1", 3, 0),
37 VREG("msmc2", 4), 40 VREG("msmc2", 4, 0),
38 VREG("gp3", 5), 41 VREG("gp3", 5, 0),
39 VREG("msme2", 6), 42 VREG("msme2", 6, 0),
40 VREG("gp4", 7), 43 VREG("gp4", 7, 0),
41 VREG("gp1", 8), 44 VREG("gp1", 8, 0),
42 VREG("tcxo", 9), 45 VREG("tcxo", 9, 0),
43 VREG("pa", 10), 46 VREG("pa", 10, 0),
44 VREG("rftx", 11), 47 VREG("rftx", 11, 0),
45 VREG("rfrx1", 12), 48 VREG("rfrx1", 12, 0),
46 VREG("rfrx2", 13), 49 VREG("rfrx2", 13, 0),
47 VREG("synt", 14), 50 VREG("synt", 14, 0),
48 VREG("wlan", 15), 51 VREG("wlan", 15, 0),
49 VREG("usb", 16), 52 VREG("usb", 16, 0),
50 VREG("boost", 17), 53 VREG("boost", 17, 0),
51 VREG("mmc", 18), 54 VREG("mmc", 18, 0),
52 VREG("ruim", 19), 55 VREG("ruim", 19, 0),
53 VREG("msmc0", 20), 56 VREG("msmc0", 20, 0),
54 VREG("gp2", 21), 57 VREG("gp2", 21, 0),
55 VREG("gp5", 22), 58 VREG("gp5", 22, 0),
56 VREG("gp6", 23), 59 VREG("gp6", 23, 0),
57 VREG("rf", 24), 60 VREG("rf", 24, 0),
58 VREG("rf_vco", 26), 61 VREG("rf_vco", 26, 0),
59 VREG("mpll", 27), 62 VREG("mpll", 27, 0),
60 VREG("s2", 28), 63 VREG("s2", 28, 0),
61 VREG("s3", 29), 64 VREG("s3", 29, 0),
62 VREG("rfubm", 30), 65 VREG("rfubm", 30, 0),
63 VREG("ncp", 31), 66 VREG("ncp", 31, 0),
64}; 67};
65 68
66struct vreg *vreg_get(struct device *dev, const char *id) 69struct vreg *vreg_get(struct device *dev, const char *id)
@@ -81,20 +84,26 @@ int vreg_enable(struct vreg *vreg)
81{ 84{
82 unsigned id = vreg->id; 85 unsigned id = vreg->id;
83 unsigned enable = 1; 86 unsigned enable = 1;
84 return msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable); 87
88 vreg->status = msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable);
89 return vreg->status;
85} 90}
86 91
87void vreg_disable(struct vreg *vreg) 92int vreg_disable(struct vreg *vreg)
88{ 93{
89 unsigned id = vreg->id; 94 unsigned id = vreg->id;
90 unsigned enable = 0; 95 unsigned enable = 0;
91 msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable); 96
97 vreg->status = msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable);
98 return vreg->status;
92} 99}
93 100
94int vreg_set_level(struct vreg *vreg, unsigned mv) 101int vreg_set_level(struct vreg *vreg, unsigned mv)
95{ 102{
96 unsigned id = vreg->id; 103 unsigned id = vreg->id;
97 return msm_proc_comm(PCOM_VREG_SET_LEVEL, &id, &mv); 104
105 vreg->status = msm_proc_comm(PCOM_VREG_SET_LEVEL, &id, &mv);
106 return vreg->status;
98} 107}
99 108
100#if defined(CONFIG_DEBUG_FS) 109#if defined(CONFIG_DEBUG_FS)
@@ -118,7 +127,14 @@ static int vreg_debug_set(void *data, u64 val)
118 127
119static int vreg_debug_get(void *data, u64 *val) 128static int vreg_debug_get(void *data, u64 *val)
120{ 129{
121 return -ENOSYS; 130 struct vreg *vreg = data;
131
132 if (!vreg->status)
133 *val = 0;
134 else
135 *val = 1;
136
137 return 0;
122} 138}
123 139
124DEFINE_SIMPLE_ATTRIBUTE(vreg_fops, vreg_debug_get, vreg_debug_set, "%llu\n"); 140DEFINE_SIMPLE_ATTRIBUTE(vreg_fops, vreg_debug_get, vreg_debug_set, "%llu\n");