diff options
author | Matt Porter <mporter@linaro.org> | 2014-03-11 19:33:54 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-03-19 04:59:59 -0400 |
commit | 037b60f2ca9403d02cbee60ad0a10f3806f9dc4b (patch) | |
tree | 4f2e42a0adf1595269b6d70a2c43d3c3f374f84d /drivers/mfd | |
parent | c6215037ac5594ef375e07e33572d85aeb0f5e3e (diff) |
mfd: Add bcm590xx pmu driver
Add a driver for the BCM590xx PMU multi-function devices. The driver
initially supports regmap initialization and instantiation of the
voltage regulator device function of the PMU.
Signed-off-by: Matt Porter <mporter@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/Kconfig | 8 | ||||
-rw-r--r-- | drivers/mfd/Makefile | 1 | ||||
-rw-r--r-- | drivers/mfd/bcm590xx.c | 93 |
3 files changed, 102 insertions, 0 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index d22ca0fc873f..7587c9e1a519 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -59,6 +59,14 @@ config MFD_AAT2870_CORE | |||
59 | additional drivers must be enabled in order to use the | 59 | additional drivers must be enabled in order to use the |
60 | functionality of the device. | 60 | functionality of the device. |
61 | 61 | ||
62 | config MFD_BCM590XX | ||
63 | tristate "Broadcom BCM590xx PMUs" | ||
64 | select MFD_CORE | ||
65 | select REGMAP_I2C | ||
66 | depends on I2C | ||
67 | help | ||
68 | Support for the BCM590xx PMUs from Broadcom | ||
69 | |||
62 | config MFD_CROS_EC | 70 | config MFD_CROS_EC |
63 | tristate "ChromeOS Embedded Controller" | 71 | tristate "ChromeOS Embedded Controller" |
64 | select MFD_CORE | 72 | select MFD_CORE |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 89a7951503ca..23835dfa615c 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -8,6 +8,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_SM501) += sm501.o | 9 | obj-$(CONFIG_MFD_SM501) += sm501.o |
10 | obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o | 10 | obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o |
11 | obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o | ||
11 | obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o | 12 | obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o |
12 | obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o | 13 | obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o |
13 | obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o | 14 | obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o |
diff --git a/drivers/mfd/bcm590xx.c b/drivers/mfd/bcm590xx.c new file mode 100644 index 000000000000..926a57e4d533 --- /dev/null +++ b/drivers/mfd/bcm590xx.c | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Broadcom BCM590xx PMU | ||
3 | * | ||
4 | * Copyright 2014 Linaro Limited | ||
5 | * Author: Matt Porter <mporter@linaro.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/err.h> | ||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/mfd/bcm590xx.h> | ||
17 | #include <linux/mfd/core.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/moduleparam.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_device.h> | ||
22 | #include <linux/regmap.h> | ||
23 | #include <linux/slab.h> | ||
24 | |||
25 | static const struct mfd_cell bcm590xx_devs[] = { | ||
26 | { | ||
27 | .name = "bcm590xx-vregs", | ||
28 | }, | ||
29 | }; | ||
30 | |||
31 | static const struct regmap_config bcm590xx_regmap_config = { | ||
32 | .reg_bits = 8, | ||
33 | .val_bits = 8, | ||
34 | .max_register = BCM590XX_MAX_REGISTER, | ||
35 | .cache_type = REGCACHE_RBTREE, | ||
36 | }; | ||
37 | |||
38 | static int bcm590xx_i2c_probe(struct i2c_client *i2c, | ||
39 | const struct i2c_device_id *id) | ||
40 | { | ||
41 | struct bcm590xx *bcm590xx; | ||
42 | int ret; | ||
43 | |||
44 | bcm590xx = devm_kzalloc(&i2c->dev, sizeof(*bcm590xx), GFP_KERNEL); | ||
45 | if (!bcm590xx) | ||
46 | return -ENOMEM; | ||
47 | |||
48 | i2c_set_clientdata(i2c, bcm590xx); | ||
49 | bcm590xx->dev = &i2c->dev; | ||
50 | bcm590xx->i2c_client = i2c; | ||
51 | |||
52 | bcm590xx->regmap = devm_regmap_init_i2c(i2c, &bcm590xx_regmap_config); | ||
53 | if (IS_ERR(bcm590xx->regmap)) { | ||
54 | ret = PTR_ERR(bcm590xx->regmap); | ||
55 | dev_err(&i2c->dev, "regmap initialization failed: %d\n", ret); | ||
56 | return ret; | ||
57 | } | ||
58 | |||
59 | ret = mfd_add_devices(&i2c->dev, -1, bcm590xx_devs, | ||
60 | ARRAY_SIZE(bcm590xx_devs), NULL, 0, NULL); | ||
61 | if (ret < 0) | ||
62 | dev_err(&i2c->dev, "failed to add sub-devices: %d\n", ret); | ||
63 | |||
64 | return ret; | ||
65 | } | ||
66 | |||
67 | static const struct of_device_id bcm590xx_of_match[] = { | ||
68 | { .compatible = "brcm,bcm59056" }, | ||
69 | { } | ||
70 | }; | ||
71 | MODULE_DEVICE_TABLE(i2c, bcm590xx_of_match); | ||
72 | |||
73 | static const struct i2c_device_id bcm590xx_i2c_id[] = { | ||
74 | { "bcm59056" }, | ||
75 | { } | ||
76 | }; | ||
77 | MODULE_DEVICE_TABLE(i2c, bcm590xx_i2c_id); | ||
78 | |||
79 | static struct i2c_driver bcm590xx_i2c_driver = { | ||
80 | .driver = { | ||
81 | .name = "bcm590xx", | ||
82 | .owner = THIS_MODULE, | ||
83 | .of_match_table = of_match_ptr(bcm590xx_of_match), | ||
84 | }, | ||
85 | .probe = bcm590xx_i2c_probe, | ||
86 | .id_table = bcm590xx_i2c_id, | ||
87 | }; | ||
88 | module_i2c_driver(bcm590xx_i2c_driver); | ||
89 | |||
90 | MODULE_AUTHOR("Matt Porter <mporter@linaro.org>"); | ||
91 | MODULE_DESCRIPTION("BCM590xx multi-function driver"); | ||
92 | MODULE_LICENSE("GPL v2"); | ||
93 | MODULE_ALIAS("platform:bcm590xx"); | ||