aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-core.c
diff options
context:
space:
mode:
authorRickard Andersson <rickard.andersson@stericsson.com>2012-04-17 03:30:57 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-05-01 07:33:53 -0400
commit6ef9418c9e6fc41e6c1066b6423f3a1625e4b822 (patch)
treee6747f8b325172df10684fe2b08dd08bbfc7715a /drivers/mfd/ab8500-core.c
parent112a80d29b529d4057777ac2cb4ec15ff5b6d210 (diff)
mfd: Add parameter to disable ab8500 battery management
This patch makes it possible to disable battery management via a module boot parameter. When 'ab8500-core.no_bm=1' then ab8500_btemp, ab8500_chargalg, ab8500_charger and ab8500_fg will not be probed. This boot parameter is used for scripted testing of the system. Signed-off-by: Rickard Andersson <rickard.andersson@stericsson.com> Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab8500-core.c')
-rw-r--r--drivers/mfd/ab8500-core.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index eee95606bdb..08850f0d152 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -97,6 +97,9 @@
97 97
98#define AB8500_TURN_ON_STATUS 0x00 98#define AB8500_TURN_ON_STATUS 0x00
99 99
100static bool no_bm; /* No battery management */
101module_param(no_bm, bool, S_IRUGO);
102
100#define AB9540_MODEM_CTRL2_REG 0x23 103#define AB9540_MODEM_CTRL2_REG 0x23
101#define AB9540_MODEM_CTRL2_SWDBBRSTN_BIT BIT(2) 104#define AB9540_MODEM_CTRL2_SWDBBRSTN_BIT BIT(2)
102 105
@@ -834,26 +837,6 @@ static struct mfd_cell __devinitdata abx500_common_devs[] = {
834 .resources = ab8500_rtc_resources, 837 .resources = ab8500_rtc_resources,
835 }, 838 },
836 { 839 {
837 .name = "ab8500-charger",
838 .num_resources = ARRAY_SIZE(ab8500_charger_resources),
839 .resources = ab8500_charger_resources,
840 },
841 {
842 .name = "ab8500-btemp",
843 .num_resources = ARRAY_SIZE(ab8500_btemp_resources),
844 .resources = ab8500_btemp_resources,
845 },
846 {
847 .name = "ab8500-fg",
848 .num_resources = ARRAY_SIZE(ab8500_fg_resources),
849 .resources = ab8500_fg_resources,
850 },
851 {
852 .name = "ab8500-chargalg",
853 .num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
854 .resources = ab8500_chargalg_resources,
855 },
856 {
857 .name = "ab8500-acc-det", 840 .name = "ab8500-acc-det",
858 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), 841 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
859 .resources = ab8500_av_acc_detect_resources, 842 .resources = ab8500_av_acc_detect_resources,
@@ -886,6 +869,29 @@ static struct mfd_cell __devinitdata abx500_common_devs[] = {
886 }, 869 },
887}; 870};
888 871
872static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
873 {
874 .name = "ab8500-charger",
875 .num_resources = ARRAY_SIZE(ab8500_charger_resources),
876 .resources = ab8500_charger_resources,
877 },
878 {
879 .name = "ab8500-btemp",
880 .num_resources = ARRAY_SIZE(ab8500_btemp_resources),
881 .resources = ab8500_btemp_resources,
882 },
883 {
884 .name = "ab8500-fg",
885 .num_resources = ARRAY_SIZE(ab8500_fg_resources),
886 .resources = ab8500_fg_resources,
887 },
888 {
889 .name = "ab8500-chargalg",
890 .num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
891 .resources = ab8500_chargalg_resources,
892 },
893};
894
889static struct mfd_cell __devinitdata ab8500_devs[] = { 895static struct mfd_cell __devinitdata ab8500_devs[] = {
890 { 896 {
891 .name = "ab8500-gpio", 897 .name = "ab8500-gpio",
@@ -1204,6 +1210,15 @@ int __devinit ab8500_init(struct ab8500 *ab8500, enum ab8500_version version)
1204 if (ret) 1210 if (ret)
1205 goto out_freeirq; 1211 goto out_freeirq;
1206 1212
1213 if (!no_bm) {
1214 /* Add battery management devices */
1215 ret = mfd_add_devices(ab8500->dev, 0, ab8500_bm_devs,
1216 ARRAY_SIZE(ab8500_bm_devs), NULL,
1217 ab8500->irq_base);
1218 if (ret)
1219 dev_err(ab8500->dev, "error adding bm devices\n");
1220 }
1221
1207 if (is_ab9540(ab8500)) 1222 if (is_ab9540(ab8500))
1208 ret = sysfs_create_group(&ab8500->dev->kobj, 1223 ret = sysfs_create_group(&ab8500->dev->kobj,
1209 &ab9540_attr_group); 1224 &ab9540_attr_group);