88pm8607.c (07259a7092e47b9fbb5c8bfdad45fa4c7dbbc051) | 88pm8607.c (586e1a1763d34bd256f3f1e77293d8386e4871d2) |
---|---|
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 --- 384 unchanged lines hidden (view full) --- 393 PM8607_LDO(13, VIBRATOR_SET, 1, 3, VIBRATOR_SET, 0), 394 PM8607_LDO(14, LDO14, 0, 4, SUPPLIES_EN12, 6), 395}; 396 397static int __devinit pm8607_regulator_probe(struct platform_device *pdev) 398{ 399 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 400 struct pm8607_regulator_info *info = 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 --- 384 unchanged lines hidden (view full) --- 393 PM8607_LDO(13, VIBRATOR_SET, 1, 3, VIBRATOR_SET, 0), 394 PM8607_LDO(14, LDO14, 0, 4, SUPPLIES_EN12, 6), 395}; 396 397static int __devinit pm8607_regulator_probe(struct platform_device *pdev) 398{ 399 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 400 struct pm8607_regulator_info *info = NULL; |
401 struct regulator_init_data *pdata; | 401 struct regulator_init_data *pdata = pdev->dev.platform_data; 402 struct resource *res; |
402 int i; 403 | 403 int i; 404 |
404 pdata = pdev->dev.platform_data; 405 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"); |
406 return -EINVAL; | 408 return -EINVAL; |
407 | 409 } |
408 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) { 409 info = &pm8607_regulator_info[i]; | 410 for (i = 0; i < ARRAY_SIZE(pm8607_regulator_info); i++) { 411 info = &pm8607_regulator_info[i]; |
410 if (!strcmp(info->desc.name, pdata->constraints.name)) | 412 if (info->desc.id == res->start) |
411 break; 412 } | 413 break; 414 } |
413 if (i > ARRAY_SIZE(pm8607_regulator_info)) { 414 dev_err(&pdev->dev, "Failed to find regulator %s\n", 415 pdata->constraints.name); | 415 if ((i < 0) || (i > PM8607_ID_RG_MAX)) { 416 dev_err(&pdev->dev, "Failed to find regulator %d\n", 417 res->start); |
416 return -EINVAL; 417 } | 418 return -EINVAL; 419 } |
418 | |
419 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; 420 info->chip = chip; 421 422 /* check DVC ramp slope double */ | 420 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; 421 info->chip = chip; 422 423 /* check DVC ramp slope double */ |
423 if (!strcmp(info->desc.name, "BUCK3")) 424 if (info->chip->buck3_double) 425 info->slope_double = 1; | 424 if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double) 425 info->slope_double = 1; |
426 | 426 |
427 /* replace driver_data with info */ |
|
427 info->regulator = regulator_register(&info->desc, &pdev->dev, 428 pdata, info); 429 if (IS_ERR(info->regulator)) { 430 dev_err(&pdev->dev, "failed to register regulator %s\n", 431 info->desc.name); 432 return PTR_ERR(info->regulator); 433 } 434 --- 38 unchanged lines hidden --- | 428 info->regulator = regulator_register(&info->desc, &pdev->dev, 429 pdata, info); 430 if (IS_ERR(info->regulator)) { 431 dev_err(&pdev->dev, "failed to register regulator %s\n", 432 info->desc.name); 433 return PTR_ERR(info->regulator); 434 } 435 --- 38 unchanged lines hidden --- |