88pm8607.c (023670295ab6b65f5a84b8f214377c04c683809d) 88pm8607.c (a70abacb06b884131ec181551a71ef325490f374)
1/*
2 * Regulators driver for Marvell 88PM8607
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 308 unchanged lines hidden (view full) ---

317 struct pm8607_regulator_info *info = NULL;
318 struct regulator_init_data *pdata = pdev->dev.platform_data;
319 struct regulator_config config = { };
320 struct resource *res;
321 int i;
322
323 res = platform_get_resource(pdev, IORESOURCE_REG, 0);
324 if (res == NULL) {
1/*
2 * Regulators driver for Marvell 88PM8607
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 308 unchanged lines hidden (view full) ---

317 struct pm8607_regulator_info *info = NULL;
318 struct regulator_init_data *pdata = pdev->dev.platform_data;
319 struct regulator_config config = { };
320 struct resource *res;
321 int i;
322
323 res = platform_get_resource(pdev, IORESOURCE_REG, 0);
324 if (res == NULL) {
325 dev_err(&pdev->dev, "No I/O resource!\n");
325 dev_err(&pdev->dev, "No REG resource!\n");
326 return -EINVAL;
327 }
328 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
329 info = &pm8607_regulator_info[i];
326 return -EINVAL;
327 }
328 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) {
329 info = &pm8607_regulator_info[i];
330 if (info->desc.id == res->start)
330 if (info->desc.vsel_reg == res->start)
331 break;
332 }
333 if (i == ARRAY_SIZE(pm8607_regulator_info)) {
334 dev_err(&pdev->dev, "Failed to find regulator %llu\n",
335 (unsigned long long)res->start);
336 return -EINVAL;
337 }
338 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;

--- 7 unchanged lines hidden (view full) ---

346 config.init_data = pdata;
347 config.driver_data = info;
348
349 if (chip->id == CHIP_PM8607)
350 config.regmap = chip->regmap;
351 else
352 config.regmap = chip->regmap_companion;
353
331 break;
332 }
333 if (i == ARRAY_SIZE(pm8607_regulator_info)) {
334 dev_err(&pdev->dev, "Failed to find regulator %llu\n",
335 (unsigned long long)res->start);
336 return -EINVAL;
337 }
338 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;

--- 7 unchanged lines hidden (view full) ---

346 config.init_data = pdata;
347 config.driver_data = info;
348
349 if (chip->id == CHIP_PM8607)
350 config.regmap = chip->regmap;
351 else
352 config.regmap = chip->regmap_companion;
353
354 /* replace driver_data with info */
355 info->regulator = regulator_register(&info->desc, &config);
356 if (IS_ERR(info->regulator)) {
357 dev_err(&pdev->dev, "failed to register regulator %s\n",
358 info->desc.name);
359 return PTR_ERR(info->regulator);
360 }
361
362 platform_set_drvdata(pdev, info);

--- 37 unchanged lines hidden ---
354 info->regulator = regulator_register(&info->desc, &config);
355 if (IS_ERR(info->regulator)) {
356 dev_err(&pdev->dev, "failed to register regulator %s\n",
357 info->desc.name);
358 return PTR_ERR(info->regulator);
359 }
360
361 platform_set_drvdata(pdev, info);

--- 37 unchanged lines hidden ---