aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/bcm590xx.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 13:24:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 13:24:18 -0400
commite5744abb2fa3629aa5a94e21ca1eae32ff2fe00b (patch)
treeef90c96390256b073f5255d224aecb2fc1f6ee84 /drivers/mfd/bcm590xx.c
parentc29aa153ef0469cddf0146d41ce6494bd76be78b (diff)
parent2d28ca731b9bb6262f7711241628c7844b0cf7dc (diff)
Merge tag 'mfd-for-linus-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "Changes to existing drivers: - Use of managed resources - omap, twl4030, ti_am335x_tscadc - Advanced error handling - omap - Rework clk management - omap - Device Tree (re-)work - tc3589x, pm8921, da9055, sec - IRC management overhaul and !BROKEN - pm8921 - Convert to regmap - ssbi, pm8921 - Use simple power-management ops - ucb1x00 - Include file clean-up - adp5520, cs5535, janz, lpc_ich, - lpc_sch, max14577, mcp-sa11x0, pcf50633-adc, rc5t583, rdc321x-southbridge, retu, smsc-ece1099, ti-ssp, ti_am335x_tscadc, tps65912, vexpress-config, wm8350, ywm8350 - Various bug fixes across the subsystem - NULL/invalid pointer dereference prevention - Resource leak mitigation, - Variable used initialised - Staticise various containers - Enforce return value checks New drivers/supported devices: - Add support for s2mps14 and s2mpa01 to sec - Add support for da9063 (v5) to da9063 - Add support for atom-c2000 to gpio-ich - Add support for come-{mbt10,cbt6,chl6} to kempld - Add support for da9053 to da9052 - Add support for itco-wdt (v3) and baytrail to lpc_ich - Add new drivers for tps65218, rtsx_usb, bcm590xx (Re-)moved drivers: - twl4030 ==> drivers/iio - ti-ssp ==> /dev/null" * tag 'mfd-for-linus-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (103 commits) mfd: wm5110: Correct default for HEADPHONE_DETECT_1 mfd: arizona: Correct small errors in the DT binding documentation mfd: arizona: Mark DSP clocking register as volatile mfd: devicetree: bindings: Add pm8xxx RTC description mfd: kempld-core: Fix potential hang-up during boot mfd: sec-core: Fix uninitialized 'regmap_rtc' on S2MPA01 mfd: tps65910: Fix regmap_irq_chip_data leak on mfd_add_devices fail mfd: tps65910: Fix possible invalid pointer dereference on regmap_add_irq_chip fail mfd: sec-core: Fix I2C dummy device resource leak on probe failure mfd: sec-core: Add of_compatible strings for clock MFD cells mfd: Remove obsolete ti-ssp driver Documentation: mfd: s2mps11: Describe S5M8767 and S2MPS14 clocks mfd: bcm590xx: Fix type argument for module device table mfd: lpc_ich: Add support for Intel Bay Trail SoC mfd: lpc_ich: Add support for NM10 GPIO mfd: lpc_ich: Change Avoton to iTCO v3 watchdog: iTCO_wdt: Add support for v3 silicon mfd: lpc_ich: Add support for iTCO v3 mfd: lpc_ich: Remove lpc_ich_cfg struct use mfd: lpc_ich: Only configure watchdog or GPIO when present ...
Diffstat (limited to 'drivers/mfd/bcm590xx.c')
-rw-r--r--drivers/mfd/bcm590xx.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/drivers/mfd/bcm590xx.c b/drivers/mfd/bcm590xx.c
new file mode 100644
index 000000000000..e9a33c79431b
--- /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
25static const struct mfd_cell bcm590xx_devs[] = {
26 {
27 .name = "bcm590xx-vregs",
28 },
29};
30
31static 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
38static 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
67static const struct of_device_id bcm590xx_of_match[] = {
68 { .compatible = "brcm,bcm59056" },
69 { }
70};
71MODULE_DEVICE_TABLE(of, bcm590xx_of_match);
72
73static const struct i2c_device_id bcm590xx_i2c_id[] = {
74 { "bcm59056" },
75 { }
76};
77MODULE_DEVICE_TABLE(i2c, bcm590xx_i2c_id);
78
79static 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};
88module_i2c_driver(bcm590xx_i2c_driver);
89
90MODULE_AUTHOR("Matt Porter <mporter@linaro.org>");
91MODULE_DESCRIPTION("BCM590xx multi-function driver");
92MODULE_LICENSE("GPL v2");
93MODULE_ALIAS("platform:bcm590xx");