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

Commit 3ecdf835 authored by Kavya Nunna's avatar Kavya Nunna
Browse files

power: schgm-flashlite: cleanup schgm-flashlite driver



PM2250 doesn't have force boost control register
remove the register usage in driver, also remove headroom
usage.

while at it, replace flash functions with flashlite
functions in smblite, also remove smblite irqs which are
not used.

Change-Id: I81ad074fbbad90db2a73bfc498ed1c9265d1a1bb
Signed-off-by: default avatarKavya Nunna <knunna@codeaurora.org>
parent 10da9faf
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
@@ -85,13 +85,6 @@ static void schgm_flashlite_parse_dt(struct smb_charger *chg)
		if (IS_BETWEEN(0, 100, val))
			chg->flash_disable_soc = (val * 255) / 100;
	}

	chg->headroom_mode = -EINVAL;
	rc = of_property_read_u32(node, "qcom,headroom-mode", &val);
	if (!rc) {
		if (IS_BETWEEN(FIXED_MODE, ADAPTIVE_MODE, val))
			chg->headroom_mode = val;
	}
}

bool is_flashlite_active(struct smb_charger *chg)
@@ -151,13 +144,6 @@ void schgm_flashlite_torch_priority(struct smb_charger *chg,
	int rc;
	u8 reg;

	/*
	 * If torch is configured in default BOOST mode, skip any update in the
	 * mode configuration.
	 */
	if (chg->headroom_mode == FIXED_MODE)
		return;

	if ((mode != TORCH_BOOST_MODE) && (mode != TORCH_BUCK_MODE))
		return;

@@ -209,31 +195,6 @@ int schgm_flashlite_init(struct smb_charger *chg)
		}
	}

	if (chg->headroom_mode != -EINVAL) {
		/*
		 * configure headroom management policy for
		 * flash and torch mode.
		 */
		reg = (chg->headroom_mode == FIXED_MODE)
					? FORCE_FLASH_BOOST_5V_BIT : 0;
		rc = smblite_lib_write(chg, SCHGM_FORCE_BOOST_CONTROL, reg);
		if (rc < 0) {
			pr_err("Couldn't write force boost control reg rc=%d\n",
					rc);
			return rc;
		}

		reg = (chg->headroom_mode == FIXED_MODE)
					? TORCH_PRIORITY_CONTROL_BIT : 0;
		rc = smblite_lib_write(chg,
					SCHGM_TORCH_PRIORITY_CONTROL_REG, reg);
		if (rc < 0) {
			pr_err("Couldn't force 5V boost in torch mode rc=%d\n",
					rc);
			return rc;
		}
	}

	if ((chg->flash_derating_soc != -EINVAL)
				|| (chg->flash_disable_soc != -EINVAL)) {
		/* Check if SOC based derating/disable is enabled */
+0 −3
Original line number Diff line number Diff line
@@ -21,9 +21,6 @@

#define SCHGM_FLASH_STATUS_5_REG		(SCHGM_FLASH_BASE + 0x0B)

#define SCHGM_FORCE_BOOST_CONTROL		(SCHGM_FLASH_BASE + 0x41)
#define FORCE_FLASH_BOOST_5V_BIT		BIT(0)

#define SCHGM_FLASH_S2_LATCH_RESET_CMD_REG	(SCHGM_FLASH_BASE + 0x44)
#define FLASH_S2_LATCH_RESET_BIT		BIT(0)

+6 −7
Original line number Diff line number Diff line
@@ -15,10 +15,9 @@
#include <linux/ktime.h>
#include "smblite-lib.h"
#include "smblite-reg.h"
#include "schgm-flash.h"
#include "step-chg-jeita.h"
#include "storm-watch.h"
#include "schgm-flash.h"
#include "schgm-flashlite.h"

#define smblite_lib_err(chg, fmt, ...)		\
	pr_err("%s: %s: " fmt, chg->name,	\
@@ -432,7 +431,7 @@ static void smblite_lib_uusb_removal(struct smb_charger *chg)
	vote(chg->pl_enable_votable_indirect, USBIN_I_VOTER, false, 0);
	vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0);
	vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
			is_flash_active(chg) ? USBIN_500UA : USBIN_100UA);
			is_flashlite_active(chg) ? USBIN_500UA : USBIN_100UA);

	/* Remove SW thermal regulation votes */
	vote(chg->usb_icl_votable, SW_THERM_REGULATION_VOTER, false, 0);
@@ -521,7 +520,7 @@ int smblite_lib_set_icl_current(struct smb_charger *chg, int icl_ua)
	/* suspend if 25mA or less is requested */
	bool suspend = (icl_ua <= USBIN_25UA);

	schgm_flash_torch_priority(chg, suspend ? TORCH_BOOST_MODE :
	schgm_flashlite_torch_priority(chg, suspend ? TORCH_BOOST_MODE :
							TORCH_BUCK_MODE);
	/* Do not configure ICL from SW for DAM */
	if (smblite_lib_get_prop_typec_mode(chg) ==
@@ -1992,7 +1991,7 @@ irqreturn_t smblite_usbin_uv_irq_handler(int irq, void *data)

unsuspend_input:
		/* Force torch in boost mode to ensure it works with low ICL */
		schgm_flash_torch_priority(chg, TORCH_BOOST_MODE);
		schgm_flashlite_torch_priority(chg, TORCH_BOOST_MODE);

		if (chg->aicl_max_reached) {
			smblite_lib_dbg(chg, PR_MISC,
@@ -2185,7 +2184,7 @@ static void update_sw_icl_max(struct smb_charger *chg,
						USB_PSY_VOTER)) {
			/* if flash is active force 500mA */
			vote(chg->usb_icl_votable, USB_PSY_VOTER, true,
					is_flash_active(chg) ?
					is_flashlite_active(chg) ?
					USBIN_500UA : USBIN_100UA);
		}
		vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, false, 0);
@@ -2491,7 +2490,7 @@ static void typec_src_removal(struct smb_charger *chg)

	/* reset input current limit voters */
	vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
			is_flash_active(chg) ? USBIN_500UA : USBIN_100UA);
			is_flashlite_active(chg) ? USBIN_500UA : USBIN_100UA);
	vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0);

	/* reset parallel voters */
+0 −4
Original line number Diff line number Diff line
@@ -144,14 +144,10 @@ enum smb_irq_index {
	VREG_OK_IRQ,
	ILIM_S2_IRQ,
	ILIM_S1_IRQ,
	VOUT_DOWN_IRQ,
	VOUT_UP_IRQ,
	FLASH_STATE_CHANGE_IRQ,
	TORCH_REQ_IRQ,
	FLASH_EN_IRQ,
	SDAM_STS_IRQ,
	/* END */
	SMB_IRQ_MAX,
};

enum chg_term_config_src {