ARM: dts: add 'dr_mode' property to hsotg devices for exynos boards
[linux/fpc-iii.git] / drivers / mfd / qcom-spmi-pmic.c
blob4b8beb2a1579c77e35943fc8859815c1c652f9c4
1 /*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
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.
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.
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>
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,
27 static int pmic_spmi_probe(struct spmi_device *sdev)
29 struct device_node *root = sdev->dev.of_node;
30 struct regmap *regmap;
32 regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config);
33 if (IS_ERR(regmap))
34 return PTR_ERR(regmap);
36 return of_platform_populate(root, NULL, NULL, &sdev->dev);
39 static void pmic_spmi_remove(struct spmi_device *sdev)
41 of_platform_depopulate(&sdev->dev);
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 { }
51 MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);
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,
61 module_spmi_driver(pmic_spmi_driver);
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>");