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

Commit c5fd9dbe authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

thermal: tsens: Switch from usleep_range() to msleep



On certain cases we have seen usleep_range() return before
the intended minimum time parameter passed to this function.
There is no protection against wakeups and we may return
early. msleep() already has code to handle this cases since
it loops as long as there is still time.

Change-Id: I3cf1e2d7f61f5a6d42d66afb86ae3b3fe141a9e7
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent 2116b44b
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -170,10 +170,8 @@
#define TSENS_DEBUG_OFFSET_WORD3	0xc
#define TSENS_DEBUG_OFFSET_ROW		0x10
#define TSENS_DEBUG_DECIDEGC		-950
#define TSENS_DEBUG_MIN_CYCLE		63000
#define TSENS_DEBUG_MAX_CYCLE		64000
#define TSENS_DEBUG_POLL_MIN		200000
#define TSENS_DEBUG_POLL_MAX		210000
#define TSENS_DEBUG_CYCLE_MS		64
#define TSENS_DEBUG_POLL_MS		200
#define TSENS_DEBUG_BUS_ID2_MIN_CYCLE	50
#define TSENS_DEBUG_BUS_ID2_MAX_CYCLE	51
#define TSENS_DEBUG_ID_MASK_1_4		0xffffffe1
@@ -1412,8 +1410,7 @@ static void tsens_poll(struct work_struct *work)
	spin_unlock_irqrestore(&tmdev->tsens_crit_lock, flags);

	if (tmdev->tsens_critical_poll) {
		usleep_range(TSENS_DEBUG_POLL_MIN,
				TSENS_DEBUG_POLL_MAX);
		msleep(TSENS_DEBUG_POLL_MS);
		sensor_status_addr = TSENS_TM_SN_STATUS(tmdev->tsens_addr);

		spin_lock_irqsave(&tmdev->tsens_crit_lock, flags);
@@ -1567,8 +1564,7 @@ debug_start:
				offset += TSENS_DEBUG_OFFSET_ROW;
			}
			loop++;
			usleep_range(TSENS_DEBUG_MIN_CYCLE,
				TSENS_DEBUG_MAX_CYCLE);
			msleep(TSENS_DEBUG_CYCLE_MS);
		}
		BUG();
	}