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

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

Merge "power: qpnp-smb2: Specify the min/max charger switching frequency"

parents 2a46b117 f222cd62
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -169,6 +169,18 @@ Charger specific properties:
  Definition: Boolean flag which when present enables intput suspend for
		debug battery.

- qcom,min-freq-khz
  Usage:      optional
  Value type: <u32>
  Definition: Specifies the minimum charger buck/boost switching frequency
		in KHz. It overrides the min frequency defined for the charger.

- qcom,max-freq-khz
  Usage:      optional
  Value type: <u32>
  Definition: Specifies the maximum charger buck/boost switching frequency in
		 KHz. It overrides the max frequency defined for the charger.

=============================================
Second Level Nodes - SMB2 Charger Peripherals
=============================================
+24 −0
Original line number Diff line number Diff line
@@ -244,6 +244,8 @@ struct smb_dt_props {
	int	boost_threshold_ua;
	int	fv_uv;
	int	wipower_max_uw;
	int	min_freq_khz;
	int	max_freq_khz;
	u32	step_soc_threshold[STEP_CHARGING_MAX_STEPS - 1];
	s32	step_cc_delta[STEP_CHARGING_MAX_STEPS];
	struct	device_node *revid_dev_node;
@@ -338,6 +340,18 @@ static int smb2_parse_dt(struct smb2 *chip)
	if (rc < 0)
		chip->dt.boost_threshold_ua = MICRO_P1A;

	rc = of_property_read_u32(node,
				"qcom,min-freq-khz",
				&chip->dt.min_freq_khz);
	if (rc < 0)
		chip->dt.min_freq_khz = -EINVAL;

	rc = of_property_read_u32(node,
				"qcom,max-freq-khz",
				&chip->dt.max_freq_khz);
	if (rc < 0)
		chip->dt.max_freq_khz = -EINVAL;

	rc = of_property_read_u32(node, "qcom,wipower-max-uw",
				&chip->dt.wipower_max_uw);
	if (rc < 0)
@@ -1438,6 +1452,16 @@ static int smb2_init_hw(struct smb2 *chip)
		smblib_get_charge_param(chg, &chg->param.dc_icl,
					&chip->dt.dc_icl_ua);

	if (chip->dt.min_freq_khz > 0) {
		chg->param.freq_buck.min_u = chip->dt.min_freq_khz;
		chg->param.freq_boost.min_u = chip->dt.min_freq_khz;
	}

	if (chip->dt.max_freq_khz > 0) {
		chg->param.freq_buck.max_u = chip->dt.max_freq_khz;
		chg->param.freq_boost.max_u = chip->dt.max_freq_khz;
	}

	/* set a slower soft start setting for OTG */
	rc = smblib_masked_write(chg, DC_ENG_SSUPPLY_CFG2_REG,
				ENG_SSUPPLY_IVREF_OTG_SS_MASK, OTG_SS_SLOW);
+3 −1
Original line number Diff line number Diff line
@@ -3578,6 +3578,8 @@ static void typec_source_insertion(struct smb_charger *chg)
		&& !is_client_vote_enabled(chg->usb_icl_votable, PD_VOTER)
		&& !is_client_vote_enabled(chg->usb_icl_votable, USB_PSY_VOTER))
		vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 100000);

	smblib_set_opt_freq_buck(chg, chg->chg_freq.freq_5V);
}

static void typec_sink_insertion(struct smb_charger *chg)
@@ -3653,8 +3655,8 @@ static void smblib_handle_typec_insertion(struct smb_charger *chg,
		typec_source_removal(chg);
		typec_sink_insertion(chg);
	} else {
		typec_source_insertion(chg);
		typec_sink_removal(chg);
		typec_source_insertion(chg);
	}

	rp = smblib_get_prop_ufp_mode(chg);