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

Commit 266b6ba1 authored by Xin Hua Lu's avatar Xin Hua Lu
Browse files

hbtp-input : fix L13A electric leakage issue



Currently TP power regulator might be voted twice in some
cases which will cause regulator not turned off in suspend
mode. So add condition checking to prevent this.

Signed-off-by: default avatarXin Hua Lu <luxinhua@codeaurora.org>
Change-Id: Ic5cb163149a630700dbcb97ae39023c17cb0816d
parent d5d55ba0
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -82,6 +82,7 @@ struct hbtp_data {
	bool override_disp_coords;
	bool override_disp_coords;
	bool manage_afe_power_ana;
	bool manage_afe_power_ana;
	bool manage_power_dig;
	bool manage_power_dig;
	bool regulator_enabled;
	u32 power_on_delay;
	u32 power_on_delay;
	u32 power_off_delay;
	u32 power_off_delay;
	bool manage_pin_ctrl;
	bool manage_pin_ctrl;
@@ -360,6 +361,11 @@ static int hbtp_pdev_power_on(struct hbtp_data *hbtp, bool on)
	if (!on)
	if (!on)
		goto reg_off;
		goto reg_off;


	if (hbtp->regulator_enabled) {
		pr_debug("%s: regulator already enabled\n", __func__);
		return 0;
	}

	if (hbtp->vcc_ana) {
	if (hbtp->vcc_ana) {
		ret = reg_set_load_check(hbtp->vcc_ana,
		ret = reg_set_load_check(hbtp->vcc_ana,
			hbtp->afe_load_ua);
			hbtp->afe_load_ua);
@@ -403,9 +409,16 @@ static int hbtp_pdev_power_on(struct hbtp_data *hbtp, bool on)
		}
		}
	}
	}


	hbtp->regulator_enabled = true;

	return 0;
	return 0;


reg_off:
reg_off:
	if (!hbtp->regulator_enabled) {
		pr_debug("%s: regulator not enabled\n", __func__);
		return 0;
	}

	if (hbtp->vcc_dig) {
	if (hbtp->vcc_dig) {
		reg_set_load_check(hbtp->vcc_dig, 0);
		reg_set_load_check(hbtp->vcc_dig, 0);
		regulator_disable(hbtp->vcc_dig);
		regulator_disable(hbtp->vcc_dig);
@@ -422,6 +435,9 @@ static int hbtp_pdev_power_on(struct hbtp_data *hbtp, bool on)
		reg_set_load_check(hbtp->vcc_ana, 0);
		reg_set_load_check(hbtp->vcc_ana, 0);
		regulator_disable(hbtp->vcc_ana);
		regulator_disable(hbtp->vcc_ana);
	}
	}

	hbtp->regulator_enabled = false;

	return 0;
	return 0;
}
}