blob: 3b4b4970423d5476743f54b8d16708d1ff93b24e [file] [log] [blame]
David Collins00b31e62011-08-31 20:00:10 -07001/*
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/regulator/pm8018-regulator.h>
15
16#include "board-9615.h"
17
18#define VREG_CONSUMERS(_id) \
19 static struct regulator_consumer_supply vreg_consumers_##_id[]
20
21/*
22 * Consumer specific regulator names:
23 * regulator name consumer dev_name
24 */
25VREG_CONSUMERS(L2) = {
26 REGULATOR_SUPPLY("8018_l2", NULL),
27};
28VREG_CONSUMERS(L3) = {
29 REGULATOR_SUPPLY("8018_l3", NULL),
30};
31VREG_CONSUMERS(L4) = {
32 REGULATOR_SUPPLY("8018_l4", NULL),
33};
34VREG_CONSUMERS(L5) = {
35 REGULATOR_SUPPLY("8018_l5", NULL),
36};
37VREG_CONSUMERS(L6) = {
38 REGULATOR_SUPPLY("8018_l6", NULL),
39};
40VREG_CONSUMERS(L7) = {
41 REGULATOR_SUPPLY("8018_l7", NULL),
42};
43VREG_CONSUMERS(L8) = {
44 REGULATOR_SUPPLY("8018_l8", NULL),
45};
46VREG_CONSUMERS(L9) = {
47 REGULATOR_SUPPLY("8018_l9", NULL),
48};
49VREG_CONSUMERS(L10) = {
50 REGULATOR_SUPPLY("8018_l10", NULL),
51};
52VREG_CONSUMERS(L11) = {
53 REGULATOR_SUPPLY("8018_l11", NULL),
54};
55VREG_CONSUMERS(L12) = {
56 REGULATOR_SUPPLY("8018_l12", NULL),
57};
58VREG_CONSUMERS(L13) = {
59 REGULATOR_SUPPLY("8018_l13", NULL),
60};
61VREG_CONSUMERS(L14) = {
62 REGULATOR_SUPPLY("8018_l14", NULL),
63};
64VREG_CONSUMERS(S1) = {
65 REGULATOR_SUPPLY("8018_s1", NULL),
66};
67VREG_CONSUMERS(S2) = {
68 REGULATOR_SUPPLY("8018_s2", NULL),
69};
70VREG_CONSUMERS(S3) = {
71 REGULATOR_SUPPLY("8018_s3", NULL),
72};
73VREG_CONSUMERS(S4) = {
74 REGULATOR_SUPPLY("8018_s4", NULL),
75};
76VREG_CONSUMERS(S5) = {
77 REGULATOR_SUPPLY("8018_s5", NULL),
78};
79VREG_CONSUMERS(LVS1) = {
80 REGULATOR_SUPPLY("8018_lvs1", NULL),
81};
82
83#define PM8018_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
84 _pull_down, _always_on, _supply_regulator, \
85 _system_uA, _enable_time) \
86 { \
87 .init_data = { \
88 .constraints = { \
89 .valid_modes_mask = _modes, \
90 .valid_ops_mask = _ops, \
91 .min_uV = _min_uV, \
92 .max_uV = _max_uV, \
93 .input_uV = _max_uV, \
94 .apply_uV = _apply_uV, \
95 .always_on = _always_on, \
96 }, \
97 .num_consumer_supplies = \
98 ARRAY_SIZE(vreg_consumers_##_id), \
99 .consumer_supplies = vreg_consumers_##_id, \
100 .supply_regulator = _supply_regulator, \
101 }, \
102 .id = PM8018_VREG_ID_##_id, \
103 .pull_down_enable = _pull_down, \
104 .system_uA = _system_uA, \
105 .enable_time = _enable_time, \
106 }
107
108#define PM8018_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
109 _enable_time, _supply_regulator, _system_uA) \
110 PM8018_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
111 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
112 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
113 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
114 _supply_regulator, _system_uA, _enable_time)
115
116#define PM8018_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
117 _max_uV, _enable_time, _supply_regulator, _system_uA) \
118 PM8018_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
119 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
120 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
121 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
122 _supply_regulator, _system_uA, _enable_time)
123
124#define PM8018_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
125 _enable_time, _supply_regulator, _system_uA) \
126 PM8018_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
127 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
128 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
129 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
130 _supply_regulator, _system_uA, _enable_time)
131
132#define PM8018_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
133 _supply_regulator) \
134 PM8018_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
135 _always_on, _supply_regulator, 0, _enable_time)
136
137/* Pin control initialization */
138#define PM8018_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
139 { \
140 .init_data = { \
141 .constraints = { \
142 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
143 .always_on = _always_on, \
144 }, \
145 .num_consumer_supplies = \
146 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
147 .consumer_supplies = vreg_consumers_##_id##_PC, \
148 .supply_regulator = _supply_regulator, \
149 }, \
150 .id = PM8018_VREG_ID_##_id##_PC, \
151 .pin_fn = PM8018_VREG_PIN_FN_##_pin_fn, \
152 .pin_ctrl = _pin_ctrl, \
153 }
154
155/* PM8018 regulator constraints */
156struct pm8018_regulator_platform_data
157msm_pm8018_regulator_pdata[] __devinitdata = {
158 /* ID a_on pd min_uV max_uV en_t supply sys_uA */
159 PM8018_VREG_INIT_SMPS(S1, 1, 1, 1150000, 1150000, 500, NULL, 100000),
160 PM8018_VREG_INIT_SMPS(S2, 0, 1, 1225000, 1300000, 500, NULL, 0),
161 PM8018_VREG_INIT_SMPS(S3, 1, 1, 1800000, 1800000, 500, NULL, 100000),
162 PM8018_VREG_INIT_SMPS(S4, 0, 1, 2100000, 2200000, 500, NULL, 0),
163 PM8018_VREG_INIT_SMPS(S5, 1, 1, 1350000, 1350000, 500, NULL, 100000),
164
165 PM8018_VREG_INIT_LDO(L2, 1, 1, 1800000, 1800000, 200, NULL, 10000),
166 PM8018_VREG_INIT_LDO(L3, 0, 1, 1800000, 1800000, 200, NULL, 0),
167 PM8018_VREG_INIT_LDO(L4, 0, 1, 3075000, 3075000, 200, NULL, 0),
168 PM8018_VREG_INIT_LDO(L5, 0, 1, 2850000, 2850000, 200, NULL, 0),
169 PM8018_VREG_INIT_LDO(L6, 0, 1, 1800000, 2850000, 200, NULL, 0),
170 PM8018_VREG_INIT_LDO(L7, 0, 1, 1850000, 1900000, 200, "8018_s4", 0),
171 PM8018_VREG_INIT_LDO(L8, 0, 1, 1200000, 1200000, 200, "8018_s3", 0),
172 PM8018_VREG_INIT_LDO(L9, 1, 1, 1150000, 1150000, 200, "8018_s5",
173 10000),
174 PM8018_VREG_INIT_LDO(L10, 0, 1, 1050000, 1050000, 200, "8018_s5", 0),
175 PM8018_VREG_INIT_LDO(L11, 0, 1, 1050000, 1050000, 200, "8018_s5", 0),
176 PM8018_VREG_INIT_LDO(L12, 0, 1, 1050000, 1050000, 200, "8018_s5", 0),
177 PM8018_VREG_INIT_LDO(L13, 0, 1, 2950000, 2950000, 200, NULL, 0),
178 PM8018_VREG_INIT_LDO(L14, 0, 1, 2850000, 2850000, 200, NULL, 0),
179
180 /* ID a_on pd en_t supply */
181 PM8018_VREG_INIT_VS(LVS1, 0, 1, 0, "8018_s3"),
182};
183
184int msm_pm8018_regulator_pdata_len __devinitdata =
185 ARRAY_SIZE(msm_pm8018_regulator_pdata);