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

Commit 6f8cc6b8 authored by Devesh Jhunjhunwala's avatar Devesh Jhunjhunwala
Browse files

power: smb1351-charger: Update smb1351 switching frequency



The default switching frequency of 750kHz is causing spur
on some devices, so increase the switching frequency to 1.5MHz.

CRs-Fixed: 1018750
Change-Id: I09da751b414d09729eb07c36ff1e9b667237833b
Signed-off-by: default avatarDevesh Jhunjhunwala <deveshj@codeaurora.org>
parent 9f277664
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ Optional Properties:
- qcom,batt-cool-ma:		Maximum cool battery charge current in milli-amps.
- qcom,batt-warm-mv:		Maximum warm battery target voltage in milli-volts.
- qcom,batt-cool-mv:		Maximum cool battery target voltage in milli-volts.
- qcom,switch-freq:		Switching frequency of charger. Supported values:
				0 - 750 kHz, 1 - 1 MHz, 2 - 1.5 MHz, 3 - 3 MHz.
- qcom,parallel-en-pin-polarity Specify the polarity of enable signal controlled
				via pin in a parallel-charger configuration.
				0 - Active low and 1  - Active high.
+8 −0
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@

#define OTG_TLIM_CTRL_REG			0xA
#define SWITCH_FREQ_MASK			SMB1351_MASK(7, 6)
#define SWITCH_FREQ_SHIFT			6
#define THERM_LOOP_TEMP_SEL_MASK		SMB1351_MASK(5, 4)
#define OTG_OC_LIMIT_MASK			SMB1351_MASK(3, 2)
#define OTG_BATT_UVLO_TH_MASK			SMB1351_MASK(1, 0)
@@ -433,6 +434,7 @@ struct smb1351_charger {
	bool			iterm_disabled;
	int			iterm_ma;
	int			vfloat_mv;
	int			switch_freq;
	int			chg_present;
	int			fake_battery_soc;
	bool			chg_autonomous_mode;
@@ -1098,6 +1100,10 @@ static int smb1351_hw_init(struct smb1351_charger *chip)
		}
	}

	/* Update switching frequency based on device tree entry */
	rc = smb1351_masked_write(chip, OTG_TLIM_CTRL_REG, SWITCH_FREQ_MASK,
			(chip->switch_freq << SWITCH_FREQ_SHIFT));

	/* enable/disable charging by suspending usb */
	rc = smb1351_usb_suspend(chip, USER, chip->usb_suspended_status);
	if (rc) {
@@ -2759,6 +2765,8 @@ static int smb1351_parse_dt(struct smb1351_charger *chip)
	chip->recharge_disabled = of_property_read_bool(node,
					"qcom,recharge-disabled");

	rc = of_property_read_u32(node, "qcom,switch-freq",
						&chip->switch_freq);
	/* thermal and jeita support */
	rc = of_property_read_u32(node, "qcom,batt-cold-decidegc",
						&chip->batt_cold_decidegc);