~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/regulator/88pm8607.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
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>
20
19
 
21
20
struct pm8607_regulator_info {
399
398
{
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;
404
403
        int i;
405
404
 
406
 
        cell = pdev->dev.platform_data;
407
 
        if (cell == NULL)
408
 
                return -ENODEV;
409
 
        pdata = cell->mfd_data;
410
 
        if (pdata == NULL)
 
405
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
 
406
        if (res == NULL) {
 
407
                dev_err(&pdev->dev, "No I/O resource!\n");
411
408
                return -EINVAL;
412
 
 
 
409
        }
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)
416
413
                        break;
417
414
        }
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);
421
418
                return -EINVAL;
422
419
        }
423
 
 
424
420
        info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
425
421
        info->chip = chip;
426
422
 
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;
431
426
 
 
427
        /* replace driver_data with info */
432
428
        info->regulator = regulator_register(&info->desc, &pdev->dev,
433
429
                                             pdata, info);
434
430
        if (IS_ERR(info->regulator)) {