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

Commit a00b4e88 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5: update thermal mitigation configuration"

parents 662ee602 40b66271
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -1785,28 +1785,32 @@ static int smb5_configure_micro_usb(struct smb_charger *chg)
static int smb5_configure_mitigation(struct smb_charger *chg)
{
	int rc;
	u8 chan = 0;
	u8 chan = 0, src_cfg = 0;

	if (!chg->hw_die_temp_mitigation && !chg->hw_connector_mitigation)
		return 0;

	if (chg->hw_die_temp_mitigation) {
		rc = smblib_write(chg, MISC_THERMREG_SRC_CFG_REG,
				THERMREG_CONNECTOR_ADC_SRC_EN_BIT
				| THERMREG_DIE_ADC_SRC_EN_BIT
				| THERMREG_DIE_CMP_SRC_EN_BIT);
		chan = DIE_TEMP_CHANNEL_EN_BIT;
		src_cfg = THERMREG_DIE_ADC_SRC_EN_BIT
			| THERMREG_DIE_CMP_SRC_EN_BIT;
	}

	if (chg->hw_connector_mitigation) {
		chan |= CONN_THM_CHANNEL_EN_BIT;
		src_cfg |= THERMREG_CONNECTOR_ADC_SRC_EN_BIT;
	}

	rc = smblib_masked_write(chg, MISC_THERMREG_SRC_CFG_REG,
			THERMREG_SW_ICL_ADJUST_BIT | THERMREG_DIE_ADC_SRC_EN_BIT
			| THERMREG_DIE_CMP_SRC_EN_BIT
			| THERMREG_CONNECTOR_ADC_SRC_EN_BIT, src_cfg);
	if (rc < 0) {
		dev_err(chg->dev,
				"Couldn't configure THERM_SRC reg rc=%d\n", rc);
		return rc;
	};

		chan = DIE_TEMP_CHANNEL_EN_BIT;
	}

	if (chg->hw_connector_mitigation)
		chan |= CONN_THM_CHANNEL_EN_BIT;

	rc = smblib_masked_write(chg, BATIF_ADC_CHANNEL_EN_REG,
			CONN_THM_CHANNEL_EN_BIT | DIE_TEMP_CHANNEL_EN_BIT,
			chan);