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

Commit e9fd08d2 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Harry Yang
Browse files

qcom: smb138x: set the freq to 700Khz



700Khz is not a harmonic of the digital clock and is optimal enough
for all vbus ranges. Running the smb in the non harmonic freq range
is required for correct TDIE adc reporting.

Change-Id: Ib70d64cd72b7408474fd64df287f6404d3749764
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent e3d988a9
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -380,13 +380,13 @@ static int smblib_set_opt_freq_buck(struct smb_charger *chg, int fsw_khz)

	if (chg->mode == PARALLEL_MASTER && chg->pl.psy) {
		pval.intval = fsw_khz;
		rc = power_supply_set_property(chg->pl.psy,
		/*
		 * Some parallel charging implementations may not have
		 * PROP_BUCK_FREQ property - they could be running
		 * with a fixed frequency
		 */
		power_supply_set_property(chg->pl.psy,
				POWER_SUPPLY_PROP_BUCK_FREQ, &pval);
		if (rc < 0) {
			dev_err(chg->dev,
				"Could not set parallel buck_freq rc=%d\n", rc);
			return rc;
		}
	}

	return rc;
+8 −5
Original line number Diff line number Diff line
@@ -621,10 +621,6 @@ static int smb138x_parallel_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
		rc = smblib_set_charge_param(chg, &chg->param.fcc, val->intval);
		break;
	case POWER_SUPPLY_PROP_BUCK_FREQ:
		rc = smblib_set_charge_param(chg, &chg->param.freq_buck,
					     val->intval);
		break;
	case POWER_SUPPLY_PROP_SET_SHIP_MODE:
		/* Not in ship mode as long as the device is active */
		if (!val->intval)
@@ -632,7 +628,7 @@ static int smb138x_parallel_set_prop(struct power_supply *psy,
		rc = smblib_set_prop_ship_mode(chg, val);
		break;
	default:
		pr_err("parallel power supply set prop %d not supported\n",
		pr_debug("parallel power supply set prop %d not supported\n",
			prop);
		return -EINVAL;
	}
@@ -911,6 +907,13 @@ static int smb138x_init_hw(struct smb138x *chip)

	chg->dcp_icl_ua = chip->dt.usb_icl_ua;

	/* configure to a fixed 700khz freq to avoid tdie errors */
	rc = smblib_set_charge_param(chg, &chg->param.freq_buck, 700);
	if (rc < 0) {
		pr_err("Couldn't configure 700Khz switch freq rc=%d\n", rc);
		return rc;
	}

	/* configure charge enable for software control; active high */
	rc = smblib_masked_write(chg, CHGR_CFG2_REG,
				 CHG_EN_POLARITY_BIT | CHG_EN_SRC_BIT, 0);