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

Commit f5dd75db authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

drivers: thermal: bcl_pmic5: Incorporate thermometer encoding



The BCL hardware doesn't notify the HLOS on thermometer encoded format.
This can lead to a situation where a higher vbat or ibat violation gets
triggered, but the lower violation doesn't.

Update the interrupt handling to handle this case. The irq handler will
notify the lower violation routine to mimic the thermometer encoding.

Change-Id: I3e6d1461a9085bc737d4a5ed2226124c0c1f87a2
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent b98e655c
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -399,12 +399,32 @@ static irqreturn_t bcl_handle_irq(int irq, void *data)
			(bcl_perph->param[BCL_VBAT_LVL1].tz_dev)) {
			of_thermal_handle_trip(
				bcl_perph->param[BCL_VBAT_LVL1].tz_dev);

			/*
			 * There is a possibility that just vbat_l1 be the
			 * source of bcl event. So trigger Vbat_l0 in
			 * those case.
			 */
			if (!(irq_status & BCL_IRQ_VCMP_L0) &&
				(bcl_perph->param[BCL_VBAT_LVL0].tz_dev))
				of_thermal_handle_trip(
					bcl_perph->param[BCL_VBAT_LVL0].tz_dev);
			notify = true;
		}
		if ((irq_status & BCL_IRQ_IBAT_L1) &&
			(bcl_perph->param[BCL_IBAT_LVL1].tz_dev)) {
			of_thermal_handle_trip(
				bcl_perph->param[BCL_IBAT_LVL1].tz_dev);

			/*
			 * There is a possibility that just ibat_l1 be the
			 * source of bcl event. So trigger ibat_l0 in
			 * those case.
			 */
			if (!(irq_status & BCL_IRQ_IBAT_L0) &&
				(bcl_perph->param[BCL_IBAT_LVL0].tz_dev))
				of_thermal_handle_trip(
					bcl_perph->param[BCL_IBAT_LVL0].tz_dev);
			notify = true;
		}
		break;
@@ -413,6 +433,20 @@ static irqreturn_t bcl_handle_irq(int irq, void *data)
			(bcl_perph->param[BCL_VBAT_LVL2].tz_dev)) {
			of_thermal_handle_trip(
				bcl_perph->param[BCL_VBAT_LVL2].tz_dev);

			/*
			 * There is a possibility that just vbat_l2 be the
			 * source of bcl event. So trigger Vbat_l0 and vbat_l1
			 * in those case.
			 */
			if (!(irq_status & BCL_IRQ_VCMP_L1) &&
				(bcl_perph->param[BCL_VBAT_LVL1].tz_dev))
				of_thermal_handle_trip(
					bcl_perph->param[BCL_VBAT_LVL1].tz_dev);
			if (!(irq_status & BCL_IRQ_VCMP_L0) &&
				(bcl_perph->param[BCL_VBAT_LVL0].tz_dev))
				of_thermal_handle_trip(
					bcl_perph->param[BCL_VBAT_LVL0].tz_dev);
			notify = true;
		}
		break;