diff options
author | Chen-Yu Tsai <wens@csie.org> | 2016-02-11 21:02:44 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2016-02-12 03:54:42 -0500 |
commit | 02071f0f797c989b342f46fbdf472ddb1c2cdee9 (patch) | |
tree | 1433241c6bf6c950e5b590b91ae6e42f29b3c5ad | |
parent | 2260a45356756285faa0b46f0afa53c7f251fb9c (diff) |
mfd: axp20x: Add support for RSB based AXP223 PMIC
The AXP223 is a new PMIC commonly paired with Allwinner A23/A33 SoCs.
It is functionally identical to AXP221; only the regulator default
voltage/status and the external host interface are different.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
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/axp20x-rsb.c | 80 | ||||
-rw-r--r-- | drivers/mfd/axp20x.c | 2 | ||||
-rw-r--r-- | include/linux/mfd/axp20x.h | 1 |
5 files changed, 95 insertions, 0 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 0037b9c933d9..ae3990b5a2bf 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -107,6 +107,17 @@ config MFD_AXP20X_I2C | |||
107 | components like regulators or the PEK (Power Enable Key) under the | 107 | components like regulators or the PEK (Power Enable Key) under the |
108 | corresponding menus. | 108 | corresponding menus. |
109 | 109 | ||
110 | config MFD_AXP20X_RSB | ||
111 | tristate "X-Powers AXP series PMICs with RSB" | ||
112 | select MFD_AXP20X | ||
113 | depends on SUNXI_RSB | ||
114 | help | ||
115 | If you say Y here you get support for the X-Powers AXP series power | ||
116 | management ICs (PMICs) controlled with RSB. | ||
117 | This driver include only the core APIs. You have to select individual | ||
118 | components like regulators or the PEK (Power Enable Key) under the | ||
119 | corresponding menus. | ||
120 | |||
110 | config MFD_CROS_EC | 121 | config MFD_CROS_EC |
111 | tristate "ChromeOS Embedded Controller" | 122 | tristate "ChromeOS Embedded Controller" |
112 | select MFD_CORE | 123 | select MFD_CORE |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index dba4f99d9044..c69ea744fd1a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -112,6 +112,7 @@ obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o | |||
112 | obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o | 112 | obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o |
113 | obj-$(CONFIG_MFD_AXP20X) += axp20x.o | 113 | obj-$(CONFIG_MFD_AXP20X) += axp20x.o |
114 | obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o | 114 | obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o |
115 | obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o | ||
115 | 116 | ||
116 | obj-$(CONFIG_MFD_LP3943) += lp3943.o | 117 | obj-$(CONFIG_MFD_LP3943) += lp3943.o |
117 | obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o | 118 | obj-$(CONFIG_MFD_LP8788) += lp8788.o lp8788-irq.o |
diff --git a/drivers/mfd/axp20x-rsb.c b/drivers/mfd/axp20x-rsb.c new file mode 100644 index 000000000000..28c20247c112 --- /dev/null +++ b/drivers/mfd/axp20x-rsb.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * RSB driver for the X-Powers' Power Management ICs | ||
3 | * | ||
4 | * AXP20x typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC | ||
5 | * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature | ||
6 | * as well as configurable GPIOs. | ||
7 | * | ||
8 | * This driver supports the RSB variants. | ||
9 | * | ||
10 | * Copyright (C) 2015 Chen-Yu Tsai | ||
11 | * | ||
12 | * Author: Chen-Yu Tsai <wens@csie.org> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License version 2 as | ||
16 | * published by the Free Software Foundation. | ||
17 | */ | ||
18 | |||
19 | #include <linux/acpi.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/mfd/axp20x.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/of.h> | ||
24 | #include <linux/regmap.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/sunxi-rsb.h> | ||
27 | |||
28 | static int axp20x_rsb_probe(struct sunxi_rsb_device *rdev) | ||
29 | { | ||
30 | struct axp20x_dev *axp20x; | ||
31 | int ret; | ||
32 | |||
33 | axp20x = devm_kzalloc(&rdev->dev, sizeof(*axp20x), GFP_KERNEL); | ||
34 | if (!axp20x) | ||
35 | return -ENOMEM; | ||
36 | |||
37 | axp20x->dev = &rdev->dev; | ||
38 | axp20x->irq = rdev->irq; | ||
39 | dev_set_drvdata(&rdev->dev, axp20x); | ||
40 | |||
41 | ret = axp20x_match_device(axp20x); | ||
42 | if (ret) | ||
43 | return ret; | ||
44 | |||
45 | axp20x->regmap = devm_regmap_init_sunxi_rsb(rdev, axp20x->regmap_cfg); | ||
46 | if (IS_ERR(axp20x->regmap)) { | ||
47 | ret = PTR_ERR(axp20x->regmap); | ||
48 | dev_err(&rdev->dev, "regmap init failed: %d\n", ret); | ||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | return axp20x_device_probe(axp20x); | ||
53 | } | ||
54 | |||
55 | static int axp20x_rsb_remove(struct sunxi_rsb_device *rdev) | ||
56 | { | ||
57 | struct axp20x_dev *axp20x = sunxi_rsb_device_get_drvdata(rdev); | ||
58 | |||
59 | return axp20x_device_remove(axp20x); | ||
60 | } | ||
61 | |||
62 | static const struct of_device_id axp20x_rsb_of_match[] = { | ||
63 | { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID }, | ||
64 | { }, | ||
65 | }; | ||
66 | MODULE_DEVICE_TABLE(of, axp20x_rsb_of_match); | ||
67 | |||
68 | static struct sunxi_rsb_driver axp20x_rsb_driver = { | ||
69 | .driver = { | ||
70 | .name = "axp20x-rsb", | ||
71 | .of_match_table = of_match_ptr(axp20x_rsb_of_match), | ||
72 | }, | ||
73 | .probe = axp20x_rsb_probe, | ||
74 | .remove = axp20x_rsb_remove, | ||
75 | }; | ||
76 | module_sunxi_rsb_driver(axp20x_rsb_driver); | ||
77 | |||
78 | MODULE_DESCRIPTION("PMIC MFD sunXi RSB driver for AXP20X"); | ||
79 | MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>"); | ||
80 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 3054ea4b95e8..a57d6e940610 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c | |||
@@ -35,6 +35,7 @@ static const char * const axp20x_model_names[] = { | |||
35 | "AXP202", | 35 | "AXP202", |
36 | "AXP209", | 36 | "AXP209", |
37 | "AXP221", | 37 | "AXP221", |
38 | "AXP223", | ||
38 | "AXP288", | 39 | "AXP288", |
39 | }; | 40 | }; |
40 | 41 | ||
@@ -618,6 +619,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x) | |||
618 | axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; | 619 | axp20x->regmap_irq_chip = &axp20x_regmap_irq_chip; |
619 | break; | 620 | break; |
620 | case AXP221_ID: | 621 | case AXP221_ID: |
622 | case AXP223_ID: | ||
621 | axp20x->nr_cells = ARRAY_SIZE(axp22x_cells); | 623 | axp20x->nr_cells = ARRAY_SIZE(axp22x_cells); |
622 | axp20x->cells = axp22x_cells; | 624 | axp20x->cells = axp22x_cells; |
623 | axp20x->regmap_cfg = &axp22x_regmap_config; | 625 | axp20x->regmap_cfg = &axp22x_regmap_config; |
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index 00697c6ad8b0..d82e7d51372b 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h | |||
@@ -18,6 +18,7 @@ enum { | |||
18 | AXP202_ID, | 18 | AXP202_ID, |
19 | AXP209_ID, | 19 | AXP209_ID, |
20 | AXP221_ID, | 20 | AXP221_ID, |
21 | AXP223_ID, | ||
21 | AXP288_ID, | 22 | AXP288_ID, |
22 | NR_AXP20X_VARIANTS, | 23 | NR_AXP20X_VARIANTS, |
23 | }; | 24 | }; |