cpufreq: schedutil: Fix per-CPU structure initialization in sugov_start()
[linux-2.6/btrfs-unstable.git] / drivers / mfd / act8945a.c
bloba4024d91da01c7656e476624dc9d660bad12e112
1 /*
2 * MFD driver for Active-semi ACT8945a PMIC
4 * Copyright (C) 2015 Atmel Corporation.
6 * Author: Wenyou Yang <wenyou.yang@atmel.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #include <linux/i2c.h>
15 #include <linux/mfd/core.h>
16 #include <linux/module.h>
17 #include <linux/of_device.h>
18 #include <linux/regmap.h>
20 static const struct mfd_cell act8945a_devs[] = {
22 .name = "act8945a-regulator",
25 .name = "act8945a-charger",
26 .of_compatible = "active-semi,act8945a-charger",
30 static const struct regmap_config act8945a_regmap_config = {
31 .reg_bits = 8,
32 .val_bits = 8,
35 static int act8945a_i2c_probe(struct i2c_client *i2c,
36 const struct i2c_device_id *id)
38 int ret;
39 struct regmap *regmap;
41 regmap = devm_regmap_init_i2c(i2c, &act8945a_regmap_config);
42 if (IS_ERR(regmap)) {
43 ret = PTR_ERR(regmap);
44 dev_err(&i2c->dev, "regmap init failed: %d\n", ret);
45 return ret;
48 i2c_set_clientdata(i2c, regmap);
50 ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE,
51 act8945a_devs, ARRAY_SIZE(act8945a_devs),
52 NULL, 0, NULL);
53 if (ret) {
54 dev_err(&i2c->dev, "Failed to add sub devices\n");
55 return ret;
58 return 0;
61 static const struct i2c_device_id act8945a_i2c_id[] = {
62 { "act8945a", 0 },
65 MODULE_DEVICE_TABLE(i2c, act8945a_i2c_id);
67 static const struct of_device_id act8945a_of_match[] = {
68 { .compatible = "active-semi,act8945a", },
69 {},
71 MODULE_DEVICE_TABLE(of, act8945a_of_match);
73 static struct i2c_driver act8945a_i2c_driver = {
74 .driver = {
75 .name = "act8945a",
76 .of_match_table = of_match_ptr(act8945a_of_match),
78 .probe = act8945a_i2c_probe,
79 .id_table = act8945a_i2c_id,
82 static int __init act8945a_i2c_init(void)
84 return i2c_add_driver(&act8945a_i2c_driver);
86 subsys_initcall(act8945a_i2c_init);
88 static void __exit act8945a_i2c_exit(void)
90 i2c_del_driver(&act8945a_i2c_driver);
92 module_exit(act8945a_i2c_exit);
94 MODULE_DESCRIPTION("ACT8945A PMIC multi-function driver");
95 MODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>");
96 MODULE_LICENSE("GPL");