88pm8607.c (ff13e9e256d49a478b34da3dc380af41e0b9175f) | 88pm8607.c (2e57d56747e601b3e0ff6697e524025d0504d161) |
---|---|
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 9 * published by the Free Software Foundation. 10 */ 11#include <linux/kernel.h> 12#include <linux/init.h> 13#include <linux/err.h> 14#include <linux/i2c.h> | 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 9 * published by the Free Software Foundation. 10 */ 11#include <linux/kernel.h> 12#include <linux/init.h> 13#include <linux/err.h> 14#include <linux/i2c.h> |
15#include <linux/of.h> 16#include <linux/regulator/of_regulator.h> |
|
15#include <linux/platform_device.h> 16#include <linux/regulator/driver.h> 17#include <linux/regulator/machine.h> 18#include <linux/mfd/88pm860x.h> 19#include <linux/module.h> 20 21struct pm8607_regulator_info { 22 struct regulator_desc desc; --- 336 unchanged lines hidden (view full) --- 359 PM8607_LDO(13, VIBRATOR_SET, 1, VIBRATOR_SET, 0), 360 PM8607_LDO(14, LDO14, 0, SUPPLIES_EN12, 6), 361}; 362 363static struct pm8607_regulator_info pm8606_regulator_info[] = { 364 PM8606_PREG(PREREGULATORB, 5), 365}; 366 | 17#include <linux/platform_device.h> 18#include <linux/regulator/driver.h> 19#include <linux/regulator/machine.h> 20#include <linux/mfd/88pm860x.h> 21#include <linux/module.h> 22 23struct pm8607_regulator_info { 24 struct regulator_desc desc; --- 336 unchanged lines hidden (view full) --- 361 PM8607_LDO(13, VIBRATOR_SET, 1, VIBRATOR_SET, 0), 362 PM8607_LDO(14, LDO14, 0, SUPPLIES_EN12, 6), 363}; 364 365static struct pm8607_regulator_info pm8606_regulator_info[] = { 366 PM8606_PREG(PREREGULATORB, 5), 367}; 368 |
369#ifdef CONFIG_OF 370static int pm8607_regulator_dt_init(struct platform_device *pdev, 371 struct pm8607_regulator_info *info, 372 struct regulator_config *config) 373{ 374 struct device_node *nproot, *np; 375 nproot = pdev->dev.parent->of_node; 376 if (!nproot) 377 return -ENODEV; 378 nproot = of_find_node_by_name(nproot, "regulators"); 379 if (!nproot) { 380 dev_err(&pdev->dev, "failed to find regulators node\n"); 381 return -ENODEV; 382 } 383 for_each_child_of_node(nproot, np) { 384 if (!of_node_cmp(np->name, info->desc.name)) { 385 config->init_data = 386 of_get_regulator_init_data(&pdev->dev, np); 387 config->of_node = np; 388 break; 389 } 390 } 391 return 0; 392} 393#else 394#define pm8607_regulator_dt_init(x, y, z) (-1) 395#endif 396 |
|
367static int __devinit pm8607_regulator_probe(struct platform_device *pdev) 368{ 369 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 370 struct pm8607_regulator_info *info = NULL; 371 struct regulator_init_data *pdata = pdev->dev.platform_data; 372 struct regulator_config config = { }; 373 struct resource *res; 374 int i; --- 22 unchanged lines hidden (view full) --- 397 chip->client; 398 info->chip = chip; 399 400 /* check DVC ramp slope double */ 401 if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double) 402 info->slope_double = 1; 403 404 config.dev = &pdev->dev; | 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 = pdev->dev.platform_data; 402 struct regulator_config config = { }; 403 struct resource *res; 404 int i; --- 22 unchanged lines hidden (view full) --- 427 chip->client; 428 info->chip = chip; 429 430 /* check DVC ramp slope double */ 431 if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double) 432 info->slope_double = 1; 433 434 config.dev = &pdev->dev; |
405 config.init_data = pdata; | |
406 config.driver_data = info; 407 | 435 config.driver_data = info; 436 |
437 if (pm8607_regulator_dt_init(pdev, info, &config)) 438 if (pdata) 439 config.init_data = pdata; 440 |
|
408 if (chip->id == CHIP_PM8607) 409 config.regmap = chip->regmap; 410 else 411 config.regmap = chip->regmap_companion; 412 413 info->regulator = regulator_register(&info->desc, &config); 414 if (IS_ERR(info->regulator)) { 415 dev_err(&pdev->dev, "failed to register regulator %s\n", --- 55 unchanged lines hidden --- | 441 if (chip->id == CHIP_PM8607) 442 config.regmap = chip->regmap; 443 else 444 config.regmap = chip->regmap_companion; 445 446 info->regulator = regulator_register(&info->desc, &config); 447 if (IS_ERR(info->regulator)) { 448 dev_err(&pdev->dev, "failed to register regulator %s\n", --- 55 unchanged lines hidden --- |