diff options
author | Wenyou Yang <wenyou.yang@atmel.com> | 2016-02-04 22:36:29 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2016-03-16 04:50:25 -0400 |
commit | b25c6b7d2801f33b0fc2072d7b9bfbda3682bd86 (patch) | |
tree | 35e8c22c755acf5041a8bf358adbbad14dcf1ede | |
parent | f4bcf5a29d57fe515b8eb6c612090376086b5f79 (diff) |
mfd: act8945a: Add Active-semi ACT8945A PMIC MFD driver
This patch adds support for the Active-semi ACT8945A PMIC.
It is a Multi Function Device with the following subdevices:
- Regulator
- Charger
It is interfaced to the host controller using I2C interface,
ACT8945A is a child device of the I2C.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/Kconfig | 11 | ||||
-rw-r--r-- | drivers/mfd/Makefile | 1 | ||||
-rw-r--r-- | drivers/mfd/act8945a.c | 102 |
3 files changed, 114 insertions, 0 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3719cc86be0b..aa21dc55eb15 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -18,6 +18,17 @@ config MFD_CS5535 | |||
18 | This is the core driver for CS5535/CS5536 MFD functions. This is | 18 | This is the core driver for CS5535/CS5536 MFD functions. This is |
19 | necessary for using the board's GPIO and MFGPT functionality. | 19 | necessary for using the board's GPIO and MFGPT functionality. |
20 | 20 | ||
21 | config MFD_ACT8945A | ||
22 | tristate "Active-semi ACT8945A" | ||
23 | select MFD_CORE | ||
24 | select REGMAP_I2C | ||
25 | depends on I2C && OF | ||
26 | help | ||
27 | Support for the ACT8945A PMIC from Active-semi. This device | ||
28 | features three step-down DC/DC converters and four low-dropout | ||
29 | linear regulators, along with a complete ActivePath battery | ||
30 | charger. | ||
31 | |||
21 | config MFD_AS3711 | 32 | config MFD_AS3711 |
22 | bool "AMS AS3711" | 33 | bool "AMS AS3711" |
23 | select MFD_CORE | 34 | select MFD_CORE |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index d2ddcf45ccd1..5eaa6465d0a6 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -6,6 +6,7 @@ | |||
6 | obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o | 6 | obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o |
7 | obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o | 7 | obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o |
8 | obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o | 8 | obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o |
9 | obj-$(CONFIG_MFD_ACT8945A) += act8945a.o | ||
9 | obj-$(CONFIG_MFD_SM501) += sm501.o | 10 | obj-$(CONFIG_MFD_SM501) += sm501.o |
10 | obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o | 11 | obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o |
11 | obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o | 12 | obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o |
diff --git a/drivers/mfd/act8945a.c b/drivers/mfd/act8945a.c new file mode 100644 index 000000000000..525b546ba42f --- /dev/null +++ b/drivers/mfd/act8945a.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * MFD driver for Active-semi ACT8945a PMIC | ||
3 | * | ||
4 | * Copyright (C) 2015 Atmel Corporation. | ||
5 | * | ||
6 | * Author: Wenyou Yang <wenyou.yang@atmel.com> | ||
7 | * | ||
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. | ||
12 | */ | ||
13 | |||
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> | ||
19 | |||
20 | static const struct mfd_cell act8945a_devs[] = { | ||
21 | { | ||
22 | .name = "act8945a-regulator", | ||
23 | }, | ||
24 | { | ||
25 | .name = "act8945a-charger", | ||
26 | }, | ||
27 | }; | ||
28 | |||
29 | static const struct regmap_config act8945a_regmap_config = { | ||
30 | .reg_bits = 8, | ||
31 | .val_bits = 8, | ||
32 | }; | ||
33 | |||
34 | static int act8945a_i2c_probe(struct i2c_client *i2c, | ||
35 | const struct i2c_device_id *id) | ||
36 | { | ||
37 | int ret; | ||
38 | struct regmap *regmap; | ||
39 | |||
40 | regmap = devm_regmap_init_i2c(i2c, &act8945a_regmap_config); | ||
41 | if (IS_ERR(regmap)) { | ||
42 | ret = PTR_ERR(regmap); | ||
43 | dev_err(&i2c->dev, "regmap init failed: %d\n", ret); | ||
44 | return ret; | ||
45 | } | ||
46 | |||
47 | i2c_set_clientdata(i2c, regmap); | ||
48 | |||
49 | ret = mfd_add_devices(&i2c->dev, PLATFORM_DEVID_NONE, act8945a_devs, | ||
50 | ARRAY_SIZE(act8945a_devs), NULL, 0, NULL); | ||
51 | if (ret) { | ||
52 | dev_err(&i2c->dev, "Failed to add sub devices\n"); | ||
53 | return ret; | ||
54 | } | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static int act8945a_i2c_remove(struct i2c_client *i2c) | ||
60 | { | ||
61 | mfd_remove_devices(&i2c->dev); | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static const struct i2c_device_id act8945a_i2c_id[] = { | ||
67 | { "act8945a", 0 }, | ||
68 | {} | ||
69 | }; | ||
70 | MODULE_DEVICE_TABLE(i2c, act8945a_i2c_id); | ||
71 | |||
72 | static const struct of_device_id act8945a_of_match[] = { | ||
73 | { .compatible = "active-semi,act8945a", }, | ||
74 | {}, | ||
75 | }; | ||
76 | MODULE_DEVICE_TABLE(of, act8945a_of_match); | ||
77 | |||
78 | static struct i2c_driver act8945a_i2c_driver = { | ||
79 | .driver = { | ||
80 | .name = "act8945a", | ||
81 | .of_match_table = of_match_ptr(act8945a_of_match), | ||
82 | }, | ||
83 | .probe = act8945a_i2c_probe, | ||
84 | .remove = act8945a_i2c_remove, | ||
85 | .id_table = act8945a_i2c_id, | ||
86 | }; | ||
87 | |||
88 | static int __init act8945a_i2c_init(void) | ||
89 | { | ||
90 | return i2c_add_driver(&act8945a_i2c_driver); | ||
91 | } | ||
92 | subsys_initcall(act8945a_i2c_init); | ||
93 | |||
94 | static void __exit act8945a_i2c_exit(void) | ||
95 | { | ||
96 | i2c_del_driver(&act8945a_i2c_driver); | ||
97 | } | ||
98 | module_exit(act8945a_i2c_exit); | ||
99 | |||
100 | MODULE_DESCRIPTION("ACT8945A PMIC multi-function driver"); | ||
101 | MODULE_AUTHOR("Wenyou Yang <wenyou.yang@atmel.com>"); | ||
102 | MODULE_LICENSE("GPL"); | ||