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

Commit c4271493 authored by Praneeth Paladugu's avatar Praneeth Paladugu Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Update the clock state variable before unprepare clocks



Clock state variable is used to check if clock is enabled or not.
While preparing the clocks the state is updated once all the clocks
are prepared and enabled. While disabling the state is updated once
all the clocks are disabled. So there is a delay between first clock
unprepare and the variable update. At this point if someone reads the
clock state it shows the clock is enabled where as the clock is
actually disabled. Hence update the variable before unpreparing the
first clock. This also matches with prepare enable update.

Change-Id: I3f4bcee696a168f39b55241cae2dc00cdb18d36b
Signed-off-by: default avatarPraneeth Paladugu <ppaladug@codeaurora.org>
parent 8a749c24
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -3565,14 +3565,23 @@ static inline void venus_hfi_disable_unprepare_clks(
		return;
	}

	/*
	* Make the clock state variable as unprepared before actually
	* unpreparing clocks. This will make sure that when we check
	* the state, we have the right clock state. We are not taking
	* any action based unprepare failures. So it is safe to do
	* before the call. This is also in sync with prepare_enable
	* state update.
	*/

	device->clk_state = DISABLED_UNPREPARED;

	venus_hfi_for_each_clock(device, cl) {
		usleep(100);
		dprintk(VIDC_DBG, "Clock: %s disable and unprepare\n",
				cl->name);
		clk_disable_unprepare(cl->clk);
	}

	device->clk_state = DISABLED_UNPREPARED;
}

static inline int venus_hfi_prepare_enable_clks(struct venus_hfi_device *device)