blob: b6d532424f59b16f453626b3e3e36ef3f897820c [file] [log] [blame]
Maheshkumar Sivasubramanian4ac23762011-11-02 10:03:06 -06001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/io.h>
19#include <linux/slab.h>
20#include <mach/msm_iomap.h>
21
22#include "spm_driver.h"
23
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -060024#define MSM_SPM_PMIC_STATE_IDLE 0
25
26#define SAW2_V1_VER_REG 0x04
27#define SAW2_V2_VER_REG 0xfd0
28
29#define SAW2_MAJOR_2 2
30
31
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032enum {
33 MSM_SPM_DEBUG_SHADOW = 1U << 0,
34 MSM_SPM_DEBUG_VCTL = 1U << 1,
35};
36
37static int msm_spm_debug_mask;
38module_param_named(
39 debug_mask, msm_spm_debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP
40);
41
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -060043static uint32_t msm_spm_reg_offsets_v1[MSM_SPM_REG_NR] = {
44 [MSM_SPM_REG_SAW2_SECURE] = 0x00,
45 [MSM_SPM_REG_SAW2_ID] = 0x04,
46 [MSM_SPM_REG_SAW2_CFG] = 0x08,
47 [MSM_SPM_REG_SAW2_STS0] = 0x0C,
48 [MSM_SPM_REG_SAW2_STS1] = 0x10,
49 [MSM_SPM_REG_SAW2_VCTL] = 0x14,
50 [MSM_SPM_REG_SAW2_AVS_CTL] = 0x18,
51 [MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x1C,
52 [MSM_SPM_REG_SAW2_SPM_CTL] = 0x20,
53 [MSM_SPM_REG_SAW2_PMIC_DLY] = 0x24,
54 [MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x28,
55 [MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x2C,
56 [MSM_SPM_REG_SAW2_RST] = 0x30,
57 [MSM_SPM_REG_SAW2_SEQ_ENTRY] = 0x80,
58};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070059
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -060060static uint32_t msm_spm_reg_offsets_v2[MSM_SPM_REG_NR] = {
61 [MSM_SPM_REG_SAW2_SECURE] = 0x00,
62 [MSM_SPM_REG_SAW2_ID] = 0x04,
63 [MSM_SPM_REG_SAW2_CFG] = 0x08,
64 [MSM_SPM_REG_SAW2_SPM_STS] = 0x0C,
65 [MSM_SPM_REG_SAW2_AVS_STS] = 0x10,
66 [MSM_SPM_REG_SAW2_PMIC_STS] = 0x14,
67 [MSM_SPM_REG_SAW2_RST] = 0x18,
68 [MSM_SPM_REG_SAW2_VCTL] = 0x1C,
69 [MSM_SPM_REG_SAW2_AVS_CTL] = 0x20,
70 [MSM_SPM_REG_SAW2_AVS_LIMIT] = 0x24,
71 [MSM_SPM_REG_SAW2_AVS_DLY] = 0x28,
72 [MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x2C,
73 [MSM_SPM_REG_SAW2_SPM_CTL] = 0x30,
74 [MSM_SPM_REG_SAW2_SPM_DLY] = 0x34,
75 [MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x40,
76 [MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x44,
77 [MSM_SPM_REG_SAW2_PMIC_DATA_2] = 0x48,
78 [MSM_SPM_REG_SAW2_PMIC_DATA_3] = 0x4C,
79 [MSM_SPM_REG_SAW2_PMIC_DATA_4] = 0x50,
80 [MSM_SPM_REG_SAW2_PMIC_DATA_5] = 0x54,
81 [MSM_SPM_REG_SAW2_PMIC_DATA_6] = 0x58,
82 [MSM_SPM_REG_SAW2_PMIC_DATA_7] = 0x5C,
83 [MSM_SPM_REG_SAW2_SEQ_ENTRY] = 0x80,
84 [MSM_SPM_REG_SAW2_VERSION] = 0xFD0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085};
86
87/******************************************************************************
88 * Internal helper functions
89 *****************************************************************************/
90
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -060091static inline uint32_t msm_spm_drv_get_num_spm_entry(
92 struct msm_spm_driver_data *dev)
93{
94 return 32;
95}
96
97static void msm_spm_drv_flush_shadow(struct msm_spm_driver_data *dev,
98 unsigned int reg_index)
99{
100 __raw_writel(dev->reg_shadow[reg_index],
101 dev->reg_base_addr + dev->reg_offsets[reg_index]);
102}
103
104static void msm_spm_drv_load_shadow(struct msm_spm_driver_data *dev,
105 unsigned int reg_index)
106{
107 dev->reg_shadow[reg_index] =
108 __raw_readl(dev->reg_base_addr +
109 dev->reg_offsets[reg_index]);
110}
111
112static inline void msm_spm_drv_set_start_addr(
113 struct msm_spm_driver_data *dev, uint32_t addr)
114{
115 addr &= 0x7F;
116 addr <<= 4;
117 dev->reg_shadow[MSM_SPM_REG_SAW2_SPM_CTL] &= 0xFFFFF80F;
118 dev->reg_shadow[MSM_SPM_REG_SAW2_SPM_CTL] |= addr;
119}
120
121static inline bool msm_spm_pmic_arb_present(struct msm_spm_driver_data *dev)
122{
123 msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW2_ID);
124
125 if (dev->major == SAW2_MAJOR_2)
126 return (dev->reg_shadow[MSM_SPM_REG_SAW2_ID] >> 2) & 0x1;
127 else
128 return (dev->reg_shadow[MSM_SPM_REG_SAW2_ID] >> 18) & 0x1;
129}
130
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700131static inline void msm_spm_drv_set_vctl(struct msm_spm_driver_data *dev,
132 uint32_t vlevel)
133{
134 dev->reg_shadow[MSM_SPM_REG_SAW2_VCTL] &= ~0xFF;
135 dev->reg_shadow[MSM_SPM_REG_SAW2_VCTL] |= vlevel;
136
137 dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_0] &= ~0xFF;
138 dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_0] |= vlevel;
Praveen Chidambaramf3f2b3e2012-03-21 20:13:38 -0600139
140 dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_1] &= ~0x3F;
141 dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_1] |= (vlevel & 0x3F);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700142}
143
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600144static inline void msm_spm_drv_set_vctl2(struct msm_spm_driver_data *dev,
145 uint32_t vlevel)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700146{
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600147 unsigned int pmic_data = 0;
148
149 pmic_data |= vlevel;
150 pmic_data |= (dev->vctl_port & 0x7) << 16;
151
152 dev->reg_shadow[MSM_SPM_REG_SAW2_VCTL] &= ~0x700FF;
153 dev->reg_shadow[MSM_SPM_REG_SAW2_VCTL] |= pmic_data;
154
155 dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_0] &= ~0x700FF;
156 dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_0] |= pmic_data;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700157}
158
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600159static inline void msm_spm_drv_apcs_set_vctl(struct msm_spm_driver_data *dev,
160 unsigned int vlevel)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700161{
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600162 if (dev->major == SAW2_MAJOR_2)
163 return msm_spm_drv_set_vctl2(dev, vlevel);
164 else
165 return msm_spm_drv_set_vctl(dev, vlevel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166}
167
168static inline uint32_t msm_spm_drv_get_sts_pmic_state(
169 struct msm_spm_driver_data *dev)
170{
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600171 if (dev->major == SAW2_MAJOR_2) {
172 msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW2_PMIC_STS);
173 return (dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_STS] >> 16) &
174 0x03;
175 } else {
176 msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW2_STS0);
177 return (dev->reg_shadow[MSM_SPM_REG_SAW2_STS0] >> 10) & 0x03;
178 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700179}
180
181static inline uint32_t msm_spm_drv_get_sts_curr_pmic_data(
182 struct msm_spm_driver_data *dev)
183{
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600184 if (dev->major == SAW2_MAJOR_2) {
185 msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW2_PMIC_STS);
186 return dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_STS] & 0xFF;
187 } else {
188 msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW2_STS1);
189 return dev->reg_shadow[MSM_SPM_REG_SAW2_STS1] & 0xFF;
190 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191}
192
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600193static inline uint32_t msm_spm_drv_get_saw2_ver(struct msm_spm_driver_data *dev,
194 uint32_t *major, uint32_t *minor)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195{
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600196 int ret = -ENODEV;
197 uint32_t val = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700198
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600199 msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW2_VERSION);
200 val = dev->reg_shadow[MSM_SPM_REG_SAW2_VERSION];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700201
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600202 if (dev->ver_reg == SAW2_V2_VER_REG) {
203 *major = (val >> 28) & 0xF;
204 *minor = (val >> 16) & 0xFFF;
205 ret = 0;
206 } else if (dev->ver_reg == SAW2_V1_VER_REG) {
207 *major = (val >> 4) & 0xF;
208 *minor = val & 0xF;
209 ret = 0;
210 }
211
212 return ret;
213}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700214
215/******************************************************************************
216 * Public functions
217 *****************************************************************************/
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600218
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700219inline int msm_spm_drv_set_spm_enable(
220 struct msm_spm_driver_data *dev, bool enable)
221{
222 uint32_t value = enable ? 0x01 : 0x00;
223
224 if (!dev)
225 return -EINVAL;
226
227 if ((dev->reg_shadow[MSM_SPM_REG_SAW2_SPM_CTL] & 0x01) ^ value) {
228
229 dev->reg_shadow[MSM_SPM_REG_SAW2_SPM_CTL] &= ~0x1;
230 dev->reg_shadow[MSM_SPM_REG_SAW2_SPM_CTL] |= value;
231
232 msm_spm_drv_flush_shadow(dev, MSM_SPM_REG_SAW2_SPM_CTL);
233 wmb();
234 }
235 return 0;
236}
237void msm_spm_drv_flush_seq_entry(struct msm_spm_driver_data *dev)
238{
239 int i;
240 int num_spm_entry = msm_spm_drv_get_num_spm_entry(dev);
241
242 if (!dev) {
243 __WARN();
244 return;
245 }
246
247 for (i = 0; i < num_spm_entry; i++) {
248 __raw_writel(dev->reg_seq_entry_shadow[i],
249 dev->reg_base_addr
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600250 + dev->reg_offsets[MSM_SPM_REG_SAW2_SEQ_ENTRY]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700251 + 4 * i);
252 }
253 mb();
254}
255
256int msm_spm_drv_write_seq_data(struct msm_spm_driver_data *dev,
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600257 uint8_t *cmd, uint32_t *offset)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258{
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600259 uint32_t cmd_w;
260 uint32_t offset_w = *offset / 4;
261 uint8_t last_cmd;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600263 if (!cmd)
264 return -EINVAL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265
266 while (1) {
267 int i;
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600268 cmd_w = 0;
269 last_cmd = 0;
270 cmd_w = dev->reg_seq_entry_shadow[offset_w];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700271
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600272 for (i = (*offset % 4) ; i < 4; i++) {
273 last_cmd = *(cmd++);
274 cmd_w |= last_cmd << (i * 8);
275 (*offset)++;
276 if (last_cmd == 0x0f)
277 break;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700278 }
279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280 dev->reg_seq_entry_shadow[offset_w++] = cmd_w;
281 if (last_cmd == 0x0f)
282 break;
283 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700284
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600285 return 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286}
287
288int msm_spm_drv_set_low_power_mode(struct msm_spm_driver_data *dev,
289 uint32_t addr)
290{
291
292 /* SPM is configured to reset start address to zero after end of Program
293 */
294 if (!dev)
295 return -EINVAL;
296
297 msm_spm_drv_set_start_addr(dev, addr);
298
Maheshkumar Sivasubramaniandaa23bb2011-07-01 17:24:51 -0600299 msm_spm_drv_flush_shadow(dev, MSM_SPM_REG_SAW2_SPM_CTL);
300 wmb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700301
302 if (msm_spm_debug_mask & MSM_SPM_DEBUG_SHADOW) {
303 int i;
304 for (i = 0; i < MSM_SPM_REG_NR; i++)
305 pr_info("%s: reg %02x = 0x%08x\n", __func__,
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600306 dev->reg_offsets[i], dev->reg_shadow[i]);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700307 }
308
309 return 0;
310}
311
312int msm_spm_drv_set_vdd(struct msm_spm_driver_data *dev, unsigned int vlevel)
313{
314 uint32_t timeout_us;
315
316 if (!dev)
317 return -EINVAL;
318
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600319 if (!msm_spm_pmic_arb_present(dev))
320 return -ENOSYS;
321
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 if (msm_spm_debug_mask & MSM_SPM_DEBUG_VCTL)
323 pr_info("%s: requesting vlevel 0x%x\n",
324 __func__, vlevel);
325
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600326 msm_spm_drv_apcs_set_vctl(dev, vlevel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327 msm_spm_drv_flush_shadow(dev, MSM_SPM_REG_SAW2_VCTL);
328 msm_spm_drv_flush_shadow(dev, MSM_SPM_REG_SAW2_PMIC_DATA_0);
Praveen Chidambaramf3f2b3e2012-03-21 20:13:38 -0600329 msm_spm_drv_flush_shadow(dev, MSM_SPM_REG_SAW2_PMIC_DATA_1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330 mb();
331
332 /* Wait for PMIC state to return to idle or until timeout */
333 timeout_us = dev->vctl_timeout_us;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334 while (msm_spm_drv_get_sts_pmic_state(dev) != MSM_SPM_PMIC_STATE_IDLE) {
335 if (!timeout_us)
336 goto set_vdd_bail;
337
338 if (timeout_us > 10) {
339 udelay(10);
340 timeout_us -= 10;
341 } else {
342 udelay(timeout_us);
343 timeout_us = 0;
344 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 }
346
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347 if (msm_spm_drv_get_sts_curr_pmic_data(dev) != vlevel)
348 goto set_vdd_bail;
349
350 if (msm_spm_debug_mask & MSM_SPM_DEBUG_VCTL)
351 pr_info("%s: done, remaining timeout %uus\n",
352 __func__, timeout_us);
353
354 return 0;
355
356set_vdd_bail:
357 pr_err("%s: failed, remaining timeout %uus, vlevel 0x%x\n",
358 __func__, timeout_us, msm_spm_drv_get_sts_curr_pmic_data(dev));
359 return -EIO;
360}
361
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600362int msm_spm_drv_set_phase(struct msm_spm_driver_data *dev,
363 unsigned int phase_cnt)
364{
365 unsigned int pmic_data = 0;
366 unsigned int timeout_us = 0;
367
368 if (dev->major != SAW2_MAJOR_2)
369 return -ENODEV;
370
371 pmic_data |= phase_cnt & 0xFF;
372 pmic_data |= (dev->phase_port & 0x7) << 16;
373
374 dev->reg_shadow[MSM_SPM_REG_SAW2_VCTL] &= ~0x700FF;
375 dev->reg_shadow[MSM_SPM_REG_SAW2_VCTL] |= pmic_data;
376 msm_spm_drv_flush_shadow(dev, MSM_SPM_REG_SAW2_VCTL);
377 mb();
378
379 /* Wait for PMIC state to return to idle or until timeout */
380 timeout_us = dev->vctl_timeout_us;
381 while (msm_spm_drv_get_sts_pmic_state(dev) != MSM_SPM_PMIC_STATE_IDLE) {
382 if (!timeout_us)
383 goto set_phase_bail;
384
385 if (timeout_us > 10) {
386 udelay(10);
387 timeout_us -= 10;
388 } else {
389 udelay(timeout_us);
390 timeout_us = 0;
391 }
392 }
393
394 if (msm_spm_drv_get_sts_curr_pmic_data(dev) != phase_cnt)
395 goto set_phase_bail;
396
397 if (msm_spm_debug_mask & MSM_SPM_DEBUG_VCTL)
398 pr_info("%s: done, remaining timeout %uus\n",
399 __func__, timeout_us);
400
401 return 0;
402
403set_phase_bail:
404 pr_err("%s: failed, remaining timeout %uus, phase count %d\n",
405 __func__, timeout_us, msm_spm_drv_get_sts_curr_pmic_data(dev));
406 return -EIO;
407
408}
409
Maheshkumar Sivasubramanian4ac23762011-11-02 10:03:06 -0600410void msm_spm_drv_reinit(struct msm_spm_driver_data *dev)
411{
412 int i;
413
414 for (i = 0; i < MSM_SPM_REG_NR_INITIALIZE; i++)
415 msm_spm_drv_flush_shadow(dev, i);
416
417 msm_spm_drv_flush_seq_entry(dev);
418 mb();
419}
420
Stephen Boyddb354112012-05-09 14:24:58 -0700421int __devinit msm_spm_drv_init(struct msm_spm_driver_data *dev,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700422 struct msm_spm_platform_data *data)
423{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700424 int i;
425 int num_spm_entry;
426
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700427 BUG_ON(!dev || !data);
428
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600429 if (dev->ver_reg == SAW2_V2_VER_REG)
430 dev->reg_offsets = msm_spm_reg_offsets_v2;
431 else
432 dev->reg_offsets = msm_spm_reg_offsets_v1;
433
434 dev->vctl_port = data->vctl_port;
435 dev->phase_port = data->phase_port;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700436 dev->reg_base_addr = data->reg_base_addr;
437 memcpy(dev->reg_shadow, data->reg_init_values,
438 sizeof(data->reg_init_values));
439
440 dev->vctl_timeout_us = data->vctl_timeout_us;
441
442 for (i = 0; i < MSM_SPM_REG_NR_INITIALIZE; i++)
443 msm_spm_drv_flush_shadow(dev, i);
444 /* barrier to ensure write completes before we update shadow
445 * registers
446 */
447 mb();
448
449 for (i = 0; i < MSM_SPM_REG_NR_INITIALIZE; i++)
450 msm_spm_drv_load_shadow(dev, i);
451
452 /* barrier to ensure read completes before we proceed further*/
453 mb();
454
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600455 msm_spm_drv_get_saw2_ver(dev, &dev->major, &dev->minor);
456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457 num_spm_entry = msm_spm_drv_get_num_spm_entry(dev);
458
459 dev->reg_seq_entry_shadow =
Praveen Chidambaramaa9d52b2012-04-02 11:09:47 -0600460 kzalloc(sizeof(*dev->reg_seq_entry_shadow) * num_spm_entry,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700461 GFP_KERNEL);
462
463 if (!dev->reg_seq_entry_shadow)
464 return -ENOMEM;
465
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466 return 0;
467}