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

Commit c1368094 authored by Ashay Jaiswal's avatar Ashay Jaiswal Committed by Umang Agrawal
Browse files

power: smb5: enable parallel charging support



Enable parallel charging support in charger driver:
- Configure STAT CMD in main charger, which enables parallel chip.
- Only disable hvdcp hw INOV for PMI8998/PM660, for all new
  platforms hw INOV is disabled in main charger.

Change-Id: I84037ca93c9801b28e47157923817413f7091e2c
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 833fba97
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ struct pl_data {
	struct class		qcom_batt_class;
	struct wakeup_source	*pl_ws;
	struct notifier_block	nb;
	bool			pl_disable;
};

struct pl_data *the_chip;
@@ -88,6 +89,7 @@ enum print_reason {

enum {
	AICL_RERUN_WA_BIT	= BIT(0),
	FORCE_INOV_DISABLE_BIT	= BIT(1),
};

static int debug_mask;
@@ -851,6 +853,12 @@ static int pl_disable_vote_callback(struct votable *votable,
		chip->pl_settled_ua = 0;
	}

	/* notify parallel state change */
	if (chip->pl_psy && (chip->pl_disable != pl_disable)) {
		power_supply_changed(chip->pl_psy);
		chip->pl_disable = (bool)pl_disable;
	}

	pl_dbg(chip, PR_PARALLEL, "parallel charging %s\n",
		   pl_disable ? "disabled" : "enabled");

@@ -919,7 +927,8 @@ static bool is_parallel_available(struct pl_data *chip)
	chip->pl_mode = pval.intval;

	/* Disable autonomous votage increments for USBIN-USBIN */
	if (IS_USBIN(chip->pl_mode)) {
	if (IS_USBIN(chip->pl_mode)
			&& (chip->wa_flags & FORCE_INOV_DISABLE_BIT)) {
		if (!chip->hvdcp_hw_inov_dis_votable)
			chip->hvdcp_hw_inov_dis_votable =
					find_votable("HVDCP_HW_INOV_DIS");
@@ -1044,7 +1053,6 @@ static void handle_settled_icl_change(struct pl_data *chip)
	else
		vote(chip->pl_enable_votable_indirect, USBIN_I_VOTER, true, 0);

	rerun_election(chip->fcc_votable);

	if (IS_USBIN(chip->pl_mode)) {
		/*
@@ -1203,7 +1211,9 @@ static void pl_config_init(struct pl_data *chip, int smb_version)
	switch (smb_version) {
	case PMI8998_SUBTYPE:
	case PM660_SUBTYPE:
		chip->wa_flags = AICL_RERUN_WA_BIT;
		chip->wa_flags = AICL_RERUN_WA_BIT | FORCE_INOV_DISABLE_BIT;
		break;
	case PMI632_SUBTYPE:
		break;
	default:
		break;
@@ -1304,6 +1314,7 @@ int qcom_batt_init(int smb_version)
		goto unreg_notifier;
	}

	chip->pl_disable = true;
	chip->qcom_batt_class.name = "qcom-battery",
	chip->qcom_batt_class.owner = THIS_MODULE,
	chip->qcom_batt_class.class_groups = batt_class_groups;