Skip to content

Commit

Permalink
power: supply: ab8500: Drop external charger leftovers
Browse files Browse the repository at this point in the history
Some leftover code for external chargers only used with
unreleased ASIC revisions and the header file for the
unsupported PM2301 was left behind in an earlier cleanup,
fix it by deleting the remnants.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
  • Loading branch information
Linus Walleij authored and Sebastian Reichel committed Jul 16, 2022
1 parent e8b60d9 commit 6c50a08
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 562 deletions.
4 changes: 0 additions & 4 deletions drivers/power/supply/ab8500-chargalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ struct ux500_charger_ops {
* @max_out_volt_uv maximum output charger voltage in uV
* @max_out_curr_ua maximum output charger current in uA
* @enabled indicates if this charger is used or not
* @external external charger unit (pm2xxx)
*/
struct ux500_charger {
struct power_supply *psy;
Expand All @@ -43,9 +42,6 @@ struct ux500_charger {
int max_out_curr_ua;
int wdt_refresh;
bool enabled;
bool external;
};

extern struct blocking_notifier_head charger_notifier_list;

#endif /* _AB8500_CHARGALG_H_ */
23 changes: 1 addition & 22 deletions drivers/power/supply/ab8500_chargalg.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,6 @@ struct ab8500_chargalg {
struct kobject chargalg_kobject;
};

/*External charger prepare notifier*/
BLOCKING_NOTIFIER_HEAD(charger_notifier_list);

/* Main battery properties */
static enum power_supply_property ab8500_chargalg_props[] = {
POWER_SUPPLY_PROP_STATUS,
Expand Down Expand Up @@ -343,8 +340,7 @@ static int ab8500_chargalg_check_charger_enable(struct ab8500_chargalg *di)
return di->usb_chg->ops.check_enable(di->usb_chg,
bi->constant_charge_voltage_max_uv,
bi->constant_charge_current_max_ua);
} else if ((di->chg_info.charger_type & AC_CHG) &&
!(di->ac_chg->external)) {
} else if (di->chg_info.charger_type & AC_CHG) {
return di->ac_chg->ops.check_enable(di->ac_chg,
bi->constant_charge_voltage_max_uv,
bi->constant_charge_current_max_ua);
Expand Down Expand Up @@ -473,15 +469,6 @@ static int ab8500_chargalg_kick_watchdog(struct ab8500_chargalg *di)
/* Check if charger exists and kick watchdog if charging */
if (di->ac_chg && di->ac_chg->ops.kick_wd &&
di->chg_info.online_chg & AC_CHG) {
/*
* If AB charger watchdog expired, pm2xxx charging
* gets disabled. To be safe, kick both AB charger watchdog
* and pm2xxx watchdog.
*/
if (di->ac_chg->external &&
di->usb_chg && di->usb_chg->ops.kick_wd)
di->usb_chg->ops.kick_wd(di->usb_chg);

return di->ac_chg->ops.kick_wd(di->ac_chg);
} else if (di->usb_chg && di->usb_chg->ops.kick_wd &&
di->chg_info.online_chg & USB_CHG)
Expand Down Expand Up @@ -517,14 +504,6 @@ static int ab8500_chargalg_ac_en(struct ab8500_chargalg *di, int enable,
di->chg_info.ac_iset_ua = iset_ua;
di->chg_info.ac_vset_uv = vset_uv;

/* Enable external charger */
if (enable && di->ac_chg->external &&
!ab8500_chargalg_ex_ac_enable_toggle) {
blocking_notifier_call_chain(&charger_notifier_list,
0, di->dev);
ab8500_chargalg_ex_ac_enable_toggle++;
}

return di->ac_chg->ops.enable(di->ac_chg, enable, vset_uv, iset_ua);
}

Expand Down
45 changes: 1 addition & 44 deletions drivers/power/supply/ab8500_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1716,29 +1716,6 @@ static int ab8500_charger_usb_en(struct ux500_charger *charger,
return ret;
}

static int ab8500_external_charger_prepare(struct notifier_block *charger_nb,
unsigned long event, void *data)
{
int ret;
struct device *dev = data;
/*Toggle External charger control pin*/
ret = abx500_set_register_interruptible(dev, AB8500_SYS_CTRL1_BLOCK,
AB8500_SYS_CHARGER_CONTROL_REG,
EXTERNAL_CHARGER_DISABLE_REG_VAL);
if (ret < 0) {
dev_err(dev, "write reg failed %d\n", ret);
goto out;
}
ret = abx500_set_register_interruptible(dev, AB8500_SYS_CTRL1_BLOCK,
AB8500_SYS_CHARGER_CONTROL_REG,
EXTERNAL_CHARGER_ENABLE_REG_VAL);
if (ret < 0)
dev_err(dev, "Write reg failed %d\n", ret);

out:
return ret;
}

/**
* ab8500_charger_usb_check_enable() - enable usb charging
* @charger: pointer to the ux500_charger structure
Expand Down Expand Up @@ -3316,10 +3293,6 @@ static int __maybe_unused ab8500_charger_suspend(struct device *dev)
return 0;
}

static struct notifier_block charger_nb = {
.notifier_call = ab8500_external_charger_prepare,
};

static char *supply_interface[] = {
"ab8500_chargalg",
"ab8500_fg",
Expand Down Expand Up @@ -3540,7 +3513,6 @@ static int ab8500_charger_probe(struct platform_device *pdev)
*/
if (!is_ab8505(di->parent))
di->ac_chg.enabled = true;
di->ac_chg.external = false;

/* USB supply */
/* ux500_charger sub-class */
Expand All @@ -3553,7 +3525,6 @@ static int ab8500_charger_probe(struct platform_device *pdev)
di->usb_chg.max_out_curr_ua =
ab8500_charge_output_curr_map[ARRAY_SIZE(ab8500_charge_output_curr_map) - 1];
di->usb_chg.wdt_refresh = CHG_WD_INTERVAL;
di->usb_chg.external = false;
di->usb_state.usb_current_ua = -1;

mutex_init(&di->charger_attached_mutex);
Expand Down Expand Up @@ -3677,17 +3648,11 @@ static int ab8500_charger_probe(struct platform_device *pdev)
goto remove_ab8500_bm;
}

/* Notifier for external charger enabling */
if (!di->ac_chg.enabled)
blocking_notifier_chain_register(
&charger_notifier_list, &charger_nb);


di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(di->usb_phy)) {
dev_err(dev, "failed to get usb transceiver\n");
ret = -EINVAL;
goto out_charger_notifier;
goto remove_ab8500_bm;
}
di->nb.notifier_call = ab8500_charger_usb_notifier_call;
ret = usb_register_notifier(di->usb_phy, &di->nb);
Expand All @@ -3696,7 +3661,6 @@ static int ab8500_charger_probe(struct platform_device *pdev)
goto put_usb_phy;
}


ret = component_master_add_with_match(&pdev->dev,
&ab8500_charger_comp_ops,
match);
Expand All @@ -3711,10 +3675,6 @@ static int ab8500_charger_probe(struct platform_device *pdev)
usb_unregister_notifier(di->usb_phy, &di->nb);
put_usb_phy:
usb_put_phy(di->usb_phy);
out_charger_notifier:
if (!di->ac_chg.enabled)
blocking_notifier_chain_unregister(
&charger_notifier_list, &charger_nb);
remove_ab8500_bm:
ab8500_bm_of_remove(di->usb_chg.psy, di->bm);
return ret;
Expand All @@ -3729,9 +3689,6 @@ static int ab8500_charger_remove(struct platform_device *pdev)
usb_unregister_notifier(di->usb_phy, &di->nb);
ab8500_bm_of_remove(di->usb_chg.psy, di->bm);
usb_put_phy(di->usb_phy);
if (!di->ac_chg.enabled)
blocking_notifier_chain_unregister(
&charger_notifier_list, &charger_nb);

return 0;
}
Expand Down
Loading

0 comments on commit 6c50a08

Please sign in to comment.