15
15
#include <linux/platform_device.h>
16
16
#include <linux/regulator/driver.h>
17
17
#include <linux/regulator/machine.h>
18
#include <linux/mfd/core.h>
19
18
#include <linux/mfd/88pm860x.h>
21
20
struct pm8607_regulator_info {
400
399
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
401
400
struct pm8607_regulator_info *info = NULL;
402
struct regulator_init_data *pdata;
403
struct mfd_cell *cell;
401
struct regulator_init_data *pdata = pdev->dev.platform_data;
402
struct resource *res;
406
cell = pdev->dev.platform_data;
409
pdata = cell->mfd_data;
405
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
407
dev_err(&pdev->dev, "No I/O resource!\n");
413
410
for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
414
411
info = &pm8607_regulator_info[i];
415
if (!strcmp(info->desc.name, pdata->constraints.name))
412
if (info->desc.id == res->start)
418
if (i > ARRAY_SIZE(pm8607_regulator_info)) {
419
dev_err(&pdev->dev, "Failed to find regulator %s\n",
420
pdata->constraints.name);
415
if ((i < 0) || (i > PM8607_ID_RG_MAX)) {
416
dev_err(&pdev->dev, "Failed to find regulator %llu\n",
417
(unsigned long long)res->start);
424
420
info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
425
421
info->chip = chip;
427
423
/* check DVC ramp slope double */
428
if (!strcmp(info->desc.name, "BUCK3"))
429
if (info->chip->buck3_double)
430
info->slope_double = 1;
424
if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double)
425
info->slope_double = 1;
427
/* replace driver_data with info */
432
428
info->regulator = regulator_register(&info->desc, &pdev->dev,
434
430
if (IS_ERR(info->regulator)) {