diff options
Diffstat (limited to 'drivers/mfd/qcom-spmi-pmic.c')
-rw-r--r-- | drivers/mfd/qcom-spmi-pmic.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c new file mode 100644 index 000000000000..4b8beb2a1579 --- /dev/null +++ b/drivers/mfd/qcom-spmi-pmic.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2014, The Linux Foundation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 and | ||
6 | * only version 2 as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/spmi.h> | ||
17 | #include <linux/regmap.h> | ||
18 | #include <linux/of_platform.h> | ||
19 | |||
20 | static const struct regmap_config spmi_regmap_config = { | ||
21 | .reg_bits = 16, | ||
22 | .val_bits = 8, | ||
23 | .max_register = 0xffff, | ||
24 | .fast_io = true, | ||
25 | }; | ||
26 | |||
27 | static int pmic_spmi_probe(struct spmi_device *sdev) | ||
28 | { | ||
29 | struct device_node *root = sdev->dev.of_node; | ||
30 | struct regmap *regmap; | ||
31 | |||
32 | regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config); | ||
33 | if (IS_ERR(regmap)) | ||
34 | return PTR_ERR(regmap); | ||
35 | |||
36 | return of_platform_populate(root, NULL, NULL, &sdev->dev); | ||
37 | } | ||
38 | |||
39 | static void pmic_spmi_remove(struct spmi_device *sdev) | ||
40 | { | ||
41 | of_platform_depopulate(&sdev->dev); | ||
42 | } | ||
43 | |||
44 | static const struct of_device_id pmic_spmi_id_table[] = { | ||
45 | { .compatible = "qcom,spmi-pmic" }, | ||
46 | { .compatible = "qcom,pm8941" }, | ||
47 | { .compatible = "qcom,pm8841" }, | ||
48 | { .compatible = "qcom,pma8084" }, | ||
49 | { } | ||
50 | }; | ||
51 | MODULE_DEVICE_TABLE(of, pmic_spmi_id_table); | ||
52 | |||
53 | static struct spmi_driver pmic_spmi_driver = { | ||
54 | .probe = pmic_spmi_probe, | ||
55 | .remove = pmic_spmi_remove, | ||
56 | .driver = { | ||
57 | .name = "pmic-spmi", | ||
58 | .of_match_table = pmic_spmi_id_table, | ||
59 | }, | ||
60 | }; | ||
61 | module_spmi_driver(pmic_spmi_driver); | ||
62 | |||
63 | MODULE_DESCRIPTION("Qualcomm SPMI PMIC driver"); | ||
64 | MODULE_ALIAS("spmi:spmi-pmic"); | ||
65 | MODULE_LICENSE("GPL v2"); | ||
66 | MODULE_AUTHOR("Josh Cartwright <joshc@codeaurora.org>"); | ||
67 | MODULE_AUTHOR("Stanimir Varbanov <svarbanov@mm-sol.com>"); | ||