Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: arizona-micsupp: Move pdata into a separate structure

In preparation for sharing this driver with Madera, move the pdata
for the micsupp regulator out of struct arizona_pdata into a dedicated
pdata struct for this driver. As a result the code in
arizona_micsupp_of_get_pdata() can be made independent of struct arizona.

This patch also updates the definition of struct arizona_pdata and
the use of this pdata in mach-crag6410-module.c

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Richard Fitzgerald and committed by
Mark Brown
22161f3e 7e642596

+35 -11
+1
MAINTAINERS
··· 13623 13623 F: include/linux/mfd/wm831x/ 13624 13624 F: include/linux/mfd/wm8350/ 13625 13625 F: include/linux/mfd/wm8400* 13626 + F: include/linux/regulator/arizona* 13626 13627 F: include/linux/wm97xx.h 13627 13628 F: include/sound/wm????.h 13628 13629 F: sound/soc/codecs/arizona.?
+11 -10
drivers/regulator/arizona-micsupp.c
··· 30 30 #include <linux/mfd/arizona/pdata.h> 31 31 #include <linux/mfd/arizona/registers.h> 32 32 33 + #include <linux/regulator/arizona-micsupp.h> 34 + 33 35 struct arizona_micsupp { 34 36 struct regulator_dev *regulator; 35 37 struct arizona *arizona; ··· 201 199 .num_consumer_supplies = 1, 202 200 }; 203 201 204 - static int arizona_micsupp_of_get_pdata(struct device *dev, 205 - struct arizona *arizona, 202 + static int arizona_micsupp_of_get_pdata(struct arizona_micsupp_pdata *pdata, 206 203 struct regulator_config *config, 207 204 const struct regulator_desc *desc) 208 205 { 209 - struct arizona_pdata *pdata = &arizona->pdata; 210 206 struct arizona_micsupp *micsupp = config->driver_data; 211 207 struct device_node *np; 212 208 struct regulator_init_data *init_data; 213 209 214 - np = of_get_child_by_name(arizona->dev->of_node, "micvdd"); 210 + np = of_get_child_by_name(config->dev->of_node, "micvdd"); 215 211 216 212 if (np) { 217 213 config->of_node = np; 218 214 219 - init_data = of_get_regulator_init_data(dev, np, desc); 215 + init_data = of_get_regulator_init_data(config->dev, np, desc); 220 216 221 217 if (init_data) { 222 218 init_data->consumer_supplies = &micsupp->supply; 223 219 init_data->num_consumer_supplies = 1; 224 220 225 - pdata->micvdd = init_data; 221 + pdata->init_data = init_data; 226 222 } 227 223 } 228 224 ··· 232 232 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 233 233 const struct regulator_desc *desc; 234 234 struct regulator_config config = { }; 235 + struct arizona_micsupp_pdata *pdata = &arizona->pdata.micvdd; 235 236 struct arizona_micsupp *micsupp; 236 237 int ret; 237 238 ··· 270 269 271 270 if (IS_ENABLED(CONFIG_OF)) { 272 271 if (!dev_get_platdata(arizona->dev)) { 273 - ret = arizona_micsupp_of_get_pdata(&pdev->dev, arizona, 274 - &config, desc); 272 + ret = arizona_micsupp_of_get_pdata(pdata, &config, 273 + desc); 275 274 if (ret < 0) 276 275 return ret; 277 276 } 278 277 } 279 278 280 - if (arizona->pdata.micvdd) 281 - config.init_data = arizona->pdata.micvdd; 279 + if (pdata->init_data) 280 + config.init_data = pdata->init_data; 282 281 else 283 282 config.init_data = &micsupp->init_data; 284 283
+2 -1
include/linux/mfd/arizona/pdata.h
··· 12 12 #define _ARIZONA_PDATA_H 13 13 14 14 #include <dt-bindings/mfd/arizona.h> 15 + #include <linux/regulator/arizona-micsupp.h> 15 16 16 17 #define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ 17 18 #define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ ··· 80 79 int ldoena; /** GPIO controlling LODENA, if any */ 81 80 82 81 /** Regulator configuration for MICVDD */ 83 - struct regulator_init_data *micvdd; 82 + struct arizona_micsupp_pdata micvdd; 84 83 85 84 /** Regulator configuration for LDO1 */ 86 85 struct regulator_init_data *ldo1;
+21
include/linux/regulator/arizona-micsupp.h
··· 1 + /* 2 + * Platform data for Arizona micsupp regulator 3 + * 4 + * Copyright 2017 Cirrus Logic 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #ifndef ARIZONA_MICSUPP_H 12 + #define ARIZONA_MICSUPP_H 13 + 14 + struct regulator_init_data; 15 + 16 + struct arizona_micsupp_pdata { 17 + /** Regulator configuration for micsupp */ 18 + const struct regulator_init_data *init_data; 19 + }; 20 + 21 + #endif