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

mfd: 88pm800: Add regulator sub device

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Chao Xie and committed by
Samuel Ortiz
2d3aa056 3a3ece54

+36
+28
drivers/mfd/88pm800.c
··· 157 157 }, 158 158 }; 159 159 160 + static struct mfd_cell regulator_devs[] = { 161 + { 162 + .name = "88pm80x-regulator", 163 + .id = -1, 164 + }, 165 + }; 166 + 160 167 static const struct regmap_irq pm800_irqs[] = { 161 168 /* INT0 */ 162 169 [PM800_IRQ_ONKEY] = { ··· 346 339 return 0; 347 340 } 348 341 342 + static int device_regulator_init(struct pm80x_chip *chip, 343 + struct pm80x_platform_data *pdata) 344 + { 345 + int ret; 346 + 347 + ret = mfd_add_devices(chip->dev, 0, &regulator_devs[0], 348 + ARRAY_SIZE(regulator_devs), NULL, 0, NULL); 349 + if (ret) { 350 + dev_err(chip->dev, "Failed to add regulator subdev\n"); 351 + return ret; 352 + } 353 + 354 + return 0; 355 + } 356 + 349 357 static int device_irq_init_800(struct pm80x_chip *chip) 350 358 { 351 359 struct regmap *map = chip->regmap; ··· 519 497 ret = device_rtc_init(chip, pdata); 520 498 if (ret) { 521 499 dev_err(chip->dev, "Failed to add rtc subdev\n"); 500 + goto out; 501 + } 502 + 503 + ret = device_regulator_init(chip, pdata); 504 + if (ret) { 505 + dev_err(chip->dev, "Failed to add regulators subdev\n"); 522 506 goto out; 523 507 } 524 508
+8
include/linux/mfd/88pm80x.h
··· 307 307 308 308 struct pm80x_platform_data { 309 309 struct pm80x_rtc_pdata *rtc; 310 + /* 311 + * For the regulator not defined, set regulators[not_defined] to be 312 + * NULL. num_regulators are the number of regulators supposed to be 313 + * initialized. If all regulators are not defined, set num_regulators 314 + * to be 0. 315 + */ 316 + struct regulator_init_data *regulators[PM800_ID_RG_MAX]; 317 + unsigned int num_regulators; 310 318 int irq_mode; /* Clear interrupt by read/write(0/1) */ 311 319 int batt_det; /* enable/disable */ 312 320 int (*plat_config)(struct pm80x_chip *chip,