Stephen Boyd | 0275f93 | 2012-01-23 18:42:35 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/slab.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/err.h> |
| 17 | #include <linux/module.h> |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 18 | #include <linux/mutex.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 19 | #include <linux/debugfs.h> |
| 20 | #include <linux/list.h> |
| 21 | #include <linux/seq_file.h> |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 22 | #include <linux/uaccess.h> |
| 23 | #include <linux/string.h> |
Stephen Boyd | 5a190a8 | 2012-03-01 14:45:15 -0800 | [diff] [blame] | 24 | #include <linux/clk.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | |
| 26 | #include <mach/msm_xo.h> |
| 27 | #include <mach/rpm.h> |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 28 | #include <mach/socinfo.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 29 | |
| 30 | #include "rpm_resources.h" |
| 31 | |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 32 | static DEFINE_MUTEX(msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 33 | |
| 34 | struct msm_xo { |
| 35 | unsigned votes[NUM_MSM_XO_MODES]; |
| 36 | unsigned mode; |
| 37 | struct list_head voters; |
| 38 | }; |
| 39 | |
| 40 | struct msm_xo_voter { |
| 41 | const char *name; |
| 42 | unsigned mode; |
| 43 | struct msm_xo *xo; |
| 44 | struct list_head list; |
| 45 | }; |
| 46 | |
| 47 | static struct msm_xo msm_xo_sources[NUM_MSM_XO_IDS]; |
| 48 | |
| 49 | #ifdef CONFIG_DEBUG_FS |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 50 | static const char *msm_xo_to_str[NUM_MSM_XO_IDS] = { |
| 51 | [MSM_XO_TCXO_D0] = "D0", |
| 52 | [MSM_XO_TCXO_D1] = "D1", |
| 53 | [MSM_XO_TCXO_A0] = "A0", |
| 54 | [MSM_XO_TCXO_A1] = "A1", |
| 55 | [MSM_XO_TCXO_A2] = "A2", |
| 56 | [MSM_XO_CORE] = "CORE", |
| 57 | }; |
| 58 | |
| 59 | static const char *msm_xo_mode_to_str[NUM_MSM_XO_MODES] = { |
| 60 | [MSM_XO_MODE_ON] = "ON", |
| 61 | [MSM_XO_MODE_PIN_CTRL] = "PIN", |
| 62 | [MSM_XO_MODE_OFF] = "OFF", |
| 63 | }; |
| 64 | |
| 65 | static int msm_xo_debugfs_open(struct inode *inode, struct file *filp) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 66 | { |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 67 | filp->private_data = inode->i_private; |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | static ssize_t msm_xo_debugfs_read(struct file *filp, char __user *ubuf, |
| 72 | size_t cnt, loff_t *ppos) |
| 73 | { |
| 74 | int r; |
| 75 | char buf[10]; |
| 76 | struct msm_xo_voter *xo = filp->private_data; |
| 77 | |
| 78 | r = snprintf(buf, sizeof(buf), "%s\n", msm_xo_mode_to_str[xo->mode]); |
| 79 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); |
| 80 | } |
| 81 | |
| 82 | static ssize_t msm_xo_debugfs_write(struct file *filp, |
| 83 | const char __user *ubuf, size_t cnt, loff_t *ppos) |
| 84 | { |
| 85 | struct msm_xo_voter *xo = filp->private_data; |
| 86 | char buf[10], *b; |
| 87 | int i, ret; |
| 88 | |
| 89 | if (cnt > sizeof(buf) - 1) |
| 90 | return -EINVAL; |
| 91 | |
| 92 | if (copy_from_user(&buf, ubuf, cnt)) |
| 93 | return -EFAULT; |
| 94 | buf[cnt] = '\0'; |
| 95 | b = strstrip(buf); |
| 96 | |
| 97 | for (i = 0; i < ARRAY_SIZE(msm_xo_mode_to_str); i++) |
| 98 | if (!strncasecmp(b, msm_xo_mode_to_str[i], sizeof(buf))) { |
| 99 | ret = msm_xo_mode_vote(xo, i); |
| 100 | return ret ? : cnt; |
| 101 | } |
| 102 | |
| 103 | return -EINVAL; |
| 104 | } |
| 105 | |
| 106 | static const struct file_operations msm_xo_debugfs_fops = { |
| 107 | .open = msm_xo_debugfs_open, |
| 108 | .read = msm_xo_debugfs_read, |
| 109 | .write = msm_xo_debugfs_write, |
| 110 | }; |
| 111 | |
| 112 | static struct dentry *xo_debugfs_root; |
| 113 | static struct msm_xo_voter *xo_debugfs_voters[NUM_MSM_XO_IDS]; |
| 114 | |
| 115 | static int __init msm_xo_init_debugfs_voters(void) |
| 116 | { |
| 117 | int i; |
| 118 | |
| 119 | xo_debugfs_root = debugfs_create_dir("msm_xo", NULL); |
| 120 | if (!xo_debugfs_root) |
| 121 | return -ENOMEM; |
| 122 | |
| 123 | for (i = 0; i < ARRAY_SIZE(msm_xo_sources); i++) { |
| 124 | xo_debugfs_voters[i] = msm_xo_get(i, "debugfs"); |
| 125 | if (IS_ERR(xo_debugfs_voters[i])) |
| 126 | goto err; |
| 127 | debugfs_create_file(msm_xo_to_str[i], S_IRUGO | S_IWUSR, |
| 128 | xo_debugfs_root, xo_debugfs_voters[i], |
| 129 | &msm_xo_debugfs_fops); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 130 | } |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 131 | return 0; |
| 132 | err: |
| 133 | while (--i >= 0) |
| 134 | msm_xo_put(xo_debugfs_voters[i]); |
| 135 | debugfs_remove_recursive(xo_debugfs_root); |
| 136 | return -ENOMEM; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | static void msm_xo_dump_xo(struct seq_file *m, struct msm_xo *xo, |
| 140 | const char *name) |
| 141 | { |
| 142 | struct msm_xo_voter *voter; |
| 143 | |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 144 | seq_printf(m, "CXO %-16s%s\n", name, msm_xo_mode_to_str[xo->mode]); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 145 | list_for_each_entry(voter, &xo->voters, list) |
| 146 | seq_printf(m, " %s %-16s %s\n", |
| 147 | xo->mode == voter->mode ? "*" : " ", |
| 148 | voter->name, |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 149 | msm_xo_mode_to_str[voter->mode]); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | static int msm_xo_show_voters(struct seq_file *m, void *v) |
| 153 | { |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 154 | int i; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 155 | |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 156 | mutex_lock(&msm_xo_lock); |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 157 | for (i = 0; i < ARRAY_SIZE(msm_xo_sources); i++) |
| 158 | msm_xo_dump_xo(m, &msm_xo_sources[i], msm_xo_to_str[i]); |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 159 | mutex_unlock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 160 | |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | static int msm_xo_voters_open(struct inode *inode, struct file *file) |
| 165 | { |
| 166 | return single_open(file, msm_xo_show_voters, inode->i_private); |
| 167 | } |
| 168 | |
| 169 | static const struct file_operations msm_xo_voters_ops = { |
| 170 | .open = msm_xo_voters_open, |
| 171 | .read = seq_read, |
| 172 | .llseek = seq_lseek, |
| 173 | .release = seq_release, |
| 174 | }; |
| 175 | |
| 176 | static int __init msm_xo_debugfs_init(void) |
| 177 | { |
Stephen Boyd | b60f386 | 2012-02-22 15:18:45 -0800 | [diff] [blame] | 178 | msm_xo_init_debugfs_voters(); |
| 179 | if (!debugfs_create_file("xo_voters", S_IRUGO, NULL, NULL, |
| 180 | &msm_xo_voters_ops)) |
| 181 | return -ENOMEM; |
| 182 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 183 | } |
Stephen Boyd | a70c543 | 2012-02-10 14:31:45 -0800 | [diff] [blame] | 184 | #else |
| 185 | static int __init msm_xo_debugfs_init(void) { return 0; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 186 | #endif |
| 187 | |
| 188 | static int msm_xo_update_vote(struct msm_xo *xo) |
| 189 | { |
| 190 | int ret; |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 191 | unsigned vote, prev_vote = xo->mode; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 192 | struct msm_rpm_iv_pair cmd; |
| 193 | |
| 194 | if (xo->votes[MSM_XO_MODE_ON]) |
| 195 | vote = MSM_XO_MODE_ON; |
| 196 | else if (xo->votes[MSM_XO_MODE_PIN_CTRL]) |
| 197 | vote = MSM_XO_MODE_PIN_CTRL; |
| 198 | else |
| 199 | vote = MSM_XO_MODE_OFF; |
| 200 | |
| 201 | if (vote == prev_vote) |
| 202 | return 0; |
| 203 | |
| 204 | /* |
| 205 | * Change the vote here to simplify the TCXO logic. If the RPM |
| 206 | * command fails we'll rollback. |
| 207 | */ |
| 208 | xo->mode = vote; |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 209 | cmd.id = MSM_RPM_ID_CXO_BUFFERS; |
| 210 | cmd.value = (msm_xo_sources[MSM_XO_TCXO_D0].mode << 0) | |
| 211 | (msm_xo_sources[MSM_XO_TCXO_D1].mode << 8) | |
| 212 | (msm_xo_sources[MSM_XO_TCXO_A0].mode << 16) | |
| 213 | (msm_xo_sources[MSM_XO_TCXO_A1].mode << 24) | |
| 214 | (msm_xo_sources[MSM_XO_TCXO_A2].mode << 28) | |
| 215 | /* |
| 216 | * 8660 RPM has XO_CORE at bit 18 and 8960 RPM has |
| 217 | * XO_CORE at bit 20. Since the opposite bit is |
| 218 | * reserved in both cases, just set both and be |
| 219 | * done with it. |
| 220 | */ |
| 221 | ((msm_xo_sources[MSM_XO_CORE].mode ? 1 : 0) << 20) | |
| 222 | ((msm_xo_sources[MSM_XO_CORE].mode ? 1 : 0) << 18); |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 223 | ret = msm_rpm_set(MSM_RPM_CTX_SET_0, &cmd, 1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 224 | |
| 225 | if (ret) |
| 226 | xo->mode = prev_vote; |
| 227 | |
| 228 | return ret; |
| 229 | } |
| 230 | |
| 231 | static int __msm_xo_mode_vote(struct msm_xo_voter *xo_voter, unsigned mode) |
| 232 | { |
| 233 | int ret; |
| 234 | struct msm_xo *xo = xo_voter->xo; |
Stephen Boyd | 5a190a8 | 2012-03-01 14:45:15 -0800 | [diff] [blame] | 235 | int is_d0 = xo == &msm_xo_sources[MSM_XO_TCXO_D0]; |
| 236 | int needs_workaround = cpu_is_msm8960() || cpu_is_apq8064() || |
Stepan Moskovchenko | 0df9bb2 | 2012-07-06 18:19:15 -0700 | [diff] [blame] | 237 | cpu_is_msm8930() || cpu_is_msm8930aa() || |
Stepan Moskovchenko | 9c74926 | 2012-07-09 19:30:44 -0700 | [diff] [blame] | 238 | cpu_is_msm9615() || cpu_is_msm8627() || |
| 239 | cpu_is_msm8960ab(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 240 | |
| 241 | if (xo_voter->mode == mode) |
| 242 | return 0; |
| 243 | |
| 244 | xo->votes[mode]++; |
| 245 | xo->votes[xo_voter->mode]--; |
| 246 | ret = msm_xo_update_vote(xo); |
| 247 | if (ret) { |
| 248 | xo->votes[xo_voter->mode]++; |
| 249 | xo->votes[mode]--; |
| 250 | goto out; |
| 251 | } |
Stephen Boyd | 5a190a8 | 2012-03-01 14:45:15 -0800 | [diff] [blame] | 252 | /* TODO: Remove once RPM separates the concept of D0 and CXO */ |
| 253 | if (is_d0 && needs_workaround) { |
| 254 | static struct clk *xo_clk; |
| 255 | |
| 256 | if (!xo_clk) { |
| 257 | xo_clk = clk_get_sys("msm_xo", "xo"); |
| 258 | BUG_ON(IS_ERR(xo_clk)); |
| 259 | } |
| 260 | /* Ignore transitions from pin to on or vice versa */ |
| 261 | if (mode && xo_voter->mode == MSM_XO_MODE_OFF) |
Stephen Boyd | 9f70b9b | 2012-08-03 11:41:27 -0700 | [diff] [blame] | 262 | clk_prepare_enable(xo_clk); |
Stephen Boyd | 5a190a8 | 2012-03-01 14:45:15 -0800 | [diff] [blame] | 263 | else if (!mode) |
Stephen Boyd | 9f70b9b | 2012-08-03 11:41:27 -0700 | [diff] [blame] | 264 | clk_disable_unprepare(xo_clk); |
Stephen Boyd | 5a190a8 | 2012-03-01 14:45:15 -0800 | [diff] [blame] | 265 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 266 | xo_voter->mode = mode; |
| 267 | out: |
| 268 | return ret; |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * msm_xo_mode_vote() - Vote for an XO to be ON, OFF, or under PIN_CTRL |
| 273 | * @xo_voter - Valid handle returned from msm_xo_get() |
| 274 | * @mode - Mode to vote for (ON, OFF, PIN_CTRL) |
| 275 | * |
| 276 | * Vote for an XO to be either ON, OFF, or under PIN_CTRL. Votes are |
| 277 | * aggregated with ON taking precedence over PIN_CTRL taking precedence |
| 278 | * over OFF. |
| 279 | * |
| 280 | * This function returns 0 on success or a negative error code on failure. |
| 281 | */ |
| 282 | int msm_xo_mode_vote(struct msm_xo_voter *xo_voter, enum msm_xo_modes mode) |
| 283 | { |
| 284 | int ret; |
Tianyi Gou | c531491 | 2011-10-25 16:44:54 -0700 | [diff] [blame] | 285 | |
| 286 | if (!xo_voter) |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 287 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 288 | |
Tianyi Gou | c531491 | 2011-10-25 16:44:54 -0700 | [diff] [blame] | 289 | if (mode >= NUM_MSM_XO_MODES || IS_ERR(xo_voter)) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 290 | return -EINVAL; |
| 291 | |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 292 | mutex_lock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 293 | ret = __msm_xo_mode_vote(xo_voter, mode); |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 294 | mutex_unlock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 295 | |
| 296 | return ret; |
| 297 | } |
| 298 | EXPORT_SYMBOL(msm_xo_mode_vote); |
| 299 | |
| 300 | /** |
| 301 | * msm_xo_get() - Get a voting handle for an XO |
| 302 | * @xo_id - XO identifier |
| 303 | * @voter - Debug string to identify users |
| 304 | * |
| 305 | * XO voters vote for OFF by default. This function returns a pointer |
| 306 | * indicating success. An ERR_PTR is returned on failure. |
| 307 | * |
| 308 | * If XO voting is disabled, %NULL is returned. |
| 309 | */ |
| 310 | struct msm_xo_voter *msm_xo_get(enum msm_xo_ids xo_id, const char *voter) |
| 311 | { |
| 312 | int ret; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 313 | struct msm_xo_voter *xo_voter; |
| 314 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 315 | if (xo_id >= NUM_MSM_XO_IDS) { |
| 316 | ret = -EINVAL; |
| 317 | goto err; |
| 318 | } |
| 319 | |
| 320 | xo_voter = kzalloc(sizeof(*xo_voter), GFP_KERNEL); |
| 321 | if (!xo_voter) { |
| 322 | ret = -ENOMEM; |
| 323 | goto err; |
| 324 | } |
| 325 | |
| 326 | xo_voter->name = kstrdup(voter, GFP_KERNEL); |
| 327 | if (!xo_voter->name) { |
| 328 | ret = -ENOMEM; |
| 329 | goto err_name; |
| 330 | } |
| 331 | |
| 332 | xo_voter->xo = &msm_xo_sources[xo_id]; |
| 333 | |
| 334 | /* Voters vote for OFF by default */ |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 335 | mutex_lock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 336 | xo_voter->xo->votes[MSM_XO_MODE_OFF]++; |
| 337 | list_add(&xo_voter->list, &xo_voter->xo->voters); |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 338 | mutex_unlock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 339 | |
| 340 | return xo_voter; |
| 341 | |
| 342 | err_name: |
| 343 | kfree(xo_voter); |
| 344 | err: |
| 345 | return ERR_PTR(ret); |
| 346 | } |
| 347 | EXPORT_SYMBOL(msm_xo_get); |
| 348 | |
| 349 | /** |
| 350 | * msm_xo_put() - Release a voting handle |
| 351 | * @xo_voter - Valid handle returned from msm_xo_get() |
| 352 | * |
| 353 | * Release a reference to an XO voting handle. This also removes the voter's |
| 354 | * vote, therefore calling msm_xo_mode_vote(xo_voter, MSM_XO_MODE_OFF) |
| 355 | * beforehand is unnecessary. |
| 356 | */ |
| 357 | void msm_xo_put(struct msm_xo_voter *xo_voter) |
| 358 | { |
Tianyi Gou | c531491 | 2011-10-25 16:44:54 -0700 | [diff] [blame] | 359 | if (!xo_voter || IS_ERR(xo_voter)) |
| 360 | return; |
| 361 | |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 362 | mutex_lock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 363 | __msm_xo_mode_vote(xo_voter, MSM_XO_MODE_OFF); |
| 364 | xo_voter->xo->votes[MSM_XO_MODE_OFF]--; |
| 365 | list_del(&xo_voter->list); |
Stephen Boyd | c8357a9 | 2012-04-04 13:54:38 -0700 | [diff] [blame] | 366 | mutex_unlock(&msm_xo_lock); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 367 | |
| 368 | kfree(xo_voter->name); |
| 369 | kfree(xo_voter); |
| 370 | } |
| 371 | EXPORT_SYMBOL(msm_xo_put); |
| 372 | |
| 373 | int __init msm_xo_init(void) |
| 374 | { |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 375 | int i, ret; |
| 376 | struct msm_rpm_iv_pair cmd[1]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 377 | |
| 378 | for (i = 0; i < ARRAY_SIZE(msm_xo_sources); i++) |
| 379 | INIT_LIST_HEAD(&msm_xo_sources[i].voters); |
| 380 | |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 381 | cmd[0].id = MSM_RPM_ID_CXO_BUFFERS; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 382 | cmd[0].value = 0; |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 383 | ret = msm_rpmrs_set(MSM_RPM_CTX_SET_0, cmd, ARRAY_SIZE(cmd)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 384 | if (ret) |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 385 | return ret; |
Stephen Boyd | a70c543 | 2012-02-10 14:31:45 -0800 | [diff] [blame] | 386 | msm_xo_debugfs_init(); |
Stephen Boyd | 47239d5 | 2012-01-26 14:38:40 -0800 | [diff] [blame] | 387 | return 0; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 388 | } |