| .. | .. |
|---|
| 155 | 155 | [MAX77836_LDO2] = MAX77836_LDO_REG(2), |
|---|
| 156 | 156 | }; |
|---|
| 157 | 157 | |
|---|
| 158 | | -#ifdef CONFIG_OF |
|---|
| 159 | | -static struct of_regulator_match max14577_regulator_matches[] = { |
|---|
| 160 | | - { .name = "SAFEOUT", }, |
|---|
| 161 | | - { .name = "CHARGER", }, |
|---|
| 162 | | -}; |
|---|
| 163 | | - |
|---|
| 164 | | -static struct of_regulator_match max77836_regulator_matches[] = { |
|---|
| 165 | | - { .name = "SAFEOUT", }, |
|---|
| 166 | | - { .name = "CHARGER", }, |
|---|
| 167 | | - { .name = "LDO1", }, |
|---|
| 168 | | - { .name = "LDO2", }, |
|---|
| 169 | | -}; |
|---|
| 170 | | - |
|---|
| 171 | | -static inline struct regulator_init_data *match_init_data(int index, |
|---|
| 172 | | - enum maxim_device_type dev_type) |
|---|
| 173 | | -{ |
|---|
| 174 | | - switch (dev_type) { |
|---|
| 175 | | - case MAXIM_DEVICE_TYPE_MAX77836: |
|---|
| 176 | | - return max77836_regulator_matches[index].init_data; |
|---|
| 177 | | - |
|---|
| 178 | | - case MAXIM_DEVICE_TYPE_MAX14577: |
|---|
| 179 | | - default: |
|---|
| 180 | | - return max14577_regulator_matches[index].init_data; |
|---|
| 181 | | - } |
|---|
| 182 | | -} |
|---|
| 183 | | - |
|---|
| 184 | | -static inline struct device_node *match_of_node(int index, |
|---|
| 185 | | - enum maxim_device_type dev_type) |
|---|
| 186 | | -{ |
|---|
| 187 | | - switch (dev_type) { |
|---|
| 188 | | - case MAXIM_DEVICE_TYPE_MAX77836: |
|---|
| 189 | | - return max77836_regulator_matches[index].of_node; |
|---|
| 190 | | - |
|---|
| 191 | | - case MAXIM_DEVICE_TYPE_MAX14577: |
|---|
| 192 | | - default: |
|---|
| 193 | | - return max14577_regulator_matches[index].of_node; |
|---|
| 194 | | - } |
|---|
| 195 | | -} |
|---|
| 196 | | -#else /* CONFIG_OF */ |
|---|
| 197 | | -static inline struct regulator_init_data *match_init_data(int index, |
|---|
| 198 | | - enum maxim_device_type dev_type) |
|---|
| 199 | | -{ |
|---|
| 200 | | - return NULL; |
|---|
| 201 | | -} |
|---|
| 202 | | - |
|---|
| 203 | | -static inline struct device_node *match_of_node(int index, |
|---|
| 204 | | - enum maxim_device_type dev_type) |
|---|
| 205 | | -{ |
|---|
| 206 | | - return NULL; |
|---|
| 207 | | -} |
|---|
| 208 | | -#endif /* CONFIG_OF */ |
|---|
| 209 | | - |
|---|
| 210 | | -/** |
|---|
| 158 | +/* |
|---|
| 211 | 159 | * Registers for regulators of max77836 use different I2C slave addresses so |
|---|
| 212 | 160 | * different regmaps must be used for them. |
|---|
| 213 | 161 | * |
|---|
| .. | .. |
|---|
| 265 | 213 | if (pdata && pdata->regulators) { |
|---|
| 266 | 214 | config.init_data = pdata->regulators[i].initdata; |
|---|
| 267 | 215 | config.of_node = pdata->regulators[i].of_node; |
|---|
| 268 | | - } else { |
|---|
| 269 | | - config.init_data = match_init_data(i, dev_type); |
|---|
| 270 | | - config.of_node = match_of_node(i, dev_type); |
|---|
| 271 | 216 | } |
|---|
| 272 | 217 | config.regmap = max14577_get_regmap(max14577, |
|---|
| 273 | 218 | supported_regulators[i].id); |
|---|
| .. | .. |
|---|
| 324 | 269 | MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>"); |
|---|
| 325 | 270 | MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver"); |
|---|
| 326 | 271 | MODULE_LICENSE("GPL"); |
|---|
| 327 | | -MODULE_ALIAS("platform:max14577-regulator"); |
|---|