Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f655dba authored by Shilpa Suresh's avatar Shilpa Suresh
Browse files

power: qpnp-linear-charger: Handle battery power change



Add the handler to manage external battery power change
indication and send out the corresponding uevents.

Change-Id: I30fb1da86cbdacbf08b295cfd3fbfddd0ef7c0a2
Signed-off-by: default avatarShilpa Suresh <sbsure@codeaurora.org>
parent 85c3d47d
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2015, 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1429,6 +1429,16 @@ static void qpnp_lbc_set_appropriate_current(struct qpnp_lbc_chip *chip)
	qpnp_lbc_ibatmax_set(chip, chg_current);
}

static void qpnp_batt_external_power_changed(struct power_supply *psy)
{
	struct qpnp_lbc_chip *chip = power_supply_get_drvdata(psy);

	if (chip->bat_if_base && chip->batt_psy) {
		pr_debug("power supply changed batt_psy\n");
		power_supply_changed(chip->batt_psy);
	}
}

static int qpnp_lbc_system_temp_level_set(struct qpnp_lbc_chip *chip,
								int lvl_sel)
{
@@ -3454,6 +3464,8 @@ static int qpnp_lbc_main_probe(struct platform_device *pdev)
			ARRAY_SIZE(msm_batt_power_props);
		chip->batt_psy_d.get_property = qpnp_batt_power_get_property;
		chip->batt_psy_d.set_property = qpnp_batt_power_set_property;
		chip->batt_psy_d.external_power_changed =
			qpnp_batt_external_power_changed;
		chip->batt_psy_d.property_is_writeable =
			qpnp_batt_property_is_writeable;