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

Commit 6f70a512 authored by Ashay Jaiswal's avatar Ashay Jaiswal
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 5292b591
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;
@@ -848,6 +850,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");

@@ -916,7 +924,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");
@@ -1041,7 +1050,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)) {
		/*
@@ -1200,7 +1208,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;
@@ -1301,6 +1311,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_attrs = pl_attributes;
+9 −0
Original line number Diff line number Diff line
@@ -1590,11 +1590,20 @@ static int smb5_init_hw(struct smb5 *chip)

	/*
	 * PMI632 based hw init:
	 * - Enable STAT pin function on SMB_EN
	 * - Rerun APSD to ensure proper charger detection if device
	 *   boots with charger connected.
	 * - Initialize flash module for PMI632
	 */
	if (chg->smb_version == PMI632_SUBTYPE) {
		rc = smblib_masked_write(chg, MISC_SMB_EN_CMD_REG,
					EN_STAT_CMD_BIT, EN_STAT_CMD_BIT);
		if (rc < 0) {
			dev_err(chg->dev, "Couldn't configure SMB_EN rc=%d\n",
					rc);
			return rc;
		}

		schgm_flash_init(chg);
		smblib_rerun_apsd_if_required(chg);
	}