Skip to content

Commit

Permalink
mfd: Add parameter to disable ab8500 battery management
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jonas Aberg <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Rickard Andersson authored and Samuel Ortiz committed May 1, 2012
1 parent 112a80d commit 6ef9418
Showing 1 changed file with 35 additions and 20 deletions.
55 changes: 35 additions & 20 deletions drivers/mfd/ab8500-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@

#define AB8500_TURN_ON_STATUS 0x00

static bool no_bm; /* No battery management */
module_param(no_bm, bool, S_IRUGO);

#define AB9540_MODEM_CTRL2_REG 0x23
#define AB9540_MODEM_CTRL2_SWDBBRSTN_BIT BIT(2)

Expand Down Expand Up @@ -833,26 +836,6 @@ static struct mfd_cell __devinitdata abx500_common_devs[] = {
.num_resources = ARRAY_SIZE(ab8500_rtc_resources),
.resources = ab8500_rtc_resources,
},
{
.name = "ab8500-charger",
.num_resources = ARRAY_SIZE(ab8500_charger_resources),
.resources = ab8500_charger_resources,
},
{
.name = "ab8500-btemp",
.num_resources = ARRAY_SIZE(ab8500_btemp_resources),
.resources = ab8500_btemp_resources,
},
{
.name = "ab8500-fg",
.num_resources = ARRAY_SIZE(ab8500_fg_resources),
.resources = ab8500_fg_resources,
},
{
.name = "ab8500-chargalg",
.num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
.resources = ab8500_chargalg_resources,
},
{
.name = "ab8500-acc-det",
.num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
Expand Down Expand Up @@ -886,6 +869,29 @@ static struct mfd_cell __devinitdata abx500_common_devs[] = {
},
};

static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
{
.name = "ab8500-charger",
.num_resources = ARRAY_SIZE(ab8500_charger_resources),
.resources = ab8500_charger_resources,
},
{
.name = "ab8500-btemp",
.num_resources = ARRAY_SIZE(ab8500_btemp_resources),
.resources = ab8500_btemp_resources,
},
{
.name = "ab8500-fg",
.num_resources = ARRAY_SIZE(ab8500_fg_resources),
.resources = ab8500_fg_resources,
},
{
.name = "ab8500-chargalg",
.num_resources = ARRAY_SIZE(ab8500_chargalg_resources),
.resources = ab8500_chargalg_resources,
},
};

static struct mfd_cell __devinitdata ab8500_devs[] = {
{
.name = "ab8500-gpio",
Expand Down Expand Up @@ -1204,6 +1210,15 @@ int __devinit ab8500_init(struct ab8500 *ab8500, enum ab8500_version version)
if (ret)
goto out_freeirq;

if (!no_bm) {
/* Add battery management devices */
ret = mfd_add_devices(ab8500->dev, 0, ab8500_bm_devs,
ARRAY_SIZE(ab8500_bm_devs), NULL,
ab8500->irq_base);
if (ret)
dev_err(ab8500->dev, "error adding bm devices\n");
}

if (is_ab9540(ab8500))
ret = sysfs_create_group(&ab8500->dev->kobj,
&ab9540_attr_group);
Expand Down

0 comments on commit 6ef9418

Please sign in to comment.