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

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

Merge "msm: qpnp-haptic: Manage the state of PON regulator"

parents adb1c6ac 90f5662b
Loading
Loading
Loading
Loading
+14 −9
Original line number Original line Diff line number Diff line
@@ -353,6 +353,7 @@ struct qpnp_hap {
	u8				lra_res_cal_period;
	u8				lra_res_cal_period;
	u8				sc_duration;
	u8				sc_duration;
	u8				ext_pwm_dtest_line;
	u8				ext_pwm_dtest_line;
	bool				vcc_pon_enabled;
	bool				state;
	bool				state;
	bool				use_play_irq;
	bool				use_play_irq;
	bool				use_sc_irq;
	bool				use_sc_irq;
@@ -1718,13 +1719,15 @@ static void qpnp_hap_worker(struct work_struct *work)
	struct qpnp_hap *hap = container_of(work, struct qpnp_hap,
	struct qpnp_hap *hap = container_of(work, struct qpnp_hap,
					 work);
					 work);
	u8 val = 0x00;
	u8 val = 0x00;
	int rc, reg_en = 0;
	int rc;


	if (hap->vcc_pon) {
	if (hap->vcc_pon && hap->state && !hap->vcc_pon_enabled) {
		reg_en = regulator_enable(hap->vcc_pon);
		rc = regulator_enable(hap->vcc_pon);
		if (reg_en)
		if (rc < 0)
			pr_err("%s: could not enable vcc_pon regulator\n",
			pr_err("%s: could not enable vcc_pon regulator rc=%d\n",
				 __func__);
				 __func__, rc);
		else
			hap->vcc_pon_enabled = true;
	}
	}


	/* Disable haptics module if the duration of short circuit
	/* Disable haptics module if the duration of short circuit
@@ -1739,11 +1742,13 @@ static void qpnp_hap_worker(struct work_struct *work)
		qpnp_hap_set(hap, hap->state);
		qpnp_hap_set(hap, hap->state);
	}
	}


	if (hap->vcc_pon && !reg_en) {
	if (hap->vcc_pon && !hap->state && hap->vcc_pon_enabled) {
		rc = regulator_disable(hap->vcc_pon);
		rc = regulator_disable(hap->vcc_pon);
		if (rc)
		if (rc)
			pr_err("%s: could not disable vcc_pon regulator\n",
			pr_err("%s: could not disable vcc_pon regulator rc=%d\n",
				 __func__);
				 __func__, rc);
		else
			hap->vcc_pon_enabled = false;
	}
	}
}
}