da9211-regulator.c (076c3b8e03e2737659a89660bb8e54e13587d974) da9211-regulator.c (8c7dd8bce05345ca5fe249b64782e8feeb3b9259)
1/*
2 * da9211-regulator.c - Regulator device driver for DA9211/DA9213
3 * Copyright (C) 2014 Dialog Semiconductor Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.

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

19#include <linux/module.h>
20#include <linux/init.h>
21#include <linux/slab.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24#include <linux/regmap.h>
25#include <linux/irq.h>
26#include <linux/interrupt.h>
1/*
2 * da9211-regulator.c - Regulator device driver for DA9211/DA9213
3 * Copyright (C) 2014 Dialog Semiconductor Ltd.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.

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

19#include <linux/module.h>
20#include <linux/init.h>
21#include <linux/slab.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24#include <linux/regmap.h>
25#include <linux/irq.h>
26#include <linux/interrupt.h>
27#include <linux/of_gpio.h>
27#include <linux/regulator/of_regulator.h>
28#include <linux/regulator/da9211.h>
29#include "da9211-regulator.h"
30
31/* DEVICE IDs */
32#define DA9211_DEVICE_ID 0x22
33#define DA9213_DEVICE_ID 0x23
34

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

272
273 n = 0;
274 for (i = 0; i < ARRAY_SIZE(da9211_matches); i++) {
275 if (!da9211_matches[i].init_data)
276 continue;
277
278 pdata->init_data[n] = da9211_matches[i].init_data;
279 pdata->reg_node[n] = da9211_matches[i].of_node;
28#include <linux/regulator/of_regulator.h>
29#include <linux/regulator/da9211.h>
30#include "da9211-regulator.h"
31
32/* DEVICE IDs */
33#define DA9211_DEVICE_ID 0x22
34#define DA9213_DEVICE_ID 0x23
35

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

273
274 n = 0;
275 for (i = 0; i < ARRAY_SIZE(da9211_matches); i++) {
276 if (!da9211_matches[i].init_data)
277 continue;
278
279 pdata->init_data[n] = da9211_matches[i].init_data;
280 pdata->reg_node[n] = da9211_matches[i].of_node;
281 pdata->gpio_ren[n] =
282 of_get_named_gpio(da9211_matches[i].of_node,
283 "enable-gpios", 0);
280 n++;
281 }
282
283 return pdata;
284}
285#else
286static struct da9211_pdata *da9211_parse_regulators_dt(
287 struct device *dev)

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

361
362 for (i = 0; i < chip->num_regulator; i++) {
363 config.init_data = chip->pdata->init_data[i];
364 config.dev = chip->dev;
365 config.driver_data = chip;
366 config.regmap = chip->regmap;
367 config.of_node = chip->pdata->reg_node[i];
368
284 n++;
285 }
286
287 return pdata;
288}
289#else
290static struct da9211_pdata *da9211_parse_regulators_dt(
291 struct device *dev)

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

365
366 for (i = 0; i < chip->num_regulator; i++) {
367 config.init_data = chip->pdata->init_data[i];
368 config.dev = chip->dev;
369 config.driver_data = chip;
370 config.regmap = chip->regmap;
371 config.of_node = chip->pdata->reg_node[i];
372
373 if (gpio_is_valid(chip->pdata->gpio_ren[i])) {
374 config.ena_gpio = chip->pdata->gpio_ren[i];
375 config.ena_gpio_initialized = true;
376 } else {
377 config.ena_gpio = -EINVAL;
378 config.ena_gpio_initialized = false;
379 }
380
369 chip->rdev[i] = devm_regulator_register(chip->dev,
370 &da9211_regulators[i], &config);
371 if (IS_ERR(chip->rdev[i])) {
372 dev_err(chip->dev,
373 "Failed to register DA9211 regulator\n");
374 return PTR_ERR(chip->rdev[i]);
375 }
376

--- 122 unchanged lines hidden ---
381 chip->rdev[i] = devm_regulator_register(chip->dev,
382 &da9211_regulators[i], &config);
383 if (IS_ERR(chip->rdev[i])) {
384 dev_err(chip->dev,
385 "Failed to register DA9211 regulator\n");
386 return PTR_ERR(chip->rdev[i]);
387 }
388

--- 122 unchanged lines hidden ---