blob: 2cef2bb8405b5598a9aeb16ef3445c7c3fdcb5d3 [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),
Amit Blayf8b609e2011-09-02 20:42:53 +030027 REGULATOR_SUPPLY("HSUSB_1p8", "msm_otg"),
David Collins00b31e62011-08-31 20:00:10 -070028};
29VREG_CONSUMERS(L3) = {
30 REGULATOR_SUPPLY("8018_l3", NULL),
31};
32VREG_CONSUMERS(L4) = {
33 REGULATOR_SUPPLY("8018_l4", NULL),
Amit Blayf8b609e2011-09-02 20:42:53 +030034 REGULATOR_SUPPLY("HSUSB_3p3", "msm_otg"),
David Collins00b31e62011-08-31 20:00:10 -070035};
36VREG_CONSUMERS(L5) = {
37 REGULATOR_SUPPLY("8018_l5", NULL),
38};
39VREG_CONSUMERS(L6) = {
40 REGULATOR_SUPPLY("8018_l6", NULL),
41};
42VREG_CONSUMERS(L7) = {
43 REGULATOR_SUPPLY("8018_l7", NULL),
44};
45VREG_CONSUMERS(L8) = {
46 REGULATOR_SUPPLY("8018_l8", NULL),
47};
48VREG_CONSUMERS(L9) = {
49 REGULATOR_SUPPLY("8018_l9", NULL),
50};
51VREG_CONSUMERS(L10) = {
52 REGULATOR_SUPPLY("8018_l10", NULL),
53};
54VREG_CONSUMERS(L11) = {
55 REGULATOR_SUPPLY("8018_l11", NULL),
56};
57VREG_CONSUMERS(L12) = {
58 REGULATOR_SUPPLY("8018_l12", NULL),
59};
60VREG_CONSUMERS(L13) = {
61 REGULATOR_SUPPLY("8018_l13", NULL),
62};
63VREG_CONSUMERS(L14) = {
64 REGULATOR_SUPPLY("8018_l14", NULL),
65};
66VREG_CONSUMERS(S1) = {
67 REGULATOR_SUPPLY("8018_s1", NULL),
Amit Blayf8b609e2011-09-02 20:42:53 +030068 REGULATOR_SUPPLY("HSUSB_VDDCX", "msm_otg"),
David Collins00b31e62011-08-31 20:00:10 -070069};
70VREG_CONSUMERS(S2) = {
71 REGULATOR_SUPPLY("8018_s2", NULL),
72};
73VREG_CONSUMERS(S3) = {
74 REGULATOR_SUPPLY("8018_s3", NULL),
75};
76VREG_CONSUMERS(S4) = {
77 REGULATOR_SUPPLY("8018_s4", NULL),
78};
79VREG_CONSUMERS(S5) = {
80 REGULATOR_SUPPLY("8018_s5", NULL),
81};
82VREG_CONSUMERS(LVS1) = {
83 REGULATOR_SUPPLY("8018_lvs1", NULL),
84};
85
86#define PM8018_VREG_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, \
87 _pull_down, _always_on, _supply_regulator, \
88 _system_uA, _enable_time) \
89 { \
90 .init_data = { \
91 .constraints = { \
92 .valid_modes_mask = _modes, \
93 .valid_ops_mask = _ops, \
94 .min_uV = _min_uV, \
95 .max_uV = _max_uV, \
96 .input_uV = _max_uV, \
97 .apply_uV = _apply_uV, \
98 .always_on = _always_on, \
99 }, \
100 .num_consumer_supplies = \
101 ARRAY_SIZE(vreg_consumers_##_id), \
102 .consumer_supplies = vreg_consumers_##_id, \
103 .supply_regulator = _supply_regulator, \
104 }, \
105 .id = PM8018_VREG_ID_##_id, \
106 .pull_down_enable = _pull_down, \
107 .system_uA = _system_uA, \
108 .enable_time = _enable_time, \
109 }
110
111#define PM8018_VREG_INIT_LDO(_id, _always_on, _pull_down, _min_uV, _max_uV, \
112 _enable_time, _supply_regulator, _system_uA) \
113 PM8018_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
114 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
115 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
116 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
117 _supply_regulator, _system_uA, _enable_time)
118
119#define PM8018_VREG_INIT_NLDO1200(_id, _always_on, _pull_down, _min_uV, \
120 _max_uV, _enable_time, _supply_regulator, _system_uA) \
121 PM8018_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
122 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
123 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
124 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
125 _supply_regulator, _system_uA, _enable_time)
126
127#define PM8018_VREG_INIT_SMPS(_id, _always_on, _pull_down, _min_uV, _max_uV, \
128 _enable_time, _supply_regulator, _system_uA) \
129 PM8018_VREG_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
130 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
131 REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
132 REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
133 _supply_regulator, _system_uA, _enable_time)
134
135#define PM8018_VREG_INIT_VS(_id, _always_on, _pull_down, _enable_time, \
136 _supply_regulator) \
137 PM8018_VREG_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, _pull_down, \
138 _always_on, _supply_regulator, 0, _enable_time)
139
140/* Pin control initialization */
141#define PM8018_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
142 { \
143 .init_data = { \
144 .constraints = { \
145 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
146 .always_on = _always_on, \
147 }, \
148 .num_consumer_supplies = \
149 ARRAY_SIZE(vreg_consumers_##_id##_PC), \
150 .consumer_supplies = vreg_consumers_##_id##_PC, \
151 .supply_regulator = _supply_regulator, \
152 }, \
153 .id = PM8018_VREG_ID_##_id##_PC, \
154 .pin_fn = PM8018_VREG_PIN_FN_##_pin_fn, \
155 .pin_ctrl = _pin_ctrl, \
156 }
157
158/* PM8018 regulator constraints */
159struct pm8018_regulator_platform_data
160msm_pm8018_regulator_pdata[] __devinitdata = {
161 /* ID a_on pd min_uV max_uV en_t supply sys_uA */
162 PM8018_VREG_INIT_SMPS(S1, 1, 1, 1150000, 1150000, 500, NULL, 100000),
163 PM8018_VREG_INIT_SMPS(S2, 0, 1, 1225000, 1300000, 500, NULL, 0),
164 PM8018_VREG_INIT_SMPS(S3, 1, 1, 1800000, 1800000, 500, NULL, 100000),
165 PM8018_VREG_INIT_SMPS(S4, 0, 1, 2100000, 2200000, 500, NULL, 0),
166 PM8018_VREG_INIT_SMPS(S5, 1, 1, 1350000, 1350000, 500, NULL, 100000),
167
168 PM8018_VREG_INIT_LDO(L2, 1, 1, 1800000, 1800000, 200, NULL, 10000),
169 PM8018_VREG_INIT_LDO(L3, 0, 1, 1800000, 1800000, 200, NULL, 0),
170 PM8018_VREG_INIT_LDO(L4, 0, 1, 3075000, 3075000, 200, NULL, 0),
171 PM8018_VREG_INIT_LDO(L5, 0, 1, 2850000, 2850000, 200, NULL, 0),
172 PM8018_VREG_INIT_LDO(L6, 0, 1, 1800000, 2850000, 200, NULL, 0),
173 PM8018_VREG_INIT_LDO(L7, 0, 1, 1850000, 1900000, 200, "8018_s4", 0),
174 PM8018_VREG_INIT_LDO(L8, 0, 1, 1200000, 1200000, 200, "8018_s3", 0),
175 PM8018_VREG_INIT_LDO(L9, 1, 1, 1150000, 1150000, 200, "8018_s5",
176 10000),
177 PM8018_VREG_INIT_LDO(L10, 0, 1, 1050000, 1050000, 200, "8018_s5", 0),
178 PM8018_VREG_INIT_LDO(L11, 0, 1, 1050000, 1050000, 200, "8018_s5", 0),
179 PM8018_VREG_INIT_LDO(L12, 0, 1, 1050000, 1050000, 200, "8018_s5", 0),
180 PM8018_VREG_INIT_LDO(L13, 0, 1, 2950000, 2950000, 200, NULL, 0),
181 PM8018_VREG_INIT_LDO(L14, 0, 1, 2850000, 2850000, 200, NULL, 0),
182
183 /* ID a_on pd en_t supply */
184 PM8018_VREG_INIT_VS(LVS1, 0, 1, 0, "8018_s3"),
185};
186
187int msm_pm8018_regulator_pdata_len __devinitdata =
188 ARRAY_SIZE(msm_pm8018_regulator_pdata);